[netcdf-libcf] 04/06: Imported Upstream version 1.0~beta10

Bas Couwenberg sebastic at xs4all.nl
Sat Jan 24 18:08:24 UTC 2015


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

sebastic-guest pushed a commit to branch master
in repository netcdf-libcf.

commit ddd739465b63ed53779469842757f1a21db60673
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sat Jan 17 18:52:35 2015 +0100

    Imported Upstream version 1.0~beta10
---
 Makefile.am                                        |    42 +-
 Makefile.in                                        |   270 +-
 aclocal.m4                                         |  6649 +---
 config.h.in => cf_config.h                         |   140 +-
 config.h.in => cf_config.h.in                      |    43 +-
 cfcheck/Makefile.am                                |    69 -
 cfcheck/cfcheck.c                                  |    87 -
 cfcheck/tst_cfcheck.sh                             |    21 -
 compile                                            |     6 +-
 config.guess                                       |   196 +-
 config.sub                                         |    43 +-
 configure                                          | 35153 ++++++++-----------
 configure.ac                                       |   413 +-
 doc/Makefile.am                                    |    43 -
 doc/Makefile.in                                    |   722 -
 doc/defines.texi                                   |    62 -
 doc/libcf.info                                     |  3232 --
 doc/libcf.pdf                                      |   Bin 185174 -> 0 bytes
 doc/libcf.ps                                       |  4275 ---
 doc/libcf.texi                                     |  3185 --
 doc/mdate-sh                                       |   205 -
 doc/stamp-vti                                      |     4 -
 doc/texinfo.tex                                    |  9291 -----
 doc/version.texi                                   |     4 -
 examples/Makefile.am                               |    54 +
 {gridspec/tools/shared => examples}/Makefile.in    |   249 +-
 examples/ex2.c                                     |   239 +
 examples/ex3.c                                     |   278 +
 examples/ex_create_cube_grids.c                    |    94 +
 examples/ex_create_lonlat.c                        |    60 +
 examples/ex_create_static_data.c                   |    94 +
 examples/ex_create_time_data.c                     |   137 +
 examples/ex_fortran_interface.f90                  |    77 +
 examples/ex_subset.c                               |   244 +
 examples/examples.h                                |   117 +
 examples/exparinterp.c                             |   248 +
 gridspec/Makefile.am                               |     8 -
 gridspec/shared/Makefile.am                        |     6 -
 gridspec/shared/Makefile.in                        |   574 -
 gridspec/shared/mosaic/Makefile.am                 |    71 -
 gridspec/shared/mosaic/constant.h                  |    38 -
 gridspec/shared/mosaic/create_xgrid.c              |  1106 -
 gridspec/shared/mosaic/create_xgrid.h              |    43 -
 gridspec/shared/mosaic/gradient_c2l.c              |   435 -
 gridspec/shared/mosaic/gradient_c2l.h              |    17 -
 gridspec/shared/mosaic/interp.c                    |   152 -
 gridspec/shared/mosaic/interp.h                    |    14 -
 gridspec/shared/mosaic/mosaic_util.c               |   531 -
 gridspec/shared/mosaic/mosaic_util.h               |    34 -
 gridspec/shared/mosaic/read_mosaic.c               |   700 -
 gridspec/shared/mosaic/read_mosaic.h               |    15 -
 gridspec/tools/Makefile.am                         |    12 -
 gridspec/tools/Makefile.in                         |   672 -
 gridspec/tools/fregrid/Makefile.am                 |    66 -
 gridspec/tools/fregrid/Makefile.in                 |   571 -
 gridspec/tools/fregrid/fregrid.c                   |   410 -
 gridspec/tools/get_data.sh                         |    27 -
 gridspec/tools/make_coupler_mosaic/Makefile.am     |    67 -
 gridspec/tools/make_coupler_mosaic/Makefile.in     |   572 -
 .../make_coupler_mosaic/make_coupler_mosaic.c      |   206 -
 gridspec/tools/make_hgrid/Makefile.am              |    75 -
 gridspec/tools/make_hgrid/make_hgrid.c             |   340 -
 gridspec/tools/make_hgrid/run_tests.in             |    36 -
 gridspec/tools/make_mosaic/Makefile.am             |    73 -
 gridspec/tools/make_mosaic/Makefile.in             |   575 -
 gridspec/tools/make_mosaic/make_mosaic.c           |   177 -
 gridspec/tools/make_topog/Makefile.am              |    70 -
 gridspec/tools/make_topog/make_topog.c             |   324 -
 gridspec/tools/make_topog/run_tests.in             |    21 -
 gridspec/tools/make_vgrid/Makefile.am              |    72 -
 gridspec/tools/make_vgrid/make_vgrid.c             |   133 -
 gridspec/tools/make_vgrid/run_tests.in             |    13 -
 gridspec/tools/shared/Makefile.am                  |    76 -
 gridspec/tools/shared/bilinear_interp.c            |  1137 -
 gridspec/tools/shared/bilinear_interp.h            |    10 -
 gridspec/tools/shared/conserve_interp.c            |   675 -
 gridspec/tools/shared/conserve_interp.h            |    13 -
 .../tools/shared/create_conformal_cubic_grid.c     |   816 -
 gridspec/tools/shared/create_gnomonic_cubic_grid.c |   908 -
 gridspec/tools/shared/create_grid_from_file.c      |   179 -
 gridspec/tools/shared/create_hgrid.h               |    41 -
 gridspec/tools/shared/create_lonlat_grid.c         |   407 -
 gridspec/tools/shared/create_vgrid.c               |    43 -
 gridspec/tools/shared/create_vgrid.h               |    11 -
 gridspec/tools/shared/fregrid_util.c               |  1785 -
 gridspec/tools/shared/fregrid_util.h               |    30 -
 gridspec/tools/shared/make_boundary_contact.c      |   483 -
 gridspec/tools/shared/make_boundary_contact.h      |     7 -
 gridspec/tools/shared/make_xgrid_contact.c         |   227 -
 gridspec/tools/shared/make_xgrid_contact.h         |     4 -
 gridspec/tools/shared/mpp.c                        |   230 -
 gridspec/tools/shared/mpp.h                        |    25 -
 gridspec/tools/shared/mpp_domain.c                 |   534 -
 gridspec/tools/shared/mpp_domain.h                 |    50 -
 gridspec/tools/shared/mpp_io.c                     |  1075 -
 gridspec/tools/shared/mpp_io.h                     |    54 -
 gridspec/tools/shared/tool_util.c                  |  3554 --
 gridspec/tools/shared/tool_util.h                  |    62 -
 gridspec/tools/shared/topog.c                      |   544 -
 gridspec/tools/shared/topog.h                      |    14 -
 gridspec/tools/test.sh                             |    45 -
 gridspec/tools/test_all.sh                         |    47 -
 gridspec_api/Makefile.am                           |     8 +
 {gridspec => gridspec_api}/Makefile.in             |   113 +-
 gridspec_api/axis/Makefile.am                      |    28 +
 .../make_hgrid => gridspec_api/axis}/Makefile.in   |   286 +-
 gridspec_api/axis/nccf_add_axis_att.c              |    28 +
 gridspec_api/axis/nccf_axis.h                      |    75 +
 gridspec_api/axis/nccf_def_axis.c                  |   155 +
 gridspec_api/axis/nccf_def_axis_from_file.c        |    93 +
 gridspec_api/axis/nccf_free_axis.c                 |    41 +
 gridspec_api/axis/nccf_get_axis_datapointer.c      |    28 +
 gridspec_api/axis/nccf_inq_axis_datatype.c         |    28 +
 gridspec_api/axis/nccf_inq_axis_len.c              |    28 +
 gridspec_api/axis/nccf_inq_axis_name.c             |    30 +
 gridspec_api/axis/nccf_put_axis.c                  |    31 +
 gridspec_api/axis/tst_axis.c                       |    55 +
 gridspec_api/coord/Makefile.am                     |    48 +
 .../make_hgrid => gridspec_api/coord}/Makefile.in  |   342 +-
 gridspec_api/coord/nccf_add_coord_att.c            |    27 +
 gridspec_api/coord/nccf_coord.h                    |   106 +
 gridspec_api/coord/nccf_def_coord.c                |   151 +
 gridspec_api/coord/nccf_def_coord_from_axes.c      |   105 +
 gridspec_api/coord/nccf_def_coord_from_file.c      |    59 +
 gridspec_api/coord/nccf_free_coord.c               |    47 +
 gridspec_api/coord/nccf_get_coord_data_pointer.c   |    22 +
 gridspec_api/coord/nccf_inq_coord_bound.c          |    42 +
 gridspec_api/coord/nccf_inq_coord_bound_slice.c    |   103 +
 gridspec_api/coord/nccf_inq_coord_dimnames.c       |    29 +
 gridspec_api/coord/nccf_inq_coord_dims.c           |    30 +
 gridspec_api/coord/nccf_inq_coord_name.c           |    24 +
 gridspec_api/coord/nccf_inq_coord_ndims.c          |    25 +
 gridspec_api/coord/nccf_inq_coord_units.c          |    32 +
 gridspec_api/coord/nccf_is_coord.c                 |   164 +
 gridspec_api/coord/nccf_put_coord.c                |    34 +
 gridspec_api/coord/tst_1d_boundary_slice.c         |    61 +
 gridspec_api/coord/tst_bound1.c                    |   147 +
 gridspec_api/coord/tst_lon.c                       |    98 +
 gridspec_api/coord/tst_lonlat.c                    |    63 +
 gridspec_api/coord/tst_lonlat_from_axes.c          |    70 +
 gridspec_api/data/Makefile.am                      |    38 +
 .../make_vgrid => gridspec_api/data}/Makefile.in   |   315 +-
 gridspec_api/data/nccf_add_data_att.c              |    42 +
 gridspec_api/data/nccf_data.h                      |    94 +
 gridspec_api/data/nccf_def_data.c                  |   143 +
 gridspec_api/data/nccf_def_data_from_file.c        |    78 +
 gridspec_api/data/nccf_free_data.c                 |    44 +
 gridspec_api/data/nccf_get_data_pointer.c          |    36 +
 gridspec_api/data/nccf_inq_data_dims.c             |    35 +
 gridspec_api/data/nccf_inq_data_gridid.c           |    24 +
 gridspec_api/data/nccf_inq_data_ndims.c            |    29 +
 gridspec_api/data/nccf_inq_data_type.c             |    25 +
 gridspec_api/data/nccf_put_data.c                  |    40 +
 gridspec_api/data/nccf_set_data.c                  |   101 +
 gridspec_api/data/nccf_set_data.h                  |    62 +
 gridspec_api/data/tst_nccf_def_SD_from_grid.c      |    89 +
 gridspec_api/data/tst_statdata.c                   |    91 +
 gridspec_api/data/tst_timedata.c                   |   120 +
 gridspec_api/global/Makefile.am                    |    23 +
 {cfcheck => gridspec_api/global}/Makefile.in       |   275 +-
 gridspec_api/global/nccf_add_global_att.c          |    89 +
 gridspec_api/global/nccf_def_global.c              |    49 +
 gridspec_api/global/nccf_def_global_from_file.c    |    51 +
 gridspec_api/global/nccf_free_global.c             |    35 +
 gridspec_api/global/nccf_global.h                  |    60 +
 gridspec_api/global/nccf_inq_global_att.c          |    32 +
 gridspec_api/global/nccf_inq_global_attval.c       |    52 +
 gridspec_api/global/nccf_inq_global_natts.c        |    35 +
 gridspec_api/global/nccf_put_global.c              |    99 +
 gridspec_api/global/tst_global.c                   |    74 +
 gridspec_api/grid/Makefile.am                      |    30 +
 .../make_topog => gridspec_api/grid}/Makefile.in   |   327 +-
 gridspec_api/grid/nccf_def_grid.c                  |    88 +
 gridspec_api/grid/nccf_def_grid_from_file.c        |   112 +
 gridspec_api/grid/nccf_detect_grid_periodicity.c   |    45 +
 gridspec_api/grid/nccf_free_grid.c                 |    55 +
 gridspec_api/grid/nccf_get_grid_mask_pointer.c     |    23 +
 gridspec_api/grid/nccf_grid.h                      |    77 +
 gridspec_api/grid/nccf_inq_grid_coordids.c         |    38 +
 gridspec_api/grid/nccf_inq_grid_coordnames.c       |    42 +
 gridspec_api/grid/nccf_inq_grid_name.c             |    35 +
 gridspec_api/grid/nccf_inq_grid_ndims.c            |    32 +
 gridspec_api/grid/nccf_inq_grid_periodicity.c      |    36 +
 gridspec_api/grid/nccf_put_grid.c                  |    88 +
 gridspec_api/grid/nccf_save_grid_scrip.c           |   231 +
 gridspec_api/grid/nccf_set_grid_validmask.c        |    43 +
 gridspec_api/grid/tst_1d_grid.c                    |   107 +
 gridspec_api/grid/tst_bipolar_tripolar_grid.c      |   114 +
 gridspec_api/grid/tst_cubesphere_makegrid.c        |    97 +
 gridspec_api/grid/tst_struct_grid_latlon.c         |   129 +
 gridspec_api/host/Makefile.am                      |    63 +
 {src => gridspec_api/host}/Makefile.in             |   546 +-
 gridspec_api/host/nccf_add_host_file.c             |   136 +
 gridspec_api/host/nccf_def_host.c                  |    78 +
 gridspec_api/host/nccf_def_host_data.c             |   132 +
 gridspec_api/host/nccf_def_host_from_file.c        |   321 +
 gridspec_api/host/nccf_free_host.c                 |   114 +
 gridspec_api/host/nccf_host.h                      |   153 +
 gridspec_api/host/nccf_inq_host_gridfilename.c     |    35 +
 gridspec_api/host/nccf_inq_host_gridname.c         |    32 +
 gridspec_api/host/nccf_inq_host_mosaicfilename.c   |    26 +
 gridspec_api/host/nccf_inq_host_ngrids.c           |    33 +
 gridspec_api/host/nccf_inq_host_nstatdatafiles.c   |    32 +
 gridspec_api/host/nccf_inq_host_ntimedatafiles.c   |    32 +
 gridspec_api/host/nccf_inq_host_ntimeslices.c      |    32 +
 gridspec_api/host/nccf_inq_host_statdataids.c      |    40 +
 gridspec_api/host/nccf_inq_host_statfileindex.c    |    71 +
 gridspec_api/host/nccf_inq_host_statfilename.c     |    43 +
 gridspec_api/host/nccf_inq_host_struct_grid_ids.c  |    39 +
 gridspec_api/host/nccf_inq_host_timedataids.c      |    41 +
 gridspec_api/host/nccf_inq_host_timefileindex.c    |    73 +
 gridspec_api/host/nccf_inq_host_timefilename.c     |    43 +
 gridspec_api/host/nccf_put_host.c                  |   183 +
 .../host/tst_cube_sphere_multi_dims_in_file.c      |   498 +
 gridspec_api/host/tst_cube_sphere_multi_var.c      |   366 +
 gridspec_api/host/tst_get_host_three_tile.c        |   113 +
 gridspec_api/host/tst_nccf_add_host.c              |    46 +
 gridspec_api/host/tst_nccf_def_host.c              |    43 +
 gridspec_api/host/tst_nccf_def_host_from_file.c    |    28 +
 gridspec_api/host/tst_real_data_case.c             |   226 +
 gridspec_api/host/tst_three_tile_cubed_sphere.c    |   373 +
 gridspec_api/libcf_gridspec.h                      |    18 +
 gridspec_api/mosaic/Makefile.am                    |    92 +
 {src => gridspec_api/mosaic}/Makefile.in           |   641 +-
 .../mosaic/copy_grid_for_bogus_data_files.sh       |    28 +
 gridspec_api/mosaic/nccf_add_mosaic_att.c          |    27 +
 gridspec_api/mosaic/nccf_compute_mosaic_contacts.c |   315 +
 gridspec_api/mosaic/nccf_def_mosaic.c              |    87 +
 gridspec_api/mosaic/nccf_def_mosaic_from_file.c    |   146 +
 gridspec_api/mosaic/nccf_free_mosaic.c             |   105 +
 gridspec_api/mosaic/nccf_inq_mosaic_contactmap.c   |    35 +
 gridspec_api/mosaic/nccf_inq_mosaic_coordnames.c   |    37 +
 gridspec_api/mosaic/nccf_inq_mosaic_gridids.c      |    27 +
 gridspec_api/mosaic/nccf_inq_mosaic_gridname.c     |    28 +
 gridspec_api/mosaic/nccf_inq_mosaic_gridranges.c   |   193 +
 gridspec_api/mosaic/nccf_inq_mosaic_ncontacts.c    |    26 +
 gridspec_api/mosaic/nccf_inq_mosaic_ndims.c        |    27 +
 gridspec_api/mosaic/nccf_inq_mosaic_ngrids.c       |    27 +
 gridspec_api/mosaic/nccf_inq_mosaic_tilecontact.c  |    37 +
 .../mosaic/nccf_inq_mosaic_tileseparator.c         |    29 +
 gridspec_api/mosaic/nccf_mosaic.h                  |   122 +
 .../mosaic/nccf_print_mosaic_as_polytopes.c        |   360 +
 gridspec_api/mosaic/nccf_put_mosaic.c              |   110 +
 gridspec_api/mosaic/nccf_set_mosaic_contact.c      |   142 +
 gridspec_api/mosaic/tst_1d_mosaic.c                |   104 +
 gridspec_api/mosaic/tst_big_dimsizes.c             |   111 +
 gridspec_api/mosaic/tst_bipolar_tripolar_grid.c    |   131 +
 .../mosaic/tst_bipolar_tripolar_grid_periodic.c    |   129 +
 gridspec_api/mosaic/tst_cubesphere_mosaic.c        |   142 +
 .../mosaic/tst_cubesphere_mosaic_grid_ranges.c     |   124 +
 gridspec_api/mosaic/tst_get_mosaic_grid_ranges.c   |   165 +
 gridspec_api/mosaic/tst_nccf_set_mosaic_contact.c  |    69 +
 gridspec_api/mosaic/tst_periodic_grid.c            |   165 +
 gridspec_api/mosaic/tst_rotation.c                 |   156 +
 gridspec_api/mosaic/tst_sg_mosaic_latlon.c         |   106 +
 .../mosaic/tst_sg_periodic_mosaic_latlon.c         |   103 +
 gridspec_api/mosaic/tst_tripolar_zhi.c             |    99 +
 gridspec_api/mosaic/tst_two_tiles.c                |   157 +
 gridspec_api/mosaic/tst_two_unequal_in_i_j_tiles.c |   197 +
 gridspec_api/mosaic/tst_two_unequal_in_i_tiles.c   |   164 +
 gridspec_api/regrid/Makefile.am                    |    77 +
 {src => gridspec_api/regrid}/Makefile.in           |   575 +-
 gridspec_api/regrid/nccf_add_regrid_forbidden.c    |    40 +
 gridspec_api/regrid/nccf_apply_regrid.c            |    61 +
 gridspec_api/regrid/nccf_apply_regrid_type.h       |    92 +
 gridspec_api/regrid/nccf_compute_regrid_weights.c  |   444 +
 gridspec_api/regrid/nccf_def_regrid.c              |   100 +
 gridspec_api/regrid/nccf_def_regrid_from_file.c    |    87 +
 gridspec_api/regrid/nccf_free_regrid.c             |    48 +
 .../regrid/nccf_get_regrid_weights_pointer.c       |    41 +
 gridspec_api/regrid/nccf_inq_regrid_nnodes.c       |    30 +
 gridspec_api/regrid/nccf_inq_regrid_ntargets.c     |    30 +
 gridspec_api/regrid/nccf_inq_regrid_nvalid.c       |    30 +
 gridspec_api/regrid/nccf_inq_regrid_weights.c      |   101 +
 gridspec_api/regrid/nccf_put_regrid.c              |    42 +
 gridspec_api/regrid/nccf_regrid.h                  |    88 +
 .../regrid/tst_cubesphere_to_lonlat_regrid.c       |   398 +
 gridspec_api/regrid/tst_lonlat_regrid.c            |   211 +
 gridspec_api/regrid/tst_lonlat_to_lonlat_regrid.c  |   254 +
 gridspec_api/regrid/tst_mask.c                     |   195 +
 gridspec_api/regrid/tst_mask2.c                    |   232 +
 gridspec_api/regrid/tst_periodic.c                 |   247 +
 gridspec_api/regrid/tst_periodic2.c                |   203 +
 gridspec_api/regrid/tst_periodic3.c                |   209 +
 gridspec_api/regrid/tst_put_and_def_from_file.c    |   217 +
 gridspec_api/regrid/tst_slanted_lonlat_regrid.c    |   226 +
 .../regrid/tst_tripolar_to_lonlat_regrid.c         |   302 +
 .../tst_tripolar_to_lonlat_regrid_from_weights.c   |   266 +
 include/Makefile.am                                |    19 +
 {gridspec/shared/mosaic => include}/Makefile.in    |   253 +-
 {src => include}/cferror.h                         |     5 +-
 include/cflistitem.h                               |   164 +
 include/libcf.h                                    |    23 +
 src/libcf.h => include/libcf_src.h                 |   150 +-
 {src => include}/nc_tests.h                        |     2 +-
 include/nccf_constants.h                           |    90 +
 include/nccf_errors.h                              |    54 +
 include/nccf_handle_error.h                        |    20 +
 include/nccf_utility_functions.h                   |   483 +
 include/nccf_varObj.h                              |   332 +
 ltmain.sh                                          |  3898 +-
 m4/libtool.m4                                      |  2124 +-
 m4/ltoptions.m4                                    |    13 +-
 m4/ltsugar.m4                                      |    20 +-
 m4/ltversion.m4                                    |    12 +-
 m4/lt~obsolete.m4                                  |    12 +-
 pycf/Makefile.am                                   |    19 +
 pycf/Makefile.in                                   |   451 +
 pycf/__init__.py                                   |     4 +
 pycf/__init__.py.in                                |     4 +
 pycf/generateLibCFConfig.py                        |   164 +
 pycf/libCFConfig.py                                |   370 +
 setup.py.in                                        |   142 +
 src/Makefile.am                                    |   163 +-
 src/Makefile.in                                    |   499 +-
 src/cdTimeConv.c                                   |     2 +-
 src/cddrs.h                                        |     2 +-
 src/cdms.h                                         |     2 +-
 src/cdmsint.h                                      |     2 +-
 src/cdunif.h                                       |     2 +-
 src/cfcvars.c                                      |  1262 +-
 src/cferror.c                                      |    39 +-
 src/cffiles.c                                      |   366 +-
 src/cflistitem.c                                   |   228 +
 src/cfsubsets.c                                    |    61 +-
 src/cfvars.c                                       |   196 +-
 src/drscdf.h                                       |     2 +-
 src/libcfAddOn.c                                   |    18 +
 src/libcf_api.f90                                  |   788 -
 src/libcf_int.h                                    |     4 +-
 src/nccf_add_id_to_files.c                         |    62 +
 src/nccf_find_indices.c                            |    44 +
 src/nccf_find_indices.h                            |   208 +
 src/nccf_find_next_adjacent.c                      |    34 +
 src/nccf_find_next_adjcnt_index.c                  |   140 +
 src/nccf_find_next_indices.c                       |    40 +
 src/nccf_find_next_indices.h                       |    86 +
 src/nccf_generate_id.c                             |    84 +
 src/nccf_get_bipolar_cap.c                         |    60 +
 src/nccf_get_cubedsphere_grid.c                    |    56 +
 src/nccf_get_distance_in_coord.c                   |    27 +
 src/nccf_get_distance_in_coord.h                   |    25 +
 src/nccf_get_flat_index.c                          |    14 +
 src/nccf_get_linear_weights.c                      |    32 +
 src/nccf_get_linear_weights.h                      |   163 +
 src/nccf_get_multi_index.c                         |    16 +
 src/nccf_get_position.c                            |    44 +
 src/nccf_get_position.h                            |    48 +
 src/nccf_get_start_end_bound_indices.c             |    24 +
 src/nccf_get_tripolar_grid.c                       |    64 +
 src/nccf_get_tripolar_halfgrid.c                   |    72 +
 src/nccf_handle_error.c                            |    41 +
 src/nccf_index2vector.c                            |    37 +
 src/nccf_index_to_corner_vector.c                  |    24 +
 src/nccf_keyvalue.c                                |   131 +
 src/nccf_keyvalue.h                                |    91 +
 src/nccf_linear_interp.c                           |    19 +
 src/nccf_linear_interp.h                           |    63 +
 src/nccf_linear_interp_mod.c                       |    20 +
 src/nccf_linear_interp_mod.h                       |    81 +
 src/nccf_linesearch_indices.c                      |    27 +
 src/nccf_linesearch_indices.h                      |   100 +
 src/nccf_put_var_slice_text.c                      |    45 +
 src/nccf_solve.c                                   |    52 +
 src/nccf_solve.h                                   |    30 +
 src/nccf_strerror.c                                |   115 +
 src/nccf_varObj.c                                  |   867 +
 src/nccf_varSetData_generic.h                      |    18 +
 src/nccoord.c                                      |    15 +-
 src/timeArith.c                                    |   182 +
 src/timeConv.c                                     |   399 +
 src/tst_coords.c                                   |    17 +-
 src/tst_cvars.c                                    |     6 +-
 src/tst_example_data.c                             |     6 +-
 src/tst_f03_file.f90                               |   139 -
 src/tst_files.c                                    |     6 +-
 src/tst_linear_interp.c                            |   427 +
 src/tst_listitem.c                                 |   222 +
 src/tst_nccf_find_adjacent.c                       |    93 +
 src/tst_nccf_generate_id.c                         |    75 +
 src/tst_nccf_get_bipolar_cap.c                     |    51 +
 src/tst_nccf_get_cubedsphere_grid.c                |    74 +
 src/tst_nccf_get_flat_index.c                      |    41 +
 src/tst_nccf_get_tripolar_grid.c                   |    49 +
 src/tst_nccf_get_tripolar_halfgrid.c               |    75 +
 src/tst_nccf_index2vector.c                        |    41 +
 src/tst_nccf_keyvalue.c                            |   107 +
 src/tst_nccf_linear_interp_mask.c                  |   180 +
 src/tst_nccf_varObj.c                              |   287 +
 src/tst_princeton.c                                |    73 +
 src/tst_solve.c                                    |    47 +
 src/tst_subsets.c                                  |     6 +-
 src/tst_vars.c                                     |    14 +-
 src/tst_vert.c                                     |     6 +-
 394 files changed, 51266 insertions(+), 74831 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 5b8631b..888a9f4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,36 +1,31 @@
-## This is an automake file, part of Unidata's NetCDF CF Library
-## package. Copyright 2006, see the COPYRIGHT file for more
-## information.
+## This is a automake file, part of Unidata's NetCDF CF Library package.
+# Copyright 2006-2011, see the COPYRIGHT file for more information.
 
-# This is the main automake file for the NetCDF CF Library. 
-
-# $Id: Makefile.am,v 1.2 2009/09/08 17:14:51 ed Exp $
+# This is the main automake file for the libCF library. 
 
 # These files get added to the distribution.
 EXTRA_DIST = COPYRIGHT
 
 ACLOCAL_AMFLAGS = -I m4
+AM_CPPFLAGS = -I $(top_srcdir)/src -I $(top_srcdir)/gridspec_api
 
-# Does the user want to build cfcheck?
-if BUILD_CFCHECK
-CFCHECK = cfcheck
-endif
-
-# Does the user want to build the docs?
-if BUILD_DOCS
-DOC = doc
-endif
+SUBDIRS = include src gridspec_api examples pycf # testpy
 
-# Does the user want to build the gridspec?
-if BUILD_GRIDSPEC
-GRIDSPEC = gridspec
-endif
+include_HEADERS = cf_config.h
 
-SUBDIRS = $(GRIDSPEC) src $(CFCHECK) $(DOC) 
+lib_LTLIBRARIES = libcf.la
+libcf_la_SOURCES = 
+libcf_la_LIBADD = gridspec_api/host/libnccf_host.la			\
+gridspec_api/mosaic/libnccf_mosaic.la					\
+gridspec_api/regrid/libnccf_regrid.la					\
+gridspec_api/data/libnccf_data.la                                       \
+gridspec_api/grid/libnccf_grid.la	                                \
+gridspec_api/coord/libnccf_coord.la					\
+gridspec_api/axis/libnccf_axis.la					\
+gridspec_api/global/libnccf_global.la                                   \
+src/libcf_src.la -lnetcdf
 
-check_install: check install
-
-# What needs to go in the binrary dist?
+# What needs to go in the binary dist?
 BINFILES = README_BINARIES.txt include/libcf.h lib/libcf.a
 
 # At Unidata, package up binaries.
@@ -43,4 +38,3 @@ ftpbin: install
 	echo "FCFLAGS=$(FCFLAGS) F77FLAGS=$(F77FLAGS) $F90FLAGS=$(F90FLAGS)" >> ${prefix}/README_BINARIES.txt
 	tar cf binary-libcf- at PACKAGE_VERSION@.tar -C ${prefix} ${BINFILES}
 	gzip -f binary-libcf- at PACKAGE_VERSION@.tar
-
diff --git a/Makefile.in b/Makefile.in
index b443dee..9786a7c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,9 +15,11 @@
 
 @SET_MAKE@
 
-# This is the main automake file for the NetCDF CF Library. 
+# Copyright 2006-2011, see the COPYRIGHT file for more information.
+
+# This is the main automake file for the libCF library. 
+
 
-# $Id: Makefile.am,v 1.2 2009/09/08 17:14:51 ed Exp $
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -38,9 +40,10 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 subdir = .
-DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
-	$(srcdir)/nfconfig.in $(top_srcdir)/configure compile \
+DIST_COMMON = $(am__configure_deps) $(include_HEADERS) \
+	$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/cf_config.h.in $(srcdir)/nfconfig.in \
+	$(srcdir)/setup.py.in $(top_srcdir)/configure compile \
 	config.guess config.sub depcomp install-sh ltmain.sh missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -52,11 +55,54 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
  configure.lineno config.status.lineno
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = config.h nfconfig.inc
-CONFIG_CLEAN_FILES =
+CONFIG_HEADER = cf_config.h nfconfig.inc
+CONFIG_CLEAN_FILES = setup.py
 CONFIG_CLEAN_VPATH_FILES =
-SOURCES =
-DIST_SOURCES =
+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__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libcf_la_DEPENDENCIES = gridspec_api/host/libnccf_host.la \
+	gridspec_api/mosaic/libnccf_mosaic.la \
+	gridspec_api/regrid/libnccf_regrid.la \
+	gridspec_api/data/libnccf_data.la \
+	gridspec_api/grid/libnccf_grid.la \
+	gridspec_api/coord/libnccf_coord.la \
+	gridspec_api/axis/libnccf_axis.la \
+	gridspec_api/global/libnccf_global.la src/libcf_src.la
+am_libcf_la_OBJECTS =
+libcf_la_OBJECTS = $(am_libcf_la_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(libcf_la_SOURCES)
+DIST_SOURCES = $(libcf_la_SOURCES)
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	html-recursive info-recursive install-data-recursive \
 	install-dvi-recursive install-exec-recursive \
@@ -64,6 +110,7 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
+HEADERS = $(include_HEADERS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
 AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@@ -71,7 +118,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
 	distdir dist dist-all distcheck
 ETAGS = etags
 CTAGS = ctags
-DIST_SUBDIRS = gridspec src cfcheck doc
+DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
@@ -112,7 +159,6 @@ ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
 AR = @AR@
-AS = @AS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -133,15 +179,19 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-F77 = @F77@
 FC = @FC@
 FCFLAGS = @FCFLAGS@
 FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
+FCLIBS = @FCLIBS@
 FGREP = @FGREP@
 GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
+HAVE_DARWIN = @HAVE_DARWIN@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_LAPACK_LIB = @HAVE_LAPACK_LIB@
+HAVE_LAPACK_NO_UNDERSCORE = @HAVE_LAPACK_NO_UNDERSCORE@
+HAVE_LAPACK_UNDERSCORE = @HAVE_LAPACK_UNDERSCORE@
+HAVE_SHARED = @HAVE_SHARED@
+HAVE_UUID = @HAVE_UUID@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -156,8 +206,10 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 MOD_FLAG = @MOD_FLAG@
+NCDUMP = @NCDUMP@
 NCDUMPDIR = @NCDUMPDIR@
 NETCDFDIR = @NETCDFDIR@
 NM = @NM@
@@ -171,23 +223,23 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
 VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
 ac_ct_FC = @ac_ct_FC@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -219,7 +271,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -239,20 +290,25 @@ top_srcdir = @top_srcdir@
 # These files get added to the distribution.
 EXTRA_DIST = COPYRIGHT
 ACLOCAL_AMFLAGS = -I m4
-
-# Does the user want to build cfcheck?
- at BUILD_CFCHECK_TRUE@CFCHECK = cfcheck
-
-# Does the user want to build the docs?
- at BUILD_DOCS_TRUE@DOC = doc
-
-# Does the user want to build the gridspec?
- at BUILD_GRIDSPEC_TRUE@GRIDSPEC = gridspec
-SUBDIRS = $(GRIDSPEC) src $(CFCHECK) $(DOC) 
-
-# What needs to go in the binrary dist?
+AM_CPPFLAGS = -I $(top_srcdir)/src -I $(top_srcdir)/gridspec_api
+SUBDIRS = include src gridspec_api examples pycf # testpy
+include_HEADERS = cf_config.h
+lib_LTLIBRARIES = libcf.la
+libcf_la_SOURCES = 
+libcf_la_LIBADD = gridspec_api/host/libnccf_host.la			\
+gridspec_api/mosaic/libnccf_mosaic.la					\
+gridspec_api/regrid/libnccf_regrid.la					\
+gridspec_api/data/libnccf_data.la                                       \
+gridspec_api/grid/libnccf_grid.la	                                \
+gridspec_api/coord/libnccf_coord.la					\
+gridspec_api/axis/libnccf_axis.la					\
+gridspec_api/global/libnccf_global.la                                   \
+src/libcf_src.la -lnetcdf
+
+
+# What needs to go in the binary dist?
 BINFILES = README_BINARIES.txt include/libcf.h lib/libcf.a
-all: config.h nfconfig.inc
+all: cf_config.h nfconfig.inc
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
 
 .SUFFIXES:
@@ -291,16 +347,16 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
 $(am__aclocal_m4_deps):
 
-config.h: stamp-h1
+cf_config.h: stamp-h1
 	@if test ! -f $@; then \
 	  rm -f stamp-h1; \
 	  $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
 	else :; fi
 
-stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+stamp-h1: $(srcdir)/cf_config.h.in $(top_builddir)/config.status
 	@rm -f stamp-h1
-	cd $(top_builddir) && $(SHELL) ./config.status config.h
-$(srcdir)/config.h.in:  $(am__configure_deps) 
+	cd $(top_builddir) && $(SHELL) ./config.status cf_config.h
+$(srcdir)/cf_config.h.in:  $(am__configure_deps) 
 	($(am__cd) $(top_srcdir) && $(AUTOHEADER))
 	rm -f stamp-h1
 	touch $@
@@ -316,7 +372,48 @@ stamp-h2: $(srcdir)/nfconfig.in $(top_builddir)/config.status
 	cd $(top_builddir) && $(SHELL) ./config.status nfconfig.inc
 
 distclean-hdr:
-	-rm -f config.h stamp-h1 nfconfig.inc stamp-h2
+	-rm -f cf_config.h stamp-h1 nfconfig.inc stamp-h2
+setup.py: $(top_builddir)/config.status $(srcdir)/setup.py.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	list2=; for p in $$list; do \
+	  if test -f $$p; then \
+	    list2="$$list2 $$p"; \
+	  else :; fi; \
+	done; \
+	test -z "$$list2" || { \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+	}
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	for p in $$list; do \
+	  $(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libcf.la: $(libcf_la_OBJECTS) $(libcf_la_DEPENDENCIES) 
+	$(LINK) -rpath $(libdir) $(libcf_la_OBJECTS) $(libcf_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -326,6 +423,26 @@ clean-libtool:
 
 distclean-libtool:
 	-rm -f libtool config.lt
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	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|^.*/||'`; \
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(includedir)" && rm -f $$files
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -334,7 +451,7 @@ distclean-libtool:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -359,7 +476,7 @@ $(RECURSIVE_TARGETS):
 	fi; test -z "$$fail"
 
 $(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -407,7 +524,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	mkid -fID $$unique
 tags: TAGS
 
-TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in nfconfig.in $(TAGS_DEPENDENCIES) \
+TAGS: tags-recursive $(HEADERS) $(SOURCES) cf_config.h.in nfconfig.in $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	set x; \
 	here=`pwd`; \
@@ -424,7 +541,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in nfconfig.in $(TAGS_DEPEND
 	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
-	list='$(SOURCES) $(HEADERS) config.h.in nfconfig.in $(LISP) $(TAGS_FILES)'; \
+	list='$(SOURCES) $(HEADERS) cf_config.h.in nfconfig.in $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
@@ -442,9 +559,9 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in nfconfig.in $(TAGS_DEPEND
 	  fi; \
 	fi
 ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in nfconfig.in $(TAGS_DEPENDENCIES) \
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) cf_config.h.in nfconfig.in $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS) config.h.in nfconfig.in $(LISP) $(TAGS_FILES)'; \
+	list='$(SOURCES) $(HEADERS) cf_config.h.in nfconfig.in $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
@@ -523,7 +640,8 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 	-test -n "$(am__skip_mode_fix)" \
-	|| find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+	|| find "$(distdir)" -type d ! -perm -755 \
+		-exec chmod u+rwx,go+rx {} \; -o \
 	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
 	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
@@ -567,17 +685,17 @@ dist dist-all: distdir
 distcheck: dist
 	case '$(DIST_ARCHIVES)' in \
 	*.tar.gz*) \
-	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
-	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
 	*.tar.lzma*) \
-	  unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+	  lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
 	*.tar.xz*) \
 	  xz -dc $(distdir).tar.xz | $(am__untar) ;;\
 	*.tar.Z*) \
 	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
 	*.shar.gz*) \
-	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
 	esac
@@ -638,9 +756,12 @@ distcleancheck: distclean
 	       exit 1; } >&2
 check-am: all-am
 check: check-recursive
-all-am: Makefile config.h nfconfig.inc
+all-am: Makefile $(LTLIBRARIES) $(HEADERS) cf_config.h nfconfig.inc
 installdirs: installdirs-recursive
 installdirs-am:
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
 install: install-recursive
 install-exec: install-exec-recursive
 install-data: install-data-recursive
@@ -668,13 +789,14 @@ maintainer-clean-generic:
 	@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-libLTLIBRARIES clean-libtool \
+	mostlyclean-am
 
 distclean: distclean-recursive
 	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
 	-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-hdr \
-	distclean-libtool distclean-tags
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-hdr distclean-libtool distclean-tags
 
 dvi: dvi-recursive
 
@@ -688,13 +810,13 @@ info: info-recursive
 
 info-am:
 
-install-data-am:
+install-data-am: install-includeHEADERS
 
 install-dvi: install-dvi-recursive
 
 install-dvi-am:
 
-install-exec-am:
+install-exec-am: install-libLTLIBRARIES
 
 install-html: install-html-recursive
 
@@ -724,7 +846,8 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
 
 mostlyclean: mostlyclean-recursive
 
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
 
 pdf: pdf-recursive
 
@@ -734,29 +857,30 @@ ps: ps-recursive
 
 ps-am:
 
-uninstall-am:
+uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
 
 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
 	ctags-recursive install-am install-strip tags-recursive
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am am--refresh check check-am clean clean-generic \
-	clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
-	dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
-	distcheck distclean distclean-generic distclean-hdr \
-	distclean-libtool distclean-tags distcleancheck distdir \
-	distuninstallcheck 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 pdf pdf-am \
-	ps ps-am tags tags-recursive uninstall uninstall-am
-
-
-check_install: check install
+	clean-libLTLIBRARIES clean-libtool ctags ctags-recursive dist \
+	dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \
+	dist-xz dist-zip distcheck distclean distclean-compile \
+	distclean-generic distclean-hdr distclean-libtool \
+	distclean-tags distcleancheck distdir distuninstallcheck 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-libLTLIBRARIES 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-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags tags-recursive uninstall uninstall-am \
+	uninstall-includeHEADERS uninstall-libLTLIBRARIES
+
 
 # At Unidata, package up binaries.
 ftpbin: install
diff --git a/aclocal.m4 b/aclocal.m4
index 35049b6..fcf62f7 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.11 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 # 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
@@ -13,6651 +13,12 @@
 
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],,
-[m4_warning([this file was generated for autoconf 2.63.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
+[m4_warning([this file was generated for autoconf 2.68.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])
 
-# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
-
-# serial 52 AC_PROG_LIBTOOL
-
-
-# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
-# -----------------------------------------------------------
-# If this macro is not defined by Autoconf, define it here.
-m4_ifdef([AC_PROVIDE_IFELSE],
-         [],
-         [m4_define([AC_PROVIDE_IFELSE],
-	         [m4_ifdef([AC_PROVIDE_$1],
-		           [$2], [$3])])])
-
-
-# AC_PROG_LIBTOOL
-# ---------------
-AC_DEFUN([AC_PROG_LIBTOOL],
-[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
-dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
-dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
-  AC_PROVIDE_IFELSE([AC_PROG_CXX],
-    [AC_LIBTOOL_CXX],
-    [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
-  ])])
-dnl And a similar setup for Fortran 77 support
-  AC_PROVIDE_IFELSE([AC_PROG_F77],
-    [AC_LIBTOOL_F77],
-    [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
-])])
-
-dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
-dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
-dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
-  AC_PROVIDE_IFELSE([AC_PROG_GCJ],
-    [AC_LIBTOOL_GCJ],
-    [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
-      [AC_LIBTOOL_GCJ],
-      [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
-	[AC_LIBTOOL_GCJ],
-      [ifdef([AC_PROG_GCJ],
-	     [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
-       ifdef([A][M_PROG_GCJ],
-	     [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
-       ifdef([LT_AC_PROG_GCJ],
-	     [define([LT_AC_PROG_GCJ],
-		defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
-])])# AC_PROG_LIBTOOL
-
-
-# _AC_PROG_LIBTOOL
-# ----------------
-AC_DEFUN([_AC_PROG_LIBTOOL],
-[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
-AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
-AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
-AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
-
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
-
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-AC_SUBST(LIBTOOL)dnl
-
-# Prevent multiple expansion
-define([AC_PROG_LIBTOOL], [])
-])# _AC_PROG_LIBTOOL
-
-
-# AC_LIBTOOL_SETUP
-# ----------------
-AC_DEFUN([AC_LIBTOOL_SETUP],
-[AC_PREREQ(2.50)dnl
-AC_REQUIRE([AC_ENABLE_SHARED])dnl
-AC_REQUIRE([AC_ENABLE_STATIC])dnl
-AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_LD])dnl
-AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
-AC_REQUIRE([AC_PROG_NM])dnl
-
-AC_REQUIRE([AC_PROG_LN_S])dnl
-AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
-# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
-AC_REQUIRE([AC_OBJEXT])dnl
-AC_REQUIRE([AC_EXEEXT])dnl
-dnl
-AC_LIBTOOL_SYS_MAX_CMD_LEN
-AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
-AC_LIBTOOL_OBJDIR
-
-AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
-_LT_AC_PROG_ECHO_BACKSLASH
-
-case $host_os in
-aix3*)
-  # AIX sometimes has problems with the GCC collect2 program.  For some
-  # reason, if we set the COLLECT_NAMES environment variable, the problems
-  # vanish in a puff of smoke.
-  if test "X${COLLECT_NAMES+set}" != Xset; then
-    COLLECT_NAMES=
-    export COLLECT_NAMES
-  fi
-  ;;
-esac
-
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='sed -e 1s/^X//'
-[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
-
-# Same as above, but do not quote variable references.
-[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
-# Constants:
-rm="rm -f"
-
-# Global variables:
-default_ofile=libtool
-can_build_shared=yes
-
-# All known linkers require a `.a' archive for static linking (except MSVC,
-# which needs '.lib').
-libext=a
-ltmain="$ac_aux_dir/ltmain.sh"
-ofile="$default_ofile"
-with_gnu_ld="$lt_cv_prog_gnu_ld"
-
-AC_CHECK_TOOL(AR, ar, false)
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-AC_CHECK_TOOL(STRIP, strip, :)
-
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
-
-# Set sane defaults for various variables
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
-test -z "$AS" && AS=as
-test -z "$CC" && CC=cc
-test -z "$LTCC" && LTCC=$CC
-test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-test -z "$LD" && LD=ld
-test -z "$LN_S" && LN_S="ln -s"
-test -z "$MAGIC_CMD" && MAGIC_CMD=file
-test -z "$NM" && NM=nm
-test -z "$SED" && SED=sed
-test -z "$OBJDUMP" && OBJDUMP=objdump
-test -z "$RANLIB" && RANLIB=:
-test -z "$STRIP" && STRIP=:
-test -z "$ac_objext" && ac_objext=o
-
-# Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
-old_postinstall_cmds='chmod 644 $oldlib'
-old_postuninstall_cmds=
-
-if test -n "$RANLIB"; then
-  case $host_os in
-  openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
-    ;;
-  *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
-    ;;
-  esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
-fi
-
-_LT_CC_BASENAME([$compiler])
-
-# Only perform the check for file, if the check method requires it
-case $deplibs_check_method in
-file_magic*)
-  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
-    AC_PATH_MAGIC
-  fi
-  ;;
-esac
-
-_LT_REQUIRED_DARWIN_CHECKS
-
-AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
-AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
-enable_win32_dll=yes, enable_win32_dll=no)
-
-AC_ARG_ENABLE([libtool-lock],
-    [AC_HELP_STRING([--disable-libtool-lock],
-	[avoid locking (might break parallel builds)])])
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
-
-AC_ARG_WITH([pic],
-    [AC_HELP_STRING([--with-pic],
-	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
-    [pic_mode="$withval"],
-    [pic_mode=default])
-test -z "$pic_mode" && pic_mode=default
-
-# Use C for the default configuration in the libtool script
-tagname=
-AC_LIBTOOL_LANG_C_CONFIG
-_LT_AC_TAGCONFIG
-])# AC_LIBTOOL_SETUP
-
-
-# _LT_AC_SYS_COMPILER
-# -------------------
-AC_DEFUN([_LT_AC_SYS_COMPILER],
-[AC_REQUIRE([AC_PROG_CC])dnl
-
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
-
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
-
-# Allow CC to be a program name with arguments.
-compiler=$CC
-])# _LT_AC_SYS_COMPILER
-
-
-# _LT_CC_BASENAME(CC)
-# -------------------
-# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
-AC_DEFUN([_LT_CC_BASENAME],
-[for cc_temp in $1""; do
-  case $cc_temp in
-    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
-    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
-])
-
-
-# _LT_COMPILER_BOILERPLATE
-# ------------------------
-# Check for compiler boilerplate output or warnings with
-# the simple compiler test code.
-AC_DEFUN([_LT_COMPILER_BOILERPLATE],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$rm conftest*
-])# _LT_COMPILER_BOILERPLATE
-
-
-# _LT_LINKER_BOILERPLATE
-# ----------------------
-# Check for linker boilerplate output or warnings with
-# the simple link test code.
-AC_DEFUN([_LT_LINKER_BOILERPLATE],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$rm -r conftest*
-])# _LT_LINKER_BOILERPLATE
-
-# _LT_REQUIRED_DARWIN_CHECKS
-# --------------------------
-# Check for some things on darwin
-AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[
-  case $host_os in
-    rhapsody* | darwin*)
-    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
-    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
-
-    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
-      [lt_cv_apple_cc_single_mod=no
-      if test -z "${LT_MULTI_MODULE}"; then
-   # By default we will add the -single_module flag. You can override
-   # by either setting the environment variable LT_MULTI_MODULE
-   # non-empty at configure time, or by adding -multi_module to the
-   # link flags.
-   echo "int foo(void){return 1;}" > conftest.c
-   $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-     -dynamiclib ${wl}-single_module conftest.c
-   if test -f libconftest.dylib; then
-     lt_cv_apple_cc_single_mod=yes
-     rm -rf libconftest.dylib*
-   fi
-   rm conftest.c
-      fi])
-    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
-      [lt_cv_ld_exported_symbols_list],
-      [lt_cv_ld_exported_symbols_list=no
-      save_LDFLAGS=$LDFLAGS
-      echo "_main" > conftest.sym
-      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
-      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-   [lt_cv_ld_exported_symbols_list=yes],
-   [lt_cv_ld_exported_symbols_list=no])
-   LDFLAGS="$save_LDFLAGS"
-    ])
-    case $host_os in
-    rhapsody* | darwin1.[[0123]])
-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
-    darwin1.*)
-     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-    darwin*)
-      # if running on 10.5 or later, the deployment target defaults
-      # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it?
-      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
-   10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
-     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-   10.[[012]]*)
-     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-   10.*)
-     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-      esac
-    ;;
-  esac
-    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
-      _lt_dar_single_mod='$single_module'
-    fi
-    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
-      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
-    else
-      _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
-    fi
-    if test "$DSYMUTIL" != ":"; then
-      _lt_dsymutil="~$DSYMUTIL \$lib || :"
-    else
-      _lt_dsymutil=
-    fi
-    ;;
-  esac
-])
-
-# _LT_AC_SYS_LIBPATH_AIX
-# ----------------------
-# Links a minimal program and checks the executable
-# for the system default hardcoded library path. In most cases,
-# this is /usr/lib:/lib, but when the MPI compilers are used
-# the location of the communication and MPI libs are included too.
-# If we don't find anything, use the default library path according
-# to the aix ld manual.
-AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_LINK_IFELSE(AC_LANG_PROGRAM,[
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi],[])
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
-])# _LT_AC_SYS_LIBPATH_AIX
-
-
-# _LT_AC_SHELL_INIT(ARG)
-# ----------------------
-AC_DEFUN([_LT_AC_SHELL_INIT],
-[ifdef([AC_DIVERSION_NOTICE],
-	     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
-	 [AC_DIVERT_PUSH(NOTICE)])
-$1
-AC_DIVERT_POP
-])# _LT_AC_SHELL_INIT
-
-
-# _LT_AC_PROG_ECHO_BACKSLASH
-# --------------------------
-# Add some code to the start of the generated configure script which
-# will find an echo command which doesn't interpret backslashes.
-AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
-[_LT_AC_SHELL_INIT([
-# Check that we are running under the correct shell.
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-case X$ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
-  ;;
-esac
-
-echo=${ECHO-echo}
-if test "X[$]1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X[$]1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
-  # Yippee, $echo works!
-  :
-else
-  # Restart under the correct shell.
-  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
-fi
-
-if test "X[$]1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<EOF
-[$]*
-EOF
-  exit 0
-fi
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$ECHO"; then
-if test "X${echo_test_string+set}" != Xset; then
-# find a string as large as possible, as long as the shell can cope with it
-  for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
-    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
-    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
-       echo_test_string=`eval $cmd` &&
-       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
-    then
-      break
-    fi
-  done
-fi
-
-if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
-   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
-   test "X$echo_testing_string" = "X$echo_test_string"; then
-  :
-else
-  # The Solaris, AIX, and Digital Unix default echo programs unquote
-  # backslashes.  This makes it impossible to quote backslashes using
-  #   echo "$something" | sed 's/\\/\\\\/g'
-  #
-  # So, first we look for a working echo in the user's PATH.
-
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  for dir in $PATH /usr/ucb; do
-    IFS="$lt_save_ifs"
-    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
-       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
-       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
-       test "X$echo_testing_string" = "X$echo_test_string"; then
-      echo="$dir/echo"
-      break
-    fi
-  done
-  IFS="$lt_save_ifs"
-
-  if test "X$echo" = Xecho; then
-    # We didn't find a better echo, so look for alternatives.
-    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
-       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
-       test "X$echo_testing_string" = "X$echo_test_string"; then
-      # This shell has a builtin print -r that does the trick.
-      echo='print -r'
-    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
-	 test "X$CONFIG_SHELL" != X/bin/ksh; then
-      # If we have ksh, try running configure again with it.
-      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-      export ORIGINAL_CONFIG_SHELL
-      CONFIG_SHELL=/bin/ksh
-      export CONFIG_SHELL
-      exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
-    else
-      # Try using printf.
-      echo='printf %s\n'
-      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
-	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
-	 test "X$echo_testing_string" = "X$echo_test_string"; then
-	# Cool, printf works
-	:
-      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
-	   test "X$echo_testing_string" = 'X\t' &&
-	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
-	export CONFIG_SHELL
-	SHELL="$CONFIG_SHELL"
-	export SHELL
-	echo="$CONFIG_SHELL [$]0 --fallback-echo"
-      elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
-	   test "X$echo_testing_string" = 'X\t' &&
-	   echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	echo="$CONFIG_SHELL [$]0 --fallback-echo"
-      else
-	# maybe with a smaller string...
-	prev=:
-
-	for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
-	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
-	  then
-	    break
-	  fi
-	  prev="$cmd"
-	done
-
-	if test "$prev" != 'sed 50q "[$]0"'; then
-	  echo_test_string=`eval $prev`
-	  export echo_test_string
-	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
-	else
-	  # Oops.  We lost completely, so just stick with echo.
-	  echo=echo
-	fi
-      fi
-    fi
-  fi
-fi
-fi
-
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-ECHO=$echo
-if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
-   ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
-fi
-
-AC_SUBST(ECHO)
-])])# _LT_AC_PROG_ECHO_BACKSLASH
-
-
-# _LT_AC_LOCK
-# -----------
-AC_DEFUN([_LT_AC_LOCK],
-[AC_ARG_ENABLE([libtool-lock],
-    [AC_HELP_STRING([--disable-libtool-lock],
-	[avoid locking (might break parallel builds)])])
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
-
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case $host in
-ia64-*-hpux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.$ac_objext` in
-    *ELF-32*)
-      HPUX_IA64_MODE="32"
-      ;;
-    *ELF-64*)
-      HPUX_IA64_MODE="64"
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-*-*-irix6*)
-  # Find out which ABI we are using.
-  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-   if test "$lt_cv_prog_gnu_ld" = yes; then
-    case `/usr/bin/file conftest.$ac_objext` in
-    *32-bit*)
-      LD="${LD-ld} -melf32bsmip"
-      ;;
-    *N32*)
-      LD="${LD-ld} -melf32bmipn32"
-      ;;
-    *64-bit*)
-      LD="${LD-ld} -melf64bmip"
-      ;;
-    esac
-   else
-    case `/usr/bin/file conftest.$ac_objext` in
-    *32-bit*)
-      LD="${LD-ld} -32"
-      ;;
-    *N32*)
-      LD="${LD-ld} -n32"
-      ;;
-    *64-bit*)
-      LD="${LD-ld} -64"
-      ;;
-    esac
-   fi
-  fi
-  rm -rf conftest*
-  ;;
-
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
-s390*-*linux*|sparc*-*linux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.o` in
-    *32-bit*)
-      case $host in
-        x86_64-*kfreebsd*-gnu)
-          LD="${LD-ld} -m elf_i386_fbsd"
-          ;;
-        x86_64-*linux*)
-          LD="${LD-ld} -m elf_i386"
-          ;;
-        ppc64-*linux*|powerpc64-*linux*)
-          LD="${LD-ld} -m elf32ppclinux"
-          ;;
-        s390x-*linux*)
-          LD="${LD-ld} -m elf_s390"
-          ;;
-        sparc64-*linux*)
-          LD="${LD-ld} -m elf32_sparc"
-          ;;
-      esac
-      ;;
-    *64-bit*)
-      libsuff=64
-      case $host in
-        x86_64-*kfreebsd*-gnu)
-          LD="${LD-ld} -m elf_x86_64_fbsd"
-          ;;
-        x86_64-*linux*)
-          LD="${LD-ld} -m elf_x86_64"
-          ;;
-        ppc*-*linux*|powerpc*-*linux*)
-          LD="${LD-ld} -m elf64ppc"
-          ;;
-        s390*-*linux*)
-          LD="${LD-ld} -m elf64_s390"
-          ;;
-        sparc*-*linux*)
-          LD="${LD-ld} -m elf64_sparc"
-          ;;
-      esac
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-
-*-*-sco3.2v5*)
-  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
-  SAVE_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -belf"
-  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
-    [AC_LANG_PUSH(C)
-     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
-     AC_LANG_POP])
-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
-    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
-    CFLAGS="$SAVE_CFLAGS"
-  fi
-  ;;
-sparc*-*solaris*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.o` in
-    *64-bit*)
-      case $lt_cv_prog_gnu_ld in
-      yes*) LD="${LD-ld} -m elf64_sparc" ;;
-      *)
-        if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
-	  LD="${LD-ld} -64"
-	fi
-	;;
-      esac
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-
-AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
-[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
-  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-  AC_CHECK_TOOL(AS, as, false)
-  AC_CHECK_TOOL(OBJDUMP, objdump, false)
-  ;;
-  ])
-esac
-
-need_locks="$enable_libtool_lock"
-
-])# _LT_AC_LOCK
-
-
-# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
-# ----------------------------------------------------------------
-# Check whether the given compiler option works
-AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
-[AC_REQUIRE([LT_AC_PROG_SED])
-AC_CACHE_CHECK([$1], [$2],
-  [$2=no
-  ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$3"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       $2=yes
-     fi
-   fi
-   $rm conftest*
-])
-
-if test x"[$]$2" = xyes; then
-    ifelse([$5], , :, [$5])
-else
-    ifelse([$6], , :, [$6])
-fi
-])# AC_LIBTOOL_COMPILER_OPTION
-
-
-# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-#                          [ACTION-SUCCESS], [ACTION-FAILURE])
-# ------------------------------------------------------------
-# Check whether the given compiler option works
-AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_CACHE_CHECK([$1], [$2],
-  [$2=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS $3"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The linker can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test -s conftest.err; then
-       # Append any errors to the config.log.
-       cat conftest.err 1>&AS_MESSAGE_LOG_FD
-       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         $2=yes
-       fi
-     else
-       $2=yes
-     fi
-   fi
-   $rm -r conftest*
-   LDFLAGS="$save_LDFLAGS"
-])
-
-if test x"[$]$2" = xyes; then
-    ifelse([$4], , :, [$4])
-else
-    ifelse([$5], , :, [$5])
-fi
-])# AC_LIBTOOL_LINKER_OPTION
-
-
-# AC_LIBTOOL_SYS_MAX_CMD_LEN
-# --------------------------
-AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
-[# find the maximum length of command line arguments
-AC_MSG_CHECKING([the maximum length of command line arguments])
-AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
-  i=0
-  teststring="ABCD"
-
-  case $build_os in
-  msdosdjgpp*)
-    # On DJGPP, this test can blow up pretty badly due to problems in libc
-    # (any single argument exceeding 2000 bytes causes a buffer overrun
-    # during glob expansion).  Even if it were fixed, the result of this
-    # check would be larger than it should be.
-    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
-    ;;
-
-  gnu*)
-    # Under GNU Hurd, this test is not required because there is
-    # no limit to the length of command line arguments.
-    # Libtool will interpret -1 as no limit whatsoever
-    lt_cv_sys_max_cmd_len=-1;
-    ;;
-
-  cygwin* | mingw*)
-    # On Win9x/ME, this test blows up -- it succeeds, but takes
-    # about 5 minutes as the teststring grows exponentially.
-    # Worse, since 9x/ME are not pre-emptively multitasking,
-    # you end up with a "frozen" computer, even though with patience
-    # the test eventually succeeds (with a max line length of 256k).
-    # Instead, let's just punt: use the minimum linelength reported by
-    # all of the supported platforms: 8192 (on NT/2K/XP).
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
-  amigaos*)
-    # On AmigaOS with pdksh, this test takes hours, literally.
-    # So we just punt and use a minimum line length of 8192.
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
-  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
-    # This has been around since 386BSD, at least.  Likely further.
-    if test -x /sbin/sysctl; then
-      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
-    elif test -x /usr/sbin/sysctl; then
-      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
-    else
-      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
-    fi
-    # And add a safety zone
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
-    ;;
-
-  interix*)
-    # We know the value 262144 and hardcode it with a safety zone (like BSD)
-    lt_cv_sys_max_cmd_len=196608
-    ;;
-
-  osf*)
-    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
-    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
-    # nice to cause kernel panics so lets avoid the loop below.
-    # First set a reasonable default.
-    lt_cv_sys_max_cmd_len=16384
-    #
-    if test -x /sbin/sysconfig; then
-      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
-        *1*) lt_cv_sys_max_cmd_len=-1 ;;
-      esac
-    fi
-    ;;
-  sco3.2v5*)
-    lt_cv_sys_max_cmd_len=102400
-    ;;
-  sysv5* | sco5v6* | sysv4.2uw2*)
-    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
-    if test -n "$kargmax"; then
-      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ 	]]//'`
-    else
-      lt_cv_sys_max_cmd_len=32768
-    fi
-    ;;
-  *)
-    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
-    if test -n "$lt_cv_sys_max_cmd_len"; then
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
-    else
-      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
-      while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
-	       = "XX$teststring") >/dev/null 2>&1 &&
-	      new_result=`expr "X$teststring" : ".*" 2>&1` &&
-	      lt_cv_sys_max_cmd_len=$new_result &&
-	      test $i != 17 # 1/2 MB should be enough
-      do
-        i=`expr $i + 1`
-        teststring=$teststring$teststring
-      done
-      teststring=
-      # Add a significant safety factor because C++ compilers can tack on massive
-      # amounts of additional arguments before passing them to the linker.
-      # It appears as though 1/2 is a usable value.
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
-    fi
-    ;;
-  esac
-])
-if test -n $lt_cv_sys_max_cmd_len ; then
-  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
-else
-  AC_MSG_RESULT(none)
-fi
-])# AC_LIBTOOL_SYS_MAX_CMD_LEN
-
-
-# _LT_AC_CHECK_DLFCN
-# ------------------
-AC_DEFUN([_LT_AC_CHECK_DLFCN],
-[AC_CHECK_HEADERS(dlfcn.h)dnl
-])# _LT_AC_CHECK_DLFCN
-
-
-# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
-#                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
-# ---------------------------------------------------------------------
-AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
-[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
-if test "$cross_compiling" = yes; then :
-  [$4]
-else
-  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-  lt_status=$lt_dlunknown
-  cat > conftest.$ac_ext <<EOF
-[#line __oline__ "configure"
-#include "confdefs.h"
-
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <stdio.h>
-
-#ifdef RTLD_GLOBAL
-#  define LT_DLGLOBAL		RTLD_GLOBAL
-#else
-#  ifdef DL_GLOBAL
-#    define LT_DLGLOBAL		DL_GLOBAL
-#  else
-#    define LT_DLGLOBAL		0
-#  endif
-#endif
-
-/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
-   find out it does not work in some platform. */
-#ifndef LT_DLLAZY_OR_NOW
-#  ifdef RTLD_LAZY
-#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
-#  else
-#    ifdef DL_LAZY
-#      define LT_DLLAZY_OR_NOW		DL_LAZY
-#    else
-#      ifdef RTLD_NOW
-#        define LT_DLLAZY_OR_NOW	RTLD_NOW
-#      else
-#        ifdef DL_NOW
-#          define LT_DLLAZY_OR_NOW	DL_NOW
-#        else
-#          define LT_DLLAZY_OR_NOW	0
-#        endif
-#      endif
-#    endif
-#  endif
-#endif
-
-#ifdef __cplusplus
-extern "C" void exit (int);
-#endif
-
-void fnord() { int i=42;}
-int main ()
-{
-  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
-  int status = $lt_dlunknown;
-
-  if (self)
-    {
-      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
-      /* dlclose (self); */
-    }
-  else
-    puts (dlerror ());
-
-    exit (status);
-}]
-EOF
-  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
-    lt_status=$?
-    case x$lt_status in
-      x$lt_dlno_uscore) $1 ;;
-      x$lt_dlneed_uscore) $2 ;;
-      x$lt_dlunknown|x*) $3 ;;
-    esac
-  else :
-    # compilation failed
-    $3
-  fi
-fi
-rm -fr conftest*
-])# _LT_AC_TRY_DLOPEN_SELF
-
-
-# AC_LIBTOOL_DLOPEN_SELF
-# ----------------------
-AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
-[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
-if test "x$enable_dlopen" != xyes; then
-  enable_dlopen=unknown
-  enable_dlopen_self=unknown
-  enable_dlopen_self_static=unknown
-else
-  lt_cv_dlopen=no
-  lt_cv_dlopen_libs=
-
-  case $host_os in
-  beos*)
-    lt_cv_dlopen="load_add_on"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
-    ;;
-
-  mingw* | pw32*)
-    lt_cv_dlopen="LoadLibrary"
-    lt_cv_dlopen_libs=
-   ;;
-
-  cygwin*)
-    lt_cv_dlopen="dlopen"
-    lt_cv_dlopen_libs=
-   ;;
-
-  darwin*)
-  # if libdl is installed we need to link against it
-    AC_CHECK_LIB([dl], [dlopen],
-		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
-    lt_cv_dlopen="dyld"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
-    ])
-   ;;
-
-  *)
-    AC_CHECK_FUNC([shl_load],
-	  [lt_cv_dlopen="shl_load"],
-      [AC_CHECK_LIB([dld], [shl_load],
-	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
-	[AC_CHECK_FUNC([dlopen],
-	      [lt_cv_dlopen="dlopen"],
-	  [AC_CHECK_LIB([dl], [dlopen],
-		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
-	    [AC_CHECK_LIB([svld], [dlopen],
-		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
-	      [AC_CHECK_LIB([dld], [dld_link],
-		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
-	      ])
-	    ])
-	  ])
-	])
-      ])
-    ;;
-  esac
-
-  if test "x$lt_cv_dlopen" != xno; then
-    enable_dlopen=yes
-  else
-    enable_dlopen=no
-  fi
-
-  case $lt_cv_dlopen in
-  dlopen)
-    save_CPPFLAGS="$CPPFLAGS"
-    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
-
-    save_LDFLAGS="$LDFLAGS"
-    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
-
-    save_LIBS="$LIBS"
-    LIBS="$lt_cv_dlopen_libs $LIBS"
-
-    AC_CACHE_CHECK([whether a program can dlopen itself],
-	  lt_cv_dlopen_self, [dnl
-	  _LT_AC_TRY_DLOPEN_SELF(
-	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
-	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
-    ])
-
-    if test "x$lt_cv_dlopen_self" = xyes; then
-      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
-      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
-    	  lt_cv_dlopen_self_static, [dnl
-	  _LT_AC_TRY_DLOPEN_SELF(
-	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
-	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
-      ])
-    fi
-
-    CPPFLAGS="$save_CPPFLAGS"
-    LDFLAGS="$save_LDFLAGS"
-    LIBS="$save_LIBS"
-    ;;
-  esac
-
-  case $lt_cv_dlopen_self in
-  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
-  *) enable_dlopen_self=unknown ;;
-  esac
-
-  case $lt_cv_dlopen_self_static in
-  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
-  *) enable_dlopen_self_static=unknown ;;
-  esac
-fi
-])# AC_LIBTOOL_DLOPEN_SELF
-
-
-# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
-# ---------------------------------
-# Check to see if options -c and -o are simultaneously supported by compiler
-AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
-AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
-  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
-  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
-   $rm -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
-     fi
-   fi
-   chmod u+w . 2>&AS_MESSAGE_LOG_FD
-   $rm conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
-   $rm out/* && rmdir out
-   cd ..
-   rmdir conftest
-   $rm conftest*
-])
-])# AC_LIBTOOL_PROG_CC_C_O
-
-
-# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
-# -----------------------------------------
-# Check to see if we can do hard links to lock some files if needed
-AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
-[AC_REQUIRE([_LT_AC_LOCK])dnl
-
-hard_links="nottested"
-if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
-  # do not overwrite the value of need_locks provided by the user
-  AC_MSG_CHECKING([if we can lock with hard links])
-  hard_links=yes
-  $rm conftest*
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  touch conftest.a
-  ln conftest.a conftest.b 2>&5 || hard_links=no
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  AC_MSG_RESULT([$hard_links])
-  if test "$hard_links" = no; then
-    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
-    need_locks=warn
-  fi
-else
-  need_locks=no
-fi
-])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
-
-
-# AC_LIBTOOL_OBJDIR
-# -----------------
-AC_DEFUN([AC_LIBTOOL_OBJDIR],
-[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
-[rm -f .libs 2>/dev/null
-mkdir .libs 2>/dev/null
-if test -d .libs; then
-  lt_cv_objdir=.libs
-else
-  # MS-DOS does not allow filenames that begin with a dot.
-  lt_cv_objdir=_libs
-fi
-rmdir .libs 2>/dev/null])
-objdir=$lt_cv_objdir
-])# AC_LIBTOOL_OBJDIR
-
-
-# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
-# ----------------------------------------------
-# Check hardcoding attributes.
-AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
-[AC_MSG_CHECKING([how to hardcode library paths into programs])
-_LT_AC_TAGVAR(hardcode_action, $1)=
-if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
-   test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
-   test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
-
-  # We can hardcode non-existant directories.
-  if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
-     # If the only mechanism to avoid hardcoding is shlibpath_var, we
-     # have to relink, otherwise we might link with an installed library
-     # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
-     test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
-    # Linking always hardcodes the temporary library directory.
-    _LT_AC_TAGVAR(hardcode_action, $1)=relink
-  else
-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
-    _LT_AC_TAGVAR(hardcode_action, $1)=immediate
-  fi
-else
-  # We cannot hardcode anything, or else we can only hardcode existing
-  # directories.
-  _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
-fi
-AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
-
-if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
-  # Fast installation is not supported
-  enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
-  # Fast installation is not necessary
-  enable_fast_install=needless
-fi
-])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
-
-
-# AC_LIBTOOL_SYS_LIB_STRIP
-# ------------------------
-AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
-[striplib=
-old_striplib=
-AC_MSG_CHECKING([whether stripping libraries is possible])
-if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
-  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
-  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  AC_MSG_RESULT([yes])
-else
-# FIXME - insert some real tests, host_os isn't really good enough
-  case $host_os in
-   darwin*)
-       if test -n "$STRIP" ; then
-         striplib="$STRIP -x"
-         old_striplib="$STRIP -S"
-         AC_MSG_RESULT([yes])
-       else
-  AC_MSG_RESULT([no])
-fi
-       ;;
-   *)
-  AC_MSG_RESULT([no])
-    ;;
-  esac
-fi
-])# AC_LIBTOOL_SYS_LIB_STRIP
-
-
-# AC_LIBTOOL_SYS_DYNAMIC_LINKER
-# -----------------------------
-# PORTME Fill in your ld.so characteristics
-AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_MSG_CHECKING([dynamic linker characteristics])
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-shrext_cmds=".so"
-postinstall_cmds=
-postuninstall_cmds=
-finish_cmds=
-finish_eval=
-shlibpath_var=
-shlibpath_overrides_runpath=unknown
-version_type=none
-dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib"
-m4_if($1,[],[
-if test "$GCC" = yes; then
-  case $host_os in
-    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
-    *) lt_awk_arg="/^libraries:/" ;;
-  esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
-    # if the path contains ";" then we assume it to be the separator
-    # otherwise default to the standard path separator (i.e. ":") - it is
-    # assumed that no part of a normal pathname contains ";" but that should
-    # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
-  # Ok, now we have the path, separated by spaces, we can step through it
-  # and add multilib dir if necessary.
-  lt_tmp_lt_search_path_spec=
-  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
-  for lt_sys_path in $lt_search_path_spec; do
-    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
-      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
-    else
-      test -d "$lt_sys_path" && \
-	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
-    fi
-  done
-  lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
-BEGIN {RS=" "; FS="/|\n";} {
-  lt_foo="";
-  lt_count=0;
-  for (lt_i = NF; lt_i > 0; lt_i--) {
-    if ($lt_i != "" && $lt_i != ".") {
-      if ($lt_i == "..") {
-        lt_count++;
-      } else {
-        if (lt_count == 0) {
-          lt_foo="/" $lt_i lt_foo;
-        } else {
-          lt_count--;
-        }
-      }
-    }
-  }
-  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
-  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
-}'`
-  sys_lib_search_path_spec=`echo $lt_search_path_spec`
-else
-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-fi])
-need_lib_prefix=unknown
-hardcode_into_libs=no
-
-# when you set need_version to no, make sure it does not cause -set_version
-# flags to be left without arguments
-need_version=unknown
-
-case $host_os in
-aix3*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
-  shlibpath_var=LIBPATH
-
-  # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
-  ;;
-
-aix[[4-9]]*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
-    # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
-    shlibpath_var=LD_LIBRARY_PATH
-  else
-    # With GCC up to 2.95.x, collect2 would create an import file
-    # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
-    # development snapshots of GCC prior to 3.0.
-    case $host_os in
-      aix4 | aix4.[[01]] | aix4.[[01]].*)
-      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
-	   echo ' yes '
-	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
-	:
-      else
-	can_build_shared=no
-      fi
-      ;;
-    esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
-    # soname into executable. Probably we can add versioning support to
-    # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
-      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
-      # instead of lib<name>.a to let people know that these are not
-      # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    else
-      # We preserve .a as extension for shared libraries through AIX4.2
-      # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
-    fi
-    shlibpath_var=LIBPATH
-  fi
-  ;;
-
-amigaos*)
-  library_names_spec='$libname.ixlibrary $libname.a'
-  # Create ${libname}_ixlibrary.a entries in /sys/libs.
-  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
-  ;;
-
-beos*)
-  library_names_spec='${libname}${shared_ext}'
-  dynamic_linker="$host_os ld.so"
-  shlibpath_var=LIBRARY_PATH
-  ;;
-
-bsdi[[45]]*)
-  version_type=linux
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
-  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
-  # the default ld.so.conf also contains /usr/contrib/lib and
-  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
-  # libtool to hard-code these into programs
-  ;;
-
-cygwin* | mingw* | pw32*)
-  version_type=windows
-  shrext_cmds=".dll"
-  need_version=no
-  need_lib_prefix=no
-
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32*)
-    library_names_spec='$libname.dll.a'
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname~
-      chmod a+x \$dldir/$dlname'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $rm \$dlpath'
-    shlibpath_overrides_runpath=yes
-
-    case $host_os in
-    cygwin*)
-      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
-      ;;
-    mingw*)
-      # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    ;;
-
-  *)
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    ;;
-  esac
-  dynamic_linker='Win32 ld.exe'
-  # FIXME: first we should search . and the directory the executable is in
-  shlibpath_var=PATH
-  ;;
-
-darwin* | rhapsody*)
-  dynamic_linker="$host_os dyld"
-  version_type=darwin
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
-  shlibpath_overrides_runpath=yes
-  shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
-  m4_if([$1], [],[
-  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) 
-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
-  ;;
-
-dgux*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
-
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
-freebsd* | dragonfly*)
-  # DragonFly does not have aout.  When/if they implement a new
-  # versioning mechanism, adjust this.
-  if test -x /usr/bin/objformat; then
-    objformat=`/usr/bin/objformat`
-  else
-    case $host_os in
-    freebsd[[123]]*) objformat=aout ;;
-    *) objformat=elf ;;
-    esac
-  fi
-  version_type=freebsd-$objformat
-  case $version_type in
-    freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-      need_version=no
-      need_lib_prefix=no
-      ;;
-    freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
-      need_version=yes
-      ;;
-  esac
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_os in
-  freebsd2*)
-    shlibpath_overrides_runpath=yes
-    ;;
-  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
-  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
-    shlibpath_overrides_runpath=no
-    hardcode_into_libs=yes
-    ;;
-  *) # from 4.6 on, and DragonFly
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  esac
-  ;;
-
-gnu*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  hardcode_into_libs=yes
-  ;;
-
-hpux9* | hpux10* | hpux11*)
-  # Give a soname corresponding to the major version so that dld.sl refuses to
-  # link against other versions.
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  case $host_cpu in
-  ia64*)
-    shrext_cmds='.so'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.so"
-    shlibpath_var=LD_LIBRARY_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
-      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
-    else
-      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
-    fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-   hppa*64*)
-     shrext_cmds='.sl'
-     hardcode_into_libs=yes
-     dynamic_linker="$host_os dld.sl"
-     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
-     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-     soname_spec='${libname}${release}${shared_ext}$major'
-     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
-     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-     ;;
-   *)
-    shrext_cmds='.sl'
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=SHLIB_PATH
-    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    ;;
-  esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
-  postinstall_cmds='chmod 555 $lib'
-  ;;
-
-interix[[3-9]]*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-irix5* | irix6* | nonstopux*)
-  case $host_os in
-    nonstopux*) version_type=nonstopux ;;
-    *)
-	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
-	else
-		version_type=irix
-	fi ;;
-  esac
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
-  case $host_os in
-  irix5* | nonstopux*)
-    libsuff= shlibsuff=
-    ;;
-  *)
-    case $LD in # libtool.m4 will add one of these switches to LD
-    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
-      libsuff= shlibsuff= libmagic=32-bit;;
-    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
-      libsuff=32 shlibsuff=N32 libmagic=N32;;
-    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
-      libsuff=64 shlibsuff=64 libmagic=64-bit;;
-    *) libsuff= shlibsuff= libmagic=never-match;;
-    esac
-    ;;
-  esac
-  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
-  shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-  hardcode_into_libs=yes
-  ;;
-
-# No shared lib support for Linux oldld, aout, or coff.
-linux*oldld* | linux*aout* | linux*coff*)
-  dynamic_linker=no
-  ;;
-
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  # This implies no fast_install, which is unacceptable.
-  # Some rework will be needed to allow for fast_install
-  # before this can be enabled.
-  hardcode_into_libs=yes
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-
-  # Append ld.so.conf contents to the search path
-  if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
-  fi
-
-  # We used to test for /lib/ld.so.1 and disable shared libraries on
-  # powerpc, because MkLinux only supported shared libraries with the
-  # GNU dynamic linker.  Since this was broken with cross compilers,
-  # most powerpc-linux boxes support dynamic linking these days and
-  # people can always --disable-shared, the test was removed, and we
-  # assume the GNU/Linux dynamic linker is in use.
-  dynamic_linker='GNU/Linux ld.so'
-  ;;
-
-netbsd*)
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-    dynamic_linker='NetBSD (a.out) ld.so'
-  else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    dynamic_linker='NetBSD ld.elf_so'
-  fi
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  ;;
-
-newsos6)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  ;;
-
-nto-qnx*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  ;;
-
-openbsd*)
-  version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
-  need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
-    *)                         need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[[89]] | openbsd2.[[89]].*)
-	shlibpath_overrides_runpath=no
-	;;
-      *)
-	shlibpath_overrides_runpath=yes
-	;;
-      esac
-  else
-    shlibpath_overrides_runpath=yes
-  fi
-  ;;
-
-os2*)
-  libname_spec='$name'
-  shrext_cmds=".dll"
-  need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
-  dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
-  ;;
-
-osf3* | osf4* | osf5*)
-  version_type=osf
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
-  ;;
-
-rdos*)
-  dynamic_linker=no
-  ;;
-
-solaris*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  # ldd complains unless libraries are executable
-  postinstall_cmds='chmod +x $lib'
-  ;;
-
-sunos4*)
-  version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
-    need_lib_prefix=no
-  fi
-  need_version=yes
-  ;;
-
-sysv4 | sysv4.3*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_vendor in
-    sni)
-      shlibpath_overrides_runpath=no
-      need_lib_prefix=no
-      export_dynamic_flag_spec='${wl}-Blargedynsym'
-      runpath_var=LD_RUN_PATH
-      ;;
-    siemens)
-      need_lib_prefix=no
-      ;;
-    motorola)
-      need_lib_prefix=no
-      need_version=no
-      shlibpath_overrides_runpath=no
-      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
-      ;;
-  esac
-  ;;
-
-sysv4*MP*)
-  if test -d /usr/nec ;then
-    version_type=linux
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
-    shlibpath_var=LD_LIBRARY_PATH
-  fi
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
-    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
-    shlibpath_overrides_runpath=no
-  else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    shlibpath_overrides_runpath=yes
-    case $host_os in
-      sco3.2v5*)
-        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
-	;;
-    esac
-  fi
-  sys_lib_dlsearch_path_spec='/usr/lib'
-  ;;
-
-uts4*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
-
-*)
-  dynamic_linker=no
-  ;;
-esac
-AC_MSG_RESULT([$dynamic_linker])
-test "$dynamic_linker" = no && can_build_shared=no
-
-AC_CACHE_VAL([lt_cv_sys_lib_search_path_spec],
-[lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"])
-sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec],
-[lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"])
-sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-
-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
-  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
-fi
-])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
-
-
-# _LT_AC_TAGCONFIG
-# ----------------
-AC_DEFUN([_LT_AC_TAGCONFIG],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_ARG_WITH([tags],
-    [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
-        [include additional configurations @<:@automatic@:>@])],
-    [tagnames="$withval"])
-
-if test -f "$ltmain" && test -n "$tagnames"; then
-  if test ! -f "${ofile}"; then
-    AC_MSG_WARN([output file `$ofile' does not exist])
-  fi
-
-  if test -z "$LTCC"; then
-    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
-    if test -z "$LTCC"; then
-      AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
-    else
-      AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
-    fi
-  fi
-  if test -z "$LTCFLAGS"; then
-    eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
-  fi
-
-  # Extract list of available tagged configurations in $ofile.
-  # Note that this assumes the entire list is on one line.
-  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
-
-  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-  for tagname in $tagnames; do
-    IFS="$lt_save_ifs"
-    # Check whether tagname contains only valid characters
-    case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
-    "") ;;
-    *)  AC_MSG_ERROR([invalid tag name: $tagname])
-	;;
-    esac
-
-    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
-    then
-      AC_MSG_ERROR([tag name \"$tagname\" already exists])
-    fi
-
-    # Update the list of available tags.
-    if test -n "$tagname"; then
-      echo appending configuration tag \"$tagname\" to $ofile
-
-      case $tagname in
-      CXX)
-	if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
-	    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
-	    (test "X$CXX" != "Xg++"))) ; then
-	  AC_LIBTOOL_LANG_CXX_CONFIG
-	else
-	  tagname=""
-	fi
-	;;
-
-      F77)
-	if test -n "$F77" && test "X$F77" != "Xno"; then
-	  AC_LIBTOOL_LANG_F77_CONFIG
-	else
-	  tagname=""
-	fi
-	;;
-
-      GCJ)
-	if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
-	  AC_LIBTOOL_LANG_GCJ_CONFIG
-	else
-	  tagname=""
-	fi
-	;;
-
-      RC)
-	AC_LIBTOOL_LANG_RC_CONFIG
-	;;
-
-      *)
-	AC_MSG_ERROR([Unsupported tag name: $tagname])
-	;;
-      esac
-
-      # Append the new tag name to the list of available tags.
-      if test -n "$tagname" ; then
-      available_tags="$available_tags $tagname"
-    fi
-    fi
-  done
-  IFS="$lt_save_ifs"
-
-  # Now substitute the updated list of available tags.
-  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
-    mv "${ofile}T" "$ofile"
-    chmod +x "$ofile"
-  else
-    rm -f "${ofile}T"
-    AC_MSG_ERROR([unable to update list of available tagged configurations.])
-  fi
-fi
-])# _LT_AC_TAGCONFIG
-
-
-# AC_LIBTOOL_DLOPEN
-# -----------------
-# enable checks for dlopen support
-AC_DEFUN([AC_LIBTOOL_DLOPEN],
- [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
-])# AC_LIBTOOL_DLOPEN
-
-
-# AC_LIBTOOL_WIN32_DLL
-# --------------------
-# declare package support for building win32 DLLs
-AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
-[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
-])# AC_LIBTOOL_WIN32_DLL
-
-
-# AC_ENABLE_SHARED([DEFAULT])
-# ---------------------------
-# implement the --enable-shared flag
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-AC_DEFUN([AC_ENABLE_SHARED],
-[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE([shared],
-    [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
-	[build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_shared=yes ;;
-    no) enable_shared=no ;;
-    *)
-      enable_shared=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_shared=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
-])# AC_ENABLE_SHARED
-
-
-# AC_DISABLE_SHARED
-# -----------------
-# set the default shared flag to --disable-shared
-AC_DEFUN([AC_DISABLE_SHARED],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_SHARED(no)
-])# AC_DISABLE_SHARED
-
-
-# AC_ENABLE_STATIC([DEFAULT])
-# ---------------------------
-# implement the --enable-static flag
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-AC_DEFUN([AC_ENABLE_STATIC],
-[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE([static],
-    [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
-	[build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_static=yes ;;
-    no) enable_static=no ;;
-    *)
-     enable_static=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_static=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_static=]AC_ENABLE_STATIC_DEFAULT)
-])# AC_ENABLE_STATIC
-
-
-# AC_DISABLE_STATIC
-# -----------------
-# set the default static flag to --disable-static
-AC_DEFUN([AC_DISABLE_STATIC],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_STATIC(no)
-])# AC_DISABLE_STATIC
-
-
-# AC_ENABLE_FAST_INSTALL([DEFAULT])
-# ---------------------------------
-# implement the --enable-fast-install flag
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-AC_DEFUN([AC_ENABLE_FAST_INSTALL],
-[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE([fast-install],
-    [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
-    [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_fast_install=yes ;;
-    no) enable_fast_install=no ;;
-    *)
-      enable_fast_install=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_fast_install=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
-])# AC_ENABLE_FAST_INSTALL
-
-
-# AC_DISABLE_FAST_INSTALL
-# -----------------------
-# set the default to --disable-fast-install
-AC_DEFUN([AC_DISABLE_FAST_INSTALL],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_FAST_INSTALL(no)
-])# AC_DISABLE_FAST_INSTALL
-
-
-# AC_LIBTOOL_PICMODE([MODE])
-# --------------------------
-# implement the --with-pic flag
-# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
-AC_DEFUN([AC_LIBTOOL_PICMODE],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-pic_mode=ifelse($#,1,$1,default)
-])# AC_LIBTOOL_PICMODE
-
-
-# AC_PROG_EGREP
-# -------------
-# This is predefined starting with Autoconf 2.54, so this conditional
-# definition can be removed once we require Autoconf 2.54 or later.
-m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
-[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
-   [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
-    then ac_cv_prog_egrep='grep -E'
-    else ac_cv_prog_egrep='egrep'
-    fi])
- EGREP=$ac_cv_prog_egrep
- AC_SUBST([EGREP])
-])])
-
-
-# AC_PATH_TOOL_PREFIX
-# -------------------
-# find a file program which can recognize shared library
-AC_DEFUN([AC_PATH_TOOL_PREFIX],
-[AC_REQUIRE([AC_PROG_EGREP])dnl
-AC_MSG_CHECKING([for $1])
-AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
-[case $MAGIC_CMD in
-[[\\/*] |  ?:[\\/]*])
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
-  ;;
-*)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-dnl $ac_dummy forces splitting on constant user-supplied paths.
-dnl POSIX.2 word splitting is done only on the output of word expansions,
-dnl not every word.  This closes a longstanding sh security hole.
-  ac_dummy="ifelse([$2], , $PATH, [$2])"
-  for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$1; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
-      if test -n "$file_magic_test_file"; then
-	case $deplibs_check_method in
-	"file_magic "*)
-	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
-	    $EGREP "$file_magic_regex" > /dev/null; then
-	    :
-	  else
-	    cat <<EOF 1>&2
-
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such.  This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem.  Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool at gnu.org
-
-EOF
-	  fi ;;
-	esac
-      fi
-      break
-    fi
-  done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
-  ;;
-esac])
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
-  AC_MSG_RESULT($MAGIC_CMD)
-else
-  AC_MSG_RESULT(no)
-fi
-])# AC_PATH_TOOL_PREFIX
-
-
-# AC_PATH_MAGIC
-# -------------
-# find a file program which can recognize a shared library
-AC_DEFUN([AC_PATH_MAGIC],
-[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
-if test -z "$lt_cv_path_MAGIC_CMD"; then
-  if test -n "$ac_tool_prefix"; then
-    AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
-  else
-    MAGIC_CMD=:
-  fi
-fi
-])# AC_PATH_MAGIC
-
-
-# AC_PROG_LD
-# ----------
-# find the pathname to the GNU or non-GNU linker
-AC_DEFUN([AC_PROG_LD],
-[AC_ARG_WITH([gnu-ld],
-    [AC_HELP_STRING([--with-gnu-ld],
-	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
-    [test "$withval" = no || with_gnu_ld=yes],
-    [with_gnu_ld=no])
-AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-ac_prog=ld
-if test "$GCC" = yes; then
-  # Check if gcc -print-prog-name=ld gives a path.
-  AC_MSG_CHECKING([for ld used by $CC])
-  case $host in
-  *-*-mingw*)
-    # gcc leaves a trailing carriage return which upsets mingw
-    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
-  *)
-    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
-  esac
-  case $ac_prog in
-    # Accept absolute paths.
-    [[\\/]]* | ?:[[\\/]]*)
-      re_direlt='/[[^/]][[^/]]*/\.\./'
-      # Canonicalize the pathname of ld
-      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
-      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
-	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
-      done
-      test -z "$LD" && LD="$ac_prog"
-      ;;
-  "")
-    # If it fails, then pretend we aren't using GCC.
-    ac_prog=ld
-    ;;
-  *)
-    # If it is relative, then search for the first ld in PATH.
-    with_gnu_ld=unknown
-    ;;
-  esac
-elif test "$with_gnu_ld" = yes; then
-  AC_MSG_CHECKING([for GNU ld])
-else
-  AC_MSG_CHECKING([for non-GNU ld])
-fi
-AC_CACHE_VAL(lt_cv_path_LD,
-[if test -z "$LD"; then
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  for ac_dir in $PATH; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
-      lt_cv_path_LD="$ac_dir/$ac_prog"
-      # Check to see if the program is GNU ld.  I'd rather use --version,
-      # but apparently some variants of GNU ld only accept -v.
-      # Break only if it was the GNU/non-GNU ld that we prefer.
-      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
-      *GNU* | *'with BFD'*)
-	test "$with_gnu_ld" != no && break
-	;;
-      *)
-	test "$with_gnu_ld" != yes && break
-	;;
-      esac
-    fi
-  done
-  IFS="$lt_save_ifs"
-else
-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
-  AC_MSG_RESULT($LD)
-else
-  AC_MSG_RESULT(no)
-fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-AC_PROG_LD_GNU
-])# AC_PROG_LD
-
-
-# AC_PROG_LD_GNU
-# --------------
-AC_DEFUN([AC_PROG_LD_GNU],
-[AC_REQUIRE([AC_PROG_EGREP])dnl
-AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
-[# I'd rather use --version here, but apparently some GNU lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
-  lt_cv_prog_gnu_ld=yes
-  ;;
-*)
-  lt_cv_prog_gnu_ld=no
-  ;;
-esac])
-with_gnu_ld=$lt_cv_prog_gnu_ld
-])# AC_PROG_LD_GNU
-
-
-# AC_PROG_LD_RELOAD_FLAG
-# ----------------------
-# find reload flag for linker
-#   -- PORTME Some linkers may need a different reload flag.
-AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
-[AC_CACHE_CHECK([for $LD option to reload object files],
-  lt_cv_ld_reload_flag,
-  [lt_cv_ld_reload_flag='-r'])
-reload_flag=$lt_cv_ld_reload_flag
-case $reload_flag in
-"" | " "*) ;;
-*) reload_flag=" $reload_flag" ;;
-esac
-reload_cmds='$LD$reload_flag -o $output$reload_objs'
-case $host_os in
-  darwin*)
-    if test "$GCC" = yes; then
-      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
-    else
-      reload_cmds='$LD$reload_flag -o $output$reload_objs'
-    fi
-    ;;
-esac
-])# AC_PROG_LD_RELOAD_FLAG
-
-
-# AC_DEPLIBS_CHECK_METHOD
-# -----------------------
-# how to check for library dependencies
-#  -- PORTME fill in with the dynamic library characteristics
-AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
-[AC_CACHE_CHECK([how to recognize dependent libraries],
-lt_cv_deplibs_check_method,
-[lt_cv_file_magic_cmd='$MAGIC_CMD'
-lt_cv_file_magic_test_file=
-lt_cv_deplibs_check_method='unknown'
-# Need to set the preceding variable on all platforms that support
-# interlibrary dependencies.
-# 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
-# 'pass_all' -- all dependencies passed with no checks.
-# 'test_compile' -- check by making test program.
-# 'file_magic [[regex]]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given extended regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
-
-case $host_os in
-aix[[4-9]]*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-beos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-bsdi[[45]]*)
-  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
-  lt_cv_file_magic_cmd='/usr/bin/file -L'
-  lt_cv_file_magic_test_file=/shlib/libc.so
-  ;;
-
-cygwin*)
-  # func_win32_libid is a shell function defined in ltmain.sh
-  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-  lt_cv_file_magic_cmd='func_win32_libid'
-  ;;
-
-mingw* | pw32*)
-  # Base MSYS/MinGW do not provide the 'file' command needed by
-  # func_win32_libid shell function, so use a weaker test based on 'objdump',
-  # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
-    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-    lt_cv_file_magic_cmd='func_win32_libid'
-  else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
-    lt_cv_file_magic_cmd='$OBJDUMP -f'
-  fi
-  ;;
-
-darwin* | rhapsody*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-freebsd* | dragonfly*)
-  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
-    case $host_cpu in
-    i*86 )
-      # Not sure whether the presence of OpenBSD here was a mistake.
-      # Let's accept both of them until this is cleared up.
-      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
-      lt_cv_file_magic_cmd=/usr/bin/file
-      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
-      ;;
-    esac
-  else
-    lt_cv_deplibs_check_method=pass_all
-  fi
-  ;;
-
-gnu*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-hpux10.20* | hpux11*)
-  lt_cv_file_magic_cmd=/usr/bin/file
-  case $host_cpu in
-  ia64*)
-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
-    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
-    ;;
-  hppa*64*)
-    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
-    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
-    ;;
-  *)
-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
-    lt_cv_file_magic_test_file=/usr/lib/libc.sl
-    ;;
-  esac
-  ;;
-
-interix[[3-9]]*)
-  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
-  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
-  ;;
-
-irix5* | irix6* | nonstopux*)
-  case $LD in
-  *-32|*"-32 ") libmagic=32-bit;;
-  *-n32|*"-n32 ") libmagic=N32;;
-  *-64|*"-64 ") libmagic=64-bit;;
-  *) libmagic=never-match;;
-  esac
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-netbsd*)
-  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
-  else
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
-  fi
-  ;;
-
-newos6*)
-  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
-  lt_cv_file_magic_cmd=/usr/bin/file
-  lt_cv_file_magic_test_file=/usr/lib/libnls.so
-  ;;
-
-nto-qnx*)
-  lt_cv_deplibs_check_method=unknown
-  ;;
-
-openbsd*)
-  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
-  else
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
-  fi
-  ;;
-
-osf3* | osf4* | osf5*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-rdos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-solaris*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-sysv4 | sysv4.3*)
-  case $host_vendor in
-  motorola)
-    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
-    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
-    ;;
-  ncr)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  sequent)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
-    ;;
-  sni)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
-    lt_cv_file_magic_test_file=/lib/libc.so
-    ;;
-  siemens)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  pc)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  esac
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-esac
-])
-file_magic_cmd=$lt_cv_file_magic_cmd
-deplibs_check_method=$lt_cv_deplibs_check_method
-test -z "$deplibs_check_method" && deplibs_check_method=unknown
-])# AC_DEPLIBS_CHECK_METHOD
-
-
-# AC_PROG_NM
-# ----------
-# find the pathname to a BSD-compatible name lister
-AC_DEFUN([AC_PROG_NM],
-[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
-[if test -n "$NM"; then
-  # Let the user override the test.
-  lt_cv_path_NM="$NM"
-else
-  lt_nm_to_check="${ac_tool_prefix}nm"
-  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
-    lt_nm_to_check="$lt_nm_to_check nm"
-  fi
-  for lt_tmp_nm in $lt_nm_to_check; do
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
-      IFS="$lt_save_ifs"
-      test -z "$ac_dir" && ac_dir=.
-      tmp_nm="$ac_dir/$lt_tmp_nm"
-      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
-	# Check to see if the nm accepts a BSD-compat flag.
-	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
-	#   nm: unknown option "B" ignored
-	# Tru64's nm complains that /dev/null is an invalid object file
-	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
-	*/dev/null* | *'Invalid file or object type'*)
-	  lt_cv_path_NM="$tmp_nm -B"
-	  break
-	  ;;
-	*)
-	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
-	  */dev/null*)
-	    lt_cv_path_NM="$tmp_nm -p"
-	    break
-	    ;;
-	  *)
-	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
-	    continue # so that we can try to find one that supports BSD flags
-	    ;;
-	  esac
-	  ;;
-	esac
-      fi
-    done
-    IFS="$lt_save_ifs"
-  done
-  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
-fi])
-NM="$lt_cv_path_NM"
-])# AC_PROG_NM
-
-
-# AC_CHECK_LIBM
-# -------------
-# check for math library
-AC_DEFUN([AC_CHECK_LIBM],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-LIBM=
-case $host in
-*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
-  # These system don't have libm, or don't need it
-  ;;
-*-ncr-sysv4.3*)
-  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
-  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
-  ;;
-*)
-  AC_CHECK_LIB(m, cos, LIBM="-lm")
-  ;;
-esac
-])# AC_CHECK_LIBM
-
-
-# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
-# -----------------------------------
-# sets LIBLTDL to the link flags for the libltdl convenience library and
-# LTDLINCL to the include flags for the libltdl header and adds
-# --enable-ltdl-convenience to the configure arguments.  Note that
-# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
-# it is assumed to be `libltdl'.  LIBLTDL will be prefixed with
-# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
-# (note the single quotes!).  If your package is not flat and you're not
-# using automake, define top_builddir and top_srcdir appropriately in
-# the Makefiles.
-AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-  case $enable_ltdl_convenience in
-  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
-  "") enable_ltdl_convenience=yes
-      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
-  esac
-  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
-  LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
-  # For backwards non-gettext consistent compatibility...
-  INCLTDL="$LTDLINCL"
-])# AC_LIBLTDL_CONVENIENCE
-
-
-# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
-# -----------------------------------
-# sets LIBLTDL to the link flags for the libltdl installable library and
-# LTDLINCL to the include flags for the libltdl header and adds
-# --enable-ltdl-install to the configure arguments.  Note that
-# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
-# and an installed libltdl is not found, it is assumed to be `libltdl'.
-# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
-# '${top_srcdir}/' (note the single quotes!).  If your package is not
-# flat and you're not using automake, define top_builddir and top_srcdir
-# appropriately in the Makefiles.
-# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
-AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-  AC_CHECK_LIB(ltdl, lt_dlinit,
-  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
-  [if test x"$enable_ltdl_install" = xno; then
-     AC_MSG_WARN([libltdl not installed, but installation disabled])
-   else
-     enable_ltdl_install=yes
-   fi
-  ])
-  if test x"$enable_ltdl_install" = x"yes"; then
-    ac_configure_args="$ac_configure_args --enable-ltdl-install"
-    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
-    LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
-  else
-    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
-    LIBLTDL="-lltdl"
-    LTDLINCL=
-  fi
-  # For backwards non-gettext consistent compatibility...
-  INCLTDL="$LTDLINCL"
-])# AC_LIBLTDL_INSTALLABLE
-
-
-# AC_LIBTOOL_CXX
-# --------------
-# enable support for C++ libraries
-AC_DEFUN([AC_LIBTOOL_CXX],
-[AC_REQUIRE([_LT_AC_LANG_CXX])
-])# AC_LIBTOOL_CXX
-
-
-# _LT_AC_LANG_CXX
-# ---------------
-AC_DEFUN([_LT_AC_LANG_CXX],
-[AC_REQUIRE([AC_PROG_CXX])
-AC_REQUIRE([_LT_AC_PROG_CXXCPP])
-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
-])# _LT_AC_LANG_CXX
-
-# _LT_AC_PROG_CXXCPP
-# ------------------
-AC_DEFUN([_LT_AC_PROG_CXXCPP],
-[
-AC_REQUIRE([AC_PROG_CXX])
-if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
-    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
-    (test "X$CXX" != "Xg++"))) ; then
-  AC_PROG_CXXCPP
-fi
-])# _LT_AC_PROG_CXXCPP
-
-# AC_LIBTOOL_F77
-# --------------
-# enable support for Fortran 77 libraries
-AC_DEFUN([AC_LIBTOOL_F77],
-[AC_REQUIRE([_LT_AC_LANG_F77])
-])# AC_LIBTOOL_F77
-
-
-# _LT_AC_LANG_F77
-# ---------------
-AC_DEFUN([_LT_AC_LANG_F77],
-[AC_REQUIRE([AC_PROG_F77])
-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
-])# _LT_AC_LANG_F77
-
-
-# AC_LIBTOOL_GCJ
-# --------------
-# enable support for GCJ libraries
-AC_DEFUN([AC_LIBTOOL_GCJ],
-[AC_REQUIRE([_LT_AC_LANG_GCJ])
-])# AC_LIBTOOL_GCJ
-
-
-# _LT_AC_LANG_GCJ
-# ---------------
-AC_DEFUN([_LT_AC_LANG_GCJ],
-[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
-  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
-    [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
-      [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
-	 [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
-	   [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
-])# _LT_AC_LANG_GCJ
-
-
-# AC_LIBTOOL_RC
-# -------------
-# enable support for Windows resource files
-AC_DEFUN([AC_LIBTOOL_RC],
-[AC_REQUIRE([LT_AC_PROG_RC])
-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
-])# AC_LIBTOOL_RC
-
-
-# AC_LIBTOOL_LANG_C_CONFIG
-# ------------------------
-# Ensure that the configuration vars for the C compiler are
-# suitably defined.  Those variables are subsequently used by
-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
-AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
-AC_DEFUN([_LT_AC_LANG_C_CONFIG],
-[lt_save_CC="$CC"
-AC_LANG_PUSH(C)
-
-# Source file extension for C test sources.
-ac_ext=c
-
-# Object file extension for compiled C test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}'
-
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
-AC_LIBTOOL_PROG_COMPILER_PIC($1)
-AC_LIBTOOL_PROG_CC_C_O($1)
-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
-AC_LIBTOOL_PROG_LD_SHLIBS($1)
-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
-AC_LIBTOOL_SYS_LIB_STRIP
-AC_LIBTOOL_DLOPEN_SELF
-
-# Report which library types will actually be built
-AC_MSG_CHECKING([if libtool supports shared libraries])
-AC_MSG_RESULT([$can_build_shared])
-
-AC_MSG_CHECKING([whether to build shared libraries])
-test "$can_build_shared" = "no" && enable_shared=no
-
-# On AIX, shared libraries and static libraries use the same namespace, and
-# are all built from PIC.
-case $host_os in
-aix3*)
-  test "$enable_shared" = yes && enable_static=no
-  if test -n "$RANLIB"; then
-    archive_cmds="$archive_cmds~\$RANLIB \$lib"
-    postinstall_cmds='$RANLIB $lib'
-  fi
-  ;;
-
-aix[[4-9]]*)
-  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-    test "$enable_shared" = yes && enable_static=no
-  fi
-    ;;
-esac
-AC_MSG_RESULT([$enable_shared])
-
-AC_MSG_CHECKING([whether to build static libraries])
-# Make sure either enable_shared or enable_static is yes.
-test "$enable_shared" = yes || enable_static=yes
-AC_MSG_RESULT([$enable_static])
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_POP
-CC="$lt_save_CC"
-])# AC_LIBTOOL_LANG_C_CONFIG
-
-
-# AC_LIBTOOL_LANG_CXX_CONFIG
-# --------------------------
-# Ensure that the configuration vars for the C compiler are
-# suitably defined.  Those variables are subsequently used by
-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
-AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
-AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
-[AC_LANG_PUSH(C++)
-AC_REQUIRE([AC_PROG_CXX])
-AC_REQUIRE([_LT_AC_PROG_CXXCPP])
-
-_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_AC_TAGVAR(allow_undefined_flag, $1)=
-_LT_AC_TAGVAR(always_export_symbols, $1)=no
-_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
-_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_AC_TAGVAR(hardcode_direct, $1)=no
-_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
-_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
-_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-_LT_AC_TAGVAR(hardcode_automatic, $1)=no
-_LT_AC_TAGVAR(module_cmds, $1)=
-_LT_AC_TAGVAR(module_expsym_cmds, $1)=
-_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_AC_TAGVAR(no_undefined_flag, $1)=
-_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Dependencies to place before and after the object being linked:
-_LT_AC_TAGVAR(predep_objects, $1)=
-_LT_AC_TAGVAR(postdep_objects, $1)=
-_LT_AC_TAGVAR(predeps, $1)=
-_LT_AC_TAGVAR(postdeps, $1)=
-_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
-_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
-
-# Source file extension for C++ test sources.
-ac_ext=cpp
-
-# Object file extension for compiled C++ test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC=$CC
-lt_save_LD=$LD
-lt_save_GCC=$GCC
-GCC=$GXX
-lt_save_with_gnu_ld=$with_gnu_ld
-lt_save_path_LD=$lt_cv_path_LD
-if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
-  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
-else
-  $as_unset lt_cv_prog_gnu_ld
-fi
-if test -n "${lt_cv_path_LDCXX+set}"; then
-  lt_cv_path_LD=$lt_cv_path_LDCXX
-else
-  $as_unset lt_cv_path_LD
-fi
-test -z "${LDCXX+set}" || LD=$LDCXX
-CC=${CXX-"c++"}
-compiler=$CC
-_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-
-# We don't want -fno-exception wen compiling C++ code, so set the
-# no_builtin_flag separately
-if test "$GXX" = yes; then
-  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
-else
-  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
-fi
-
-if test "$GXX" = yes; then
-  # Set up default GNU C++ configuration
-
-  AC_PROG_LD
-
-  # Check if GNU C++ uses GNU ld as the underlying linker, since the
-  # archiving commands below assume that GNU ld is being used.
-  if test "$with_gnu_ld" = yes; then
-    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-
-    # If archive_cmds runs LD, not CC, wlarc should be empty
-    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
-    #     investigate it a little bit more. (MM)
-    wlarc='${wl}'
-
-    # ancient GNU ld didn't support --whole-archive et. al.
-    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
-	grep 'no-whole-archive' > /dev/null; then
-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-    else
-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
-    fi
-  else
-    with_gnu_ld=no
-    wlarc=
-
-    # A generic and very simple default shared library creation
-    # command for GNU C++ for the case where it uses the native
-    # linker, instead of GNU ld.  If possible, this setting should
-    # overridden to take advantage of the native linker features on
-    # the platform it is being used on.
-    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-  fi
-
-  # Commands to make compiler produce verbose output that lists
-  # what "hidden" libraries, object files and flags are used when
-  # linking a shared library.
-  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
-
-else
-  GXX=no
-  with_gnu_ld=no
-  wlarc=
-fi
-
-# PORTME: fill in a description of your system's C++ link characteristics
-AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
-_LT_AC_TAGVAR(ld_shlibs, $1)=yes
-case $host_os in
-  aix3*)
-    # FIXME: insert proper C++ library support
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-  aix[[4-9]]*)
-    if test "$host_cpu" = ia64; then
-      # On IA64, the linker does run time linking by default, so we don't
-      # have to do anything special.
-      aix_use_runtimelinking=no
-      exp_sym_flag='-Bexport'
-      no_entry_flag=""
-    else
-      aix_use_runtimelinking=no
-
-      # Test if we are trying to use run time linking or normal
-      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
-      # need to do runtime linking.
-      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
-	for ld_flag in $LDFLAGS; do
-	  case $ld_flag in
-	  *-brtl*)
-	    aix_use_runtimelinking=yes
-	    break
-	    ;;
-	  esac
-	done
-	;;
-      esac
-
-      exp_sym_flag='-bexport'
-      no_entry_flag='-bnoentry'
-    fi
-
-    # When large executables or shared objects are built, AIX ld can
-    # have problems creating the table of contents.  If linking a library
-    # or program results in "error TOC overflow" add -mminimal-toc to
-    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
-
-    _LT_AC_TAGVAR(archive_cmds, $1)=''
-    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
-    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-
-    if test "$GXX" = yes; then
-      case $host_os in aix4.[[012]]|aix4.[[012]].*)
-      # We only want to do this on AIX 4.2 and lower, the check
-      # below for broken collect2 doesn't work under 4.3+
-	collect2name=`${CC} -print-prog-name=collect2`
-	if test -f "$collect2name" && \
-	   strings "$collect2name" | grep resolve_lib_name >/dev/null
-	then
-	  # We have reworked collect2
-	  :
-	else
-	  # We have old collect2
-	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
-	  # It fails to find uninstalled libraries when the uninstalled
-	  # path is not listed in the libpath.  Setting hardcode_minus_L
-	  # to unsupported forces relinking
-	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
-	fi
-	;;
-      esac
-      shared_flag='-shared'
-      if test "$aix_use_runtimelinking" = yes; then
-	shared_flag="$shared_flag "'${wl}-G'
-      fi
-    else
-      # not using gcc
-      if test "$host_cpu" = ia64; then
-	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-	# chokes on -Wl,-G. The following line is correct:
-	shared_flag='-G'
-      else
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag='${wl}-G'
-	else
-	  shared_flag='${wl}-bM:SRE'
-	fi
-      fi
-    fi
-
-    # It seems that -bexpall does not export symbols beginning with
-    # underscore (_), so it is better to generate a list of symbols to export.
-    _LT_AC_TAGVAR(always_export_symbols, $1)=yes
-    if test "$aix_use_runtimelinking" = yes; then
-      # Warning - without using the other runtime loading flags (-brtl),
-      # -berok will link without error, but may produce a broken library.
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
-      # Determine the default libpath from the value encoded in an empty executable.
-      _LT_AC_SYS_LIBPATH_AIX
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-     else
-      if test "$host_cpu" = ia64; then
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-      else
-	# Determine the default libpath from the value encoded in an empty executable.
-	_LT_AC_SYS_LIBPATH_AIX
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-	# Warning - without using the other run time loading flags,
-	# -berok will link without error, but may produce a broken library.
-	_LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	# Exported symbols can be pulled into shared objects from archives
-	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
-	# This is similar to how AIX traditionally builds its shared libraries.
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-      fi
-    fi
-    ;;
-
-  beos*)
-    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
-      # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-      # support --undefined.  This deserves some investigation.  FIXME
-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-    else
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    fi
-    ;;
-
-  chorus*)
-    case $cc_basename in
-      *)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-    esac
-    ;;
-
-  cygwin* | mingw* | pw32*)
-    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-    # as there is no search path for DLLs.
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-    _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
-    _LT_AC_TAGVAR(always_export_symbols, $1)=no
-    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-
-    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-      # If the export-symbols file already is a .def file (1st line
-      # is EXPORTS), use it as is; otherwise, prepend...
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	cp $export_symbols $output_objdir/$soname.def;
-      else
-	echo EXPORTS > $output_objdir/$soname.def;
-	cat $export_symbols >> $output_objdir/$soname.def;
-      fi~
-      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-    else
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    fi
-  ;;
-      darwin* | rhapsody*)
-      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_AC_TAGVAR(hardcode_direct, $1)=no
-      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
-      if test "$GXX" = yes ; then
-      output_verbose_link_cmd='echo'
-      _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-      _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-      _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-      if test "$lt_cv_apple_cc_single_mod" != "yes"; then
-        _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
-        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
-      fi
-      else
-      case $cc_basename in
-        xlc*)
-         output_verbose_link_cmd='echo'
-          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
-          _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          ;;
-       *)
-         _LT_AC_TAGVAR(ld_shlibs, $1)=no
-          ;;
-      esac
-      fi
-        ;;
-
-  dgux*)
-    case $cc_basename in
-      ec++*)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      ghcx*)
-	# Green Hills C++ Compiler
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      *)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-    esac
-    ;;
-  freebsd[[12]]*)
-    # C++ shared libraries reported to be fairly broken before switch to ELF
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-  freebsd-elf*)
-    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-    ;;
-  freebsd* | dragonfly*)
-    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
-    # conventions
-    _LT_AC_TAGVAR(ld_shlibs, $1)=yes
-    ;;
-  gnu*)
-    ;;
-  hpux9*)
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-    _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
-				# but as the default
-				# location of the library.
-
-    case $cc_basename in
-    CC*)
-      # FIXME: insert proper C++ library support
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-      ;;
-    aCC*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      # Commands to make compiler produce verbose output that lists
-      # what "hidden" libraries, object files and flags are used when
-      # linking a shared library.
-      #
-      # There doesn't appear to be a way to prevent this compiler from
-      # explicitly linking system object files so we need to strip them
-      # from the output so that they don't get included in the library
-      # dependencies.
-      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-      ;;
-    *)
-      if test "$GXX" = yes; then
-        _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      else
-        # FIXME: insert proper C++ library support
-        _LT_AC_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-    esac
-    ;;
-  hpux10*|hpux11*)
-    if test $with_gnu_ld = no; then
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-      case $host_cpu in
-      hppa*64*|ia64*) ;;
-      *)
-	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-        ;;
-      esac
-    fi
-    case $host_cpu in
-    hppa*64*|ia64*)
-      _LT_AC_TAGVAR(hardcode_direct, $1)=no
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-    *)
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
-					      # but as the default
-					      # location of the library.
-      ;;
-    esac
-
-    case $cc_basename in
-      CC*)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      aCC*)
-	case $host_cpu in
-	hppa*64*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	  ;;
-	ia64*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	  ;;
-	*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	  ;;
-	esac
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-	;;
-      *)
-	if test "$GXX" = yes; then
-	  if test $with_gnu_ld = no; then
-	    case $host_cpu in
-	    hppa*64*)
-	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	      ;;
-	    ia64*)
-	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	      ;;
-	    *)
-	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	      ;;
-	    esac
-	  fi
-	else
-	  # FIXME: insert proper C++ library support
-	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
-	fi
-	;;
-    esac
-    ;;
-  interix[[3-9]]*)
-    _LT_AC_TAGVAR(hardcode_direct, $1)=no
-    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-    # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-    # Instead, shared libraries are loaded at an image base (0x10000000 by
-    # default) and relocated if they conflict, which is a slow very memory
-    # consuming and fragmenting process.  To avoid this, we pick a random,
-    # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-    # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-    ;;
-  irix5* | irix6*)
-    case $cc_basename in
-      CC*)
-	# SGI C++
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-
-	# Archives containing C++ object files must be created using
-	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
-	# necessary to make sure instantiated templates are included
-	# in the archive.
-	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
-	;;
-      *)
-	if test "$GXX" = yes; then
-	  if test "$with_gnu_ld" = no; then
-	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	  else
-	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
-	  fi
-	fi
-	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-	;;
-    esac
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-    ;;
-  linux* | k*bsd*-gnu)
-    case $cc_basename in
-      KCC*)
-	# Kuck and Associates, Inc. (KAI) C++ Compiler
-
-	# KCC will only create a shared library if the output file
-	# ends with ".so" (or ".sl" for HP-UX), so rename the library
-	# to its proper name (with version) after linking.
-	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
-	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-
-	# Archives containing C++ object files must be created using
-	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
-	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
-	;;
-      icpc*)
-	# Intel C++
-	with_gnu_ld=yes
-	# version 8.0 and above of icpc choke on multiply defined symbols
-	# if we add $predep_objects and $postdep_objects, however 7.1 and
-	# earlier do not add the objects themselves.
-	case `$CC -V 2>&1` in
-	*"Version 7."*)
-  	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-  	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-	  ;;
-	*)  # Version 8.0 or newer
-	  tmp_idyn=
-	  case $host_cpu in
-	    ia64*) tmp_idyn=' -i_dynamic';;
-	  esac
-  	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-	  ;;
-	esac
-	_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	;;
-      pgCC* | pgcpp*)
-        # Portland Group C++ compiler
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-  	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
-
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
-	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-        ;;
-      cxx*)
-	# Compaq C++
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
-
-	runpath_var=LD_RUN_PATH
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-	;;
-      *)
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C++ 5.9
-	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-
-	  # Not sure whether something based on
-	  # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
-	  # would be better.
-	  output_verbose_link_cmd='echo'
-
-	  # Archives containing C++ object files must be created using
-	  # "CC -xar", where "CC" is the Sun C++ compiler.  This is
-	  # necessary to make sure instantiated templates are included
-	  # in the archive.
-	  _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
-	  ;;
-	esac
-	;;
-    esac
-    ;;
-  lynxos*)
-    # FIXME: insert proper C++ library support
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-  m88k*)
-    # FIXME: insert proper C++ library support
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-  mvs*)
-    case $cc_basename in
-      cxx*)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      *)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-    esac
-    ;;
-  netbsd*)
-    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
-      wlarc=
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-    fi
-    # Workaround some broken pre-1.5 toolchains
-    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
-    ;;
-  openbsd2*)
-    # C++ shared libraries are fairly broken
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-  openbsd*)
-    if test -f /usr/libexec/ld.so; then
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
-	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-      fi
-      output_verbose_link_cmd='echo'
-    else
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    fi
-    ;;
-  osf3*)
-    case $cc_basename in
-      KCC*)
-	# Kuck and Associates, Inc. (KAI) C++ Compiler
-
-	# KCC will only create a shared library if the output file
-	# ends with ".so" (or ".sl" for HP-UX), so rename the library
-	# to its proper name (with version) after linking.
-	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	# Archives containing C++ object files must be created using
-	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
-	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
-
-	;;
-      RCC*)
-	# Rational C++ 2.4.1
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      cxx*)
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-	;;
-      *)
-	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	  # Commands to make compiler produce verbose output that lists
-	  # what "hidden" libraries, object files and flags are used when
-	  # linking a shared library.
-	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
-
-	else
-	  # FIXME: insert proper C++ library support
-	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
-	fi
-	;;
-    esac
-    ;;
-  osf4* | osf5*)
-    case $cc_basename in
-      KCC*)
-	# Kuck and Associates, Inc. (KAI) C++ Compiler
-
-	# KCC will only create a shared library if the output file
-	# ends with ".so" (or ".sl" for HP-UX), so rename the library
-	# to its proper name (with version) after linking.
-	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	# Archives containing C++ object files must be created using
-	# the KAI C++ compiler.
-	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
-	;;
-      RCC*)
-	# Rational C++ 2.4.1
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      cxx*)
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
-	  echo "-hidden">> $lib.exp~
-	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry ${output_objdir}/so_locations -o $lib~
-	  $rm $lib.exp'
-
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-	;;
-      *)
-	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	 _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	  # Commands to make compiler produce verbose output that lists
-	  # what "hidden" libraries, object files and flags are used when
-	  # linking a shared library.
-	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
-
-	else
-	  # FIXME: insert proper C++ library support
-	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
-	fi
-	;;
-    esac
-    ;;
-  psos*)
-    # FIXME: insert proper C++ library support
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-  sunos4*)
-    case $cc_basename in
-      CC*)
-	# Sun C++ 4.x
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      lcc*)
-	# Lucid
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      *)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-    esac
-    ;;
-  solaris*)
-    case $cc_basename in
-      CC*)
-	# Sun C++ 4.2, 5.x and Centerline C++
-        _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes
-	_LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-	$CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
-
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-	case $host_os in
-	  solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-	  *)
-	    # The compiler driver will combine and reorder linker options,
-	    # but understands `-z linker_flag'.
-	    # Supported since Solaris 2.6 (maybe 2.5.1?)
-	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
-	    ;;
-	esac
-	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-
-	output_verbose_link_cmd='echo'
-
-	# Archives containing C++ object files must be created using
-	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
-	# necessary to make sure instantiated templates are included
-	# in the archive.
-	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
-	;;
-      gcx*)
-	# Green Hills C++ Compiler
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-
-	# The C++ compiler must be used to create the archive.
-	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
-	;;
-      *)
-	# GNU C++ compiler with Solaris linker
-	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
-	  if $CC --version | grep -v '^2\.7' > /dev/null; then
-	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-		$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
-
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
-	  else
-	    # g++ 2.7 appears to require `-G' NOT `-shared' on this
-	    # platform.
-	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-		$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
-
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
-	  fi
-
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
-	  case $host_os in
-	  solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-	  *)
-	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	    ;;
-	  esac
-	fi
-	;;
-    esac
-    ;;
-  sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
-    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-    runpath_var='LD_RUN_PATH'
-
-    case $cc_basename in
-      CC*)
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	;;
-      *)
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	;;
-    esac
-    ;;
-  sysv5* | sco3.2v5* | sco5v6*)
-    # Note: We can NOT use -z defs as we might desire, because we do not
-    # link with -lc, and that would cause any symbols used from libc to
-    # always be unresolved, which means just about no library would
-    # ever link correctly.  If we're not using GNU ld we use -z text
-    # though, which does catch some bad symbols but isn't as heavy-handed
-    # as -z defs.
-    # For security reasons, it is highly recommended that you always
-    # use absolute paths for naming shared libraries, and exclude the
-    # DT_RUNPATH tag from executables and libraries.  But doing so
-    # requires that you compile everything twice, which is a pain.
-    # So that behaviour is only enabled if SCOABSPATH is set to a
-    # non-empty value in the environment.  Most likely only useful for
-    # creating official distributions of packages.
-    # This is a hack until libtool officially supports absolute path
-    # names for shared libraries.
-    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-    _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
-    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
-    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
-    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
-    runpath_var='LD_RUN_PATH'
-
-    case $cc_basename in
-      CC*)
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	;;
-      *)
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	;;
-    esac
-    ;;
-  tandem*)
-    case $cc_basename in
-      NCC*)
-	# NonStop-UX NCC 3.20
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      *)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-    esac
-    ;;
-  vxworks*)
-    # FIXME: insert proper C++ library support
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-  *)
-    # FIXME: insert proper C++ library support
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-esac
-AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
-test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
-_LT_AC_TAGVAR(GCC, $1)="$GXX"
-_LT_AC_TAGVAR(LD, $1)="$LD"
-
-AC_LIBTOOL_POSTDEP_PREDEP($1)
-AC_LIBTOOL_PROG_COMPILER_PIC($1)
-AC_LIBTOOL_PROG_CC_C_O($1)
-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
-AC_LIBTOOL_PROG_LD_SHLIBS($1)
-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_POP
-CC=$lt_save_CC
-LDCXX=$LD
-LD=$lt_save_LD
-GCC=$lt_save_GCC
-with_gnu_ldcxx=$with_gnu_ld
-with_gnu_ld=$lt_save_with_gnu_ld
-lt_cv_path_LDCXX=$lt_cv_path_LD
-lt_cv_path_LD=$lt_save_path_LD
-lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
-lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
-])# AC_LIBTOOL_LANG_CXX_CONFIG
-
-# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
-# ------------------------------------
-# Figure out "hidden" library dependencies from verbose
-# compiler output when linking a shared library.
-# Parse the compiler output and extract the necessary
-# objects, libraries and library flags.
-AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-dnl we can't use the lt_simple_compile_test_code here,
-dnl because it contains code intended for an executable,
-dnl not a library.  It's possible we should let each
-dnl tag define a new lt_????_link_test_code variable,
-dnl but it's only used here...
-ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
-int a;
-void foo (void) { a = 0; }
-EOF
-],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
-class Foo
-{
-public:
-  Foo (void) { a = 0; }
-private:
-  int a;
-};
-EOF
-],[$1],[F77],[cat > conftest.$ac_ext <<EOF
-      subroutine foo
-      implicit none
-      integer*4 a
-      a=0
-      return
-      end
-EOF
-],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
-public class foo {
-  private int a;
-  public void bar (void) {
-    a = 0;
-  }
-};
-EOF
-])
-dnl Parse the compiler output and extract the necessary
-dnl objects, libraries and library flags.
-if AC_TRY_EVAL(ac_compile); then
-  # Parse the compiler output and extract the necessary
-  # objects, libraries and library flags.
-
-  # Sentinel used to keep track of whether or not we are before
-  # the conftest object file.
-  pre_test_object_deps_done=no
-
-  # The `*' in the case matches for architectures that use `case' in
-  # $output_verbose_cmd can trigger glob expansion during the loop
-  # eval without this substitution.
-  output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
-
-  for p in `eval $output_verbose_link_cmd`; do
-    case $p in
-
-    -L* | -R* | -l*)
-       # Some compilers place space between "-{L,R}" and the path.
-       # Remove the space.
-       if test $p = "-L" \
-	  || test $p = "-R"; then
-	 prev=$p
-	 continue
-       else
-	 prev=
-       fi
-
-       if test "$pre_test_object_deps_done" = no; then
-	 case $p in
-	 -L* | -R*)
-	   # Internal compiler library paths should come after those
-	   # provided the user.  The postdeps already come after the
-	   # user supplied libs so there is no need to process them.
-	   if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
-	     _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
-	   else
-	     _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
-	   fi
-	   ;;
-	 # The "-l" case would never come before the object being
-	 # linked, so don't bother handling this case.
-	 esac
-       else
-	 if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
-	   _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
-	 else
-	   _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
-	 fi
-       fi
-       ;;
-
-    *.$objext)
-       # This assumes that the test object file only shows up
-       # once in the compiler output.
-       if test "$p" = "conftest.$objext"; then
-	 pre_test_object_deps_done=yes
-	 continue
-       fi
-
-       if test "$pre_test_object_deps_done" = no; then
-	 if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
-	   _LT_AC_TAGVAR(predep_objects, $1)="$p"
-	 else
-	   _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
-	 fi
-       else
-	 if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
-	   _LT_AC_TAGVAR(postdep_objects, $1)="$p"
-	 else
-	   _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
-	 fi
-       fi
-       ;;
-
-    *) ;; # Ignore the rest.
-
-    esac
-  done
-
-  # Clean up.
-  rm -f a.out a.exe
-else
-  echo "libtool.m4: error: problem compiling $1 test program"
-fi
-
-$rm -f confest.$objext
-
-_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
-if test -n "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
-  _LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_AC_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
-fi
-
-# PORTME: override above test on systems where it is broken
-ifelse([$1],[CXX],
-[case $host_os in
-interix[[3-9]]*)
-  # Interix 3.5 installs completely hosed .la files for C++, so rather than
-  # hack all around it, let's just trust "g++" to DTRT.
-  _LT_AC_TAGVAR(predep_objects,$1)=
-  _LT_AC_TAGVAR(postdep_objects,$1)=
-  _LT_AC_TAGVAR(postdeps,$1)=
-  ;;
-
-linux*)
-  case `$CC -V 2>&1 | sed 5q` in
-  *Sun\ C*)
-    # Sun C++ 5.9
-    #
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-
-solaris*)
-  case $cc_basename in
-  CC*)
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-
-    # Adding this requires a known-good setup of shared libraries for
-    # Sun compiler versions before 5.6, else PIC objects from an old
-    # archive will be linked into the output, leading to subtle bugs.
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-esac
-])
-case " $_LT_AC_TAGVAR(postdeps, $1) " in
-*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
-esac
-])# AC_LIBTOOL_POSTDEP_PREDEP
-
-# AC_LIBTOOL_LANG_F77_CONFIG
-# --------------------------
-# Ensure that the configuration vars for the C compiler are
-# suitably defined.  Those variables are subsequently used by
-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
-AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
-AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
-[AC_REQUIRE([AC_PROG_F77])
-AC_LANG_PUSH(Fortran 77)
-
-_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_AC_TAGVAR(allow_undefined_flag, $1)=
-_LT_AC_TAGVAR(always_export_symbols, $1)=no
-_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
-_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_AC_TAGVAR(hardcode_direct, $1)=no
-_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
-_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
-_LT_AC_TAGVAR(hardcode_automatic, $1)=no
-_LT_AC_TAGVAR(module_cmds, $1)=
-_LT_AC_TAGVAR(module_expsym_cmds, $1)=
-_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_AC_TAGVAR(no_undefined_flag, $1)=
-_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for f77 test sources.
-ac_ext=f
-
-# Object file extension for compiled f77 test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="\
-      subroutine t
-      return
-      end
-"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code="\
-      program t
-      end
-"
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-CC=${F77-"f77"}
-compiler=$CC
-_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-
-AC_MSG_CHECKING([if libtool supports shared libraries])
-AC_MSG_RESULT([$can_build_shared])
-
-AC_MSG_CHECKING([whether to build shared libraries])
-test "$can_build_shared" = "no" && enable_shared=no
-
-# On AIX, shared libraries and static libraries use the same namespace, and
-# are all built from PIC.
-case $host_os in
-aix3*)
-  test "$enable_shared" = yes && enable_static=no
-  if test -n "$RANLIB"; then
-    archive_cmds="$archive_cmds~\$RANLIB \$lib"
-    postinstall_cmds='$RANLIB $lib'
-  fi
-  ;;
-aix[[4-9]]*)
-  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-    test "$enable_shared" = yes && enable_static=no
-  fi
-  ;;
-esac
-AC_MSG_RESULT([$enable_shared])
-
-AC_MSG_CHECKING([whether to build static libraries])
-# Make sure either enable_shared or enable_static is yes.
-test "$enable_shared" = yes || enable_static=yes
-AC_MSG_RESULT([$enable_static])
-
-_LT_AC_TAGVAR(GCC, $1)="$G77"
-_LT_AC_TAGVAR(LD, $1)="$LD"
-
-AC_LIBTOOL_PROG_COMPILER_PIC($1)
-AC_LIBTOOL_PROG_CC_C_O($1)
-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
-AC_LIBTOOL_PROG_LD_SHLIBS($1)
-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_POP
-CC="$lt_save_CC"
-])# AC_LIBTOOL_LANG_F77_CONFIG
-
-
-# AC_LIBTOOL_LANG_GCJ_CONFIG
-# --------------------------
-# Ensure that the configuration vars for the C compiler are
-# suitably defined.  Those variables are subsequently used by
-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
-AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
-AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
-[AC_LANG_SAVE
-
-# Source file extension for Java test sources.
-ac_ext=java
-
-# Object file extension for compiled Java test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-CC=${GCJ-"gcj"}
-compiler=$CC
-_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-
-# GCJ did not exist at the time GCC didn't implicitly link libc in.
-_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-
-_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-
-AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
-AC_LIBTOOL_PROG_COMPILER_PIC($1)
-AC_LIBTOOL_PROG_CC_C_O($1)
-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
-AC_LIBTOOL_PROG_LD_SHLIBS($1)
-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_RESTORE
-CC="$lt_save_CC"
-])# AC_LIBTOOL_LANG_GCJ_CONFIG
-
-
-# AC_LIBTOOL_LANG_RC_CONFIG
-# -------------------------
-# Ensure that the configuration vars for the Windows resource compiler are
-# suitably defined.  Those variables are subsequently used by
-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
-AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
-AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
-[AC_LANG_SAVE
-
-# Source file extension for RC test sources.
-ac_ext=rc
-
-# Object file extension for compiled RC test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
-
-# Code to be used in simple link tests
-lt_simple_link_test_code="$lt_simple_compile_test_code"
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-CC=${RC-"windres"}
-compiler=$CC
-_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_RESTORE
-CC="$lt_save_CC"
-])# AC_LIBTOOL_LANG_RC_CONFIG
-
-
-# AC_LIBTOOL_CONFIG([TAGNAME])
-# ----------------------------
-# If TAGNAME is not passed, then create an initial libtool script
-# with a default configuration from the untagged config vars.  Otherwise
-# add code to config.status for appending the configuration named by
-# TAGNAME from the matching tagged config vars.
-AC_DEFUN([AC_LIBTOOL_CONFIG],
-[# The else clause should only fire when bootstrapping the
-# libtool distribution, otherwise you forgot to ship ltmain.sh
-# with your package, and you will get complaints that there are
-# no rules to generate ltmain.sh.
-if test -f "$ltmain"; then
-  # See if we are running on zsh, and set the options which allow our commands through
-  # without removal of \ escapes.
-  if test -n "${ZSH_VERSION+set}" ; then
-    setopt NO_GLOB_SUBST
-  fi
-  # Now quote all the things that may contain metacharacters while being
-  # careful not to overquote the AC_SUBSTed values.  We take copies of the
-  # variables and quote the copies for generation of the libtool script.
-  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
-    SED SHELL STRIP \
-    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
-    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
-    deplibs_check_method reload_flag reload_cmds need_locks \
-    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
-    lt_cv_sys_global_symbol_to_c_name_address \
-    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
-    old_postinstall_cmds old_postuninstall_cmds \
-    _LT_AC_TAGVAR(compiler, $1) \
-    _LT_AC_TAGVAR(CC, $1) \
-    _LT_AC_TAGVAR(LD, $1) \
-    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
-    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
-    _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
-    _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
-    _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
-    _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
-    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
-    _LT_AC_TAGVAR(old_archive_cmds, $1) \
-    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
-    _LT_AC_TAGVAR(predep_objects, $1) \
-    _LT_AC_TAGVAR(postdep_objects, $1) \
-    _LT_AC_TAGVAR(predeps, $1) \
-    _LT_AC_TAGVAR(postdeps, $1) \
-    _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
-    _LT_AC_TAGVAR(compiler_lib_search_dirs, $1) \
-    _LT_AC_TAGVAR(archive_cmds, $1) \
-    _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
-    _LT_AC_TAGVAR(postinstall_cmds, $1) \
-    _LT_AC_TAGVAR(postuninstall_cmds, $1) \
-    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
-    _LT_AC_TAGVAR(allow_undefined_flag, $1) \
-    _LT_AC_TAGVAR(no_undefined_flag, $1) \
-    _LT_AC_TAGVAR(export_symbols_cmds, $1) \
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
-    _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
-    _LT_AC_TAGVAR(hardcode_automatic, $1) \
-    _LT_AC_TAGVAR(module_cmds, $1) \
-    _LT_AC_TAGVAR(module_expsym_cmds, $1) \
-    _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
-    _LT_AC_TAGVAR(fix_srcfile_path, $1) \
-    _LT_AC_TAGVAR(exclude_expsyms, $1) \
-    _LT_AC_TAGVAR(include_expsyms, $1); do
-
-    case $var in
-    _LT_AC_TAGVAR(old_archive_cmds, $1) | \
-    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
-    _LT_AC_TAGVAR(archive_cmds, $1) | \
-    _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
-    _LT_AC_TAGVAR(module_cmds, $1) | \
-    _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
-    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
-    _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
-    extract_expsyms_cmds | reload_cmds | finish_cmds | \
-    postinstall_cmds | postuninstall_cmds | \
-    old_postinstall_cmds | old_postuninstall_cmds | \
-    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
-      # Double-quote double-evaled strings.
-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
-      ;;
-    *)
-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
-      ;;
-    esac
-  done
-
-  case $lt_echo in
-  *'\[$]0 --fallback-echo"')
-    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
-    ;;
-  esac
-
-ifelse([$1], [],
-  [cfgfile="${ofile}T"
-  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
-  $rm -f "$cfgfile"
-  AC_MSG_NOTICE([creating $ofile])],
-  [cfgfile="$ofile"])
-
-  cat <<__EOF__ >> "$cfgfile"
-ifelse([$1], [],
-[#! $SHELL
-
-# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-# Free Software Foundation, Inc.
-#
-# This file is part of GNU Libtool:
-# Originally by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# A sed program that does not truncate output.
-SED=$lt_SED
-
-# Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="$SED -e 1s/^X//"
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-# The names of the tagged configurations supported by this script.
-available_tags=
-
-# ### BEGIN LIBTOOL CONFIG],
-[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
-
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
-
-# Whether or not to build shared libraries.
-build_libtool_libs=$enable_shared
-
-# Whether or not to build static libraries.
-build_old_libs=$enable_static
-
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
-
-# Whether or not to disallow shared libs when runtime libs are static
-allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
-
-# Whether or not to optimize for fast installation.
-fast_install=$enable_fast_install
-
-# The host system.
-host_alias=$host_alias
-host=$host
-host_os=$host_os
-
-# The build system.
-build_alias=$build_alias
-build=$build
-build_os=$build_os
-
-# An echo program that does not interpret backslashes.
-echo=$lt_echo
-
-# The archiver.
-AR=$lt_AR
-AR_FLAGS=$lt_AR_FLAGS
-
-# A C compiler.
-LTCC=$lt_LTCC
-
-# LTCC compiler flags.
-LTCFLAGS=$lt_LTCFLAGS
-
-# A language-specific compiler.
-CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
-
-# Is the compiler the GNU C compiler?
-with_gcc=$_LT_AC_TAGVAR(GCC, $1)
-
-# An ERE matcher.
-EGREP=$lt_EGREP
-
-# The linker used to build libraries.
-LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
-
-# Whether we need hard or soft links.
-LN_S=$lt_LN_S
-
-# A BSD-compatible nm program.
-NM=$lt_NM
-
-# A symbol stripping program
-STRIP=$lt_STRIP
-
-# Used to examine libraries when file_magic_cmd begins "file"
-MAGIC_CMD=$MAGIC_CMD
-
-# Used on cygwin: DLL creation program.
-DLLTOOL="$DLLTOOL"
-
-# Used on cygwin: object dumper.
-OBJDUMP="$OBJDUMP"
-
-# Used on cygwin: assembler.
-AS="$AS"
-
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
-
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
-
-# How to pass a linker flag through the compiler.
-wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
-
-# Object file suffix (normally "o").
-objext="$ac_objext"
-
-# Old archive suffix (normally "a").
-libext="$libext"
-
-# Shared library suffix (normally ".so").
-shrext_cmds='$shrext_cmds'
-
-# Executable file suffix (normally "").
-exeext="$exeext"
-
-# Additional compiler flags for building library objects.
-pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
-pic_mode=$pic_mode
-
-# What is the maximum length of a command?
-max_cmd_len=$lt_cv_sys_max_cmd_len
-
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
-
-# Must we lock files when doing compilation?
-need_locks=$lt_need_locks
-
-# Do we need the lib prefix for modules?
-need_lib_prefix=$need_lib_prefix
-
-# Do we need a version for libraries?
-need_version=$need_version
-
-# Whether dlopen is supported.
-dlopen_support=$enable_dlopen
-
-# Whether dlopen of programs is supported.
-dlopen_self=$enable_dlopen_self
-
-# Whether dlopen of statically linked programs is supported.
-dlopen_self_static=$enable_dlopen_self_static
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
-
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
-
-# Compiler flag to generate thread-safe objects.
-thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
-
-# Library versioning type.
-version_type=$version_type
-
-# Format of library name prefix.
-libname_spec=$lt_libname_spec
-
-# List of archive names.  First name is the real one, the rest are links.
-# The last name is the one that the linker finds with -lNAME.
-library_names_spec=$lt_library_names_spec
-
-# The coded name of the library, if different from the real name.
-soname_spec=$lt_soname_spec
-
-# Commands used to build and install an old-style archive.
-RANLIB=$lt_RANLIB
-old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
-old_postinstall_cmds=$lt_old_postinstall_cmds
-old_postuninstall_cmds=$lt_old_postuninstall_cmds
-
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
-
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
-
-# Commands used to build and install a shared archive.
-archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
-archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
-postinstall_cmds=$lt_postinstall_cmds
-postuninstall_cmds=$lt_postuninstall_cmds
-
-# Commands used to build a loadable module (assumed same as above if empty)
-module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
-module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
-
-# Commands to strip libraries.
-old_striplib=$lt_old_striplib
-striplib=$lt_striplib
-
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
-
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
-
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
-
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
-
-# The directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)
-
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
-
-# Method to check whether dependent libraries are shared objects.
-deplibs_check_method=$lt_deplibs_check_method
-
-# Command to use when deplibs_check_method == file_magic.
-file_magic_cmd=$lt_file_magic_cmd
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
-
-# Flag that forces no undefined symbols.
-no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
-
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds=$lt_finish_cmds
-
-# Same as above, but a single script fragment to be evaled but not shown.
-finish_eval=$lt_finish_eval
-
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
-
-# Transform the output of nm in a proper C declaration
-global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
-
-# Transform the output of nm in a C name address pair
-global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
-
-# This is the shared library runtime path variable.
-runpath_var=$runpath_var
-
-# This is the shared library path variable.
-shlibpath_var=$shlibpath_var
-
-# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=$shlibpath_overrides_runpath
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
-
-# Whether we should hardcode library paths into libraries.
-hardcode_into_libs=$hardcode_into_libs
-
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
-
-# If ld is used when linking, flag to hardcode \$libdir into
-# a binary during linking. This must work even if \$libdir does
-# not exist.
-hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
-
-# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
-
-# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
-# resulting binary.
-hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
-
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
-hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
-
-# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
-# the resulting binary.
-hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
-
-# Set to yes if building a shared library automatically hardcodes DIR into the library
-# and all subsequent libraries and executables linked against it.
-hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
-
-# Variables whose values should be saved in libtool wrapper scripts and
-# restored at relink time.
-variables_saved_for_relink="$variables_saved_for_relink"
-
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
-
-# Compile-time system search path for libraries
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
-
-# Run-time system search path for libraries
-sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
-
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
-
-# Set to yes if exported symbols are required.
-always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
-
-# The commands to list exported symbols.
-export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
-
-# The commands to extract the exported symbol list from a shared archive.
-extract_expsyms_cmds=$lt_extract_expsyms_cmds
-
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
-
-# Symbols that must always be exported.
-include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
-
-ifelse([$1],[],
-[# ### END LIBTOOL CONFIG],
-[# ### END LIBTOOL TAG CONFIG: $tagname])
-
-__EOF__
-
-ifelse([$1],[], [
-  case $host_os in
-  aix3*)
-    cat <<\EOF >> "$cfgfile"
-
-# AIX sometimes has problems with the GCC collect2 program.  For some
-# reason, if we set the COLLECT_NAMES environment variable, the problems
-# vanish in a puff of smoke.
-if test "X${COLLECT_NAMES+set}" != Xset; then
-  COLLECT_NAMES=
-  export COLLECT_NAMES
-fi
-EOF
-    ;;
-  esac
-
-  # We use sed instead of cat because bash on DJGPP gets confused if
-  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
-  # text mode, it properly converts lines to CR/LF.  This bash problem
-  # is reportedly fixed, but why not run on old versions too?
-  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
-
-  mv -f "$cfgfile" "$ofile" || \
-    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
-  chmod +x "$ofile"
-])
-else
-  # If there is no Makefile yet, we rely on a make rule to execute
-  # `config.status --recheck' to rerun these tests and create the
-  # libtool script then.
-  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
-  if test -f "$ltmain_in"; then
-    test -f Makefile && make "$ltmain"
-  fi
-fi
-])# AC_LIBTOOL_CONFIG
-
-
-# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
-# -------------------------------------------
-AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
-[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
-
-_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
-
-if test "$GCC" = yes; then
-  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
-
-  AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
-    lt_cv_prog_compiler_rtti_exceptions,
-    [-fno-rtti -fno-exceptions], [],
-    [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
-fi
-])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
-
-
-# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
-# ---------------------------------
-AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
-[AC_REQUIRE([AC_CANONICAL_HOST])
-AC_REQUIRE([LT_AC_PROG_SED])
-AC_REQUIRE([AC_PROG_NM])
-AC_REQUIRE([AC_OBJEXT])
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-AC_MSG_CHECKING([command to parse $NM output from $compiler object])
-AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
-[
-# These are sane defaults that work on at least a few old systems.
-# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
-
-# Character class describing NM global symbol codes.
-symcode='[[BCDEGRST]]'
-
-# Regexp to match symbols that can be accessed directly from C.
-sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
-
-# Transform an extracted symbol line into a proper C declaration
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
-
-# Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
-
-# Define system-specific variables.
-case $host_os in
-aix*)
-  symcode='[[BCDT]]'
-  ;;
-cygwin* | mingw* | pw32*)
-  symcode='[[ABCDGISTW]]'
-  ;;
-hpux*) # Its linker distinguishes data from code symbols
-  if test "$host_cpu" = ia64; then
-    symcode='[[ABCDEGRST]]'
-  fi
-  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
-  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
-  ;;
-linux* | k*bsd*-gnu)
-  if test "$host_cpu" = ia64; then
-    symcode='[[ABCDGIRSTW]]'
-    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
-    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
-  fi
-  ;;
-irix* | nonstopux*)
-  symcode='[[BCDEGRST]]'
-  ;;
-osf*)
-  symcode='[[BCDEGQRST]]'
-  ;;
-solaris*)
-  symcode='[[BDRT]]'
-  ;;
-sco3.2v5*)
-  symcode='[[DT]]'
-  ;;
-sysv4.2uw2*)
-  symcode='[[DT]]'
-  ;;
-sysv5* | sco5v6* | unixware* | OpenUNIX*)
-  symcode='[[ABDT]]'
-  ;;
-sysv4)
-  symcode='[[DFNSTU]]'
-  ;;
-esac
-
-# Handle CRLF in mingw tool chain
-opt_cr=
-case $build_os in
-mingw*)
-  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
-  ;;
-esac
-
-# If we're using GNU nm, then use its standard symbol codes.
-case `$NM -V 2>&1` in
-*GNU* | *'with BFD'*)
-  symcode='[[ABCDGIRSTW]]' ;;
-esac
-
-# Try without a prefix undercore, then with it.
-for ac_symprfx in "" "_"; do
-
-  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
-  symxfrm="\\1 $ac_symprfx\\2 \\2"
-
-  # Write the raw and C identifiers.
-  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ 	]]\($symcode$symcode*\)[[ 	]][[ 	]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
-
-  # Check to see that the pipe works correctly.
-  pipe_works=no
-
-  rm -f conftest*
-  cat > conftest.$ac_ext <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
-EOF
-
-  if AC_TRY_EVAL(ac_compile); then
-    # Now try to grab the symbols.
-    nlist=conftest.nm
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
-      # Try sorting and uniquifying the output.
-      if sort "$nlist" | uniq > "$nlist"T; then
-	mv -f "$nlist"T "$nlist"
-      else
-	rm -f "$nlist"T
-      fi
-
-      # Make sure that we snagged all the symbols we need.
-      if grep ' nm_test_var$' "$nlist" >/dev/null; then
-	if grep ' nm_test_func$' "$nlist" >/dev/null; then
-	  cat <<EOF > conftest.$ac_ext
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
-	  # Now generate the symbol file.
-	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
-
-	  cat <<EOF >> conftest.$ac_ext
-#if defined (__STDC__) && __STDC__
-# define lt_ptr_t void *
-#else
-# define lt_ptr_t char *
-# define const
-#endif
-
-/* The mapping between symbol names and symbols. */
-const struct {
-  const char *name;
-  lt_ptr_t address;
-}
-lt_preloaded_symbols[[]] =
-{
-EOF
-	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
-	  cat <<\EOF >> conftest.$ac_ext
-  {0, (lt_ptr_t) 0}
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_save_LIBS="$LIBS"
-	  lt_save_CFLAGS="$CFLAGS"
-	  LIBS="conftstm.$ac_objext"
-	  CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
-	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
-	    pipe_works=yes
-	  fi
-	  LIBS="$lt_save_LIBS"
-	  CFLAGS="$lt_save_CFLAGS"
-	else
-	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
-	fi
-      else
-	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
-      fi
-    else
-      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
-    fi
-  else
-    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
-    cat conftest.$ac_ext >&5
-  fi
-  rm -rf conftest* conftst*
-
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$pipe_works" = yes; then
-    break
-  else
-    lt_cv_sys_global_symbol_pipe=
-  fi
-done
-])
-if test -z "$lt_cv_sys_global_symbol_pipe"; then
-  lt_cv_sys_global_symbol_to_cdecl=
-fi
-if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
-  AC_MSG_RESULT(failed)
-else
-  AC_MSG_RESULT(ok)
-fi
-]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
-
-
-# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
-# ---------------------------------------
-AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
-[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
-_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
-_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
-
-AC_MSG_CHECKING([for $compiler option to produce PIC])
- ifelse([$1],[CXX],[
-  # C++ specific cases for pic, static, wl, etc.
-  if test "$GXX" = yes; then
-    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
-
-    case $host_os in
-    aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-    amigaos*)
-      # FIXME: we need at least 68020 code to build shared libraries, but
-      # adding the `-m68020' flag to GCC prevents building anything better,
-      # like `-m68040'.
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
-      ;;
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-    mingw* | cygwin* | os2* | pw32*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      m4_if([$1], [GCJ], [],
-	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
-      ;;
-    *djgpp*)
-      # DJGPP does not support shared libraries at all
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
-      ;;
-    interix[[3-9]]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
-      fi
-      ;;
-    hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	;;
-      *)
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	;;
-      esac
-      ;;
-    *)
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-      ;;
-    esac
-  else
-    case $host_os in
-      aix[[4-9]]*)
-	# All AIX code is PIC.
-	if test "$host_cpu" = ia64; then
-	  # AIX 5 now supports IA64 processor
-	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	else
-	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
-	fi
-	;;
-      chorus*)
-	case $cc_basename in
-	cxch68*)
-	  # Green Hills C++ Compiler
-	  # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
-	  ;;
-	esac
-	;;
-       darwin*)
-         # PIC is the default on this platform
-         # Common symbols not allowed in MH_DYLIB files
-         case $cc_basename in
-           xlc*)
-           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
-           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-           ;;
-         esac
-       ;;
-      dgux*)
-	case $cc_basename in
-	  ec++*)
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    ;;
-	  ghcx*)
-	    # Green Hills C++ Compiler
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      freebsd* | dragonfly*)
-	# FreeBSD uses GNU C++
-	;;
-      hpux9* | hpux10* | hpux11*)
-	case $cc_basename in
-	  CC*)
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-	    if test "$host_cpu" != ia64; then
-	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	    fi
-	    ;;
-	  aCC*)
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-	    case $host_cpu in
-	    hppa*64*|ia64*)
-	      # +Z the default
-	      ;;
-	    *)
-	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	      ;;
-	    esac
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      interix*)
-	# This is c89, which is MS Visual C++ (no shared libs)
-	# Anyone wants to do a port?
-	;;
-      irix5* | irix6* | nonstopux*)
-	case $cc_basename in
-	  CC*)
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    # CC pic flag -KPIC is the default.
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      linux* | k*bsd*-gnu)
-	case $cc_basename in
-	  KCC*)
-	    # KAI C++ Compiler
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	    ;;
-	  icpc* | ecpc*)
-	    # Intel C++
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
-	    ;;
-	  pgCC* | pgcpp*)
-	    # Portland Group C++ compiler.
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	  cxx*)
-	    # Compaq C++
-	    # Make sure the PIC flag is empty.  It appears that all Alpha
-	    # Linux and Compaq Tru64 Unix objects are PIC.
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    ;;
-	  *)
-	    case `$CC -V 2>&1 | sed 5q` in
-	    *Sun\ C*)
-	      # Sun C++ 5.9
-	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	      ;;
-	    esac
-	    ;;
-	esac
-	;;
-      lynxos*)
-	;;
-      m88k*)
-	;;
-      mvs*)
-	case $cc_basename in
-	  cxx*)
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      netbsd*)
-	;;
-      osf3* | osf4* | osf5*)
-	case $cc_basename in
-	  KCC*)
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
-	    ;;
-	  RCC*)
-	    # Rational C++ 2.4.1
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  cxx*)
-	    # Digital/Compaq C++
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    # Make sure the PIC flag is empty.  It appears that all Alpha
-	    # Linux and Compaq Tru64 Unix objects are PIC.
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      psos*)
-	;;
-      solaris*)
-	case $cc_basename in
-	  CC*)
-	    # Sun C++ 4.2, 5.x and Centerline C++
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	    ;;
-	  gcx*)
-	    # Green Hills C++ Compiler
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      sunos4*)
-	case $cc_basename in
-	  CC*)
-	    # Sun C++ 4.x
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	  lcc*)
-	    # Lucid
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      tandem*)
-	case $cc_basename in
-	  NCC*)
-	    # NonStop-UX NCC 3.20
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-	case $cc_basename in
-	  CC*)
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	esac
-	;;
-      vxworks*)
-	;;
-      *)
-	_LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-	;;
-    esac
-  fi
-],
-[
-  if test "$GCC" = yes; then
-    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
-
-    case $host_os in
-      aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    amigaos*)
-      # FIXME: we need at least 68020 code to build shared libraries, but
-      # adding the `-m68020' flag to GCC prevents building anything better,
-      # like `-m68040'.
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
-      ;;
-
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-
-    mingw* | cygwin* | pw32* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      m4_if([$1], [GCJ], [],
-	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
-      ;;
-
-    interix[[3-9]]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
-
-    msdosdjgpp*)
-      # Just because we use GCC doesn't mean we suddenly get shared libraries
-      # on systems that don't support them.
-      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      enable_shared=no
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
-      fi
-      ;;
-
-    hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	;;
-      esac
-      ;;
-
-    *)
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-      ;;
-    esac
-  else
-    # PORTME Check for flag to pass linker flags through the system compiler.
-    case $host_os in
-    aix*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      else
-	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
-      fi
-      ;;
-      darwin*)
-        # PIC is the default on this platform
-        # Common symbols not allowed in MH_DYLIB files
-       case $cc_basename in
-         xlc*)
-         _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
-         _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-         ;;
-       esac
-       ;;
-
-    mingw* | cygwin* | pw32* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      m4_if([$1], [GCJ], [],
-	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-
-    hpux9* | hpux10* | hpux11*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	;;
-      esac
-      # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-      ;;
-
-    irix5* | irix6* | nonstopux*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # PIC (with -KPIC) is the default.
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    newsos6)
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    linux* | k*bsd*-gnu)
-      case $cc_basename in
-      icc* | ecc*)
-	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
-        ;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
-        # Portland Group compilers (*not* the Pentium gcc compiler,
-	# which looks to be a dead project)
-	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
-	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-        ;;
-      ccc*)
-        _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-        # All Alpha code is PIC.
-        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-        ;;
-      *)
-        case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
-	  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=''
-	  ;;
-	esac
-	;;
-      esac
-      ;;
-
-    osf3* | osf4* | osf5*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # All OSF/1 code is PIC.
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    rdos*)
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    solaris*)
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      case $cc_basename in
-      f77* | f90* | f95*)
-	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
-      *)
-	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
-      esac
-      ;;
-
-    sunos4*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    sysv4 | sysv4.2uw2* | sysv4.3*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec ;then
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
-	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    unicos*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      ;;
-
-    uts4*)
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    *)
-      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      ;;
-    esac
-  fi
-])
-AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
-
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
-  AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
-    _LT_AC_TAGVAR(lt_cv_prog_compiler_pic_works, $1),
-    [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
-    [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
-     "" | " "*) ;;
-     *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
-     esac],
-    [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
-     _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
-fi
-case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
-  *djgpp*)
-    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
-    ;;
-  *)
-    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
-    ;;
-esac
-
-#
-# Check to make sure the static flag actually works.
-#
-wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
-AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
-  _LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1),
-  $lt_tmp_static_flag,
-  [],
-  [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
-])
-
-
-# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
-# ------------------------------------
-# See if the linker supports building shared libraries.
-AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
-ifelse([$1],[CXX],[
-  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  case $host_os in
-  aix[[4-9]]*)
-    # If we're using GNU nm, then we don't want the "-C" option.
-    # -C means demangle to AIX nm, but means don't demangle with GNU nm
-    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
-      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
-    else
-      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
-    fi
-    ;;
-  pw32*)
-    _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
-  ;;
-  cygwin* | mingw*)
-    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
-  ;;
-  *)
-    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  ;;
-  esac
-  _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-],[
-  runpath_var=
-  _LT_AC_TAGVAR(allow_undefined_flag, $1)=
-  _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-  _LT_AC_TAGVAR(archive_cmds, $1)=
-  _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
-  _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
-  _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
-  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
-  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
-  _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
-  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
-  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
-  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
-  _LT_AC_TAGVAR(hardcode_direct, $1)=no
-  _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
-  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
-  _LT_AC_TAGVAR(hardcode_automatic, $1)=no
-  _LT_AC_TAGVAR(module_cmds, $1)=
-  _LT_AC_TAGVAR(module_expsym_cmds, $1)=
-  _LT_AC_TAGVAR(always_export_symbols, $1)=no
-  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  # include_expsyms should be a list of space-separated symbols to be *always*
-  # included in the symbol list
-  _LT_AC_TAGVAR(include_expsyms, $1)=
-  # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
-  _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
-  # platforms (ab)use it in PIC code, but their linkers get confused if
-  # the symbol is explicitly referenced.  Since portable code cannot
-  # rely on this symbol name, it's probably fine to never include it in
-  # preloaded symbol tables.
-  # Exclude shared library initialization/finalization symbols.
-dnl Note also adjust exclude_expsyms for C++ above.
-  extract_expsyms_cmds=
-  # Just being paranoid about ensuring that cc_basename is set.
-  _LT_CC_BASENAME([$compiler])
-  case $host_os in
-  cygwin* | mingw* | pw32*)
-    # FIXME: the MSVC++ port hasn't been tested in a loooong time
-    # When not using gcc, we currently assume that we are using
-    # Microsoft Visual C++.
-    if test "$GCC" != yes; then
-      with_gnu_ld=no
-    fi
-    ;;
-  interix*)
-    # we just hope/assume this is gcc and not c89 (= MSVC++)
-    with_gnu_ld=yes
-    ;;
-  openbsd*)
-    with_gnu_ld=no
-    ;;
-  esac
-
-  _LT_AC_TAGVAR(ld_shlibs, $1)=yes
-  if test "$with_gnu_ld" = yes; then
-    # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
-
-    # Set some defaults for GNU ld with shared library support. These
-    # are reset later if shared libraries are not supported. Putting them
-    # here allows them to be overridden if necessary.
-    runpath_var=LD_RUN_PATH
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-    # ancient GNU ld didn't support --whole-archive et. al.
-    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
-	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-      else
-  	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
-    fi
-    supports_anon_versioning=no
-    case `$LD -v 2>/dev/null` in
-      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
-      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
-      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
-      *\ 2.11.*) ;; # other 2.11 versions
-      *) supports_anon_versioning=yes ;;
-    esac
-
-    # See if GNU ld supports shared libraries.
-    case $host_os in
-    aix[[3-9]]*)
-      # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	cat <<EOF 1>&2
-
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
-
-EOF
-      fi
-      ;;
-
-    amigaos*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-
-      # Samuel A. Falvo II <kc5tja at dolphin.openprojects.net> reports
-      # that the semantics of dynamic libraries on AmigaOS, at least up
-      # to version 4, is to share data among multiple programs linked
-      # with the same dynamic library.  Since this doesn't match the
-      # behavior of shared libraries on other platforms, we can't use
-      # them.
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-      ;;
-
-    beos*)
-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
-	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	# support --undefined.  This deserves some investigation.  FIXME
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      else
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    cygwin* | mingw* | pw32*)
-      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-      # as there is no search path for DLLs.
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_AC_TAGVAR(always_export_symbols, $1)=no
-      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
-
-      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	# If the export-symbols file already is a .def file (1st line
-	# is EXPORTS), use it as is; otherwise, prepend...
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	  cp $export_symbols $output_objdir/$soname.def;
-	else
-	  echo EXPORTS > $output_objdir/$soname.def;
-	  cat $export_symbols >> $output_objdir/$soname.def;
-	fi~
-	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-      else
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    interix[[3-9]]*)
-      _LT_AC_TAGVAR(hardcode_direct, $1)=no
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-      # Instead, shared libraries are loaded at an image base (0x10000000 by
-      # default) and relocated if they conflict, which is a slow very memory
-      # consuming and fragmenting process.  To avoid this, we pick a random,
-      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      ;;
-
-    gnu* | linux* | k*bsd*-gnu)
-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	tmp_addflag=
-	case $cc_basename,$host_cpu in
-	pgcc*)				# Portland Group C compiler
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag'
-	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag -Mnomain' ;;
-	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
-	  tmp_addflag=' -i_dynamic' ;;
-	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
-	  tmp_addflag=' -i_dynamic -nofor_main' ;;
-	ifc* | ifort*)			# Intel Fortran compiler
-	  tmp_addflag=' -nofor_main' ;;
-	esac
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)			# Sun C 5.9
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_sharedflag='-G' ;;
-	*Sun\ F*)			# Sun Fortran 8.3
-	  tmp_sharedflag='-G' ;;
-	*)
-	  tmp_sharedflag='-shared' ;;
-	esac
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-
-	if test $supports_anon_versioning = yes; then
-	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
-  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-  $echo "local: *; };" >> $output_objdir/$libname.ver~
-	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-	fi
-      else
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    netbsd*)
-      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
-	wlarc=
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      fi
-      ;;
-
-    solaris*)
-      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	cat <<EOF 1>&2
-
-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
-*** create shared libraries on Solaris systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.9.1 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-EOF
-      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
-      case `$LD -v 2>&1` in
-        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	cat <<_LT_EOF 1>&2
-
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
-	;;
-	*)
-	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
-	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
-	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
-	  else
-	    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-	  fi
-	;;
-      esac
-      ;;
-
-    sunos4*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      wlarc=
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *)
-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-    esac
-
-    if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then
-      runpath_var=
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
-    fi
-  else
-    # PORTME fill in a description of your system's linker (not GNU ld)
-    case $host_os in
-    aix3*)
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
-      # Note: this linker hardcodes the directories in LIBPATH if there
-      # are no directories specified by -L.
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
-	# Neither direct hardcoding nor static linking is supported with a
-	# broken collect2.
-	_LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
-      fi
-      ;;
-
-    aix[[4-9]]*)
-      if test "$host_cpu" = ia64; then
-	# On IA64, the linker does run time linking by default, so we don't
-	# have to do anything special.
-	aix_use_runtimelinking=no
-	exp_sym_flag='-Bexport'
-	no_entry_flag=""
-      else
-	# If we're using GNU nm, then we don't want the "-C" option.
-	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
-	  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
-	else
-	  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
-	fi
-	aix_use_runtimelinking=no
-
-	# Test if we are trying to use run time linking or normal
-	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
-	# need to do runtime linking.
-	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
-	  for ld_flag in $LDFLAGS; do
-  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
-  	    aix_use_runtimelinking=yes
-  	    break
-  	  fi
-	  done
-	  ;;
-	esac
-
-	exp_sym_flag='-bexport'
-	no_entry_flag='-bnoentry'
-      fi
-
-      # When large executables or shared objects are built, AIX ld can
-      # have problems creating the table of contents.  If linking a library
-      # or program results in "error TOC overflow" add -mminimal-toc to
-      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
-
-      _LT_AC_TAGVAR(archive_cmds, $1)=''
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-
-      if test "$GCC" = yes; then
-	case $host_os in aix4.[[012]]|aix4.[[012]].*)
-	# We only want to do this on AIX 4.2 and lower, the check
-	# below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
-	  if test -f "$collect2name" && \
-  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
-	  then
-  	  # We have reworked collect2
-  	  :
-	  else
-  	  # We have old collect2
-  	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
-  	  # It fails to find uninstalled libraries when the uninstalled
-  	  # path is not listed in the libpath.  Setting hardcode_minus_L
-  	  # to unsupported forces relinking
-  	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-  	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-  	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
-	  fi
-	  ;;
-	esac
-	shared_flag='-shared'
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag="$shared_flag "'${wl}-G'
-	fi
-      else
-	# not using gcc
-	if test "$host_cpu" = ia64; then
-  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-  	# chokes on -Wl,-G. The following line is correct:
-	  shared_flag='-G'
-	else
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag='${wl}-G'
-	  else
-	    shared_flag='${wl}-bM:SRE'
-	  fi
-	fi
-      fi
-
-      # It seems that -bexpall does not export symbols beginning with
-      # underscore (_), so it is better to generate a list of symbols to export.
-      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
-      if test "$aix_use_runtimelinking" = yes; then
-	# Warning - without using the other runtime loading flags (-brtl),
-	# -berok will link without error, but may produce a broken library.
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
-       # Determine the default libpath from the value encoded in an empty executable.
-       _LT_AC_SYS_LIBPATH_AIX
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-       else
-	if test "$host_cpu" = ia64; then
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
-	  _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-	else
-	 # Determine the default libpath from the value encoded in an empty executable.
-	 _LT_AC_SYS_LIBPATH_AIX
-	 _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-	  # Warning - without using the other run time loading flags,
-	  # -berok will link without error, but may produce a broken library.
-	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
-	  # This is similar to how AIX traditionally builds its shared libraries.
-	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-	fi
-      fi
-      ;;
-
-    amigaos*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-      # see comment about different semantics on the GNU ld section
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-      ;;
-
-    bsdi[[45]]*)
-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
-      ;;
-
-    cygwin* | mingw* | pw32*)
-      # When not using gcc, we currently assume that we are using
-      # Microsoft Visual C++.
-      # hardcode_libdir_flag_spec is actually meaningless, as there is
-      # no search path for DLLs.
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
-      # FIXME: Should let the user specify the lib program.
-      _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
-      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-      ;;
-
-    darwin* | rhapsody*)
-      case $host_os in
-        rhapsody* | darwin1.[[012]])
-         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
-         ;;
-       *) # Darwin 1.3 on
-         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
-           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-         else
-           case ${MACOSX_DEPLOYMENT_TARGET} in
-             10.[[012]])
-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-               ;;
-             10.*)
-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
-               ;;
-           esac
-         fi
-         ;;
-      esac
-      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_AC_TAGVAR(hardcode_direct, $1)=no
-      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-    if test "$GCC" = yes ; then
-    	output_verbose_link_cmd='echo'
-        _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-        _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-        _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-    else
-      case $cc_basename in
-        xlc*)
-         output_verbose_link_cmd='echo'
-         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
-         _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          ;;
-       *)
-         _LT_AC_TAGVAR(ld_shlibs, $1)=no
-          ;;
-      esac
-    fi
-      ;;
-
-    dgux*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    freebsd1*)
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-      ;;
-
-    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
-    # support.  Future versions do this automatically, but an explicit c++rt0.o
-    # does not break anything, and helps significantly (at the cost of a little
-    # extra space).
-    freebsd2.2*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    hpux9*)
-      if test "$GCC" = yes; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-
-      # hardcode_minus_L: Not really in the search PATH,
-      # but as the default location of the library.
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-      ;;
-
-    hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      if test "$with_gnu_ld" = no; then
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	_LT_AC_TAGVAR(hardcode_direct, $1)=yes
-	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-
-	# hardcode_minus_L: Not really in the search PATH,
-	# but as the default location of the library.
-	_LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-      fi
-      ;;
-
-    hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	case $host_cpu in
-	hppa*64*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      else
-	case $host_cpu in
-	hppa*64*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      fi
-      if test "$with_gnu_ld" = no; then
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	case $host_cpu in
-	hppa*64*|ia64*)
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
-	  _LT_AC_TAGVAR(hardcode_direct, $1)=no
-	  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-	  ;;
-	*)
-	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-	  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-
-	  # hardcode_minus_L: Not really in the search PATH,
-	  # but as the default location of the library.
-	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-	  ;;
-	esac
-      fi
-      ;;
-
-    irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
-      fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
-    netbsd*)
-      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
-      fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    newsos6)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    openbsd*)
-      if test -f /usr/libexec/ld.so; then
-	_LT_AC_TAGVAR(hardcode_direct, $1)=yes
-	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	else
-	  case $host_os in
-	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
-	     _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	     ;;
-	   *)
-	     _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	     ;;
-	  esac
-        fi
-      else
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    os2*)
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
-      ;;
-
-    osf3*)
-      if test "$GCC" = yes; then
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-      fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-      ;;
-
-    osf4* | osf5*)	# as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      else
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
-	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
-
-	# Both c and cxx compiler support -rpath directly
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-      fi
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-      ;;
-
-    solaris*)
-      _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
-      if test "$GCC" = yes; then
-	wlarc='${wl}'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
-      else
-	wlarc=''
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
-      fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      case $host_os in
-      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-      *)
-	# The compiler driver will combine and reorder linker options,
-	# but understands `-z linker_flag'.  GCC discards it without `$wl',
-	# but is careful enough not to reorder.
- 	# Supported since Solaris 2.6 (maybe 2.5.1?)
-	if test "$GCC" = yes; then
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	else
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
-	fi
-	;;
-      esac
-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
-    sunos4*)
-      if test "x$host_vendor" = xsequent; then
-	# Use $CC to link under sequent, because it throws in some extra .o
-	# files that make .init and .fini sections work.
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    sysv4)
-      case $host_vendor in
-	sni)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
-	;;
-	siemens)
-	  ## LD is ld it makes a PLAMLIB
-	  ## CC just makes a GrossModule.
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
-	  _LT_AC_TAGVAR(hardcode_direct, $1)=no
-        ;;
-	motorola)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
-	;;
-      esac
-      runpath_var='LD_RUN_PATH'
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    sysv4.3*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-	runpath_var=LD_RUN_PATH
-	hardcode_runpath_var=yes
-	_LT_AC_TAGVAR(ld_shlibs, $1)=yes
-      fi
-      ;;
-
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
-      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      runpath_var='LD_RUN_PATH'
-
-      if test "$GCC" = yes; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
-
-    sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
-      # link with -lc, and that would cause any symbols used from libc to
-      # always be unresolved, which means just about no library would
-      # ever link correctly.  If we're not using GNU ld we use -z text
-      # though, which does catch some bad symbols but isn't as heavy-handed
-      # as -z defs.
-      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
-      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
-      runpath_var='LD_RUN_PATH'
-
-      if test "$GCC" = yes; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
-
-    uts4*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *)
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-      ;;
-    esac
-  fi
-])
-AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
-test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
-#
-# Do we need to explicitly link libc?
-#
-case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
-x|xyes)
-  # Assume -lc should be added
-  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
-
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
-    case $_LT_AC_TAGVAR(archive_cmds, $1) in
-    *'~'*)
-      # FIXME: we may have to deal with multi-command sequences.
-      ;;
-    '$CC '*)
-      # Test whether the compiler implicitly links with -lc since on some
-      # systems, -lgcc has to come before -lc. If gcc already passes -lc
-      # to ld, don't add -lc before -lgcc.
-      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
-      $rm conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
-	pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
-        _LT_AC_TAGVAR(allow_undefined_flag, $1)=
-        if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
-        then
-	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-        else
-	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
-        fi
-        _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $rm conftest*
-      AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
-      ;;
-    esac
-  fi
-  ;;
-esac
-])# AC_LIBTOOL_PROG_LD_SHLIBS
-
-
-# _LT_AC_FILE_LTDLL_C
-# -------------------
-# Be careful that the start marker always follows a newline.
-AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
-# /* ltdll.c starts here */
-# #define WIN32_LEAN_AND_MEAN
-# #include <windows.h>
-# #undef WIN32_LEAN_AND_MEAN
-# #include <stdio.h>
-#
-# #ifndef __CYGWIN__
-# #  ifdef __CYGWIN32__
-# #    define __CYGWIN__ __CYGWIN32__
-# #  endif
-# #endif
-#
-# #ifdef __cplusplus
-# extern "C" {
-# #endif
-# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
-# #ifdef __cplusplus
-# }
-# #endif
-#
-# #ifdef __CYGWIN__
-# #include <cygwin/cygwin_dll.h>
-# DECLARE_CYGWIN_DLL( DllMain );
-# #endif
-# HINSTANCE __hDllInstance_base;
-#
-# BOOL APIENTRY
-# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
-# {
-#   __hDllInstance_base = hInst;
-#   return TRUE;
-# }
-# /* ltdll.c ends here */
-])# _LT_AC_FILE_LTDLL_C
-
-
-# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
-# ---------------------------------
-AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
-
-
-# old names
-AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
-AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
-AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
-AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
-AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
-AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
-AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
-
-# This is just to silence aclocal about the macro not being used
-ifelse([AC_DISABLE_FAST_INSTALL])
-
-AC_DEFUN([LT_AC_PROG_GCJ],
-[AC_CHECK_TOOL(GCJ, gcj, no)
-  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
-  AC_SUBST(GCJFLAGS)
-])
-
-AC_DEFUN([LT_AC_PROG_RC],
-[AC_CHECK_TOOL(RC, windres, no)
-])
-
-
-# Cheap backport of AS_EXECUTABLE_P and required macros
-# from Autoconf 2.59; we should not use $as_executable_p directly.
-
-# _AS_TEST_PREPARE
-# ----------------
-m4_ifndef([_AS_TEST_PREPARE],
-[m4_defun([_AS_TEST_PREPARE],
-[if test -x / >/dev/null 2>&1; then
-  as_executable_p='test -x'
-else
-  as_executable_p='test -f'
-fi
-])])# _AS_TEST_PREPARE
-
-# AS_EXECUTABLE_P
-# ---------------
-# Check whether a file is executable.
-m4_ifndef([AS_EXECUTABLE_P],
-[m4_defun([AS_EXECUTABLE_P],
-[AS_REQUIRE([_AS_TEST_PREPARE])dnl
-$as_executable_p $1[]dnl
-])])# AS_EXECUTABLE_P
-
-# NOTE: This macro has been submitted for inclusion into   #
-#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
-#  a released version of Autoconf we should remove this    #
-#  macro and use it instead.                               #
-# LT_AC_PROG_SED
-# --------------
-# Check for a fully-functional sed program, that truncates
-# as few characters as possible.  Prefer GNU sed if found.
-AC_DEFUN([LT_AC_PROG_SED],
-[AC_MSG_CHECKING([for a sed that does not truncate output])
-AC_CACHE_VAL(lt_cv_path_SED,
-[# Loop through the user's path and test for sed and gsed.
-# Then use that list of sed's as ones to test for truncation.
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for lt_ac_prog in sed gsed; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then
-        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
-      fi
-    done
-  done
-done
-IFS=$as_save_IFS
-lt_ac_max=0
-lt_ac_count=0
-# Add /usr/xpg4/bin/sed as it is typically found on Solaris
-# along with /bin/sed that truncates output.
-for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
-  test ! -f $lt_ac_sed && continue
-  cat /dev/null > conftest.in
-  lt_ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
-  # Check for GNU sed and select it if it is found.
-  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
-    lt_cv_path_SED=$lt_ac_sed
-    break
-  fi
-  while true; do
-    cat conftest.in conftest.in >conftest.tmp
-    mv conftest.tmp conftest.in
-    cp conftest.in conftest.nl
-    echo >>conftest.nl
-    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
-    cmp -s conftest.out conftest.nl || break
-    # 10000 chars as input seems more than enough
-    test $lt_ac_count -gt 10 && break
-    lt_ac_count=`expr $lt_ac_count + 1`
-    if test $lt_ac_count -gt $lt_ac_max; then
-      lt_ac_max=$lt_ac_count
-      lt_cv_path_SED=$lt_ac_sed
-    fi
-  done
-done
-])
-SED=$lt_cv_path_SED
-AC_SUBST([SED])
-AC_MSG_RESULT([$SED])
-])
-
 # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
@@ -6673,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.11'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.11], [],
+m4_if([$1], [1.11.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -6689,7 +50,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11])dnl
+[AM_AUTOMAKE_VERSION([1.11.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
diff --git a/config.h.in b/cf_config.h
similarity index 56%
copy from config.h.in
copy to cf_config.h
index 0ee5ae5..599bec0 100644
--- a/config.h.in
+++ b/cf_config.h
@@ -1,117 +1,153 @@
-/* config.h.in.  Generated from configure.ac by autoheader.  */
+/* cf_config.h.  Generated from cf_config.h.in by configure.  */
+/* cf_config.h.in.  Generated from configure.ac by autoheader.  */
 
 /* Define if building universal (internal helper macro) */
-#undef AC_APPLE_UNIVERSAL_BUILD
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
 
 /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
    systems. This function is required for `alloca.c' support on those systems.
    */
-#undef CRAY_STACKSEG_END
+/* #undef CRAY_STACKSEG_END */
 
 /* Define to 1 if using `alloca.c'. */
-#undef C_ALLOCA
+/* #undef C_ALLOCA */
+
+/* Define to dummy `main' function (if any) required to link to the Fortran
+   libraries. */
+/* #undef FC_DUMMY_MAIN */
+
+/* Define if F77 and FC dummy `main' functions are identical. */
+/* #undef FC_DUMMY_MAIN_EQ_F77 */
+
+/* Define to a macro mangling the given C identifier (in lower and upper
+   case), which must not contain underscores, for linking with Fortran. */
+#define FC_FUNC(name,NAME) name ## _
+
+/* As FC_FUNC, but for C identifiers containing underscores. */
+#define FC_FUNC_(name,NAME) name ## _
 
 /* Define to 1 if you have `alloca', as a function or macro. */
-#undef HAVE_ALLOCA
+#define HAVE_ALLOCA 1
 
 /* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
    */
-#undef HAVE_ALLOCA_H
+#define HAVE_ALLOCA_H 1
 
 /* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
+#define HAVE_DLFCN_H 1
 
 /* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
+#define HAVE_INTTYPES_H 1
+
+/* code with lapack calls compiles */
+#define HAVE_LAPACK_LIB 1
+
+/* lapack symbols have no underscore */
+/* #undef HAVE_LAPACK_NO_UNDERSCORE */
+
+/* lapack symbols have underscore */
+#define HAVE_LAPACK_UNDERSCORE 1
 
 /* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <mpi.h> header file. */
+#define HAVE_MPI_H 1
+
+/* Define to 1 if you have the <netcdf.h> header file. */
+#define HAVE_NETCDF_H 1
 
 /* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
+#define HAVE_STDINT_H 1
 
 /* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
+#define HAVE_STDLIB_H 1
 
 /* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
+#define HAVE_STRINGS_H 1
 
 /* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
+#define HAVE_STRING_H 1
 
 /* Define this if you have strlcat() */
-#undef HAVE_STRLCAT
+/* #undef HAVE_STRLCAT */
 
-/* Define to 1 if `st_blksize' is member of `struct stat'. */
-#undef HAVE_STRUCT_STAT_ST_BLKSIZE
+/* Define to 1 if `st_blksize' is a member of `struct stat'. */
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
 
 /* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use
    `HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */
-#undef HAVE_ST_BLKSIZE
+#define HAVE_ST_BLKSIZE 1
 
 /* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
+#define HAVE_SYS_STAT_H 1
 
 /* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
+#define HAVE_SYS_TYPES_H 1
 
 /* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
+#define HAVE_UNISTD_H 1
+
+/* Define if uuid is found */
+#define HAVE_UUID_H 1
 
 /* if true, turn on logging */
-#undef LOGGING
+/* #undef LOGGING */
 
 /* Define to the sub-directory in which libtool stores uninstalled libraries.
    */
-#undef LT_OBJDIR
+#define LT_OBJDIR ".libs/"
 
 /* Define to 1 if your C compiler doesn't accept -c and -o together. */
-#undef NO_MINUS_C_MINUS_O
+/* #undef NO_MINUS_C_MINUS_O */
 
 /* no stdlib.h */
-#undef NO_STDLIB_H
+/* #undef NO_STDLIB_H */
 
 /* no strerror.h */
-#undef NO_STRERROR
+/* #undef NO_STRERROR */
 
 /* no sys_types.h */
-#undef NO_SYS_TYPES_H
+/* #undef NO_SYS_TYPES_H */
 
 /* Name of package */
-#undef PACKAGE
+#define PACKAGE "libcf"
 
 /* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
+#define PACKAGE_BUGREPORT "pletzer at txcorp.com"
 
 /* Define to the full name of this package. */
-#undef PACKAGE_NAME
+#define PACKAGE_NAME "libcf"
 
 /* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
+#define PACKAGE_STRING "libcf 1.0-beta10"
 
 /* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
+#define PACKAGE_TARNAME "libcf"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
 
 /* Define to the version of this package. */
-#undef PACKAGE_VERSION
+#define PACKAGE_VERSION "1.0-beta10"
 
 /* The size of `double', as computed by sizeof. */
-#undef SIZEOF_DOUBLE
+#define SIZEOF_DOUBLE 8
 
 /* The size of `float', as computed by sizeof. */
-#undef SIZEOF_FLOAT
+#define SIZEOF_FLOAT 4
 
 /* The size of `int', as computed by sizeof. */
-#undef SIZEOF_INT
+#define SIZEOF_INT 4
 
 /* The size of `long', as computed by sizeof. */
-#undef SIZEOF_LONG
+#define SIZEOF_LONG 4
 
 /* The size of `off_t', as computed by sizeof. */
-#undef SIZEOF_OFF_T
+#define SIZEOF_OFF_T 8
 
 /* The size of `short', as computed by sizeof. */
-#undef SIZEOF_SHORT
+#define SIZEOF_SHORT 2
 
 /* If using the C implementation of alloca, define if you know the
    direction of stack growth for your system; otherwise it will be
@@ -119,16 +155,16 @@
 	STACK_DIRECTION > 0 => grows toward higher addresses
 	STACK_DIRECTION < 0 => grows toward lower addresses
 	STACK_DIRECTION = 0 => direction of growth unknown */
-#undef STACK_DIRECTION
+/* #undef STACK_DIRECTION */
 
 /* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
+#define STDC_HEADERS 1
 
-/* if true, use netCDF-4 */
-#undef USE_NETCDF4
+/* if true, turn on parallel processing */
+/* #undef USE_PARALLEL */
 
 /* Version number of package */
-#undef VERSION
+#define VERSION "1.0-beta10"
 
 /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
    significant byte first (like Motorola and SPARC, unlike Intel). */
@@ -138,32 +174,32 @@
 # endif
 #else
 # ifndef WORDS_BIGENDIAN
-#  undef WORDS_BIGENDIAN
+/* #  undef WORDS_BIGENDIAN */
 # endif
 #endif
 
 /* Number of bits in a file offset, on hosts where this is settable. */
-#undef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 64
 
 /* Define for large files, on AIX-style hosts. */
-#undef _LARGE_FILES
+/* #undef _LARGE_FILES */
 
 /* Define to 1 if type `char' is unsigned and you are not using gcc.  */
 #ifndef __CHAR_UNSIGNED__
-# undef __CHAR_UNSIGNED__
+/* # undef __CHAR_UNSIGNED__ */
 #endif
 
 /* Define to `long int' if <sys/types.h> does not define. */
-#undef off_t
+/* #undef off_t */
 
 /* Define to `int' if <sys/types.h> does not define. */
-#undef ptrdiff_t
+/* #undef ptrdiff_t */
 
 /* Define to `unsigned int' if <sys/types.h> does not define. */
-#undef size_t
+/* #undef size_t */
 
 /* Define to `int' if <sys/types.h> does not define. */
-#undef ssize_t
+/* #undef ssize_t */
 
 /* Define to `unsigned char' if <sys/types.h> does not define. */
-#undef uchar
+#define uchar unsigned char
diff --git a/config.h.in b/cf_config.h.in
similarity index 79%
rename from config.h.in
rename to cf_config.h.in
index 0ee5ae5..91ac9ab 100644
--- a/config.h.in
+++ b/cf_config.h.in
@@ -1,4 +1,4 @@
-/* config.h.in.  Generated from configure.ac by autoheader.  */
+/* cf_config.h.in.  Generated from configure.ac by autoheader.  */
 
 /* Define if building universal (internal helper macro) */
 #undef AC_APPLE_UNIVERSAL_BUILD
@@ -11,6 +11,20 @@
 /* Define to 1 if using `alloca.c'. */
 #undef C_ALLOCA
 
+/* Define to dummy `main' function (if any) required to link to the Fortran
+   libraries. */
+#undef FC_DUMMY_MAIN
+
+/* Define if F77 and FC dummy `main' functions are identical. */
+#undef FC_DUMMY_MAIN_EQ_F77
+
+/* Define to a macro mangling the given C identifier (in lower and upper
+   case), which must not contain underscores, for linking with Fortran. */
+#undef FC_FUNC
+
+/* As FC_FUNC, but for C identifiers containing underscores. */
+#undef FC_FUNC_
+
 /* Define to 1 if you have `alloca', as a function or macro. */
 #undef HAVE_ALLOCA
 
@@ -24,9 +38,24 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* code with lapack calls compiles */
+#undef HAVE_LAPACK_LIB
+
+/* lapack symbols have no underscore */
+#undef HAVE_LAPACK_NO_UNDERSCORE
+
+/* lapack symbols have underscore */
+#undef HAVE_LAPACK_UNDERSCORE
+
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the <mpi.h> header file. */
+#undef HAVE_MPI_H
+
+/* Define to 1 if you have the <netcdf.h> header file. */
+#undef HAVE_NETCDF_H
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
@@ -42,7 +71,7 @@
 /* Define this if you have strlcat() */
 #undef HAVE_STRLCAT
 
-/* Define to 1 if `st_blksize' is member of `struct stat'. */
+/* Define to 1 if `st_blksize' is a member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_BLKSIZE
 
 /* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use
@@ -58,6 +87,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define if uuid is found */
+#undef HAVE_UUID_H
+
 /* if true, turn on logging */
 #undef LOGGING
 
@@ -92,6 +124,9 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
@@ -124,8 +159,8 @@
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
-/* if true, use netCDF-4 */
-#undef USE_NETCDF4
+/* if true, turn on parallel processing */
+#undef USE_PARALLEL
 
 /* Version number of package */
 #undef VERSION
diff --git a/cfcheck/Makefile.am b/cfcheck/Makefile.am
deleted file mode 100644
index 02591a2..0000000
--- a/cfcheck/Makefile.am
+++ /dev/null
@@ -1,69 +0,0 @@
-# This is part of the libcf library.
-
-# This automake file handles the building of cfcheck.
-
-# Ed Hartnett 11/23/06
-
-# $Id: Makefile.am,v 1.2 2009/09/08 17:14:51 ed Exp $
-
-# Find libcf.h here.
-AM_CPPFLAGS = -I${top_srcdir}/src
-AM_LDFLAGS = 
-LDADD =
-
-if USE_NETCDF_DIR
-AM_CPPFLAGS += -I at NETCDFDIR@/include
-AM_LDFLAGS += -L at NETCDFDIR@/lib
-LDADD += -lnetcdf
-else
-if USE_NETCDF4
-LDADD += ../../libsrc4/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc4
-AM_LDFLAGS += -L../../libsrc4
-else
-LDADD += ../../libsrc/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc
-AM_LDFLAGS += -L../../libsrc
-endif # USE_NETCDF4
-endif # USE_NETCDF_DIR
-
-if USE_NETCDF4
-LDADD += -lhdf5_hl -lhdf5 -lz 
-endif
-
-if USE_HDF4
-LDADD += -lmfhdf -ldf -ljpeg
-endif # USE_HDF4
-
-# If the user specified a root for HDF5, use it.
-if USE_HDF5_DIR
-AM_CPPFLAGS += -I at HDF5DIR@/include
-AM_LDFLAGS += -L at HDF5DIR@/lib
-endif
-
-# If the user specified a prefix for the HDF4 library location, use it.
-if USE_HDF4_DIR
-AM_CPPFLAGS += -I at HDF4DIR@/include
-AM_LDFLAGS += -L at HDF4DIR@/lib
-endif
-
-# If the user specified a root location for ZLIB, use it.
-if USE_ZLIB_DIR
-AM_CPPFLAGS += -I at ZLIBDIR@/include
-AM_LDFLAGS += -L at ZLIBDIR@/lib
-endif
-
-# If the user specified a root location for SZLIB, use it.
-if USE_SZLIB_DIR
-AM_CPPFLAGS += -I at SZLIBDIR@/include
-AM_LDFLAGS += -L at SZLIBDIR@/lib
-endif
-
-EXTRA_DIST = tst_cfcheck.sh
-
-bin_PROGRAMS = cfcheck
-cfcheck_SOURCES = cfcheck.c
-
-TESTS = tst_cfcheck.sh
-
-CLEANFILES = useage.txt
\ No newline at end of file
diff --git a/cfcheck/cfcheck.c b/cfcheck/cfcheck.c
deleted file mode 100644
index 7b9fc5b..0000000
--- a/cfcheck/cfcheck.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Copyright 2006, Unidata/UCAR. See COPYRIGHT file for more
-   details. 
-
-   This program checks a netCDF file to see how well it complies with
-   the CF Metadata conventions.
-
-   Ed Hartnett, 11/23/06
-
-   $Id: cfcheck.c,v 1.2 2009/09/08 17:14:51 ed Exp $
-*/
-
-#include <config.h>
-#include <stdio.h>
-#include <unistd.h> /* for getopt */
-#include <netcdf.h>
-#include <libcf.h>
-
-/* This struct is used to keep track of user options from the command
- * line. */
-typedef struct
-{
-      int verbose;
-} OPTIONS_T;
-
-/* This is a message to the user about how to use cfcheck. */
-#define USAGE   "\
-  file             Name of netCDF file\n"
-
-/* This prints out a helpful message to the user when they screw up or
- * are confused and ask for help. */
-static void
-usage()
-{
-   fprintf(stderr, "cfcheck file\n%s", USAGE);
-   fprintf(stderr, "netcdf library version %s\n", nc_inq_libvers());
-}
-
-/* This function checks one file for cf conventions. */
-static int
-do_cfcheck(char *filename, OPTIONS_T *options)
-{
-   printf("Checking CF conventions for file %s.\n", filename);
-   return CF_NOERR;
-}
-
-int 
-main(int argc, char** argv)
-{
-   extern int optind;
-   extern int opterr;
-   extern char *optarg;
-   char c;
-   OPTIONS_T options;
-   int i;
-
-   /* If the user called ncdump without arguments, print the usage
-    * message and return peacefully. */
-   if (argc <= 1)
-   {
-      usage();
-      return 0;
-   }
-
-   /* See what options the user wants, and set flags in the OPTIONS_T
-    * stuct. */
-   while ((c = getopt(argc, argv, "?:v")) != EOF)
-   {
-      switch(c) 
-      {
-	 case '?':
-	    usage();
-	    return 0;
-	 case 'v':
-	    options.verbose = 1;
-	    return 0;
-      }
-      argc -= optind;
-      argv += optind;
-   }
-
-   /* Check each file in turn. */
-   for (i = 1; i < argc; i++)
-      if (argc > 0) 
-	 do_cfcheck(argv[i], &options);
-
-   return CF_NOERR;
-}
diff --git a/cfcheck/tst_cfcheck.sh b/cfcheck/tst_cfcheck.sh
deleted file mode 100755
index 3b2989d..0000000
--- a/cfcheck/tst_cfcheck.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-# Copyright 2006, Unidata/UCAR. See COPYRIGHT file.
-
-# This is part of the libcf library.
-
-# This shell script runs the cfcheck tests.
-
-# Ed Hartnett, 11/23/06
-
-# $Id: tst_cfcheck.sh,v 1.2 2009/09/08 17:14:52 ed Exp $
-
-set -e
-echo ""
-echo "*** Testing cfcheck."
-
-echo "*** testing that useage works..."
-./cfcheck &> useage.txt
-#diff -w usage.txt ref_usage.txt
-
-echo "*** All tests of cfcheck passed!"
-exit 0
diff --git a/compile b/compile
index ec64c62..c0096a7 100755
--- a/compile
+++ b/compile
@@ -1,7 +1,7 @@
 #! /bin/sh
 # Wrapper for compilers which do not understand `-c -o'.
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2009-10-06.20; # UTC
 
 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009  Free Software
 # Foundation, Inc.
@@ -124,9 +124,9 @@ trap "rmdir '$lockdir'; exit 1" 1 2 15
 ret=$?
 
 if test -f "$cofile"; then
-  mv "$cofile" "$ofile"
+  test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
 elif test -f "${cofile}bj"; then
-  mv "${cofile}bj" "$ofile"
+  test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
 fi
 
 rmdir "$lockdir"
diff --git a/config.guess b/config.guess
index da83314..dc84c68 100755
--- a/config.guess
+++ b/config.guess
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
 #   Free Software Foundation, Inc.
 
-timestamp='2009-04-27'
+timestamp='2009-11-20'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -27,16 +27,16 @@ timestamp='2009-04-27'
 # the same distribution terms that you use for the rest of that program.
 
 
-# Originally written by Per Bothner <per at bothner.com>.
-# Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches at gnu.org> and include a ChangeLog
+# entry.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
 # exits with 0.  Otherwise, it exits with 1.
 #
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -170,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-			| grep __ELF__ >/dev/null
+			| grep -q __ELF__
 		then
 		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
 		    # Return netbsd for either.  FIX?
@@ -333,6 +333,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+	echo i386-pc-auroraux${UNAME_RELEASE}
+	exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
 	eval $set_cc_for_build
 	SUN_ARCH="i386"
@@ -656,7 +659,7 @@ EOF
 	    # => hppa64-hp-hpux11.23
 
 	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
-		grep __LP64__ >/dev/null
+		grep -q __LP64__
 	    then
 		HP_ARCH="hppa2.0w"
 	    else
@@ -807,12 +810,12 @@ EOF
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
-    *:Interix*:[3456]*)
+    *:Interix*:*)
     	case ${UNAME_MACHINE} in
 	    x86)
 		echo i586-pc-interix${UNAME_RELEASE}
 		exit ;;
-	    EM64T | authenticamd | genuineintel)
+	    authenticamd | genuineintel | EM64T)
 		echo x86_64-unknown-interix${UNAME_RELEASE}
 		exit ;;
 	    IA64)
@@ -822,6 +825,9 @@ EOF
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
 	exit ;;
+    8664:Windows_NT:*)
+	echo x86_64-pc-mks
+	exit ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -851,6 +857,20 @@ EOF
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
     arm*:Linux:*:*)
 	eval $set_cc_for_build
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -873,6 +893,17 @@ EOF
     frv:Linux:*:*)
     	echo frv-unknown-linux-gnu
 	exit ;;
+    i*86:Linux:*:*)
+	LIBC=gnu
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+	exit ;;
     ia64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
@@ -882,78 +913,34 @@ EOF
     m68*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
-    mips:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#undef CPU
-	#undef mips
-	#undef mipsel
-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mipsel
-	#else
-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips
-	#else
-	CPU=
-	#endif
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
-	;;
-    mips64:Linux:*:*)
+    mips:Linux:*:* | mips64:Linux:*:*)
 	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
 	#undef CPU
-	#undef mips64
-	#undef mips64el
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
 	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mips64el
+	CPU=${UNAME_MACHINE}el
 	#else
 	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips64
+	CPU=${UNAME_MACHINE}
 	#else
 	CPU=
 	#endif
 	#endif
 EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
     or32:Linux:*:*)
 	echo or32-unknown-linux-gnu
 	exit ;;
-    ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
-	exit ;;
-    ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
-	exit ;;
-    alpha:Linux:*:*)
-	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-	  EV5)   UNAME_MACHINE=alphaev5 ;;
-	  EV56)  UNAME_MACHINE=alphaev56 ;;
-	  PCA56) UNAME_MACHINE=alphapca56 ;;
-	  PCA57) UNAME_MACHINE=alphapca56 ;;
-	  EV6)   UNAME_MACHINE=alphaev6 ;;
-	  EV67)  UNAME_MACHINE=alphaev67 ;;
-	  EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
-	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
-	exit ;;
     padre:Linux:*:*)
 	echo sparc-unknown-linux-gnu
 	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -962,8 +949,11 @@ EOF
 	  *)    echo hppa-unknown-linux-gnu ;;
 	esac
 	exit ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
 	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux
@@ -986,66 +976,6 @@ EOF
     xtensa*:Linux:*:*)
     	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
-    i*86:Linux:*:*)
-	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us. cd to the root directory to prevent
-	# problems with other programs or directories called `ld' in the path.
-	# Set LC_ALL=C to ensure ld outputs messages in English.
-	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
-			 | sed -ne '/supported targets:/!d
-				    s/[ 	][ 	]*/ /g
-				    s/.*supported targets: *//
-				    s/ .*//
-				    p'`
-        case "$ld_supported_targets" in
-	  elf32-i386)
-		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
-		;;
-	  a.out-i386-linux)
-		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-		exit ;;
-	  "")
-		# Either a pre-BFD a.out linker (linux-gnuoldld) or
-		# one that does not give us useful --help.
-		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
-		exit ;;
-	esac
-	# Determine whether the default compiler is a.out or elf
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#include <features.h>
-	#ifdef __ELF__
-	# ifdef __GLIBC__
-	#  if __GLIBC__ >= 2
-	LIBC=gnu
-	#  else
-	LIBC=gnulibc1
-	#  endif
-	# else
-	LIBC=gnulibc1
-	# endif
-	#else
-	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-	LIBC=gnu
-	#else
-	LIBC=gnuaout
-	#endif
-	#endif
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^LIBC/{
-		s: ::g
-		p
-	    }'`"
-	test x"${LIBC}" != x && {
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-		exit
-	}
-	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
-	;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
 	# earlier versions are messed up and put the nodename in both
@@ -1074,7 +1004,7 @@ EOF
     i*86:syllable:*:*)
 	echo ${UNAME_MACHINE}-pc-syllable
 	exit ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
 	echo i386-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
     i*86:*DOS:*:*)
@@ -1182,7 +1112,7 @@ EOF
     rs6000:LynxOS:2.*:*)
 	echo rs6000-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
 	echo powerpc-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
     SM[BE]S:UNIX_SV:*:*)
@@ -1275,6 +1205,16 @@ EOF
     *:Darwin:*:*)
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
 	case $UNAME_PROCESSOR in
+	    i386)
+		eval $set_cc_for_build
+		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		      grep IS_64BIT_ARCH >/dev/null
+		  then
+		      UNAME_PROCESSOR="x86_64"
+		  fi
+		fi ;;
 	    unknown) UNAME_PROCESSOR=powerpc ;;
 	esac
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
diff --git a/config.sub b/config.sub
index a39437d..2a55a50 100755
--- a/config.sub
+++ b/config.sub
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
 #   Free Software Foundation, Inc.
 
-timestamp='2009-04-17'
+timestamp='2009-11-20'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -32,13 +32,16 @@ timestamp='2009-04-17'
 
 
 # Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# diff and a properly formatted GNU ChangeLog entry.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
 # If it is invalid, we print an error message on stderr and exit with code 1.
 # Otherwise, we print the canonical config type on stdout and succeed.
 
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
 # that are meaningful with *any* GNU software.
@@ -149,10 +152,13 @@ case $os in
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray)
+	-apple | -axis | -knuth | -cray | -microblaze)
 		os=
 		basic_machine=$1
 		;;
+        -bluegene*)
+	        os=-cnk
+		;;
 	-sim | -cisco | -oki | -wec | -winbond)
 		os=
 		basic_machine=$1
@@ -281,6 +287,7 @@ case $basic_machine in
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
+	| rx \
 	| score \
 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
@@ -288,13 +295,14 @@ case $basic_machine in
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
 	| spu | strongarm \
 	| tahoe | thumb | tic4x | tic80 | tron \
+	| ubicom32 \
 	| v850 | v850e \
 	| we32k \
 	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
 	| z8k | z80)
 		basic_machine=$basic_machine-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12)
+	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
 		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
 		os=-none
@@ -337,7 +345,7 @@ case $basic_machine in
 	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
@@ -365,7 +373,7 @@ case $basic_machine in
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
-	| romp-* | rs6000-* \
+	| romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
@@ -374,6 +382,7 @@ case $basic_machine in
 	| tahoe-* | thumb-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
 	| tron-* \
+	| ubicom32-* \
 	| v850-* | v850e-* | vax-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
@@ -467,6 +476,10 @@ case $basic_machine in
 		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
 		os=-linux
 		;;
+	bluegene*)
+		basic_machine=powerpc-ibm
+		os=-cnk
+		;;
 	c90)
 		basic_machine=c90-cray
 		os=-unicos
@@ -719,6 +732,9 @@ case $basic_machine in
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
+        microblaze)
+		basic_machine=microblaze-xilinx
+		;;
 	mingw32)
 		basic_machine=i386-pc
 		os=-mingw32
@@ -1240,6 +1256,9 @@ case $os in
         # First match some system type aliases
         # that might get confused with valid system types.
 	# -solaris* is a basic system type, with this one exception.
+        -auroraux)
+	        os=-auroraux
+		;;
 	-solaris1 | -solaris1.*)
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
 		;;
@@ -1260,9 +1279,9 @@ case $os in
 	# Each alternative MUST END IN A *, to match a version number.
 	# -sysv* is not here because it comes later, after sysvr4.
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
-	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
-	      | -kopensolaris* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+	      | -sym* | -kopensolaris* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
 	      | -aos* | -aros* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
@@ -1283,7 +1302,7 @@ case $os in
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1613,7 +1632,7 @@ case $basic_machine in
 			-sunos*)
 				vendor=sun
 				;;
-			-aix*)
+			-cnk*|-aix*)
 				vendor=ibm
 				;;
 			-beos*)
diff --git a/configure b/configure
index 4c79ee9..95e2403 100755
--- a/configure
+++ b/configure
@@ -1,21 +1,25 @@
 #! /bin/sh
-# From configure.ac Id: configure.ac,v 1.6 2009/11/16 15:42:12 zhi Exp .
+# From configure.ac Id: configure.ac 925 2012-03-23 20:05:26Z pletzer .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for libcf 1.0-alpha5.
+# Generated by GNU Autoconf 2.68 for libcf 1.0-beta10.
+#
+# Report bugs to <pletzer at txcorp.com>.
 #
-# Report bugs to <support at unidata.ucar.edu>.
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
+#
+#
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
@@ -23,23 +27,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
 esac
-
 fi
 
 
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
 as_nl='
 '
 export as_nl
@@ -47,7 +43,13 @@ export as_nl
 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
   as_echo='printf %s\n'
   as_echo_n='printf %s'
 else
@@ -58,7 +60,7 @@ else
     as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
     as_echo_n_body='eval
       arg=$1;
-      case $arg in
+      case $arg in #(
       *"$as_nl"*)
 	expr "X$arg" : "X\\(.*\\)$as_nl";
 	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
@@ -81,13 +83,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
   }
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
 
 # IFS
 # We need space, tab and new line, in precisely that order.  Quoting is
@@ -97,15 +92,16 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
+as_myself=
+case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
 IFS=$as_save_IFS
 
      ;;
@@ -117,12 +113,16 @@ if test "x$as_myself" = x; then
 fi
 if test ! -f "$as_myself"; then
   $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
+  exit 1
 fi
 
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
 done
 PS1='$ '
 PS2='> '
@@ -134,7 +134,264 @@ export LC_ALL
 LANGUAGE=C
 export LANGUAGE
 
-# Required to use basename.
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test "x$CONFIG_SHELL" = x; then
+  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+  exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1
+
+  test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+      || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  as_found=:
+  case $as_dir in #(
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     # Try only shells that exist, to save several forks.
+	     as_shell=$as_dir/$as_base
+	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
+	   done;;
+       esac
+  as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+      if test "x$CONFIG_SHELL" != x; then :
+  # We cannot yet assume a decent shell, so we have to provide a
+	# neutralization value for shells without unset; and this also
+	# works around shells that cannot unset nonexistent variables.
+	# Preserve -v and -x to the replacement shell.
+	BASH_ENV=/dev/null
+	ENV=/dev/null
+	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+	export CONFIG_SHELL
+	case $- in # ((((
+	  *v*x* | *x*v* ) as_opts=-vx ;;
+	  *v* ) as_opts=-v ;;
+	  *x* ) as_opts=-x ;;
+	  * ) as_opts= ;;
+	esac
+	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+fi
+
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+  else
+    $as_echo "$0: Please tell bug-autoconf at gnu.org and pletzer at txcorp.com
+$0: about your system, including any error possibly output
+$0: before this message. Then install a modern shell, or
+$0: manually run the script under such a shell if you do
+$0: have one."
+  fi
+  exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
 if expr a : '\(a\)' >/dev/null 2>&1 &&
    test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
@@ -148,8 +405,12 @@ else
   as_basename=false
 fi
 
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
 
-# Name of the executable.
 as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
 	 X"$0" : 'X\(//\)$' \| \
@@ -169,7950 +430,3478 @@ $as_echo X/"$0" |
 	  }
 	  s/.*/./; q'`
 
-# CDPATH.
-$as_unset CDPATH
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
 
 
-if test "x$CONFIG_SHELL" = x; then
-  if (eval ":") 2>/dev/null; then
-  as_have_required=yes
-else
-  as_have_required=no
-fi
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
-  if test $as_have_required = yes &&	 (eval ":
-(as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
 }
 
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
 
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
 fi
-
-if as_func_ret_success; then
-  :
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
 else
-  exitcode=1
-  echo as_func_ret_success failed.
+  as_ln_s='cp -p'
 fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
 
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
 fi
 
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
 else
-  exitcode=1
-  echo positional parameters were not saved.
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+	test -d "$1/.";
+      else
+	case $1 in #(
+	-*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
 fi
+as_executable_p=$as_test_x
 
-test \$exitcode = 0) || { (exit 1); exit 1; }
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 
-(
-  as_lineno_1=\$LINENO
-  as_lineno_2=\$LINENO
-  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
-  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
-  :
-else
-  as_candidate_shells=
-    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  case $as_dir in
-	 /*)
-	   for as_base in sh bash ksh sh5; do
-	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
-	   done;;
-       esac
-done
-IFS=$as_save_IFS
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
+SHELL=${CONFIG_SHELL-/bin/sh}
 
-      for as_shell in $as_candidate_shells $SHELL; do
-	 # Try only shells that exist, to save several forks.
-	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-		{ ("$as_shell") 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
-fi
 
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
 
-:
-_ASEOF
-}; then
-  CONFIG_SHELL=$as_shell
-	       as_have_required=yes
-	       if { "$as_shell" 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
 
-fi
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
 
+# Identity of this package.
+PACKAGE_NAME='libcf'
+PACKAGE_TARNAME='libcf'
+PACKAGE_VERSION='1.0-beta10'
+PACKAGE_STRING='libcf 1.0-beta10'
+PACKAGE_BUGREPORT='pletzer at txcorp.com'
+PACKAGE_URL=''
 
-:
-(as_func_return () {
-  (exit $1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
+ac_unique_file="src/nccoord.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
 
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+HAVE_PYTHON_FALSE
+HAVE_PYTHON_TRUE
+PYTHON
+HAVE_FORTRAN_2003_FALSE
+HAVE_FORTRAN_2003_TRUE
+HAVE_FORTRAN_2003
+HAVE_UUID
+HAVE_UUID_FALSE
+HAVE_UUID_TRUE
+HAVE_LAPACK_LIB
+HAVE_LAPACK_UNDERSCORE
+HAVE_LAPACK_NO_UNDERSCORE
+ALLOCA
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+MANIFEST_TOOL
+RANLIB
+ac_ct_AR
+AR
+DLLTOOL
+OBJDUMP
+LN_S
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+SED
+LIBTOOL
+HAVE_MPI_FALSE
+HAVE_MPI_TRUE
+EGREP
+GREP
+CPP
+NCDUMP
+NCDUMPDIR
+NETCDFDIR
+USE_NETCDF_DIR_FALSE
+USE_NETCDF_DIR_TRUE
+BUILD_F90_FALSE
+BUILD_F90_TRUE
+EXTRA_DATA_TESTS_FALSE
+EXTRA_DATA_TESTS_TRUE
+TEST_PARALLEL_FALSE
+TEST_PARALLEL_TRUE
+BUILD_PARALLEL_FALSE
+BUILD_PARALLEL_TRUE
+BUILD_GRIDSPEC_FILE_TESTS_FALSE
+BUILD_GRIDSPEC_FILE_TESTS_TRUE
+BUILD_DOCS_FALSE
+BUILD_DOCS_TRUE
+MOD_FLAG
+FCFLAGS_f90
+FCLIBS
+ac_ct_FC
+FCFLAGS
+FC
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+HAVE_DARWIN
+HAVE_DARWIN_FALSE
+HAVE_DARWIN_TRUE
+HAVE_SHARED
+HAVE_SHARED_FALSE
+HAVE_SHARED_TRUE
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_dependency_tracking
+enable_docs
+enable_gridspec_file_tests
+enable_logging
+enable_parallel
+enable_parallel_tests
+enable_extra_data_tests
+enable_regrid
+enable_f90
+with_netcdf
+with_lapack_libdir
+with_blas_lib
+with_lapack_lib
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+with_sysroot
+enable_libtool_lock
+enable_largefile
+'
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+FC
+FCFLAGS
+CPP'
 
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
 
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
-  break
-fi
-
-fi
-
-      done
-
-      if test "x$CONFIG_SHELL" != x; then
-  for as_var in BASH_ENV ENV
-	do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-	done
-	export CONFIG_SHELL
-	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
-
-    if test $as_have_required = no; then
-  echo This script requires a shell more modern than all the
-      echo shells that I found on your system.  Please install a
-      echo modern shell, or manually run the script under such a
-      echo shell if you do have one.
-      { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
-
-
-(eval "as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0") || {
-  echo No shell found that supports shell functions.
-  echo Please tell bug-autoconf at gnu.org about your system,
-  echo including any error possibly output before this message.
-  echo This can help us improve future autoconf versions.
-  echo Configuration will now proceed without shell functions.
-}
-
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
-
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
-  case `echo 'x\c'` in
-  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
-  esac;;
-*)
-  ECHO_N='-n';;
-esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
-  if ln -s conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s='ln -s'
-    # ... but there are two gotchas:
-    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
-    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
-  elif ln conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s=ln
-  else
-    as_ln_s='cp -p'
-  fi
-else
-  as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
-else
-  test -d ./-p && rmdir ./-p
-  as_mkdir_p=false
-fi
-
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-
-
-# Check that we are running under the correct shell.
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-case X$lt_ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
-  ;;
-esac
-
-ECHO=${lt_ECHO-echo}
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
-  # Yippee, $ECHO works!
-  :
-else
-  # Restart under the correct shell.
-  exec $SHELL "$0" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<_LT_EOF
-$*
-_LT_EOF
-  exit 0
-fi
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$lt_ECHO"; then
-  if test "X${echo_test_string+set}" != Xset; then
-    # find a string as large as possible, as long as the shell can cope with it
-    for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
-      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
-      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
-	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
-      then
-        break
-      fi
-    done
-  fi
-
-  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-     test "X$echo_testing_string" = "X$echo_test_string"; then
-    :
-  else
-    # The Solaris, AIX, and Digital Unix default echo programs unquote
-    # backslashes.  This makes it impossible to quote backslashes using
-    #   echo "$something" | sed 's/\\/\\\\/g'
-    #
-    # So, first we look for a working echo in the user's PATH.
-
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for dir in $PATH /usr/ucb; do
-      IFS="$lt_save_ifs"
-      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
-         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        ECHO="$dir/echo"
-        break
-      fi
-    done
-    IFS="$lt_save_ifs"
-
-    if test "X$ECHO" = Xecho; then
-      # We didn't find a better echo, so look for alternatives.
-      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        # This shell has a builtin print -r that does the trick.
-        ECHO='print -r'
-      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
-	   test "X$CONFIG_SHELL" != X/bin/ksh; then
-        # If we have ksh, try running configure again with it.
-        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-        export ORIGINAL_CONFIG_SHELL
-        CONFIG_SHELL=/bin/ksh
-        export CONFIG_SHELL
-        exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
-      else
-        # Try using printf.
-        ECHO='printf %s\n'
-        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	  # Cool, printf works
-	  :
-        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
-	  export CONFIG_SHELL
-	  SHELL="$CONFIG_SHELL"
-	  export SHELL
-	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
-        elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
-        else
-	  # maybe with a smaller string...
-	  prev=:
-
-	  for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
-	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
-	    then
-	      break
-	    fi
-	    prev="$cmd"
-	  done
-
-	  if test "$prev" != 'sed 50q "$0"'; then
-	    echo_test_string=`eval $prev`
-	    export echo_test_string
-	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
-	  else
-	    # Oops.  We lost completely, so just stick with echo.
-	    ECHO=echo
-	  fi
-        fi
-      fi
-    fi
-  fi
-fi
-
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-lt_ECHO=$ECHO
-if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
-   lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
-fi
-
-
-
-
-exec 7<&0 </dev/null 6>&1
-
-# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-
-#
-# Initializations.
-#
-ac_default_prefix=/usr/local
-ac_clean_files=
-ac_config_libobj_dir=.
-LIBOBJS=
-cross_compiling=no
-subdirs=
-MFLAGS=
-MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Identity of this package.
-PACKAGE_NAME='libcf'
-PACKAGE_TARNAME='libcf'
-PACKAGE_VERSION='1.0-alpha5'
-PACKAGE_STRING='libcf 1.0-alpha5'
-PACKAGE_BUGREPORT='support at unidata.ucar.edu'
-
-ac_unique_file="src/nccoord.c"
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# ifdef HAVE_STDLIB_H
-#  include <stdlib.h>
-# endif
-#endif
-#ifdef HAVE_STRING_H
-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-#  include <memory.h>
-# endif
-# include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
-
-ac_subst_vars='am__EXEEXT_FALSE
-am__EXEEXT_TRUE
-LTLIBOBJS
-LIBOBJS
-ALLOCA
-CPP
-OTOOL64
-OTOOL
-LIPO
-NMEDIT
-DSYMUTIL
-lt_ECHO
-RANLIB
-AR
-LN_S
-NM
-ac_ct_DUMPBIN
-DUMPBIN
-LD
-FGREP
-EGREP
-GREP
-SED
-LIBTOOL
-OBJDUMP
-DLLTOOL
-AS
-MOD_FLAG
-FCFLAGS_f90
-ac_ct_FC
-FCFLAGS
-FC
-ac_ct_F77
-FFLAGS
-F77
-am__fastdepCC_FALSE
-am__fastdepCC_TRUE
-CCDEPMODE
-AMDEPBACKSLASH
-AMDEP_FALSE
-AMDEP_TRUE
-am__quote
-am__include
-DEPDIR
-OBJEXT
-EXEEXT
-ac_ct_CC
-CPPFLAGS
-LDFLAGS
-CFLAGS
-CC
-NCDUMPDIR
-NETCDFDIR
-USE_NETCDF_DIR_FALSE
-USE_NETCDF_DIR_TRUE
-BUILD_F90_FALSE
-BUILD_F90_TRUE
-USE_SZLIB_DIR_FALSE
-USE_SZLIB_DIR_TRUE
-USE_ZLIB_DIR_FALSE
-USE_ZLIB_DIR_TRUE
-SZLIBDIR
-ZLIBDIR
-USE_HDF4_FALSE
-USE_HDF4_TRUE
-HDF4DIR
-USE_HDF4_DIR_FALSE
-USE_HDF4_DIR_TRUE
-HDF5DIR
-USE_HDF5_DIR_FALSE
-USE_HDF5_DIR_TRUE
-EXTRA_DATA_TESTS_FALSE
-EXTRA_DATA_TESTS_TRUE
-USE_NETCDF4_FALSE
-USE_NETCDF4_TRUE
-BUILD_CFCHECK_FALSE
-BUILD_CFCHECK_TRUE
-BUILD_GRIDSPEC_FILE_TESTS_FALSE
-BUILD_GRIDSPEC_FILE_TESTS_TRUE
-BUILD_GRIDSPEC_FALSE
-BUILD_GRIDSPEC_TRUE
-BUILD_DOCS_FALSE
-BUILD_DOCS_TRUE
-am__untar
-am__tar
-AMTAR
-am__leading_dot
-SET_MAKE
-AWK
-mkdir_p
-MKDIR_P
-INSTALL_STRIP_PROGRAM
-STRIP
-install_sh
-MAKEINFO
-AUTOHEADER
-AUTOMAKE
-AUTOCONF
-ACLOCAL
-VERSION
-PACKAGE
-CYGPATH_W
-am__isrc
-INSTALL_DATA
-INSTALL_SCRIPT
-INSTALL_PROGRAM
-host_os
-host_vendor
-host_cpu
-host
-build_os
-build_vendor
-build_cpu
-build
-target_alias
-host_alias
-build_alias
-LIBS
-ECHO_T
-ECHO_N
-ECHO_C
-DEFS
-mandir
-localedir
-libdir
-psdir
-pdfdir
-dvidir
-htmldir
-infodir
-docdir
-oldincludedir
-includedir
-localstatedir
-sharedstatedir
-sysconfdir
-datadir
-datarootdir
-libexecdir
-sbindir
-bindir
-program_transform_name
-prefix
-exec_prefix
-PACKAGE_BUGREPORT
-PACKAGE_STRING
-PACKAGE_VERSION
-PACKAGE_TARNAME
-PACKAGE_NAME
-PATH_SEPARATOR
-SHELL'
-ac_subst_files=''
-ac_user_opts='
-enable_option_checking
-enable_shared
-enable_docs
-enable_gridspec
-enable_gridspec_file_tests
-enable_cfcheck
-enable_logging
-enable_netcdf_4
-enable_hdf4
-enable_extra_data_tests
-with_hdf5
-with_hdf4
-with_zlib
-with_szlib
-enable_f90
-with_netcdf
-enable_dependency_tracking
-enable_static
-with_pic
-enable_fast_install
-with_gnu_ld
-enable_libtool_lock
-enable_largefile
-'
-      ac_precious_vars='build_alias
-host_alias
-target_alias
-CC
-CFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
-F77
-FFLAGS
-FC
-FCFLAGS
-CPP'
-
-
-# Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-ac_unrecognized_opts=
-ac_unrecognized_sep=
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-cache_file=/dev/null
-exec_prefix=NONE
-no_create=
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-verbose=
-x_includes=NONE
-x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
-# (The list follows the same order as the GNU Coding Standards.)
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datarootdir='${prefix}/share'
-datadir='${datarootdir}'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
-infodir='${datarootdir}/info'
-htmldir='${docdir}'
-dvidir='${docdir}'
-pdfdir='${docdir}'
-psdir='${docdir}'
-libdir='${exec_prefix}/lib'
-localedir='${datarootdir}/locale'
-mandir='${datarootdir}/man'
-
-ac_prev=
-ac_dashdash=
-for ac_option
-do
-  # If the previous option needs an argument, assign it.
-  if test -n "$ac_prev"; then
-    eval $ac_prev=\$ac_option
-    ac_prev=
-    continue
-  fi
-
-  case $ac_option in
-  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
-  *)	ac_optarg=yes ;;
-  esac
-
-  # Accept the important Cygnus configure options, so we can diagnose typos.
-
-  case $ac_dashdash$ac_option in
-  --)
-    ac_dashdash=yes ;;
-
-  -bindir | --bindir | --bindi | --bind | --bin | --bi)
-    ac_prev=bindir ;;
-  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
-    bindir=$ac_optarg ;;
-
-  -build | --build | --buil | --bui | --bu)
-    ac_prev=build_alias ;;
-  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
-    build_alias=$ac_optarg ;;
-
-  -cache-file | --cache-file | --cache-fil | --cache-fi \
-  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
-    ac_prev=cache_file ;;
-  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
-  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-    cache_file=$ac_optarg ;;
-
-  --config-cache | -C)
-    cache_file=config.cache ;;
-
-  -datadir | --datadir | --datadi | --datad)
-    ac_prev=datadir ;;
-  -datadir=* | --datadir=* | --datadi=* | --datad=*)
-    datadir=$ac_optarg ;;
-
-  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
-  | --dataroo | --dataro | --datar)
-    ac_prev=datarootdir ;;
-  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
-  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
-    datarootdir=$ac_optarg ;;
-
-  -disable-* | --disable-*)
-    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"enable_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
-	 ac_unrecognized_sep=', ';;
-    esac
-    eval enable_$ac_useropt=no ;;
-
-  -docdir | --docdir | --docdi | --doc | --do)
-    ac_prev=docdir ;;
-  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
-    docdir=$ac_optarg ;;
-
-  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
-    ac_prev=dvidir ;;
-  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
-    dvidir=$ac_optarg ;;
-
-  -enable-* | --enable-*)
-    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"enable_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
-	 ac_unrecognized_sep=', ';;
-    esac
-    eval enable_$ac_useropt=\$ac_optarg ;;
-
-  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
-  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
-  | --exec | --exe | --ex)
-    ac_prev=exec_prefix ;;
-  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
-  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
-  | --exec=* | --exe=* | --ex=*)
-    exec_prefix=$ac_optarg ;;
-
-  -gas | --gas | --ga | --g)
-    # Obsolete; use --with-gas.
-    with_gas=yes ;;
-
-  -help | --help | --hel | --he | -h)
-    ac_init_help=long ;;
-  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
-    ac_init_help=recursive ;;
-  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
-    ac_init_help=short ;;
-
-  -host | --host | --hos | --ho)
-    ac_prev=host_alias ;;
-  -host=* | --host=* | --hos=* | --ho=*)
-    host_alias=$ac_optarg ;;
-
-  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
-    ac_prev=htmldir ;;
-  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
-  | --ht=*)
-    htmldir=$ac_optarg ;;
-
-  -includedir | --includedir | --includedi | --included | --include \
-  | --includ | --inclu | --incl | --inc)
-    ac_prev=includedir ;;
-  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
-  | --includ=* | --inclu=* | --incl=* | --inc=*)
-    includedir=$ac_optarg ;;
-
-  -infodir | --infodir | --infodi | --infod | --info | --inf)
-    ac_prev=infodir ;;
-  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
-    infodir=$ac_optarg ;;
-
-  -libdir | --libdir | --libdi | --libd)
-    ac_prev=libdir ;;
-  -libdir=* | --libdir=* | --libdi=* | --libd=*)
-    libdir=$ac_optarg ;;
-
-  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
-  | --libexe | --libex | --libe)
-    ac_prev=libexecdir ;;
-  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
-  | --libexe=* | --libex=* | --libe=*)
-    libexecdir=$ac_optarg ;;
-
-  -localedir | --localedir | --localedi | --localed | --locale)
-    ac_prev=localedir ;;
-  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
-    localedir=$ac_optarg ;;
-
-  -localstatedir | --localstatedir | --localstatedi | --localstated \
-  | --localstate | --localstat | --localsta | --localst | --locals)
-    ac_prev=localstatedir ;;
-  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
-  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
-    localstatedir=$ac_optarg ;;
-
-  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
-    ac_prev=mandir ;;
-  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
-    mandir=$ac_optarg ;;
-
-  -nfp | --nfp | --nf)
-    # Obsolete; use --without-fp.
-    with_fp=no ;;
-
-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c | -n)
-    no_create=yes ;;
-
-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
-    no_recursion=yes ;;
-
-  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
-  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
-  | --oldin | --oldi | --old | --ol | --o)
-    ac_prev=oldincludedir ;;
-  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
-  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
-  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
-    oldincludedir=$ac_optarg ;;
-
-  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
-    ac_prev=prefix ;;
-  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-    prefix=$ac_optarg ;;
-
-  -program-prefix | --program-prefix | --program-prefi | --program-pref \
-  | --program-pre | --program-pr | --program-p)
-    ac_prev=program_prefix ;;
-  -program-prefix=* | --program-prefix=* | --program-prefi=* \
-  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
-    program_prefix=$ac_optarg ;;
-
-  -program-suffix | --program-suffix | --program-suffi | --program-suff \
-  | --program-suf | --program-su | --program-s)
-    ac_prev=program_suffix ;;
-  -program-suffix=* | --program-suffix=* | --program-suffi=* \
-  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
-    program_suffix=$ac_optarg ;;
-
-  -program-transform-name | --program-transform-name \
-  | --program-transform-nam | --program-transform-na \
-  | --program-transform-n | --program-transform- \
-  | --program-transform | --program-transfor \
-  | --program-transfo | --program-transf \
-  | --program-trans | --program-tran \
-  | --progr-tra | --program-tr | --program-t)
-    ac_prev=program_transform_name ;;
-  -program-transform-name=* | --program-transform-name=* \
-  | --program-transform-nam=* | --program-transform-na=* \
-  | --program-transform-n=* | --program-transform-=* \
-  | --program-transform=* | --program-transfor=* \
-  | --program-transfo=* | --program-transf=* \
-  | --program-trans=* | --program-tran=* \
-  | --progr-tra=* | --program-tr=* | --program-t=*)
-    program_transform_name=$ac_optarg ;;
-
-  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
-    ac_prev=pdfdir ;;
-  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
-    pdfdir=$ac_optarg ;;
-
-  -psdir | --psdir | --psdi | --psd | --ps)
-    ac_prev=psdir ;;
-  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
-    psdir=$ac_optarg ;;
-
-  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-  | -silent | --silent | --silen | --sile | --sil)
-    silent=yes ;;
-
-  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
-    ac_prev=sbindir ;;
-  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
-  | --sbi=* | --sb=*)
-    sbindir=$ac_optarg ;;
-
-  -sharedstatedir | --sharedstatedir | --sharedstatedi \
-  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
-  | --sharedst | --shareds | --shared | --share | --shar \
-  | --sha | --sh)
-    ac_prev=sharedstatedir ;;
-  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
-  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
-  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
-  | --sha=* | --sh=*)
-    sharedstatedir=$ac_optarg ;;
-
-  -site | --site | --sit)
-    ac_prev=site ;;
-  -site=* | --site=* | --sit=*)
-    site=$ac_optarg ;;
-
-  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
-    ac_prev=srcdir ;;
-  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-    srcdir=$ac_optarg ;;
-
-  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
-  | --syscon | --sysco | --sysc | --sys | --sy)
-    ac_prev=sysconfdir ;;
-  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
-  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
-    sysconfdir=$ac_optarg ;;
-
-  -target | --target | --targe | --targ | --tar | --ta | --t)
-    ac_prev=target_alias ;;
-  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-    target_alias=$ac_optarg ;;
-
-  -v | -verbose | --verbose | --verbos | --verbo | --verb)
-    verbose=yes ;;
-
-  -version | --version | --versio | --versi | --vers | -V)
-    ac_init_version=: ;;
-
-  -with-* | --with-*)
-    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"with_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
-	 ac_unrecognized_sep=', ';;
-    esac
-    eval with_$ac_useropt=\$ac_optarg ;;
-
-  -without-* | --without-*)
-    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"with_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
-	 ac_unrecognized_sep=', ';;
-    esac
-    eval with_$ac_useropt=no ;;
-
-  --x)
-    # Obsolete; use --with-x.
-    with_x=yes ;;
-
-  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
-  | --x-incl | --x-inc | --x-in | --x-i)
-    ac_prev=x_includes ;;
-  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
-  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
-    x_includes=$ac_optarg ;;
-
-  -x-libraries | --x-libraries | --x-librarie | --x-librari \
-  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
-    ac_prev=x_libraries ;;
-  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
-  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
-    x_libraries=$ac_optarg ;;
-
-  -*) { $as_echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; }
-    ;;
-
-  *=*)
-    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
-   { (exit 1); exit 1; }; }
-    eval $ac_envvar=\$ac_optarg
-    export $ac_envvar ;;
-
-  *)
-    # FIXME: should be removed in autoconf 3.0.
-    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
-    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
-    ;;
-
-  esac
-done
-
-if test -n "$ac_prev"; then
-  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  { $as_echo "$as_me: error: missing argument to $ac_option" >&2
-   { (exit 1); exit 1; }; }
-fi
-
-if test -n "$ac_unrecognized_opts"; then
-  case $enable_option_checking in
-    no) ;;
-    fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2
-   { (exit 1); exit 1; }; } ;;
-    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
-  esac
-fi
-
-# Check all directory arguments for consistency.
-for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
-		datadir sysconfdir sharedstatedir localstatedir includedir \
-		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
-do
-  eval ac_val=\$$ac_var
-  # Remove trailing slashes.
-  case $ac_val in
-    */ )
-      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
-      eval $ac_var=\$ac_val;;
-  esac
-  # Be sure to have absolute directory names.
-  case $ac_val in
-    [\\/$]* | ?:[\\/]* )  continue;;
-    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
-  esac
-  { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; }
-done
-
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-if test "x$host_alias" != x; then
-  if test "x$build_alias" = x; then
-    cross_compiling=maybe
-    $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used." >&2
-  elif test "x$build_alias" != "x$host_alias"; then
-    cross_compiling=yes
-  fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
-
-ac_pwd=`pwd` && test -n "$ac_pwd" &&
-ac_ls_di=`ls -di .` &&
-ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  { $as_echo "$as_me: error: working directory cannot be determined" >&2
-   { (exit 1); exit 1; }; }
-test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
-   { (exit 1); exit 1; }; }
-
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
-  ac_srcdir_defaulted=yes
-  # Try the directory containing this script, then the parent directory.
-  ac_confdir=`$as_dirname -- "$as_myself" ||
-$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_myself" : 'X\(//\)[^/]' \| \
-	 X"$as_myself" : 'X\(//\)$' \| \
-	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_myself" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-  srcdir=$ac_confdir
-  if test ! -r "$srcdir/$ac_unique_file"; then
-    srcdir=..
-  fi
-else
-  ac_srcdir_defaulted=no
-fi
-if test ! -r "$srcdir/$ac_unique_file"; then
-  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
-   { (exit 1); exit 1; }; }
-fi
-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
-ac_abs_confdir=`(
-	cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
-   { (exit 1); exit 1; }; }
-	pwd)`
-# When building in place, set srcdir=.
-if test "$ac_abs_confdir" = "$ac_pwd"; then
-  srcdir=.
-fi
-# Remove unnecessary trailing slashes from srcdir.
-# Double slashes in file names in object file debugging info
-# mess up M-x gdb in Emacs.
-case $srcdir in
-*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
-esac
-for ac_var in $ac_precious_vars; do
-  eval ac_env_${ac_var}_set=\${${ac_var}+set}
-  eval ac_env_${ac_var}_value=\$${ac_var}
-  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
-  eval ac_cv_env_${ac_var}_value=\$${ac_var}
-done
-
-#
-# Report the --help message.
-#
-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 libcf 1.0-alpha5 to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE.  See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
-  -h, --help              display this help and exit
-      --help=short        display options specific to this package
-      --help=recursive    display the short help of all the included packages
-  -V, --version           display version information and exit
-  -q, --quiet, --silent   do not print \`checking...' messages
-      --cache-file=FILE   cache test results in FILE [disabled]
-  -C, --config-cache      alias for \`--cache-file=config.cache'
-  -n, --no-create         do not create output files
-      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
-
-Installation directories:
-  --prefix=PREFIX         install architecture-independent files in PREFIX
-                          [$ac_default_prefix]
-  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                          [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
-  --bindir=DIR            user executables [EPREFIX/bin]
-  --sbindir=DIR           system admin executables [EPREFIX/sbin]
-  --libexecdir=DIR        program executables [EPREFIX/libexec]
-  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
-  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
-  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --libdir=DIR            object code libraries [EPREFIX/lib]
-  --includedir=DIR        C header files [PREFIX/include]
-  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
-  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
-  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
-  --infodir=DIR           info documentation [DATAROOTDIR/info]
-  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
-  --mandir=DIR            man documentation [DATAROOTDIR/man]
-  --docdir=DIR            documentation root [DATAROOTDIR/doc/libcf]
-  --htmldir=DIR           html documentation [DOCDIR]
-  --dvidir=DIR            dvi documentation [DOCDIR]
-  --pdfdir=DIR            pdf documentation [DOCDIR]
-  --psdir=DIR             ps documentation [DOCDIR]
-_ACEOF
-
-  cat <<\_ACEOF
-
-Program names:
-  --program-prefix=PREFIX            prepend PREFIX to installed program names
-  --program-suffix=SUFFIX            append SUFFIX to installed program names
-  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
-
-System types:
-  --build=BUILD     configure for building on BUILD [guessed]
-  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
-_ACEOF
-fi
-
-if test -n "$ac_init_help"; then
-  case $ac_init_help in
-     short | recursive ) echo "Configuration of libcf 1.0-alpha5:";;
-   esac
-  cat <<\_ACEOF
-
-Optional Features:
-  --disable-option-checking  ignore unrecognized --enable/--with options
-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --enable-shared[=PKGS]  build shared libraries [default=no]
-  --enable-docs           build the libcf documentation (a built version is
-                          already included with the distrubution)
-  --enable-gridspec       build the gridspec tools
-  --enable-gridspec-file-tests
-                          get GRIDSPEC test data from Unidata FTP server and
-                          run extra tests
-  --enable-cfcheck        still in development - not working yet
-  --enable-logging        enable logging capability. This debugging features
-                          is only of interest to libcf developers.
-  --enable-netcdf-4       build with netcdf-4 (HDF5 is required)
-  --enable-hdf4           build netcdf-4 with HDF4 read capability (HDF4, HDF5
-                          and zlib required)
-  --enable-extra-data-tests
-                          Perform extra tests using CF example files from
-                          Unidata web site (example files must be donloaded
-                          separately). This option should only be used by
-                          those with excessive interest in testing libcf.
-  --disable-f90           don't try to build Fortran 90 API
-  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors
-  --enable-static[=PKGS]  build static libraries [default=yes]
-  --enable-fast-install[=PKGS]
-                          optimize for fast installation [default=yes]
-  --disable-libtool-lock  avoid locking (might break parallel builds)
-  --disable-largefile     omit support for large files
-
-Optional Packages:
-  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
-  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-hdf5=<directory> Specify location of HDF5 library. Configure will
-                          expect to find subdirs include and lib.
-  --with-hdf4=<directory> Specify location of HDF4 library. Configure will
-                          expect to find subdirs include and lib.
-  --with-zlib=<directory> Specify location of ZLIB library. ZLIB is required
-                          for netCDF-4. Configure will expect to find subdirs
-                          include and lib.
-  --with-szlib=<directory>
-                          Specify location of SZLIB library. SZLIB is not
-                          required for netCDF-4, but you must specify its
-                          location if HDF5 was built with SZLIB. Configure
-                          will expect to find subdirs include and lib.
-  --with-netcdf=<directory>
-                          Specify location of netCDF library. Configure will
-                          expect to find subdirs include and lib.
-  --with-pic              try to use only PIC/non-PIC objects [default=use
-                          both]
-  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
-
-Some influential environment variables:
-  CC          C compiler command
-  CFLAGS      C compiler flags
-  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
-              nonstandard directory <lib dir>
-  LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
-              you have headers in a nonstandard directory <include dir>
-  F77         Fortran 77 compiler command
-  FFLAGS      Fortran 77 compiler flags
-  FC          Fortran compiler command
-  FCFLAGS     Fortran compiler flags
-  CPP         C preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-Report bugs to <support at unidata.ucar.edu>.
-_ACEOF
-ac_status=$?
-fi
-
-if test "$ac_init_help" = "recursive"; then
-  # If there are subdirs, report their specific --help.
-  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-    test -d "$ac_dir" ||
-      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
-      continue
-    ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
-  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-  esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
-  .)  # We are building in place.
-    ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-    cd "$ac_dir" || { ac_status=$?; continue; }
-    # Check for guested configure.
-    if test -f "$ac_srcdir/configure.gnu"; then
-      echo &&
-      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
-    elif test -f "$ac_srcdir/configure"; then
-      echo &&
-      $SHELL "$ac_srcdir/configure" --help=recursive
-    else
-      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
-    fi || ac_status=$?
-    cd "$ac_pwd" || { ac_status=$?; break; }
-  done
-fi
-
-test -n "$ac_init_help" && exit $ac_status
-if $ac_init_version; then
-  cat <<\_ACEOF
-libcf configure 1.0-alpha5
-generated by GNU Autoconf 2.63
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
-  exit
-fi
-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 libcf $as_me 1.0-alpha5, which was
-generated by GNU Autoconf 2.63.  Invocation command line was
-
-  $ $0 $@
-
-_ACEOF
-exec 5>>config.log
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
-
-/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
-/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
-/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  $as_echo "PATH: $as_dir"
-done
-IFS=$as_save_IFS
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
-  for ac_arg
-  do
-    case $ac_arg in
-    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-    | -silent | --silent | --silen | --sile | --sil)
-      continue ;;
-    *\'*)
-      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    esac
-    case $ac_pass in
-    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
-    2)
-      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
-      if test $ac_must_keep_next = true; then
-	ac_must_keep_next=false # Got value, back to normal.
-      else
-	case $ac_arg in
-	  *=* | --config-cache | -C | -disable-* | --disable-* \
-	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-	  | -with-* | --with-* | -without-* | --without-* | --x)
-	    case "$ac_configure_args0 " in
-	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-	    esac
-	    ;;
-	  -* ) ac_must_keep_next=true ;;
-	esac
-      fi
-      ac_configure_args="$ac_configure_args '$ac_arg'"
-      ;;
-    esac
-  done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log.  We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
-trap 'exit_status=$?
-  # Save into config.log some information that might help in debugging.
-  {
-    echo
-
-    cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
-    echo
-    # The following way of writing the cache mishandles newlines in values,
-(
-  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
-    eval ac_val=\$$ac_var
-    case $ac_val in #(
-    *${as_nl}*)
-      case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) $as_unset $ac_var ;;
-      esac ;;
-    esac
-  done
-  (set) 2>&1 |
-    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
-    *${as_nl}ac_space=\ *)
-      sed -n \
-	"s/'\''/'\''\\\\'\'''\''/g;
-	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
-      ;; #(
-    *)
-      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
-      ;;
-    esac |
-    sort
-)
-    echo
-
-    cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
-    echo
-    for ac_var in $ac_subst_vars
-    do
-      eval ac_val=\$$ac_var
-      case $ac_val in
-      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-      esac
-      $as_echo "$ac_var='\''$ac_val'\''"
-    done | sort
-    echo
-
-    if test -n "$ac_subst_files"; then
-      cat <<\_ASBOX
-## ------------------- ##
-## File substitutions. ##
-## ------------------- ##
-_ASBOX
-      echo
-      for ac_var in $ac_subst_files
-      do
-	eval ac_val=\$$ac_var
-	case $ac_val in
-	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-	esac
-	$as_echo "$ac_var='\''$ac_val'\''"
-      done | sort
-      echo
-    fi
-
-    if test -s confdefs.h; then
-      cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
-      echo
-      cat confdefs.h
-      echo
-    fi
-    test "$ac_signal" != 0 &&
-      $as_echo "$as_me: caught signal $ac_signal"
-    $as_echo "$as_me: exit $exit_status"
-  } >&5
-  rm -f core *.core core.conftest.* &&
-    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
-    exit $exit_status
-' 0
-for ac_signal in 1 2 13 15; do
-  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -f -r conftest* confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer an explicitly selected file to automatically selected ones.
-ac_site_file1=NONE
-ac_site_file2=NONE
-if test -n "$CONFIG_SITE"; then
-  ac_site_file1=$CONFIG_SITE
-elif test "x$prefix" != xNONE; then
-  ac_site_file1=$prefix/share/config.site
-  ac_site_file2=$prefix/etc/config.site
-else
-  ac_site_file1=$ac_default_prefix/share/config.site
-  ac_site_file2=$ac_default_prefix/etc/config.site
-fi
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
-do
-  test "x$ac_site_file" = xNONE && continue
-  if test -r "$ac_site_file"; then
-    { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-$as_echo "$as_me: loading site script $ac_site_file" >&6;}
-    sed 's/^/| /' "$ac_site_file" >&5
-    . "$ac_site_file"
-  fi
-done
-
-if test -r "$cache_file"; then
-  # Some versions of bash will fail to source /dev/null (special
-  # files actually), so we avoid doing that.
-  if test -f "$cache_file"; then
-    { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
-$as_echo "$as_me: loading cache $cache_file" >&6;}
-    case $cache_file in
-      [\\/]* | ?:[\\/]* ) . "$cache_file";;
-      *)                      . "./$cache_file";;
-    esac
-  fi
-else
-  { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
-$as_echo "$as_me: creating cache $cache_file" >&6;}
-  >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
-  eval ac_old_set=\$ac_cv_env_${ac_var}_set
-  eval ac_new_set=\$ac_env_${ac_var}_set
-  eval ac_old_val=\$ac_cv_env_${ac_var}_value
-  eval ac_new_val=\$ac_env_${ac_var}_value
-  case $ac_old_set,$ac_new_set in
-    set,)
-      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,set)
-      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,);;
-    *)
-      if test "x$ac_old_val" != "x$ac_new_val"; then
-	# differences in whitespace do not lead to failure.
-	ac_old_val_w=`echo x $ac_old_val`
-	ac_new_val_w=`echo x $ac_new_val`
-	if test "$ac_old_val_w" != "$ac_new_val_w"; then
-	  { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-	  ac_cache_corrupted=:
-	else
-	  { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
-$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
-	  eval $ac_var=\$ac_old_val
-	fi
-	{ $as_echo "$as_me:$LINENO:   former value:  \`$ac_old_val'" >&5
-$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
-	{ $as_echo "$as_me:$LINENO:   current value: \`$ac_new_val'" >&5
-$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
-      fi;;
-  esac
-  # Pass precious variables to config.status.
-  if test "$ac_new_set" = set; then
-    case $ac_new_val in
-    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
-    *) ac_arg=$ac_var=$ac_new_val ;;
-    esac
-    case " $ac_configure_args " in
-      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
-      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
-    esac
-  fi
-done
-if $ac_cache_corrupted; then
-  { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-  { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-{ $as_echo "$as_me:$LINENO: libcf 1.0-alpha5" >&5
-$as_echo "$as_me: libcf 1.0-alpha5" >&6;}
-
-# Find out about the host we're building on.
-ac_aux_dir=
-for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
-  if test -f "$ac_dir/install-sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f "$ac_dir/install.sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  elif test -f "$ac_dir/shtool"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
-    break
-  fi
-done
-if test -z "$ac_aux_dir"; then
-  { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
-$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
-
-
-# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
-   { (exit 1); exit 1; }; }
-
-{ $as_echo "$as_me:$LINENO: checking build system type" >&5
-$as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_build_alias=$build_alias
-test "x$ac_build_alias" = x &&
-  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
-test "x$ac_build_alias" = x &&
-  { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
-   { (exit 1); exit 1; }; }
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-$as_echo "$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-$as_echo "$as_me: error: invalid value of canonical build" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
-build=$ac_cv_build
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_build
-shift
-build_cpu=$1
-build_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-build_os=$*
-IFS=$ac_save_IFS
-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
-
-
-{ $as_echo "$as_me:$LINENO: checking host system type" >&5
-$as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "x$host_alias" = x; then
-  ac_cv_host=$ac_cv_build
-else
-  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-$as_echo "$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-$as_echo "$as_me: error: invalid value of canonical host" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
-host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
-
-
-
-# We will output a config.h for the C library, and a fortran inc file,
-# nfconfig.inc.
-ac_config_headers="$ac_config_headers config.h"
-
-ac_config_headers="$ac_config_headers nfconfig.inc:nfconfig.in"
-
-
-# This call is required by automake.
-am__api_version='1.11'
-
-# Find a good install program.  We prefer a C program (faster),
-# so one script is as good as another.  But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-# Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-$as_echo_n "checking for a BSD-compatible install... " >&6; }
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
-  ./ | .// | /cC/* | \
-  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
-  /usr/ucb/* ) ;;
-  *)
-    # OSF1 and SCO ODT 3.0 have their own names for install.
-    # Don't use installbsd from OSF since it installs stuff as root
-    # by default.
-    for ac_prog in ginstall scoinst install; do
-      for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
-	  if test $ac_prog = install &&
-	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-	    # AIX install.  It has an incompatible calling convention.
-	    :
-	  elif test $ac_prog = install &&
-	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-	    # program-specific install script used by HP pwplus--don't use.
-	    :
-	  else
-	    rm -rf conftest.one conftest.two conftest.dir
-	    echo one > conftest.one
-	    echo two > conftest.two
-	    mkdir conftest.dir
-	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
-	      test -s conftest.one && test -s conftest.two &&
-	      test -s conftest.dir/conftest.one &&
-	      test -s conftest.dir/conftest.two
-	    then
-	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-	      break 3
-	    fi
-	  fi
-	fi
-      done
-    done
-    ;;
-esac
-
-done
-IFS=$as_save_IFS
-
-rm -rf conftest.one conftest.two conftest.dir
-
-fi
-  if test "${ac_cv_path_install+set}" = set; then
-    INSTALL=$ac_cv_path_install
-  else
-    # As a last resort, use the slow shell script.  Don't cache a
-    # value for INSTALL within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the value is a relative name.
-    INSTALL=$ac_install_sh
-  fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
-$as_echo "$INSTALL" >&6; }
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5
-$as_echo_n "checking whether build environment is sane... " >&6; }
-# Just in case
-sleep 1
-echo timestamp > conftest.file
-# Reject unsafe characters in $srcdir or the absolute working directory
-# name.  Accept space and tab only in the latter.
-am_lf='
-'
-case `pwd` in
-  *[\\\"\#\$\&\'\`$am_lf]*)
-    { { $as_echo "$as_me:$LINENO: error: unsafe absolute working directory name" >&5
-$as_echo "$as_me: error: unsafe absolute working directory name" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
-case $srcdir in
-  *[\\\"\#\$\&\'\`$am_lf\ \	]*)
-    { { $as_echo "$as_me:$LINENO: error: unsafe srcdir value: \`$srcdir'" >&5
-$as_echo "$as_me: error: unsafe srcdir value: \`$srcdir'" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
-
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments.  Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
-   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-   if test "$*" = "X"; then
-      # -L didn't work.
-      set X `ls -t "$srcdir/configure" conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$*" != "X $srcdir/configure conftest.file" \
-      && test "$*" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&5
-$as_echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&2;}
-   { (exit 1); exit 1; }; }
-   fi
-
-   test "$2" = conftest.file
-   )
-then
-   # Ok.
-   :
-else
-   { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files!
-Check your system clock" >&5
-$as_echo "$as_me: error: newly created file is older than distributed files!
-Check your system clock" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-{ $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-test "$program_prefix" != NONE &&
-  program_transform_name="s&^&$program_prefix&;$program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
-  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
-# Double any \ or $.
-# By default was `s,x,x', remove it if useless.
-ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
-program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
-
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
-
-if test x"${MISSING+set}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
-  *)
-    MISSING="\${SHELL} $am_aux_dir/missing" ;;
-  esac
-fi
-# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
-else
-  am_missing_run=
-  { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
-$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
-fi
-
-if test x"${install_sh}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
-  *)
-    install_sh="\${SHELL} $am_aux_dir/install-sh"
-  esac
-fi
-
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
-# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-if test "$cross_compiling" != no; then
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$STRIP"; then
-  ac_cv_prog_STRIP="$STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
-  { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_STRIP"; then
-  ac_ct_STRIP=$STRIP
-  # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_STRIP"; then
-  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_STRIP="strip"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
-if test -n "$ac_ct_STRIP"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-$as_echo "$ac_ct_STRIP" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_STRIP" = x; then
-    STRIP=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    STRIP=$ac_ct_STRIP
-  fi
-else
-  STRIP="$ac_cv_prog_STRIP"
-fi
-
-fi
-INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
-
-{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
-$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
-if test -z "$MKDIR_P"; then
-  if test "${ac_cv_path_mkdir+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_prog in mkdir gmkdir; do
-	 for ac_exec_ext in '' $ac_executable_extensions; do
-	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
-	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
-	     'mkdir (GNU coreutils) '* | \
-	     'mkdir (coreutils) '* | \
-	     'mkdir (fileutils) '4.1*)
-	       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
-	       break 3;;
-	   esac
-	 done
-       done
-done
-IFS=$as_save_IFS
-
-fi
-
-  if test "${ac_cv_path_mkdir+set}" = set; then
-    MKDIR_P="$ac_cv_path_mkdir -p"
-  else
-    # As a last resort, use the slow shell script.  Don't cache a
-    # value for MKDIR_P within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the value is a relative name.
-    test -d ./--version && rmdir ./--version
-    MKDIR_P="$ac_install_sh -d"
-  fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5
-$as_echo "$MKDIR_P" >&6; }
-
-mkdir_p="$MKDIR_P"
-case $mkdir_p in
-  [\\/$]* | ?:[\\/]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-
-for ac_prog in gawk mawk nawk awk
-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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$AWK"; then
-  ac_cv_prog_AWK="$AWK" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AWK="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-AWK=$ac_cv_prog_AWK
-if test -n "$AWK"; then
-  { $as_echo "$as_me:$LINENO: result: $AWK" >&5
-$as_echo "$AWK" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$AWK" && break
-done
-
-{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
-set x ${MAKE-make}
-ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.make <<\_ACEOF
-SHELL = /bin/sh
-all:
-	@echo '@@@%%%=$(MAKE)=@@@%%%'
-_ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-case `${MAKE-make} -f conftest.make 2>/dev/null` in
-  *@@@%%%=?*=@@@%%%*)
-    eval ac_cv_prog_make_${ac_make}_set=yes;;
-  *)
-    eval ac_cv_prog_make_${ac_make}_set=no;;
-esac
-rm -f conftest.make
-fi
-if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-  SET_MAKE=
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-  SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-rm -rf .tst 2>/dev/null
-mkdir .tst 2>/dev/null
-if test -d .tst; then
-  am__leading_dot=.
-else
-  am__leading_dot=_
-fi
-rmdir .tst 2>/dev/null
-
-if test "`cd $srcdir && pwd`" != "`pwd`"; then
-  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
-  # is not polluted with repeated "-I."
-  am__isrc=' -I$(srcdir)'
-  # test to see if srcdir already configured
-  if test -f $srcdir/config.status; then
-    { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
-$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-fi
-
-# test whether we have cygpath
-if test -z "$CYGPATH_W"; then
-  if (cygpath --version) >/dev/null 2>/dev/null; then
-    CYGPATH_W='cygpath -w'
-  else
-    CYGPATH_W=echo
-  fi
-fi
-
-
-# Define the identity of the package.
- PACKAGE='libcf'
- VERSION='1.0-alpha5'
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE "$PACKAGE"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define VERSION "$VERSION"
-_ACEOF
-
-# Some tools Automake needs.
-
-ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
-
-
-AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
-
-
-AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
-
-
-AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
-
-
-MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
-
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
-# Always define AMTAR for backward compatibility.
-
-AMTAR=${AMTAR-"${am_missing_run}tar"}
-
-am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
-
-
-
-
-
-
-# Check for the existance of this file before proceeding.
-
-
-{ $as_echo "$as_me:$LINENO: checking user options" >&5
-$as_echo "$as_me: checking user options" >&6;}
-
-# Turn off shared libraries by default
-# Check whether --enable-shared was given.
-if test "${enable_shared+set}" = set; then
-  enableval=$enable_shared; p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_shared=yes ;;
-    no) enable_shared=no ;;
-    *)
-      enable_shared=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_shared=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac
-else
-  enable_shared=no
-fi
-
-
-
-
-
-
-
-
-
-
-# The autoconf manual suggests the following to set a var if it's not
-# already set: test "${var+set}" = set || var={value}
-
-# For backward compatibility, check to see if the user has set FC to
-# null. If so, treat that as the --disable-fortran option to
-# configure.
-
-# Did the user set fc to null?
-{ $as_echo "$as_me:$LINENO: checking whether FC is set to ''" >&5
-$as_echo_n "checking whether FC is set to ''... " >&6; }
-nc_null_fc=no
-test "x${FC+set}" = xset && test "x$FC" = x && nc_null_fc=yes
-{ $as_echo "$as_me:$LINENO: result: $nc_null_fc" >&5
-$as_echo "$nc_null_fc" >&6; }
-
-# Does the user want to build documentation?
-{ $as_echo "$as_me:$LINENO: checking whether documentation is to be built" >&5
-$as_echo_n "checking whether documentation is to be built... " >&6; }
-# Check whether --enable-docs was given.
-if test "${enable_docs+set}" = set; then
-  enableval=$enable_docs;
-fi
-
-test "x$enable_docs" = xyes || enable_docs=no
-{ $as_echo "$as_me:$LINENO: result: $enable_docs" >&5
-$as_echo "$enable_docs" >&6; }
- if test x$enable_docs = xyes; then
-  BUILD_DOCS_TRUE=
-  BUILD_DOCS_FALSE='#'
-else
-  BUILD_DOCS_TRUE='#'
-  BUILD_DOCS_FALSE=
-fi
-
-
-# Does the user want to build gridspec tools?
-{ $as_echo "$as_me:$LINENO: checking whether gridspec tools are to be built" >&5
-$as_echo_n "checking whether gridspec tools are to be built... " >&6; }
-# Check whether --enable-gridspec was given.
-if test "${enable_gridspec+set}" = set; then
-  enableval=$enable_gridspec;
-fi
-
-test "x$enable_gridspec" = xyes || enable_gridspec=no
-{ $as_echo "$as_me:$LINENO: result: $enable_gridspec" >&5
-$as_echo "$enable_gridspec" >&6; }
- if test x$enable_gridspec = xyes; then
-  BUILD_GRIDSPEC_TRUE=
-  BUILD_GRIDSPEC_FALSE='#'
-else
-  BUILD_GRIDSPEC_TRUE='#'
-  BUILD_GRIDSPEC_FALSE=
-fi
-
-
-# Does the user want to fetch test data and run extra gridspec tests?
-{ $as_echo "$as_me:$LINENO: checking whether gridspec test data should be fetched from Unidata FTP site" >&5
-$as_echo_n "checking whether gridspec test data should be fetched from Unidata FTP site... " >&6; }
-# Check whether --enable-gridspec-file-tests was given.
-if test "${enable_gridspec_file_tests+set}" = set; then
-  enableval=$enable_gridspec_file_tests;
-fi
-
-test "x$enable_gridspec_file_tests" = xyes || enable_gridspec_file_tests=no
-{ $as_echo "$as_me:$LINENO: result: $enable_gridspec_file_tests" >&5
-$as_echo "$enable_gridspec_file_tests" >&6; }
- if test x$enable_gridspec_file_tests = xyes; then
-  BUILD_GRIDSPEC_FILE_TESTS_TRUE=
-  BUILD_GRIDSPEC_FILE_TESTS_FALSE='#'
-else
-  BUILD_GRIDSPEC_FILE_TESTS_TRUE='#'
-  BUILD_GRIDSPEC_FILE_TESTS_FALSE=
-fi
-
-
-# Does the user want to build cfcheck?
-{ $as_echo "$as_me:$LINENO: checking whether cfcheck is to be built" >&5
-$as_echo_n "checking whether cfcheck is to be built... " >&6; }
-# Check whether --enable-cfcheck was given.
-if test "${enable_cfcheck+set}" = set; then
-  enableval=$enable_cfcheck;
-fi
-
-test "x$enable_cfcheck" = xyes || enable_cfcheck=no
-{ $as_echo "$as_me:$LINENO: result: $enable_cfcheck" >&5
-$as_echo "$enable_cfcheck" >&6; }
- if test x$enable_cfcheck = xyes; then
-  BUILD_CFCHECK_TRUE=
-  BUILD_CFCHECK_FALSE='#'
-else
-  BUILD_CFCHECK_TRUE='#'
-  BUILD_CFCHECK_FALSE=
-fi
-
-
-# Does the user want to enable logging?
-{ $as_echo "$as_me:$LINENO: checking whether logging is enabled (useful to CF developers, mainly" >&5
-$as_echo_n "checking whether logging is enabled (useful to CF developers, mainly... " >&6; }
-# Check whether --enable-logging was given.
-if test "${enable_logging+set}" = set; then
-  enableval=$enable_logging;
-fi
-
-test "x$enable_logging" = "xyes" || enable_logging=no
-{ $as_echo "$as_me:$LINENO: result: $enable_logging" >&5
-$as_echo "$enable_logging" >&6; }
-if test "x$enable_logging" = xyes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define LOGGING 1
-_ACEOF
-
-fi
-
-# Does the user want to use netcdf-4?
-{ $as_echo "$as_me:$LINENO: checking whether netCDF-4 is to be used" >&5
-$as_echo_n "checking whether netCDF-4 is to be used... " >&6; }
-# Check whether --enable-netcdf-4 was given.
-if test "${enable_netcdf_4+set}" = set; then
-  enableval=$enable_netcdf_4;
-fi
-
-
-# If hdf5 dir is set, turn on enable-netcdf-4.
-if test "x$with_hdf5" != x; then
-   enable_netcdf_4=yes
-else
-   test "x$enable_netcdf_4" = xyes || enable_netcdf_4=no
-fi
-{ $as_echo "$as_me:$LINENO: result: $enable_netcdf_4" >&5
-$as_echo "$enable_netcdf_4" >&6; }
- if test x$enable_netcdf_4 = xyes; then
-  USE_NETCDF4_TRUE=
-  USE_NETCDF4_FALSE='#'
-else
-  USE_NETCDF4_TRUE='#'
-  USE_NETCDF4_FALSE=
-fi
-
-if test "x$enable_netcdf_4" = xyes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define USE_NETCDF4 1
-_ACEOF
-
-fi
-
-# Does the user want to turn on HDF4 read ability?
-# Check whether --enable-hdf4 was given.
-if test "${enable_hdf4+set}" = set; then
-  enableval=$enable_hdf4;
-fi
-
-
-# Does the user want extra tests on CF sample files?
-{ $as_echo "$as_me:$LINENO: checking whether extra tests on sample data should be performed" >&5
-$as_echo_n "checking whether extra tests on sample data should be performed... " >&6; }
-# Check whether --enable-extra-data-tests was given.
-if test "${enable_extra_data_tests+set}" = set; then
-  enableval=$enable_extra_data_tests;
-fi
-
-test "x$enable_extra_data_tests" = xyes || enable_extra_data_tests=no
-{ $as_echo "$as_me:$LINENO: result: $enable_extra_data_tests" >&5
-$as_echo "$enable_extra_data_tests" >&6; }
- if test x$enable_extra_data_tests = xyes; then
-  EXTRA_DATA_TESTS_TRUE=
-  EXTRA_DATA_TESTS_FALSE='#'
-else
-  EXTRA_DATA_TESTS_TRUE='#'
-  EXTRA_DATA_TESTS_FALSE=
-fi
-
-
-# Did the user specify a location for the HDF5 library?
-{ $as_echo "$as_me:$LINENO: checking whether a location for the HDF5 library was specified" >&5
-$as_echo_n "checking whether a location for the HDF5 library was specified... " >&6; }
-
-# Check whether --with-hdf5 was given.
-if test "${with_hdf5+set}" = set; then
-  withval=$with_hdf5; HDF5DIR=$with_hdf5
-fi
-
-{ $as_echo "$as_me:$LINENO: result: $HDF5DIR" >&5
-$as_echo "$HDF5DIR" >&6; }
- if test ! "x$HDF5DIR" = x; then
-  USE_HDF5_DIR_TRUE=
-  USE_HDF5_DIR_FALSE='#'
-else
-  USE_HDF5_DIR_TRUE='#'
-  USE_HDF5_DIR_FALSE=
-fi
-
-HDF5DIR=$HDF5DIR
-
-if test ! "x$HDF5DIR" = x; then
-   LDFLAGS="${LDFLAGS} -L$HDF5DIR/lib"
-fi
-
-# Did the user specify a location for the HDF4 library?
-{ $as_echo "$as_me:$LINENO: checking whether a location for the HDF4 library was specified" >&5
-$as_echo_n "checking whether a location for the HDF4 library was specified... " >&6; }
-
-# Check whether --with-hdf4 was given.
-if test "${with_hdf4+set}" = set; then
-  withval=$with_hdf4; HDF4DIR=$with_hdf4
-fi
-
-{ $as_echo "$as_me:$LINENO: result: $HDF4DIR" >&5
-$as_echo "$HDF4DIR" >&6; }
- if test ! "x$HDF4DIR" = x; then
-  USE_HDF4_DIR_TRUE=
-  USE_HDF4_DIR_FALSE='#'
-else
-  USE_HDF4_DIR_TRUE='#'
-  USE_HDF4_DIR_FALSE=
-fi
-
-HDF4DIR=$HDF4DIR
-
- if test x$enable_hdf4 = xyes; then
-  USE_HDF4_TRUE=
-  USE_HDF4_FALSE='#'
-else
-  USE_HDF4_TRUE='#'
-  USE_HDF4_FALSE=
-fi
-
-
-# Did the user specify a location for the ZLIB library?
-{ $as_echo "$as_me:$LINENO: checking whether a location for the ZLIB library was specified" >&5
-$as_echo_n "checking whether a location for the ZLIB library was specified... " >&6; }
-
-# Check whether --with-zlib was given.
-if test "${with_zlib+set}" = set; then
-  withval=$with_zlib; ZLIBDIR=$with_zlib
-fi
-
-{ $as_echo "$as_me:$LINENO: result: $ZLIBDIR" >&5
-$as_echo "$ZLIBDIR" >&6; }
-ZLIBDIR=$ZLIBDIR
-
-
-# Did the user specify a location for the SZLIB library?
-{ $as_echo "$as_me:$LINENO: checking whether a location for the SZLIB library was specified" >&5
-$as_echo_n "checking whether a location for the SZLIB library was specified... " >&6; }
-
-# Check whether --with-szlib was given.
-if test "${with_szlib+set}" = set; then
-  withval=$with_szlib; SZLIBDIR=$with_szlib
-fi
-
-{ $as_echo "$as_me:$LINENO: result: $SZLIBDIR" >&5
-$as_echo "$SZLIBDIR" >&6; }
-SZLIBDIR=$SZLIBDIR
-
-
- if test ! "x$ZLIBDIR" = x; then
-  USE_ZLIB_DIR_TRUE=
-  USE_ZLIB_DIR_FALSE='#'
-else
-  USE_ZLIB_DIR_TRUE='#'
-  USE_ZLIB_DIR_FALSE=
-fi
-
- if test ! "x$SZLIBDIR" = x; then
-  USE_SZLIB_DIR_TRUE=
-  USE_SZLIB_DIR_FALSE='#'
-else
-  USE_SZLIB_DIR_TRUE='#'
-  USE_SZLIB_DIR_FALSE=
-fi
-
-
-# Do we want to build the fortran API? Check for --disable-f90
-nc_build_f90=yes
-{ $as_echo "$as_me:$LINENO: checking whether Fortran 90 API is desired" >&5
-$as_echo_n "checking whether Fortran 90 API is desired... " >&6; }
-# Check whether --enable-f90 was given.
-if test "${enable_f90+set}" = set; then
-  enableval=$enable_f90;
-fi
-
-test "x$enable_f90" = "xno" && nc_build_f90=no
-test "x$nc_null_fc" = xyes && nc_build_f90=no
-{ $as_echo "$as_me:$LINENO: result: $nc_build_f90" >&5
-$as_echo "$nc_build_f90" >&6; }
- if test "x$nc_build_f90" = xyes; then
-  BUILD_F90_TRUE=
-  BUILD_F90_FALSE='#'
-else
-  BUILD_F90_TRUE='#'
-  BUILD_F90_FALSE=
-fi
-
-
-# Did the user specify a location for the netcdf library?
-{ $as_echo "$as_me:$LINENO: checking whether a location for the netCDF library was specified" >&5
-$as_echo_n "checking whether a location for the netCDF library was specified... " >&6; }
-
-# Check whether --with-netcdf was given.
-if test "${with_netcdf+set}" = set; then
-  withval=$with_netcdf;
-else
-  with_netcdf=no
-fi
-
-{ $as_echo "$as_me:$LINENO: result: $with_netcdf" >&5
-$as_echo "$with_netcdf" >&6; }
- if test ! x$with_netcdf = xno; then
-  USE_NETCDF_DIR_TRUE=
-  USE_NETCDF_DIR_FALSE='#'
-else
-  USE_NETCDF_DIR_TRUE='#'
-  USE_NETCDF_DIR_FALSE=
-fi
-
-if test ! x$with_netcdf = xno; then
-   NETCDFDIR=$with_netcdf
-
-   NCDUMPDIR=$with_netcdf/bin
-
-   LDFLAGS="${LDFLAGS} -L$NETCDFDIR/lib"
-else
-   NCDUMPDIR=../../../../ncdump
-
-fi
-
-# According to the autoconf mailing list gurus, we must test for
-# compilers unconditionally. That is, we can't skip looking for the
-# fortran compilers, just because the user doesn't want fortran. This
-# is due to a limitation in autoconf.
-
-# Find the C compiler.
-{ $as_echo "$as_me:$LINENO: finding C compiler" >&5
-$as_echo "$as_me: finding C compiler" >&6;}
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  for ac_prog in mpcc_r xlc cc c89 acc gcc
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    test -n "$CC" && break
-  done
-fi
-if test -z "$CC"; then
-  ac_ct_CC=$CC
-  for ac_prog in mpcc_r xlc cc c89 acc gcc
-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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_CC="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$ac_ct_CC" && break
-done
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-fi
-
-
-test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-
-# Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
-ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-
-# The possible output files:
-ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
-
-ac_rmfiles=
-for ac_file in $ac_files
-do
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
-    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
-  esac
-done
-rm -f $ac_rmfiles
-
-if { (ac_try="$ac_link_default"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link_default") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile.  We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files ''
-do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
-	;;
-    [ab].out )
-	# We found the default executable, but exeext='' is most
-	# certainly right.
-	break;;
-    *.* )
-        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
-	then :; else
-	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-	fi
-	# We set ac_cv_exeext here because the later test for it is not
-	# safe: cross compilers may not add the suffix if given an `-o'
-	# argument, so we may need to know it at that point already.
-	# Even if this section looks crufty: it has the advantage of
-	# actually working.
-	break;;
-    * )
-	break;;
-  esac
-done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
-else
-  ac_file=''
-fi
-
-{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-if test -z "$ac_file"; then
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
-  if { ac_try='./$ac_file'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-    cross_compiling=no
-  else
-    if test "$cross_compiling" = maybe; then
-	cross_compiling=yes
-    else
-	{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-    fi
-  fi
-fi
-{ $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
-$as_echo_n "checking for suffix of executables... " >&6; }
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
-    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-	  break;;
-    * ) break;;
-  esac
-done
-else
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-$as_echo "$ac_cv_exeext" >&6; }
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
-$as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  for ac_file in conftest.o conftest.obj conftest.*; do
-  test -f "$ac_file" || continue;
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
-    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
-       break;;
-  esac
-done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-$as_echo "$ac_cv_objext" >&6; }
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-#ifndef __GNUC__
-       choke me
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_compiler_gnu=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_compiler_gnu=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-$as_echo "$ac_cv_c_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
-  GCC=yes
-else
-  GCC=
-fi
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_save_c_werror_flag=$ac_c_werror_flag
-   ac_c_werror_flag=yes
-   ac_cv_prog_cc_g=no
-   CFLAGS="-g"
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_g=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	CFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_c_werror_flag=$ac_save_c_werror_flag
-	 CFLAGS="-g"
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_g=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_c_werror_flag=$ac_save_c_werror_flag
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-$as_echo "$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
-  CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
-  if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
-  else
-    CFLAGS="-g"
-  fi
-else
-  if test "$GCC" = yes; then
-    CFLAGS="-O2"
-  else
-    CFLAGS=
-  fi
-fi
-{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
-   function prototypes and stuff, but not '\xHH' hex character constants.
-   These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std is added to get
-   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
-   array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std.  */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-   inside strings and character constants.  */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
-_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_c89=$ac_arg
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { $as_echo "$as_me:$LINENO: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
-  xno)
-    { $as_echo "$as_me:$LINENO: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-DEPDIR="${am__leading_dot}deps"
-
-ac_config_commands="$ac_config_commands depfiles"
-
-
-am_make=${MAKE-make}
-cat > confinc << 'END'
-am__doit:
-	@echo this is the am__doit target
-.PHONY: am__doit
-END
-# If we don't find an include directive, just comment out the code.
-{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
-$as_echo_n "checking for style of include used by $am_make... " >&6; }
-am__include="#"
-am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
-     ;;
-   esac
-fi
-
-
-{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5
-$as_echo "$_am_result" >&6; }
-rm -f confinc confmf
-
-# Check whether --enable-dependency-tracking was given.
-if test "${enable_dependency_tracking+set}" = set; then
-  enableval=$enable_dependency_tracking;
-fi
-
-if test "x$enable_dependency_tracking" != xno; then
-  am_depcomp="$ac_aux_dir/depcomp"
-  AMDEPBACKSLASH='\'
-fi
- if test "x$enable_dependency_tracking" != xno; then
-  AMDEP_TRUE=
-  AMDEP_FALSE='#'
-else
-  AMDEP_TRUE='#'
-  AMDEP_FALSE=
-fi
-
-
-
-depcc="$CC"   am_compiler_list=
-
-{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
-$as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
-  # We make a subdir and do the tests there.  Otherwise we can end up
-  # making bogus files that we don't know about and never remove.  For
-  # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
-  mkdir conftest.dir
-  # Copy depcomp to subdir because otherwise we won't find it if we're
-  # using a relative directory.
-  cp "$am_depcomp" conftest.dir
-  cd conftest.dir
-  # We will build objects and dependencies in a subdirectory because
-  # it helps to detect inapplicable dependency modes.  For instance
-  # both Tru64's cc and ICC support -MD to output dependencies as a
-  # side effect of compilation, but ICC will put the dependencies in
-  # the current directory while Tru64 will put them in the object
-  # directory.
-  mkdir sub
-
-  am_cv_CC_dependencies_compiler_type=none
-  if test "$am_compiler_list" = ""; then
-     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
-  fi
-  am__universal=false
-  case " $depcc " in #(
-     *\ -arch\ *\ -arch\ *) am__universal=true ;;
-     esac
-
-  for depmode in $am_compiler_list; do
-    # Setup a source with many dependencies, because some compilers
-    # like to wrap large dependency lists on column 80 (with \), and
-    # we should not choose a depcomp mode which is confused by this.
-    #
-    # We need to recreate these files for each test, as the compiler may
-    # overwrite some of them when testing with obscure command lines.
-    # This happens at least with the AIX C compiler.
-    : > sub/conftest.c
-    for i in 1 2 3 4 5 6; do
-      echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
-    done
-    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
-    # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
-    am__obj=sub/conftest.${OBJEXT-o}
-    am__minus_obj="-o $am__obj"
-    case $depmode in
-    gcc)
-      # This depmode causes a compiler race in universal mode.
-      test "$am__universal" = false || continue
-      ;;
-    nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
-      if test "x$enable_dependency_tracking" = xyes; then
-	continue
-      else
-	break
-      fi
-      ;;
-    msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
-      # not run yet.  These depmodes are late enough in the game, and
-      # so weak that their functioning should not be impacted.
-      am__obj=conftest.${OBJEXT-o}
-      am__minus_obj=
-      ;;
-    none) break ;;
-    esac
-    if depmode=$depmode \
-       source=sub/conftest.c object=$am__obj \
-       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
-         >/dev/null 2>conftest.err &&
-       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
-       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
-      # icc doesn't choke on unknown options, it will just issue warnings
-      # or remarks (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored or not supported.
-      # When given -MP, icc 7.0 and 7.1 complain thusly:
-      #   icc: Command line warning: ignoring option '-M'; no argument required
-      # The diagnosis changed in icc 8.0:
-      #   icc: Command line remark: option '-MP' not supported
-      if (grep 'ignoring option' conftest.err ||
-          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
-        am_cv_CC_dependencies_compiler_type=$depmode
-        break
-      fi
-    fi
-  done
-
-  cd ..
-  rm -rf conftest.dir
-else
-  am_cv_CC_dependencies_compiler_type=none
-fi
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
-$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
-CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
-
- if
-  test "x$enable_dependency_tracking" != xno \
-  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
-  am__fastdepCC_TRUE=
-  am__fastdepCC_FALSE='#'
-else
-  am__fastdepCC_TRUE='#'
-  am__fastdepCC_FALSE=
-fi
-
-
-if test "x$CC" != xcc; then
-  { $as_echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5
-$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
-else
-  { $as_echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5
-$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
-fi
-set dummy $CC; ac_cc=`$as_echo "$2" |
-		      sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-# Make sure it works both with $CC and with simple cc.
-# We do the test twice because some compilers refuse to overwrite an
-# existing .o file with -o, though they will create one.
-ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
-rm -f conftest2.*
-if { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-   test -f conftest2.$ac_objext && { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); };
-then
-  eval ac_cv_prog_cc_${ac_cc}_c_o=yes
-  if test "x$CC" != xcc; then
-    # Test first that cc exists at all.
-    if { ac_try='cc -c conftest.$ac_ext >&5'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-      ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
-      rm -f conftest2.*
-      if { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 test -f conftest2.$ac_objext && { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); };
-      then
-	# cc works too.
-	:
-      else
-	# cc exists but doesn't like -o.
-	eval ac_cv_prog_cc_${ac_cc}_c_o=no
-      fi
-    fi
-  fi
-else
-  eval ac_cv_prog_cc_${ac_cc}_c_o=no
-fi
-rm -f core conftest*
-
-fi
-if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define NO_MINUS_C_MINUS_O 1
-_ACEOF
-
-fi
-
-# FIXME: we rely on the cache variable name because
-# there is no other way.
-set dummy $CC
-am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
-if test "$am_t" != yes; then
-   # Losing compiler, so override with the script.
-   # FIXME: It is wrong to rewrite CC.
-   # But if we don't then we get into trouble of one sort or another.
-   # A longer-term fix would be to have automake use am__CC in this case,
-   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
-   CC="$am_aux_dir/compile $CC"
-fi
-
-
-
-# Find fortran compiler. If FC isn't set after AC_PROG_FC, we couldn't
-# find a fortran compiler. If the user requested the fortran API, then
-# bail out right here.
-{ $as_echo "$as_me:$LINENO: finding Fortran compiler (required, even if Fortran API is not desired)" >&5
-$as_echo "$as_me: finding Fortran compiler (required, even if Fortran API is not desired)" >&6;}
-
-# We must call AC_PROG_F77 here, otherwise the LIBTOOL macro below
-# will call it, and reset F77 to g77.
-ac_ext=f
-ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
-ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_f77_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  for ac_prog in mpxlf_r xlf fort xlf95 ifort ifc efc pgf95 lf95 g95 gfortran f95 frt pgf77 f77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 g77
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_F77+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$F77"; then
-  ac_cv_prog_F77="$F77" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-F77=$ac_cv_prog_F77
-if test -n "$F77"; then
-  { $as_echo "$as_me:$LINENO: result: $F77" >&5
-$as_echo "$F77" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    test -n "$F77" && break
-  done
-fi
-if test -z "$F77"; then
-  ac_ct_F77=$F77
-  for ac_prog in mpxlf_r xlf fort xlf95 ifort ifc efc pgf95 lf95 g95 gfortran f95 frt pgf77 f77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 g77
-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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_F77+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_F77"; then
-  ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_F77="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_F77=$ac_cv_prog_ac_ct_F77
-if test -n "$ac_ct_F77"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
-$as_echo "$ac_ct_F77" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$ac_ct_F77" && break
-done
-
-  if test "x$ac_ct_F77" = x; then
-    F77=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    F77=$ac_ct_F77
-  fi
-fi
-
-
-# Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-rm -f a.out
-
-# If we don't use `.F' as extension, the preprocessor is not run on the
-# input file.  (Note that this only needs to work for GNU compilers.)
-ac_save_ext=$ac_ext
-ac_ext=F
-{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
-$as_echo_n "checking whether we are using the GNU Fortran 77 compiler... " >&6; }
-if test "${ac_cv_f77_compiler_gnu+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-      program main
-#ifndef __GNUC__
-       choke me
-#endif
-
-      end
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_compiler_gnu=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_compiler_gnu=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_f77_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
-$as_echo "$ac_cv_f77_compiler_gnu" >&6; }
-ac_ext=$ac_save_ext
-ac_test_FFLAGS=${FFLAGS+set}
-ac_save_FFLAGS=$FFLAGS
-FFLAGS=
-{ $as_echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
-$as_echo_n "checking whether $F77 accepts -g... " >&6; }
-if test "${ac_cv_prog_f77_g+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  FFLAGS=-g
-cat >conftest.$ac_ext <<_ACEOF
-      program main
-
-      end
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_f77_g=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_prog_f77_g=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
-$as_echo "$ac_cv_prog_f77_g" >&6; }
-if test "$ac_test_FFLAGS" = set; then
-  FFLAGS=$ac_save_FFLAGS
-elif test $ac_cv_prog_f77_g = yes; then
-  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
-    FFLAGS="-g -O2"
-  else
-    FFLAGS="-g"
-  fi
-else
-  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
-    FFLAGS="-O2"
-  else
-    FFLAGS=
-  fi
-fi
-
-if test $ac_compiler_gnu = yes; then
-  G77=yes
-else
-  G77=
-fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-if test "${F77+set}" = set && test "x$F77" = x && test "x$nc_build_fortran" = xyes; then
-   { { $as_echo "$as_me:$LINENO: error: Can't find F77 compiler, and compiler recovery disabled." >&5
-$as_echo "$as_me: error: Can't find F77 compiler, and compiler recovery disabled." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-ac_ext=${ac_fc_srcext-f}
-ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
-ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_fc_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  for ac_prog in mpxlf_r xlf90 fort xlf95 ifort ifc efc pgf95 lf95 g95 gfortran f95 frt pgf77 f77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 g77
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_FC+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$FC"; then
-  ac_cv_prog_FC="$FC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_FC="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-FC=$ac_cv_prog_FC
-if test -n "$FC"; then
-  { $as_echo "$as_me:$LINENO: result: $FC" >&5
-$as_echo "$FC" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    test -n "$FC" && break
-  done
-fi
-if test -z "$FC"; then
-  ac_ct_FC=$FC
-  for ac_prog in mpxlf_r xlf90 fort xlf95 ifort ifc efc pgf95 lf95 g95 gfortran f95 frt pgf77 f77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 g77
-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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_FC+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_FC"; then
-  ac_cv_prog_ac_ct_FC="$ac_ct_FC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_FC="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_FC=$ac_cv_prog_ac_ct_FC
-if test -n "$ac_ct_FC"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_FC" >&5
-$as_echo "$ac_ct_FC" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$ac_ct_FC" && break
-done
-
-  if test "x$ac_ct_FC" = x; then
-    FC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    FC=$ac_ct_FC
-  fi
-fi
-
-
-# Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for Fortran compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-rm -f a.out
-
-# If we don't use `.F' as extension, the preprocessor is not run on the
-# input file.  (Note that this only needs to work for GNU compilers.)
-ac_save_ext=$ac_ext
-ac_ext=F
-{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU Fortran compiler" >&5
-$as_echo_n "checking whether we are using the GNU Fortran compiler... " >&6; }
-if test "${ac_cv_fc_compiler_gnu+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-      program main
-#ifndef __GNUC__
-       choke me
-#endif
-
-      end
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_fc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_compiler_gnu=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_compiler_gnu=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_fc_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_fc_compiler_gnu" >&5
-$as_echo "$ac_cv_fc_compiler_gnu" >&6; }
-ac_ext=$ac_save_ext
-ac_test_FFLAGS=${FCFLAGS+set}
-ac_save_FFLAGS=$FCFLAGS
-FCFLAGS=
-{ $as_echo "$as_me:$LINENO: checking whether $FC accepts -g" >&5
-$as_echo_n "checking whether $FC accepts -g... " >&6; }
-if test "${ac_cv_prog_fc_g+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  FCFLAGS=-g
-cat >conftest.$ac_ext <<_ACEOF
-      program main
-
-      end
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_fc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_fc_g=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_prog_fc_g=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_fc_g" >&5
-$as_echo "$ac_cv_prog_fc_g" >&6; }
-if test "$ac_test_FFLAGS" = set; then
-  FCFLAGS=$ac_save_FFLAGS
-elif test $ac_cv_prog_fc_g = yes; then
-  if test "x$ac_cv_fc_compiler_gnu" = xyes; then
-    FCFLAGS="-g -O2"
-  else
-    FCFLAGS="-g"
-  fi
-else
-  if test "x$ac_cv_fc_compiler_gnu" = xyes; then
-    FCFLAGS="-O2"
-  else
-    FCFLAGS=
-  fi
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-if test "x$nc_build_f90" = xyes; then
-   { $as_echo "$as_me:$LINENO: configuring fortran" >&5
-$as_echo "$as_me: configuring fortran" >&6;}
-   # Some f90 compilers change the case of the mod file names. Others
-   # require special flags to be set to deal with .f90 files. Find out
-   # about this compiler.
-   ac_ext=${ac_fc_srcext-f}
-ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
-ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_fc_compiler_gnu
-
-
-ac_ext=${ac_fc_srcext-f}
-ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
-ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_fc_compiler_gnu
-{ $as_echo "$as_me:$LINENO: checking for Fortran flag to compile .f90 files" >&5
-$as_echo_n "checking for Fortran flag to compile .f90 files... " >&6; }
-if test "${ac_cv_fc_srcext_f90+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_ext=f90
-ac_fcflags_srcext_save=$ac_fcflags_srcext
-ac_fcflags_srcext=
-ac_cv_fc_srcext_f90=unknown
-for ac_flag in none -qsuffix=f=f90 -Tf; do
-  test "x$ac_flag" != xnone && ac_fcflags_srcext="$ac_flag"
-  cat >conftest.$ac_ext <<_ACEOF
-      program main
-
-      end
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_fc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_fc_srcext_f90=$ac_flag; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest.$ac_objext conftest.f90
-ac_fcflags_srcext=$ac_fcflags_srcext_save
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_fc_srcext_f90" >&5
-$as_echo "$ac_cv_fc_srcext_f90" >&6; }
-if test "x$ac_cv_fc_srcext_f90" = xunknown; then
-  { { $as_echo "$as_me:$LINENO: error: Fortran could not compile .f90 files" >&5
-$as_echo "$as_me: error: Fortran could not compile .f90 files" >&2;}
-   { (exit 1); exit 1; }; }
-else
-  ac_fc_srcext=f90
-  if test "x$ac_cv_fc_srcext_f90" = xnone; then
-    ac_fcflags_srcext=""
-    FCFLAGS_f90=""
-  else
-    ac_fcflags_srcext=$ac_cv_fc_srcext_f90
-    FCFLAGS_f90=$ac_cv_fc_srcext_f90
-  fi
-
-
-fi
-ac_ext=${ac_fc_srcext-f}
-ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
-ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_fc_compiler_gnu
-
-   ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-{ $as_echo "$as_me:$LINENO: checking fortran 90 modules inclusion flag" >&5
-$as_echo_n "checking fortran 90 modules inclusion flag... " >&6; }
-if test "${ax_cv_f90_modflag+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_ext=${ac_fc_srcext-f}
-ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
-ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_fc_compiler_gnu
-
-i=0
-while test \( -f tmpdir_$i \) -o \( -d tmpdir_$i \) ; do
-  i=`expr $i + 1`
-done
-mkdir tmpdir_$i
-cd tmpdir_$i
-cat >conftest.$ac_ext <<_ACEOF
-module conftest_module
-   contains
-   subroutine conftest_routine
-   write(*,'(a)') 'gotcha!'
-   end subroutine conftest_routine
-   end module conftest_module
-
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_fc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-cd ..
-ax_cv_f90_modflag="not found"
-for ax_flag in "-I" "-M" "-p"; do
-  if test "$ax_cv_f90_modflag" = "not found" ; then
-    ax_save_FCFLAGS="$FCFLAGS"
-    FCFLAGS="$ax_save_FCFLAGS ${ax_flag}tmpdir_$i"
-    cat >conftest.$ac_ext <<_ACEOF
-program conftest_program
-       use conftest_module
-       call conftest_routine
-       end program conftest_program
-
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_fc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ax_cv_f90_modflag="$ax_flag"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    FCFLAGS="$ax_save_FCFLAGS"
-  fi
-done
-rm -fr tmpdir_$i
-if test "$ax_flag" = "not found" ; then
-  { { $as_echo "$as_me:$LINENO: error: unable to find compiler flag for modules inclusion" >&5
-$as_echo "$as_me: error: unable to find compiler flag for modules inclusion" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ax_cv_f90_modflag" >&5
-$as_echo "$ax_cv_f90_modflag" >&6; }
-   MOD_FLAG=${ax_cv_f90_modflag}
-
-fi
-
-{ $as_echo "$as_me:$LINENO: finding other utilities" >&5
-$as_echo "$as_me: finding other utilities" >&6;}
-
-# Find a good install program.  We prefer a C program (faster),
-# so one script is as good as another.  But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-# Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-$as_echo_n "checking for a BSD-compatible install... " >&6; }
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
-  ./ | .// | /cC/* | \
-  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
-  /usr/ucb/* ) ;;
-  *)
-    # OSF1 and SCO ODT 3.0 have their own names for install.
-    # Don't use installbsd from OSF since it installs stuff as root
-    # by default.
-    for ac_prog in ginstall scoinst install; do
-      for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
-	  if test $ac_prog = install &&
-	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-	    # AIX install.  It has an incompatible calling convention.
-	    :
-	  elif test $ac_prog = install &&
-	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-	    # program-specific install script used by HP pwplus--don't use.
-	    :
-	  else
-	    rm -rf conftest.one conftest.two conftest.dir
-	    echo one > conftest.one
-	    echo two > conftest.two
-	    mkdir conftest.dir
-	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
-	      test -s conftest.one && test -s conftest.two &&
-	      test -s conftest.dir/conftest.one &&
-	      test -s conftest.dir/conftest.two
-	    then
-	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-	      break 3
-	    fi
-	  fi
-	fi
-      done
-    done
-    ;;
-esac
-
-done
-IFS=$as_save_IFS
-
-rm -rf conftest.one conftest.two conftest.dir
-
-fi
-  if test "${ac_cv_path_install+set}" = set; then
-    INSTALL=$ac_cv_path_install
-  else
-    # As a last resort, use the slow shell script.  Don't cache a
-    # value for INSTALL within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the value is a relative name.
-    INSTALL=$ac_install_sh
-  fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
-$as_echo "$INSTALL" >&6; }
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
-{ $as_echo "$as_me:$LINENO: setting up libtool" >&5
-$as_echo "$as_me: setting up libtool" >&6;}
-
-# Produce a windows DLL. This macro must be before AM_PROG_LIBTOOL.
-enable_win32_dll=yes
-
-case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32*)
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
-set dummy ${ac_tool_prefix}as; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AS+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$AS"; then
-  ac_cv_prog_AS="$AS" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AS="${ac_tool_prefix}as"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-AS=$ac_cv_prog_AS
-if test -n "$AS"; then
-  { $as_echo "$as_me:$LINENO: result: $AS" >&5
-$as_echo "$AS" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_AS"; then
-  ac_ct_AS=$AS
-  # Extract the first word of "as", so it can be a program name with args.
-set dummy as; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_AS+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_AS"; then
-  ac_cv_prog_ac_ct_AS="$ac_ct_AS" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_AS="as"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_AS=$ac_cv_prog_ac_ct_AS
-if test -n "$ac_ct_AS"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
-$as_echo "$ac_ct_AS" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_AS" = x; then
-    AS="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    AS=$ac_ct_AS
-  fi
-else
-  AS="$ac_cv_prog_AS"
-fi
-
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dlltool; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DLLTOOL+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-DLLTOOL=$ac_cv_prog_DLLTOOL
-if test -n "$DLLTOOL"; then
-  { $as_echo "$as_me:$LINENO: result: $DLLTOOL" >&5
-$as_echo "$DLLTOOL" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_DLLTOOL"; then
-  ac_ct_DLLTOOL=$DLLTOOL
-  # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_DLLTOOL"; then
-  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
-if test -n "$ac_ct_DLLTOOL"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5
-$as_echo "$ac_ct_DLLTOOL" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_DLLTOOL" = x; then
-    DLLTOOL="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    DLLTOOL=$ac_ct_DLLTOOL
-  fi
-else
-  DLLTOOL="$ac_cv_prog_DLLTOOL"
-fi
-
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
-set dummy ${ac_tool_prefix}objdump; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJDUMP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$OBJDUMP"; then
-  ac_cv_prog_OBJDUMP="$OBJDUMP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-OBJDUMP=$ac_cv_prog_OBJDUMP
-if test -n "$OBJDUMP"; then
-  { $as_echo "$as_me:$LINENO: result: $OBJDUMP" >&5
-$as_echo "$OBJDUMP" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_OBJDUMP"; then
-  ac_ct_OBJDUMP=$OBJDUMP
-  # Extract the first word of "objdump", so it can be a program name with args.
-set dummy objdump; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_OBJDUMP"; then
-  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_OBJDUMP="objdump"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
-if test -n "$ac_ct_OBJDUMP"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
-$as_echo "$ac_ct_OBJDUMP" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_OBJDUMP" = x; then
-    OBJDUMP="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    OBJDUMP=$ac_ct_OBJDUMP
-  fi
-else
-  OBJDUMP="$ac_cv_prog_OBJDUMP"
-fi
-
-  ;;
-esac
-
-test -z "$AS" && AS=as
-
-
-
-
-
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-
-
-
-
-
-test -z "$OBJDUMP" && OBJDUMP=objdump
-
-
-
-
-
-
-
-
-# Use libtool.
-case `pwd` in
-  *\ * | *\	*)
-    { $as_echo "$as_me:$LINENO: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
-$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
-esac
-
-
-
-macro_version='2.2.4'
-macro_revision='1.2976'
-
-
-
-
-
-
-
-
-
-
-
-
-
-ltmain="$ac_aux_dir/ltmain.sh"
-
-{ $as_echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
-$as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if test "${ac_cv_path_SED+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
-     for ac_i in 1 2 3 4 5 6 7; do
-       ac_script="$ac_script$as_nl$ac_script"
-     done
-     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
-     $as_unset ac_script || ac_script=
-     if test -z "$SED"; then
-  ac_path_SED_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  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_prog in sed gsed; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
-# Check for GNU ac_path_SED and select it if it is found.
-  # Check for GNU $ac_path_SED
-case `"$ac_path_SED" --version 2>&1` in
-*GNU*)
-  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo '' >> "conftest.nl"
-    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
-    if test $ac_count -gt ${ac_path_SED_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_SED="$ac_path_SED"
-      ac_path_SED_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_SED_found && break 3
-    done
-  done
-done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_SED"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable sed could be found in \$PATH" >&5
-$as_echo "$as_me: error: no acceptable sed could be found in \$PATH" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-else
-  ac_cv_path_SED=$SED
-fi
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5
-$as_echo "$ac_cv_path_SED" >&6; }
- SED="$ac_cv_path_SED"
-  rm -f conftest.sed
-
-test -z "$SED" && SED=sed
-Xsed="$SED -e 1s/^X//"
-
-
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -z "$GREP"; then
-  ac_path_GREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_prog in grep ggrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
-# Check for GNU ac_path_GREP and select it if it is found.
-  # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'GREP' >> "conftest.nl"
-    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
-    if test $ac_count -gt ${ac_path_GREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_GREP="$ac_path_GREP"
-      ac_path_GREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_GREP_found && break 3
-    done
-  done
-done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_GREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-else
-  ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
-   then ac_cv_path_EGREP="$GREP -E"
-   else
-     if test -z "$EGREP"; then
-  ac_path_EGREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_prog in egrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
-# Check for GNU ac_path_EGREP and select it if it is found.
-  # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'EGREP' >> "conftest.nl"
-    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
-    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_EGREP="$ac_path_EGREP"
-      ac_path_EGREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_EGREP_found && break 3
-    done
-  done
-done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_EGREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-else
-  ac_cv_path_EGREP=$EGREP
-fi
-
-   fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-{ $as_echo "$as_me:$LINENO: checking for fgrep" >&5
-$as_echo_n "checking for fgrep... " >&6; }
-if test "${ac_cv_path_FGREP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
-   then ac_cv_path_FGREP="$GREP -F"
-   else
-     if test -z "$FGREP"; then
-  ac_path_FGREP_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_prog in fgrep; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
-# Check for GNU ac_path_FGREP and select it if it is found.
-  # Check for GNU $ac_path_FGREP
-case `"$ac_path_FGREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo 'FGREP' >> "conftest.nl"
-    "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
-    if test $ac_count -gt ${ac_path_FGREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_FGREP="$ac_path_FGREP"
-      ac_path_FGREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_FGREP_found && break 3
-    done
-  done
-done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_FGREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-else
-  ac_cv_path_FGREP=$FGREP
-fi
-
-   fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_FGREP" >&5
-$as_echo "$ac_cv_path_FGREP" >&6; }
- FGREP="$ac_cv_path_FGREP"
-
-
-test -z "$GREP" && GREP=grep
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# Check whether --with-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then
-  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
-else
-  with_gnu_ld=no
-fi
-
-ac_prog=ld
-if test "$GCC" = yes; then
-  # Check if gcc -print-prog-name=ld gives a path.
-  { $as_echo "$as_me:$LINENO: checking for ld used by $CC" >&5
-$as_echo_n "checking for ld used by $CC... " >&6; }
-  case $host in
-  *-*-mingw*)
-    # gcc leaves a trailing carriage return which upsets mingw
-    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
-  *)
-    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
-  esac
-  case $ac_prog in
-    # Accept absolute paths.
-    [\\/]* | ?:[\\/]*)
-      re_direlt='/[^/][^/]*/\.\./'
-      # Canonicalize the pathname of ld
-      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
-      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
-	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
-      done
-      test -z "$LD" && LD="$ac_prog"
-      ;;
-  "")
-    # If it fails, then pretend we aren't using GCC.
-    ac_prog=ld
-    ;;
-  *)
-    # If it is relative, then search for the first ld in PATH.
-    with_gnu_ld=unknown
-    ;;
-  esac
-elif test "$with_gnu_ld" = yes; then
-  { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5
-$as_echo_n "checking for GNU ld... " >&6; }
-else
-  { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5
-$as_echo_n "checking for non-GNU ld... " >&6; }
-fi
-if test "${lt_cv_path_LD+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -z "$LD"; then
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  for ac_dir in $PATH; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
-      lt_cv_path_LD="$ac_dir/$ac_prog"
-      # Check to see if the program is GNU ld.  I'd rather use --version,
-      # but apparently some variants of GNU ld only accept -v.
-      # Break only if it was the GNU/non-GNU ld that we prefer.
-      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
-      *GNU* | *'with BFD'*)
-	test "$with_gnu_ld" != no && break
-	;;
-      *)
-	test "$with_gnu_ld" != yes && break
-	;;
-      esac
-    fi
-  done
-  IFS="$lt_save_ifs"
-else
-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
-fi
-fi
-
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
-  { $as_echo "$as_me:$LINENO: result: $LD" >&5
-$as_echo "$LD" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
-$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
-   { (exit 1); exit 1; }; }
-{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
-$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if test "${lt_cv_prog_gnu_ld+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  # I'd rather use --version here, but apparently some GNU lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
-  lt_cv_prog_gnu_ld=yes
-  ;;
-*)
-  lt_cv_prog_gnu_ld=no
-  ;;
-esac
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
-$as_echo "$lt_cv_prog_gnu_ld" >&6; }
-with_gnu_ld=$lt_cv_prog_gnu_ld
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5
-$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
-if test "${lt_cv_path_NM+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$NM"; then
-  # Let the user override the test.
-  lt_cv_path_NM="$NM"
-else
-  lt_nm_to_check="${ac_tool_prefix}nm"
-  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
-    lt_nm_to_check="$lt_nm_to_check nm"
-  fi
-  for lt_tmp_nm in $lt_nm_to_check; do
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
-      IFS="$lt_save_ifs"
-      test -z "$ac_dir" && ac_dir=.
-      tmp_nm="$ac_dir/$lt_tmp_nm"
-      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
-	# Check to see if the nm accepts a BSD-compat flag.
-	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
-	#   nm: unknown option "B" ignored
-	# Tru64's nm complains that /dev/null is an invalid object file
-	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
-	*/dev/null* | *'Invalid file or object type'*)
-	  lt_cv_path_NM="$tmp_nm -B"
-	  break
-	  ;;
-	*)
-	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
-	  */dev/null*)
-	    lt_cv_path_NM="$tmp_nm -p"
-	    break
-	    ;;
-	  *)
-	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
-	    continue # so that we can try to find one that supports BSD flags
-	    ;;
-	  esac
-	  ;;
-	esac
-      fi
-    done
-    IFS="$lt_save_ifs"
-  done
-  : ${lt_cv_path_NM=no}
-fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
-$as_echo "$lt_cv_path_NM" >&6; }
-if test "$lt_cv_path_NM" != "no"; then
-  NM="$lt_cv_path_NM"
-else
-  # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DUMPBIN+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$DUMPBIN"; then
-  ac_cv_prog_DUMPBIN="$DUMPBIN" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-DUMPBIN=$ac_cv_prog_DUMPBIN
-if test -n "$DUMPBIN"; then
-  { $as_echo "$as_me:$LINENO: result: $DUMPBIN" >&5
-$as_echo "$DUMPBIN" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
 
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
 
-    test -n "$DUMPBIN" && break
-  done
-fi
-if test -z "$DUMPBIN"; then
-  ac_ct_DUMPBIN=$DUMPBIN
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
-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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_DUMPBIN"; then
-  ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
+ac_prev=
+ac_dashdash=
+for ac_option
 do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
-if test -n "$ac_ct_DUMPBIN"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5
-$as_echo "$ac_ct_DUMPBIN" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$ac_ct_DUMPBIN" && break
-done
-
-  if test "x$ac_ct_DUMPBIN" = x; then
-    DUMPBIN=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    DUMPBIN=$ac_ct_DUMPBIN
-  fi
-fi
-
-
-  if test "$DUMPBIN" != ":"; then
-    NM="$DUMPBIN"
-  fi
-fi
-test -z "$NM" && NM=nm
-
-
-
-
-
-
-{ $as_echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5
-$as_echo_n "checking the name lister ($NM) interface... " >&6; }
-if test "${lt_cv_nm_interface+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_nm_interface="BSD nm"
-  echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:5954: $ac_compile\"" >&5)
-  (eval "$ac_compile" 2>conftest.err)
-  cat conftest.err >&5
-  (eval echo "\"\$as_me:5957: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
-  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
-  cat conftest.err >&5
-  (eval echo "\"\$as_me:5960: output\"" >&5)
-  cat conftest.out >&5
-  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
-    lt_cv_nm_interface="MS dumpbin"
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
   fi
-  rm -f conftest*
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5
-$as_echo "$lt_cv_nm_interface" >&6; }
-
-{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5
-$as_echo_n "checking whether ln -s works... " >&6; }
-LN_S=$as_ln_s
-if test "$LN_S" = "ln -s"; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-$as_echo "no, using $LN_S" >&6; }
-fi
-
-# find the maximum length of command line arguments
-{ $as_echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
-$as_echo_n "checking the maximum length of command line arguments... " >&6; }
-if test "${lt_cv_sys_max_cmd_len+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-    i=0
-  teststring="ABCD"
-
-  case $build_os in
-  msdosdjgpp*)
-    # On DJGPP, this test can blow up pretty badly due to problems in libc
-    # (any single argument exceeding 2000 bytes causes a buffer overrun
-    # during glob expansion).  Even if it were fixed, the result of this
-    # check would be larger than it should be.
-    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
-    ;;
-
-  gnu*)
-    # Under GNU Hurd, this test is not required because there is
-    # no limit to the length of command line arguments.
-    # Libtool will interpret -1 as no limit whatsoever
-    lt_cv_sys_max_cmd_len=-1;
-    ;;
-
-  cygwin* | mingw*)
-    # On Win9x/ME, this test blows up -- it succeeds, but takes
-    # about 5 minutes as the teststring grows exponentially.
-    # Worse, since 9x/ME are not pre-emptively multitasking,
-    # you end up with a "frozen" computer, even though with patience
-    # the test eventually succeeds (with a max line length of 256k).
-    # Instead, let's just punt: use the minimum linelength reported by
-    # all of the supported platforms: 8192 (on NT/2K/XP).
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
-  amigaos*)
-    # On AmigaOS with pdksh, this test takes hours, literally.
-    # So we just punt and use a minimum line length of 8192.
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
 
-  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
-    # This has been around since 386BSD, at least.  Likely further.
-    if test -x /sbin/sysctl; then
-      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
-    elif test -x /usr/sbin/sysctl; then
-      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
-    else
-      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
-    fi
-    # And add a safety zone
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
-    ;;
+  case $ac_option in
+  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *=)   ac_optarg= ;;
+  *)    ac_optarg=yes ;;
+  esac
 
-  interix*)
-    # We know the value 262144 and hardcode it with a safety zone (like BSD)
-    lt_cv_sys_max_cmd_len=196608
-    ;;
+  # Accept the important Cygnus configure options, so we can diagnose typos.
 
-  osf*)
-    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
-    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
-    # nice to cause kernel panics so lets avoid the loop below.
-    # First set a reasonable default.
-    lt_cv_sys_max_cmd_len=16384
-    #
-    if test -x /sbin/sysconfig; then
-      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
-        *1*) lt_cv_sys_max_cmd_len=-1 ;;
-      esac
-    fi
-    ;;
-  sco3.2v5*)
-    lt_cv_sys_max_cmd_len=102400
-    ;;
-  sysv5* | sco5v6* | sysv4.2uw2*)
-    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
-    if test -n "$kargmax"; then
-      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[	 ]//'`
-    else
-      lt_cv_sys_max_cmd_len=32768
-    fi
-    ;;
-  *)
-    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
-    if test -n "$lt_cv_sys_max_cmd_len"; then
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
-    else
-      # Make teststring a little bigger before we do anything with it.
-      # a 1K string should be a reasonable start.
-      for i in 1 2 3 4 5 6 7 8 ; do
-        teststring=$teststring$teststring
-      done
-      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
-      # If test is not a shell built-in, we'll probably end up computing a
-      # maximum length that is only half of the actual maximum length, but
-      # we can't tell.
-      while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
-	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
-	      test $i != 17 # 1/2 MB should be enough
-      do
-        i=`expr $i + 1`
-        teststring=$teststring$teststring
-      done
-      # Only check the string length outside the loop.
-      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
-      teststring=
-      # Add a significant safety factor because C++ compilers can tack on
-      # massive amounts of additional arguments before passing them to the
-      # linker.  It appears as though 1/2 is a usable value.
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
-    fi
-    ;;
-  esac
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
 
-fi
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
 
-if test -n $lt_cv_sys_max_cmd_len ; then
-  { $as_echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
-$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: none" >&5
-$as_echo "none" >&6; }
-fi
-max_cmd_len=$lt_cv_sys_max_cmd_len
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
 
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
 
+  --config-cache | -C)
+    cache_file=config.cache ;;
 
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
 
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
 
+  -disable-* | --disable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=no ;;
 
-: ${CP="cp -f"}
-: ${MV="mv -f"}
-: ${RM="rm -f"}
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
 
-{ $as_echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5
-$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
-# Try some XSI features
-xsi_shell=no
-( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,, \
-    && eval 'test $(( 1 + 1 )) -eq 2 \
-    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
-  && xsi_shell=yes
-{ $as_echo "$as_me:$LINENO: result: $xsi_shell" >&5
-$as_echo "$xsi_shell" >&6; }
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
 
+  -enable-* | --enable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=\$ac_optarg ;;
 
-{ $as_echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5
-$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
-lt_shell_append=no
-( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
-    >/dev/null 2>&1 \
-  && lt_shell_append=yes
-{ $as_echo "$as_me:$LINENO: result: $lt_shell_append" >&5
-$as_echo "$lt_shell_append" >&6; }
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
 
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
 
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  lt_unset=unset
-else
-  lt_unset=false
-fi
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
 
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
 
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
 
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
 
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
 
-# test EBCDIC or ASCII
-case `echo X|tr X '\101'` in
- A) # ASCII based system
-    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
-  lt_SP2NL='tr \040 \012'
-  lt_NL2SP='tr \015\012 \040\040'
-  ;;
- *) # EBCDIC based system
-  lt_SP2NL='tr \100 \n'
-  lt_NL2SP='tr \r\n \100\100'
-  ;;
-esac
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
 
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
 
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
 
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    localstatedir=$ac_optarg ;;
 
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
 
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
 
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
 
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
 
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
 
-{ $as_echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
-$as_echo_n "checking for $LD option to reload object files... " >&6; }
-if test "${lt_cv_ld_reload_flag+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_ld_reload_flag='-r'
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
-$as_echo "$lt_cv_ld_reload_flag" >&6; }
-reload_flag=$lt_cv_ld_reload_flag
-case $reload_flag in
-"" | " "*) ;;
-*) reload_flag=" $reload_flag" ;;
-esac
-reload_cmds='$LD$reload_flag -o $output$reload_objs'
-case $host_os in
-  darwin*)
-    if test "$GCC" = yes; then
-      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
-    else
-      reload_cmds='$LD$reload_flag -o $output$reload_objs'
-    fi
-    ;;
-esac
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
 
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
 
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
 
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
 
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
 
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
 
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
 
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
 
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
 
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
 
-{ $as_echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
-$as_echo_n "checking how to recognize dependent libraries... " >&6; }
-if test "${lt_cv_deplibs_check_method+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_file_magic_cmd='$MAGIC_CMD'
-lt_cv_file_magic_test_file=
-lt_cv_deplibs_check_method='unknown'
-# Need to set the preceding variable on all platforms that support
-# interlibrary dependencies.
-# 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
-# 'pass_all' -- all dependencies passed with no checks.
-# 'test_compile' -- check by making test program.
-# 'file_magic [[regex]]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given extended regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
 
-case $host_os in
-aix[4-9]*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+  -with-* | --with-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=\$ac_optarg ;;
 
-beos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+  -without-* | --without-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=no ;;
 
-bsdi[45]*)
-  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
-  lt_cv_file_magic_cmd='/usr/bin/file -L'
-  lt_cv_file_magic_test_file=/shlib/libc.so
-  ;;
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
 
-cygwin*)
-  # func_win32_libid is a shell function defined in ltmain.sh
-  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-  lt_cv_file_magic_cmd='func_win32_libid'
-  ;;
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
 
-mingw* | pw32*)
-  # Base MSYS/MinGW do not provide the 'file' command needed by
-  # func_win32_libid shell function, so use a weaker test based on 'objdump',
-  # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
-    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-    lt_cv_file_magic_cmd='func_win32_libid'
-  else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
-    lt_cv_file_magic_cmd='$OBJDUMP -f'
-  fi
-  ;;
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
 
-darwin* | rhapsody*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+  -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+    ;;
 
-freebsd* | dragonfly*)
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
-    case $host_cpu in
-    i*86 )
-      # Not sure whether the presence of OpenBSD here was a mistake.
-      # Let's accept both of them until this is cleared up.
-      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
-      lt_cv_file_magic_cmd=/usr/bin/file
-      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
-      ;;
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
     esac
-  else
-    lt_cv_deplibs_check_method=pass_all
-  fi
-  ;;
-
-gnu*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
 
-hpux10.20* | hpux11*)
-  lt_cv_file_magic_cmd=/usr/bin/file
-  case $host_cpu in
-  ia64*)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
-    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
-    ;;
-  hppa*64*)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
-    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
-    ;;
   *)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
-    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    # FIXME: should be removed in autoconf 3.0.
+    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
     ;;
-  esac
-  ;;
-
-interix[3-9]*)
-  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
-  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
-  ;;
 
-irix5* | irix6* | nonstopux*)
-  case $LD in
-  *-32|*"-32 ") libmagic=32-bit;;
-  *-n32|*"-n32 ") libmagic=N32;;
-  *-64|*"-64 ") libmagic=64-bit;;
-  *) libmagic=never-match;;
   esac
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-netbsd*)
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
-    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
-  else
-    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
-  fi
-  ;;
-
-newos6*)
-  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
-  lt_cv_file_magic_cmd=/usr/bin/file
-  lt_cv_file_magic_test_file=/usr/lib/libnls.so
-  ;;
-
-*nto* | *qnx*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-openbsd*)
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
-  else
-    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
-  fi
-  ;;
-
-osf3* | osf4* | osf5*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-rdos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+done
 
-solaris*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  as_fn_error $? "missing argument to $ac_option"
+fi
 
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+  esac
+fi
 
-sysv4 | sysv4.3*)
-  case $host_vendor in
-  motorola)
-    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
-    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
-    ;;
-  ncr)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  sequent)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
-    ;;
-  sni)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
-    lt_cv_file_magic_test_file=/lib/libc.so
-    ;;
-  siemens)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  pc)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
+# Check all directory arguments for consistency.
+for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
+		datadir sysconfdir sharedstatedir localstatedir includedir \
+		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+		libdir localedir mandir
+do
+  eval ac_val=\$$ac_var
+  # Remove trailing slashes.
+  case $ac_val in
+    */ )
+      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+      eval $ac_var=\$ac_val;;
   esac
-  ;;
+  # Be sure to have absolute directory names.
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
 
-tpf*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-esac
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
 
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used" >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
-$as_echo "$lt_cv_deplibs_check_method" >&6; }
-file_magic_cmd=$lt_cv_file_magic_cmd
-deplibs_check_method=$lt_cv_deplibs_check_method
-test -z "$deplibs_check_method" && deplibs_check_method=unknown
 
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
 
+test "$silent" = yes && exec 6>/dev/null
 
 
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  as_fn_error $? "pwd does not report name of working directory"
 
 
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_myself" : 'X\(//\)[^/]' \| \
+	 X"$as_myself" : 'X\(//\)$' \| \
+	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r "$srcdir/$ac_unique_file"; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+	pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
 
+#
+# Report the --help message.
+#
+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 libcf 1.0-beta10 to adapt to many kinds of systems.
 
+Usage: $0 [OPTION]... [VAR=VALUE]...
 
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
 
+Defaults for the options are specified in brackets.
 
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking ...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
 
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AR+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$AR"; then
-  ac_cv_prog_AR="$AR" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AR="${ac_tool_prefix}ar"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
 
-fi
-fi
-AR=$ac_cv_prog_AR
-if test -n "$AR"; then
-  { $as_echo "$as_me:$LINENO: result: $AR" >&5
-$as_echo "$AR" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
 
+For better control, use the options below.
 
-fi
-if test -z "$ac_cv_prog_AR"; then
-  ac_ct_AR=$AR
-  # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_AR"; then
-  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_AR="ar"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+Fine tuning of the installation directories:
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/libcf]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
+_ACEOF
 
-fi
-fi
-ac_ct_AR=$ac_cv_prog_ac_ct_AR
-if test -n "$ac_ct_AR"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
-$as_echo "$ac_ct_AR" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
+  cat <<\_ACEOF
 
-  if test "x$ac_ct_AR" = x; then
-    AR="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    AR=$ac_ct_AR
-  fi
-else
-  AR="$ac_cv_prog_AR"
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
 fi
 
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of libcf 1.0-beta10:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-docs           build the libcf documentation (a built version is
+                          already included with the distrubution)
+  --enable-gridspec-file-tests
+                          get GRIDSPEC test data from Unidata FTP server and
+                          run extra tests
+  --enable-logging        enable logging capability. This debugging features
+                          is only of interest to libcf developers.
+  --enable-parallel       enable parallel processing in GRIDSPEC code.
+  --enable-parallel-tests Run extra parallel tests. Ignored if parallel
+                          processing is not enabled.
+  --enable-extra-data-tests
+                          Perform extra tests using CF example files from
+                          Unidata web site (example files must be donloaded
+                          separately). This option should only be used by
+                          those with excessive interest in testing libcf.
+  --disable-regrid        "don't try to build regrid API"
+  --disable-f90           "don't try to build Fortran 90 API"
+  --enable-shared[=PKGS]  build shared libraries [default=yes]
+  --enable-static[=PKGS]  build static libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
+  --disable-libtool-lock  avoid locking (might break parallel builds)
+  --disable-largefile     omit support for large files
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-netcdf=<directory>
+                          Specify location of netCDF library. Configure will
+                          expect to find subdirs include and lib.
+  --with-lapack-libdir=<directory>
+                          Specify location of LAPACK library, required for
+                          interpolation and regridding.
+  --with-blas-lib=<path>  Specify path to blas library, required for
+                          interpolation and regridding.
+  --with-lapack-lib=<path>
+                          Specify path to lapack library, required for
+                          interpolation and regridding.
+  --with-pic              try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-sysroot=DIR Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).
 
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  FC          Fortran compiler command
+  FCFLAGS     Fortran compiler flags
+  CPP         C preprocessor
 
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
 
+Report bugs to <pletzer at txcorp.com>.
+_ACEOF
+ac_status=$?
+fi
 
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+      continue
+    ac_builddir=.
 
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
 
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
 
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
+    else
+      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
 
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+libcf configure 1.0-beta10
+generated by GNU Autoconf 2.68
 
+Copyright (C) 2010 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
 
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
 
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$STRIP"; then
-  ac_cv_prog_STRIP="$STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
   fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
-  { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
+	ac_retval=1
 fi
-if test -z "$ac_cv_prog_STRIP"; then
-  ac_ct_STRIP=$STRIP
-  # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_STRIP"; then
-  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_STRIP="strip"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
 
-fi
-fi
-ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
-if test -n "$ac_ct_STRIP"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-$as_echo "$ac_ct_STRIP" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
+} # ac_fn_c_try_compile
 
-  if test "x$ac_ct_STRIP" = x; then
-    STRIP=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
+# ac_fn_fc_try_compile LINENO
+# ---------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_fc_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
 esac
-    STRIP=$ac_ct_STRIP
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
   fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_fc_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
 else
-  STRIP="$ac_cv_prog_STRIP"
-fi
-
-test -z "$STRIP" && STRIP=:
-
-
-
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
+	ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
 
+} # ac_fn_fc_try_compile
 
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
   fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
-  { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5
-$as_echo "$RANLIB" >&6; }
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
+	ac_retval=1
 fi
-if test -z "$ac_cv_prog_RANLIB"; then
-  ac_ct_RANLIB=$RANLIB
-  # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_RANLIB"; then
-  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_RANLIB="ranlib"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
 
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-$as_echo "$ac_ct_RANLIB" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
+} # ac_fn_c_try_link
 
-  if test "x$ac_ct_RANLIB" = x; then
-    RANLIB=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
+# ac_fn_fc_try_link LINENO
+# ------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_fc_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
 esac
-    RANLIB=$ac_ct_RANLIB
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
   fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_fc_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
 else
-  RANLIB="$ac_cv_prog_RANLIB"
-fi
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-test -z "$RANLIB" && RANLIB=:
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
 
+} # ac_fn_fc_try_link
 
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
+    ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
 
+} # ac_fn_c_try_cpp
 
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if eval \${$3+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
 
-# Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
-old_postinstall_cmds='chmod 644 $oldlib'
-old_postuninstall_cmds=
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
-if test -n "$RANLIB"; then
-  case $host_os in
-  openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
     ;;
-  *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## --------------------------------- ##
+## Report this to pletzer at txcorp.com ##
+## --------------------------------- ##"
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
-  esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
+} # ac_fn_c_check_header_mongrel
 
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
 
+} # ac_fn_c_try_run
 
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
+} # ac_fn_c_check_header_compile
 
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
 
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
 
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
 
+#undef $2
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
 
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
+} # ac_fn_c_check_func
 
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+if (sizeof ($2))
+	 return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+if (sizeof (($2)))
+	    return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
 
+else
+  eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
+} # ac_fn_c_check_type
 
+# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
+# ----------------------------------------------------
+# Tries to find if the field MEMBER exists in type AGGR, after including
+# INCLUDES, setting cache variable VAR accordingly.
+ac_fn_c_check_member ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
+$as_echo_n "checking for $2.$3... " >&6; }
+if eval \${$4+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+static $2 ac_aggr;
+if (ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+static $2 ac_aggr;
+if (sizeof ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  eval "$4=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$4
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
+} # ac_fn_c_check_member
 
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if test "$cross_compiling" = yes; then
+    # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid; break
+else
+  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=$ac_mid; break
+else
+  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid
+else
+  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+  else
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
 
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (($2) < 0)
+    {
+      long int i = longval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+  ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
 
+  fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
 
+} # ac_fn_c_compute_int
+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 libcf $as_me 1.0-beta10, which was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
+  $ $0 $@
 
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
 
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
 
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
 
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
 
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+_ASUNAME
 
-# Allow CC to be a program name with arguments.
-compiler=$CC
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    $as_echo "PATH: $as_dir"
+  done
+IFS=$as_save_IFS
 
+} >&5
 
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-{ $as_echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
-$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
-if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
+cat >&5 <<_ACEOF
 
-# These are sane defaults that work on at least a few old systems.
-# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
 
-# Character class describing NM global symbol codes.
-symcode='[BCDEGRST]'
+## ----------- ##
+## Core tests. ##
+## ----------- ##
 
-# Regexp to match symbols that can be accessed directly from C.
-sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+_ACEOF
 
-# Define system-specific variables.
-case $host_os in
-aix*)
-  symcode='[BCDT]'
-  ;;
-cygwin* | mingw* | pw32*)
-  symcode='[ABCDGISTW]'
-  ;;
-hpux*)
-  if test "$host_cpu" = ia64; then
-    symcode='[ABCDEGRST]'
-  fi
-  ;;
-irix* | nonstopux*)
-  symcode='[BCDEGRST]'
-  ;;
-osf*)
-  symcode='[BCDEGQRST]'
-  ;;
-solaris*)
-  symcode='[BDRT]'
-  ;;
-sco3.2v5*)
-  symcode='[DT]'
-  ;;
-sysv4.2uw2*)
-  symcode='[DT]'
-  ;;
-sysv5* | sco5v6* | unixware* | OpenUNIX*)
-  symcode='[ABDT]'
-  ;;
-sysv4)
-  symcode='[DFNSTU]'
-  ;;
-esac
 
-# If we're using GNU nm, then use its standard symbol codes.
-case `$NM -V 2>&1` in
-*GNU* | *'with BFD'*)
-  symcode='[ABCDGIRSTW]' ;;
-esac
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+    2)
+      as_fn_append ac_configure_args1 " '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      as_fn_append ac_configure_args " '$ac_arg'"
+      ;;
+    esac
+  done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
 
-# Transform an extracted symbol line into a proper C declaration.
-# Some systems (esp. on ia64) link data and code symbols differently,
-# so use this general approach.
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
 
-# Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+    $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
 
-# Handle CRLF in mingw tool chain
-opt_cr=
-case $build_os in
-mingw*)
-  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
-  ;;
-esac
+    $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      $as_echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
 
-# Try without a prefix underscore, then with it.
-for ac_symprfx in "" "_"; do
+    if test -n "$ac_subst_files"; then
+      $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	$as_echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
 
-  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
-  symxfrm="\\1 $ac_symprfx\\2 \\2"
+    if test -s confdefs.h; then
+      $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
 
-  # Write the raw and C identifiers.
-  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-    # Fake it for dumpbin and say T for any non-static function
-    # and D for any global variable.
-    # Also find C++ and __fastcall symbols from MSVC++,
-    # which start with @ or ?.
-    lt_cv_sys_global_symbol_pipe="$AWK '"\
-"     {last_section=section; section=\$ 3};"\
-"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
-"     \$ 0!~/External *\|/{next};"\
-"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
-"     {if(hide[section]) next};"\
-"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
-"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
-"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
-"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
-"     ' prfx=^$ac_symprfx"
-  else
-    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
-  fi
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
 
-  # Check to see that the pipe works correctly.
-  pipe_works=no
+$as_echo "/* confdefs.h */" > confdefs.h
 
-  rm -f conftest*
-  cat > conftest.$ac_ext <<_LT_EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(void);
-void nm_test_func(void){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
-_LT_EOF
+# Predefined preprocessor variables.
 
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-    # Now try to grab the symbols.
-    nlist=conftest.nm
-    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
-  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s "$nlist"; then
-      # Try sorting and uniquifying the output.
-      if sort "$nlist" | uniq > "$nlist"T; then
-	mv -f "$nlist"T "$nlist"
-      else
-	rm -f "$nlist"T
-      fi
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
 
-      # Make sure that we snagged all the symbols we need.
-      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
-	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
-	  cat <<_LT_EOF > conftest.$ac_ext
-#ifdef __cplusplus
-extern "C" {
-#endif
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
 
-_LT_EOF
-	  # Now generate the symbol file.
-	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
 
-	  cat <<_LT_EOF >> conftest.$ac_ext
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
 
-/* The mapping between symbol names and symbols.  */
-const struct {
-  const char *name;
-  void       *address;
-}
-lt__PROGRAM__LTX_preloaded_symbols[] =
-{
-  { "@PROGRAM@", (void *) 0 },
-_LT_EOF
-	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
-	  cat <<\_LT_EOF >> conftest.$ac_ext
-  {0, (void *) 0}
-};
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
 
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
-  return lt__PROGRAM__LTX_preloaded_symbols;
-}
-#endif
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
 
-#ifdef __cplusplus
-}
-#endif
-_LT_EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_save_LIBS="$LIBS"
-	  lt_save_CFLAGS="$CFLAGS"
-	  LIBS="conftstm.$ac_objext"
-	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
-	  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s conftest${ac_exeext}; then
-	    pipe_works=yes
-	  fi
-	  LIBS="$lt_save_LIBS"
-	  CFLAGS="$lt_save_CFLAGS"
-	else
-	  echo "cannot find nm_test_func in $nlist" >&5
-	fi
-      else
-	echo "cannot find nm_test_var in $nlist" >&5
-      fi
-    else
-      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
-    fi
-  else
-    echo "$progname: failed program was:" >&5
-    cat conftest.$ac_ext >&5
-  fi
-  rm -rf conftest* conftst*
 
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$pipe_works" = yes; then
-    break
-  else
-    lt_cv_sys_global_symbol_pipe=
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+  # We do not want a PATH search for config.site.
+  case $CONFIG_SITE in #((
+    -*)  ac_site_file1=./$CONFIG_SITE;;
+    */*) ac_site_file1=$CONFIG_SITE;;
+    *)   ac_site_file1=./$CONFIG_SITE;;
+  esac
+elif test "x$prefix" != xNONE; then
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
+else
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+  test "x$ac_site_file" = xNONE && continue
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file" \
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
   fi
 done
 
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
 fi
 
-if test -z "$lt_cv_sys_global_symbol_pipe"; then
-  lt_cv_sys_global_symbol_to_cdecl=
-fi
-if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
-  { $as_echo "$as_me:$LINENO: result: failed" >&5
-$as_echo "failed" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: ok" >&5
-$as_echo "ok" >&6; }
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	# differences in whitespace do not lead to failure.
+	ac_old_val_w=`echo x $ac_old_val`
+	ac_new_val_w=`echo x $ac_new_val`
+	if test "$ac_old_val_w" != "$ac_new_val_w"; then
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	  ac_cache_corrupted=:
+	else
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+	  eval $ac_var=\$ac_old_val
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
 fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: libcf 1.0-beta10" >&5
+$as_echo "$as_me: libcf 1.0-beta10" >&6;}
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# Check whether --enable-libtool-lock was given.
-if test "${enable_libtool_lock+set}" = set; then
-  enableval=$enable_libtool_lock;
+# Find out about the host we're building on.
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
 fi
 
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case $host in
-ia64-*-hpux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-    case `/usr/bin/file conftest.$ac_objext` in
-      *ELF-32*)
-	HPUX_IA64_MODE="32"
-	;;
-      *ELF-64*)
-	HPUX_IA64_MODE="64"
-	;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-*-*-irix6*)
-  # Find out which ABI we are using.
-  echo '#line 7059 "configure"' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-    if test "$lt_cv_prog_gnu_ld" = yes; then
-      case `/usr/bin/file conftest.$ac_objext` in
-	*32-bit*)
-	  LD="${LD-ld} -melf32bsmip"
-	  ;;
-	*N32*)
-	  LD="${LD-ld} -melf32bmipn32"
-	  ;;
-	*64-bit*)
-	  LD="${LD-ld} -melf64bmip"
-	;;
-      esac
-    else
-      case `/usr/bin/file conftest.$ac_objext` in
-	*32-bit*)
-	  LD="${LD-ld} -32"
-	  ;;
-	*N32*)
-	  LD="${LD-ld} -n32"
-	  ;;
-	*64-bit*)
-	  LD="${LD-ld} -64"
-	  ;;
-      esac
-    fi
-  fi
-  rm -rf conftest*
-  ;;
 
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
-s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-    case `/usr/bin/file conftest.o` in
-      *32-bit*)
-	case $host in
-	  x86_64-*kfreebsd*-gnu)
-	    LD="${LD-ld} -m elf_i386_fbsd"
-	    ;;
-	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_i386"
-	    ;;
-	  ppc64-*linux*|powerpc64-*linux*)
-	    LD="${LD-ld} -m elf32ppclinux"
-	    ;;
-	  s390x-*linux*)
-	    LD="${LD-ld} -m elf_s390"
-	    ;;
-	  sparc64-*linux*)
-	    LD="${LD-ld} -m elf32_sparc"
-	    ;;
-	esac
-	;;
-      *64-bit*)
-	case $host in
-	  x86_64-*kfreebsd*-gnu)
-	    LD="${LD-ld} -m elf_x86_64_fbsd"
-	    ;;
-	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_x86_64"
-	    ;;
-	  ppc*-*linux*|powerpc*-*linux*)
-	    LD="${LD-ld} -m elf64ppc"
-	    ;;
-	  s390*-*linux*|s390*-*tpf*)
-	    LD="${LD-ld} -m elf64_s390"
-	    ;;
-	  sparc*-*linux*)
-	    LD="${LD-ld} -m elf64_sparc"
-	    ;;
-	esac
-	;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
 
-*-*-sco3.2v5*)
-  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
-  SAVE_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -belf"
-  { $as_echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
-$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
-if test "${lt_cv_cc_needs_belf+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
 
-     cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  lt_cv_cc_needs_belf=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	lt_cv_cc_needs_belf=no
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-     ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
-$as_echo "$lt_cv_cc_needs_belf" >&6; }
-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
-    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
-    CFLAGS="$SAVE_CFLAGS"
-  fi
-  ;;
-sparc*-*solaris*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-    case `/usr/bin/file conftest.o` in
-    *64-bit*)
-      case $lt_cv_prog_gnu_ld in
-      yes*) LD="${LD-ld} -m elf64_sparc" ;;
-      *)
-	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
-	  LD="${LD-ld} -64"
-	fi
-	;;
-      esac
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
 esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
-need_locks="$enable_libtool_lock"
 
 
-  case $host_os in
-    rhapsody* | darwin*)
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DSYMUTIL+set}" = set; then
+# We will output a libcf_config.h for the C library, and a fortran inc file,
+# nfconfig.inc.
+ac_config_headers="$ac_config_headers cf_config.h"
+
+ac_config_headers="$ac_config_headers nfconfig.inc:nfconfig.in"
+
+
+# This call is required by automake.
+am__api_version='1.11'
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$DSYMUTIL"; then
-  ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    rm -rf conftest.one conftest.two conftest.dir
+	    echo one > conftest.one
+	    echo two > conftest.two
+	    mkdir conftest.dir
+	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+	      test -s conftest.one && test -s conftest.two &&
+	      test -s conftest.dir/conftest.one &&
+	      test -s conftest.dir/conftest.two
+	    then
+	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	      break 3
+	    fi
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+
+  done
 IFS=$as_save_IFS
 
+rm -rf conftest.one conftest.two conftest.dir
+
 fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
 fi
-DSYMUTIL=$ac_cv_prog_DSYMUTIL
-if test -n "$DSYMUTIL"; then
-  { $as_echo "$as_me:$LINENO: result: $DSYMUTIL" >&5
-$as_echo "$DSYMUTIL" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
 
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
 
-fi
-if test -z "$ac_cv_prog_DSYMUTIL"; then
-  ac_ct_DSYMUTIL=$DSYMUTIL
-  # Extract the first word of "dsymutil", so it can be a program name with args.
-set dummy dsymutil; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_DSYMUTIL"; then
-  ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[\\\"\#\$\&\'\`$am_lf]*)
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+  *[\\\"\#\$\&\'\`$am_lf\ \	]*)
+    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t "$srcdir/configure" conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" "$LINENO" 5
+   fi
 
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
 fi
-ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
-if test -n "$ac_ct_DSYMUTIL"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5
-$as_echo "$ac_ct_DSYMUTIL" >&6; }
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
+  am_missing_run=
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
 fi
 
-  if test "x$ac_ct_DSYMUTIL" = x; then
-    DSYMUTIL=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    DSYMUTIL=$ac_ct_DSYMUTIL
-  fi
-else
-  DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
 fi
 
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
-set dummy ${ac_tool_prefix}nmedit; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_NMEDIT+set}" = set; then
+if ${ac_cv_prog_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$NMEDIT"; then
-  ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # 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
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-NMEDIT=$ac_cv_prog_NMEDIT
-if test -n "$NMEDIT"; then
-  { $as_echo "$as_me:$LINENO: result: $NMEDIT" >&5
-$as_echo "$NMEDIT" >&6; }
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 fi
-if test -z "$ac_cv_prog_NMEDIT"; then
-  ac_ct_NMEDIT=$NMEDIT
-  # Extract the first word of "nmedit", so it can be a program name with args.
-set dummy nmedit; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_NMEDIT"; then
-  ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_NMEDIT="nmedit"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
-if test -n "$ac_ct_NMEDIT"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5
-$as_echo "$ac_ct_NMEDIT" >&6; }
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-  if test "x$ac_ct_NMEDIT" = x; then
-    NMEDIT=":"
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    NMEDIT=$ac_ct_NMEDIT
+    STRIP=$ac_ct_STRIP
   fi
 else
-  NMEDIT="$ac_cv_prog_NMEDIT"
+  STRIP="$ac_cv_prog_STRIP"
 fi
 
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
-set dummy ${ac_tool_prefix}lipo; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_LIPO+set}" = set; then
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+  if ${ac_cv_path_mkdir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$LIPO"; then
-  ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
+    for ac_prog in mkdir gmkdir; do
+	 for ac_exec_ext in '' $ac_executable_extensions; do
+	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+	     'mkdir (GNU coreutils) '* | \
+	     'mkdir (coreutils) '* | \
+	     'mkdir (fileutils) '4.1*)
+	       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+	       break 3;;
+	   esac
+	 done
+       done
+  done
 IFS=$as_save_IFS
 
 fi
+
+  test -d ./--version && rmdir ./--version
+  if test "${ac_cv_path_mkdir+set}" = set; then
+    MKDIR_P="$ac_cv_path_mkdir -p"
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for MKDIR_P within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    MKDIR_P="$ac_install_sh -d"
+  fi
 fi
-LIPO=$ac_cv_prog_LIPO
-if test -n "$LIPO"; then
-  { $as_echo "$as_me:$LINENO: result: $LIPO" >&5
-$as_echo "$LIPO" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
 
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+  [\\/$]* | ?:[\\/]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
 
-fi
-if test -z "$ac_cv_prog_LIPO"; then
-  ac_ct_LIPO=$LIPO
-  # Extract the first word of "lipo", so it can be a program name with args.
-set dummy lipo; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+for ac_prog in gawk mawk nawk awk
+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 test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then
+if ${ac_cv_prog_AWK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_LIPO"; then
-  ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # 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
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_LIPO="lipo"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_AWK="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
-if test -n "$ac_ct_LIPO"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_LIPO" >&5
-$as_echo "$ac_ct_LIPO" >&6; }
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-  if test "x$ac_ct_LIPO" = x; then
-    LIPO=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
+
+  test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
 esac
-    LIPO=$ac_ct_LIPO
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  am__isrc=' -I$(srcdir)'
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
   fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='libcf'
+ VERSION='1.0-beta10'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+
+# Check for the existance of this file before proceeding.
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking user options" >&5
+$as_echo "$as_me: checking user options" >&6;}
+
+# test if --enable-shared was selected
+ if test x$enable_shared = xyes; then
+  HAVE_SHARED_TRUE=
+  HAVE_SHARED_FALSE='#'
 else
-  LIPO="$ac_cv_prog_LIPO"
+  HAVE_SHARED_TRUE='#'
+  HAVE_SHARED_FALSE=
 fi
 
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
-set dummy ${ac_tool_prefix}otool; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+if test "x$enable_shared" = "xyes"; then
+	HAVE_SHARED=1
+
+else
+	HAVE_SHARED=0
+
+fi
+#check for apple
+darwin_os=''
+case $host in
+  *-apple-darwin*)
+    darwin_os='yes'
+  ;;
+esac
+ if test x$darwin_os = xyes; then
+  HAVE_DARWIN_TRUE=
+  HAVE_DARWIN_FALSE='#'
+else
+  HAVE_DARWIN_TRUE='#'
+  HAVE_DARWIN_FALSE=
+fi
+
+if test "x$darwin_os" = "xyes"; then
+   HAVE_DARWIN=1
+
+else
+   HAVE_DARWIN=0
+
+fi
+
+# Find the C compiler.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: finding C compiler" >&5
+$as_echo "$as_me: finding C compiler" >&6;}
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL+set}" = set; then
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$OTOOL"; then
-  ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # 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
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-OTOOL=$ac_cv_prog_OTOOL
-if test -n "$OTOOL"; then
-  { $as_echo "$as_me:$LINENO: result: $OTOOL" >&5
-$as_echo "$OTOOL" >&6; }
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 fi
-if test -z "$ac_cv_prog_OTOOL"; then
-  ac_ct_OTOOL=$OTOOL
-  # Extract the first word of "otool", so it can be a program name with args.
-set dummy otool; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_OTOOL"; then
-  ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_OTOOL="otool"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
-if test -n "$ac_ct_OTOOL"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL" >&5
-$as_echo "$ac_ct_OTOOL" >&6; }
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-  if test "x$ac_ct_OTOOL" = x; then
-    OTOOL=":"
+  if test "x$ac_ct_CC" = x; then
+    CC=""
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    OTOOL=$ac_ct_OTOOL
+    CC=$ac_ct_CC
   fi
 else
-  OTOOL="$ac_cv_prog_OTOOL"
+  CC="$ac_cv_prog_CC"
 fi
 
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
-set dummy ${ac_tool_prefix}otool64; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL64+set}" = set; then
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$OTOOL64"; then
-  ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # 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
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-OTOOL64=$ac_cv_prog_OTOOL64
-if test -n "$OTOOL64"; then
-  { $as_echo "$as_me:$LINENO: result: $OTOOL64" >&5
-$as_echo "$OTOOL64" >&6; }
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
+  fi
 fi
-if test -z "$ac_cv_prog_OTOOL64"; then
-  ac_ct_OTOOL64=$OTOOL64
-  # Extract the first word of "otool64", so it can be a program name with args.
-set dummy otool64; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_OTOOL64"; then
-  ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
 else
+  ac_prog_rejected=no
 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
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_OTOOL64="otool64"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
 fi
 fi
-ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
-if test -n "$ac_ct_OTOOL64"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL64" >&5
-$as_echo "$ac_ct_OTOOL64" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
 fi
-
-  if test "x$ac_ct_OTOOL64" = x; then
-    OTOOL64=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    OTOOL64=$ac_ct_OTOOL64
-  fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
 else
-  OTOOL64="$ac_cv_prog_OTOOL64"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:$LINENO: checking for -single_module linker flag" >&5
-$as_echo_n "checking for -single_module linker flag... " >&6; }
-if test "${lt_cv_apple_cc_single_mod+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_apple_cc_single_mod=no
-      if test -z "${LT_MULTI_MODULE}"; then
-	# By default we will add the -single_module flag. You can override
-	# by either setting the environment variable LT_MULTI_MODULE
-	# non-empty at configure time, or by adding -multi_module to the
-	# link flags.
-	rm -rf libconftest.dylib*
-	echo "int foo(void){return 1;}" > conftest.c
-	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
--dynamiclib -Wl,-single_module conftest.c" >&5
-	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
-        _lt_result=$?
-	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
-	  lt_cv_apple_cc_single_mod=yes
-	else
-	  cat conftest.err >&5
-	fi
-	rm -rf libconftest.dylib*
-	rm -f conftest.*
-      fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5
-$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
-    { $as_echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5
-$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
-if test "${lt_cv_ld_exported_symbols_list+set}" = set; then
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$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_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  lt_cv_ld_exported_symbols_list=no
-      save_LDFLAGS=$LDFLAGS
-      echo "_main" > conftest.sym
-      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  lt_cv_ld_exported_symbols_list=yes
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$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
 
-	lt_cv_ld_exported_symbols_list=no
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-	LDFLAGS="$save_LDFLAGS"
 
+    test -n "$CC" && break
+  done
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5
-$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
-    case $host_os in
-    rhapsody* | darwin1.[012])
-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
-    darwin1.*)
-      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-    darwin*) # darwin 5.x on
-      # if running on 10.5 or later, the deployment target defaults
-      # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it?
-      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
-	10.0,*86*-darwin8*|10.0,*-darwin[91]*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-	10.[012]*)
-	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-	10.*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-      esac
-    ;;
-  esac
-    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
-      _lt_dar_single_mod='$single_module'
-    fi
-    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
-      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
-    else
-      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
-    fi
-    if test "$DSYMUTIL" != ":"; then
-      _lt_dsymutil='~$DSYMUTIL $lib || :'
-    else
-      _lt_dsymutil=
-    fi
-    ;;
-  esac
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+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_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$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
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
 fi
-if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then
-  $as_echo_n "(cached) " >&6
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
 else
-      # Double quotes because CPP needs to be expanded
-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+    CC=$ac_ct_CC
+  fi
+fi
 
-  # Broken: fails on valid input.
-continue
 fi
 
-rm -f conftest.err conftest.$ac_ext
 
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  # Broken: success on invalid input.
-continue
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
 
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-rm -f conftest.err conftest.$ac_ext
+int
+main ()
+{
 
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  break
-fi
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
 
-    done
-    ac_cv_prog_CPP=$CPP
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
 
-fi
-  CPP=$ac_cv_prog_CPP
-else
-  ac_cv_prog_CPP=$CPP
-fi
-{ $as_echo "$as_me:$LINENO: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
+ac_rmfiles=
+for ac_file in $ac_files
 do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link_default") 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	then :; else
+	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	fi
+	# We set ac_cv_exeext here because the later test for it is not
+	# safe: cross compilers may not add the suffix if given an `-o'
+	# argument, so we may need to know it at that point already.
+	# Even if this section looks crufty: it has the advantage of
+	# actually working.
+	break;;
+    * )
+	break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
 else
-  $as_echo "$as_me: failed program was:" >&5
+  ac_file=''
+fi
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-  # Broken: fails on valid input.
-continue
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
 
-rm -f conftest.err conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  # Broken: success on invalid input.
-continue
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Passes both tests.
-ac_preproc_ok=:
-break
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
 fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
 
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
 
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  :
-else
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+    fi
+  fi
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
 
 int
 main ()
@@ -8122,583 +3911,600 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_header_stdc=yes
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
 else
   $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_header_stdc=no
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <string.h>
 
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then
-  :
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
 else
-  ac_cv_header_stdc=no
+  ac_compiler_gnu=no
 fi
-rm -f conftest*
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then
-  :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
 else
-  ac_cv_header_stdc=no
+  GCC=
 fi
-rm -f conftest*
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-fi
+int
+main ()
+{
 
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
-  :
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+  ;
+  return 0;
+}
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-		   (('a' <= (c) && (c) <= 'i') \
-		     || ('j' <= (c) && (c) <= 'r') \
-		     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
 
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
 int
 main ()
 {
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-	|| toupper (i) != TOUPPER (i))
-      return 2;
+
+  ;
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
+if ac_fn_c_try_compile "$LINENO"; then :
+
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
 
-( exit $ac_status )
-ac_cv_header_stdc=no
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
 fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-		  inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
 
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
 
-	eval "$as_ac_Header=no"
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
 fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
 
 fi
 
-done
-
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
 
+ac_config_commands="$ac_config_commands depfiles"
 
-for ac_header in dlfcn.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
 
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_Header=no"
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+  enableval=$enable_dependency_tracking;
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
 
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
 fi
 
-done
 
 
+depcc="$CC"   am_compiler_list=
 
-ac_ext=f
-ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
-ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_f77_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_F77+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$F77"; then
-  ac_cv_prog_F77="$F77" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
 
-fi
-fi
-F77=$ac_cv_prog_F77
-if test -n "$F77"; then
-  { $as_echo "$as_me:$LINENO: result: $F77" >&5
-$as_echo "$F77" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
 
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    test -n "$F77" && break
-  done
-fi
-if test -z "$F77"; then
-  ac_ct_F77=$F77
-  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
-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:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_F77+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_F77"; then
-  ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_F77="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
 
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
 fi
+
 fi
-ac_ct_F77=$ac_cv_prog_ac_ct_F77
-if test -n "$ac_ct_F77"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
-$as_echo "$ac_ct_F77" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
 fi
 
 
-  test -n "$ac_ct_F77" && break
-done
-
-  if test "x$ac_ct_F77" = x; then
-    F77=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    F77=$ac_ct_F77
-  fi
+if test "x$CC" != xcc; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
+$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
+$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
 fi
+set dummy $CC; ac_cc=`$as_echo "$2" |
+		      sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+int
+main ()
+{
 
-# Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
+  ;
+  return 0;
+}
+_ACEOF
+# Make sure it works both with $CC and with simple cc.
+# We do the test twice because some compilers refuse to overwrite an
+# existing .o file with -o, though they will create one.
+ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+rm -f conftest2.*
+if { { case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } &&
+   test -f conftest2.$ac_objext && { { case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; };
+then
+  eval ac_cv_prog_cc_${ac_cc}_c_o=yes
+  if test "x$CC" != xcc; then
+    # Test first that cc exists at all.
+    if { ac_try='cc -c conftest.$ac_ext >&5'
+  { { case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-rm -f a.out
-
-# If we don't use `.F' as extension, the preprocessor is not run on the
-# input file.  (Note that this only needs to work for GNU compilers.)
-ac_save_ext=$ac_ext
-ac_ext=F
-{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
-$as_echo_n "checking whether we are using the GNU Fortran 77 compiler... " >&6; }
-if test "${ac_cv_f77_compiler_gnu+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-      program main
-#ifndef __GNUC__
-       choke me
-#endif
-
-      end
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+      ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+      rm -f conftest2.*
+      if { { case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_compiler_gnu=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_compiler_gnu=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_f77_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
-$as_echo "$ac_cv_f77_compiler_gnu" >&6; }
-ac_ext=$ac_save_ext
-ac_test_FFLAGS=${FFLAGS+set}
-ac_save_FFLAGS=$FFLAGS
-FFLAGS=
-{ $as_echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
-$as_echo_n "checking whether $F77 accepts -g... " >&6; }
-if test "${ac_cv_prog_f77_g+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  FFLAGS=-g
-cat >conftest.$ac_ext <<_ACEOF
-      program main
-
-      end
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } &&
+	 test -f conftest2.$ac_objext && { { case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_f77_g=yes
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; };
+      then
+	# cc works too.
+	:
+      else
+	# cc exists but doesn't like -o.
+	eval ac_cv_prog_cc_${ac_cc}_c_o=no
+      fi
+    fi
+  fi
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_prog_f77_g=no
+  eval ac_cv_prog_cc_${ac_cc}_c_o=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest*
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
-$as_echo "$ac_cv_prog_f77_g" >&6; }
-if test "$ac_test_FFLAGS" = set; then
-  FFLAGS=$ac_save_FFLAGS
-elif test $ac_cv_prog_f77_g = yes; then
-  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
-    FFLAGS="-g -O2"
-  else
-    FFLAGS="-g"
-  fi
+if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 else
-  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
-    FFLAGS="-O2"
-  else
-    FFLAGS=
-  fi
-fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
 
-if test $ac_compiler_gnu = yes; then
-  G77=yes
-else
-  G77=
 fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-if test -z "$F77" || test "X$F77" = "Xno"; then
-  _lt_disable_F77=yes
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
 fi
 
 
 
+# For backward compatibility, check to see if the user has set FC to
+# null. If so, treat that as the --disable-fortran option to
+# configure.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether FC is set to ''" >&5
+$as_echo_n "checking whether FC is set to ''... " >&6; }
+nc_null_fc=no
+test "x${FC+set}" = xset && test "x$FC" = x && nc_null_fc=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $nc_null_fc" >&5
+$as_echo "$nc_null_fc" >&6; }
 
+if test "$nc_null_fc" = "no"  || test "$nc_build_f90" = "yes" ; then
+   # Find fortran compiler. If FC isn't set after AC_PROG_FC, we couldn't
+   # find a fortran compiler. If the user requested the fortran API, then
+   # bail out right here.
+   { $as_echo "$as_me:${as_lineno-$LINENO}: finding Fortran compiler (required, even if Fortran API is not desired)" >&5
+$as_echo "$as_me: finding Fortran compiler (required, even if Fortran API is not desired)" >&6;}
 
-ac_ext=${ac_fc_srcext-f}
+   # We must call AC_PROG_FC here, otherwise the LIBTOOL macro below
+   # will call it, and reset FC to g77.
+   ac_ext=${ac_fc_srcext-f}
 ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_fc_compiler_gnu
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
+  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_FC+set}" = set; then
+if ${ac_cv_prog_FC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$FC"; then
@@ -8709,24 +4515,24 @@ 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
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_FC="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 FC=$ac_cv_prog_FC
 if test -n "$FC"; then
-  { $as_echo "$as_me:$LINENO: result: $FC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FC" >&5
 $as_echo "$FC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -8736,13 +4542,13 @@ fi
 fi
 if test -z "$FC"; then
   ac_ct_FC=$FC
-  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
+  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
 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:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_FC+set}" = set; then
+if ${ac_cv_prog_ac_ct_FC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_FC"; then
@@ -8753,24 +4559,24 @@ 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
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_FC="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_FC=$ac_cv_prog_ac_ct_FC
 if test -n "$ac_ct_FC"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_FC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FC" >&5
 $as_echo "$ac_ct_FC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -8783,7 +4589,7 @@ done
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -8793,54 +4599,41 @@ fi
 
 
 # Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for Fortran compiler version" >&5
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran compiler version" >&5
 set X $ac_compile
 ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
 rm -f a.out
 
 # If we don't use `.F' as extension, the preprocessor is not run on the
 # input file.  (Note that this only needs to work for GNU compilers.)
 ac_save_ext=$ac_ext
 ac_ext=F
-{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU Fortran compiler" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Fortran compiler" >&5
 $as_echo_n "checking whether we are using the GNU Fortran compiler... " >&6; }
-if test "${ac_cv_fc_compiler_gnu+set}" = set; then
+if ${ac_cv_fc_compiler_gnu+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  cat > conftest.$ac_ext <<_ACEOF
       program main
 #ifndef __GNUC__
        choke me
@@ -8848,499 +4641,1190 @@ else
 
       end
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_fc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_fc_try_compile "$LINENO"; then :
   ac_compiler_gnu=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_compiler_gnu=no
+  ac_compiler_gnu=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_fc_compiler_gnu=$ac_compiler_gnu
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_fc_compiler_gnu" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fc_compiler_gnu" >&5
 $as_echo "$ac_cv_fc_compiler_gnu" >&6; }
 ac_ext=$ac_save_ext
-ac_test_FFLAGS=${FCFLAGS+set}
-ac_save_FFLAGS=$FCFLAGS
+ac_test_FCFLAGS=${FCFLAGS+set}
+ac_save_FCFLAGS=$FCFLAGS
 FCFLAGS=
-{ $as_echo "$as_me:$LINENO: checking whether $FC accepts -g" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $FC accepts -g" >&5
 $as_echo_n "checking whether $FC accepts -g... " >&6; }
-if test "${ac_cv_prog_fc_g+set}" = set; then
+if ${ac_cv_prog_fc_g+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   FCFLAGS=-g
-cat >conftest.$ac_ext <<_ACEOF
+cat > conftest.$ac_ext <<_ACEOF
       program main
 
       end
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_fc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_fc_try_compile "$LINENO"; then :
   ac_cv_prog_fc_g=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_prog_fc_g=no
+  ac_cv_prog_fc_g=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_fc_g" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_fc_g" >&5
 $as_echo "$ac_cv_prog_fc_g" >&6; }
-if test "$ac_test_FFLAGS" = set; then
-  FCFLAGS=$ac_save_FFLAGS
-elif test $ac_cv_prog_fc_g = yes; then
-  if test "x$ac_cv_fc_compiler_gnu" = xyes; then
-    FCFLAGS="-g -O2"
-  else
-    FCFLAGS="-g"
-  fi
-else
-  if test "x$ac_cv_fc_compiler_gnu" = xyes; then
-    FCFLAGS="-O2"
-  else
-    FCFLAGS=
-  fi
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-if test -z "$FC" || test "X$FC" = "Xno"; then
-  _lt_disable_FC=yes
-fi
-
-
-
-
-# Set options
-
-
-
-        enable_dlopen=no
-
-
-
-
-  # Check whether --enable-static was given.
-if test "${enable_static+set}" = set; then
-  enableval=$enable_static; p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_static=yes ;;
-    no) enable_static=no ;;
-    *)
-     enable_static=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_static=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac
+if test "$ac_test_FCFLAGS" = set; then
+  FCFLAGS=$ac_save_FCFLAGS
+elif test $ac_cv_prog_fc_g = yes; then
+  if test "x$ac_cv_fc_compiler_gnu" = xyes; then
+    FCFLAGS="-g -O2"
+  else
+    FCFLAGS="-g"
+  fi
 else
-  enable_static=yes
+  if test "x$ac_cv_fc_compiler_gnu" = xyes; then
+    FCFLAGS="-O2"
+  else
+    FCFLAGS=
+  fi
 fi
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
 
+   # To determine fortran subroutine name mangling (C gridspec needs
+   # Fortran lapack/blas)
 
+ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to get verbose linking output from $FC" >&5
+$as_echo_n "checking how to get verbose linking output from $FC... " >&6; }
+if ${ac_cv_prog_fc_v+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.$ac_ext <<_ACEOF
+      program main
 
+      end
+_ACEOF
+if ac_fn_fc_try_compile "$LINENO"; then :
+  ac_cv_prog_fc_v=
+# Try some options frequently used verbose output
+for ac_verb in -v -verbose --verbose -V -\#\#\#; do
+  cat > conftest.$ac_ext <<_ACEOF
+      program main
 
+      end
+_ACEOF
 
+# Compile and link our simple test program by passing a flag (argument
+# 1 to this macro) to the Fortran compiler in order to get
+# "verbose" output that we can then parse for the Fortran linker
+# flags.
+ac_save_FCFLAGS=$FCFLAGS
+FCFLAGS="$FCFLAGS $ac_verb"
+eval "set x $ac_link"
+shift
+$as_echo "$as_me:${as_lineno-$LINENO}: $*" >&5
+# gfortran 4.3 outputs lines setting COLLECT_GCC_OPTIONS, COMPILER_PATH,
+# LIBRARY_PATH; skip all such settings.
+ac_fc_v_output=`eval $ac_link 5>&1 2>&1 |
+  sed '/^Driving:/d; /^Configured with:/d;
+      '"/^[_$as_cr_Letters][_$as_cr_alnum]*=/d"`
+$as_echo "$ac_fc_v_output" >&5
+FCFLAGS=$ac_save_FCFLAGS
 
+rm -rf conftest*
 
+# On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where
+# /foo, /bar, and /baz are search directories for the Fortran linker.
+# Here, we change these into -L/foo -L/bar -L/baz (and put it first):
+ac_fc_v_output="`echo $ac_fc_v_output |
+	grep 'LPATH is:' |
+	sed 's|.*LPATH is\(: *[^ ]*\).*|\1|;s|: */| -L/|g'` $ac_fc_v_output"
+
+# FIXME: we keep getting bitten by quoted arguments; a more general fix
+#        that detects unbalanced quotes in FLIBS should be implemented
+#        and (ugh) tested at some point.
+case $ac_fc_v_output in
+  # If we are using xlf then replace all the commas with spaces.
+  *xlfentry*)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed 's/,/ /g'` ;;
+
+  # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted
+  # $LIBS confuse us, and the libraries appear later in the output anyway).
+  *mGLOB_options_string*)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed 's/"-mGLOB[^"]*"/ /g'` ;;
+
+  # Portland Group compiler has singly- or doubly-quoted -cmdline argument
+  # Singly-quoted arguments were reported for versions 5.2-4 and 6.0-4.
+  # Doubly-quoted arguments were reported for "PGF90/x86 Linux/x86 5.0-2".
+  *-cmdline\ * | *-ignore\ * | *-def\ *)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed "\
+	s/-cmdline  *'[^']*'/ /g; s/-cmdline  *\"[^\"]*\"/ /g
+	s/-ignore  *'[^']*'/ /g; s/-ignore  *\"[^\"]*\"/ /g
+	s/-def  *'[^']*'/ /g; s/-def  *\"[^\"]*\"/ /g"` ;;
+
+  # If we are using Cray Fortran then delete quotes.
+  *cft90*)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed 's/"//g'` ;;
+esac
 
 
-# Check whether --with-pic was given.
-if test "${with_pic+set}" = set; then
-  withval=$with_pic; pic_mode="$withval"
+  # look for -l* and *.a constructs in the output
+  for ac_arg in $ac_fc_v_output; do
+     case $ac_arg in
+	[\\/]*.a | ?:[\\/]*.a | -[lLRu]*)
+	  ac_cv_prog_fc_v=$ac_verb
+	  break 2 ;;
+     esac
+  done
+done
+if test -z "$ac_cv_prog_fc_v"; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine how to obtain linking information from $FC" >&5
+$as_echo "$as_me: WARNING: cannot determine how to obtain linking information from $FC" >&2;}
+fi
 else
-  pic_mode=default
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compilation failed" >&5
+$as_echo "$as_me: WARNING: compilation failed" >&2;}
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_fc_v" >&5
+$as_echo "$ac_cv_prog_fc_v" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran libraries of $FC" >&5
+$as_echo_n "checking for Fortran libraries of $FC... " >&6; }
+if ${ac_cv_fc_libs+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$FCLIBS" != "x"; then
+  ac_cv_fc_libs="$FCLIBS" # Let the user override the test.
+else
 
-test -z "$pic_mode" && pic_mode=default
+cat > conftest.$ac_ext <<_ACEOF
+      program main
 
+      end
+_ACEOF
 
+# Compile and link our simple test program by passing a flag (argument
+# 1 to this macro) to the Fortran compiler in order to get
+# "verbose" output that we can then parse for the Fortran linker
+# flags.
+ac_save_FCFLAGS=$FCFLAGS
+FCFLAGS="$FCFLAGS $ac_cv_prog_fc_v"
+eval "set x $ac_link"
+shift
+$as_echo "$as_me:${as_lineno-$LINENO}: $*" >&5
+# gfortran 4.3 outputs lines setting COLLECT_GCC_OPTIONS, COMPILER_PATH,
+# LIBRARY_PATH; skip all such settings.
+ac_fc_v_output=`eval $ac_link 5>&1 2>&1 |
+  sed '/^Driving:/d; /^Configured with:/d;
+      '"/^[_$as_cr_Letters][_$as_cr_alnum]*=/d"`
+$as_echo "$ac_fc_v_output" >&5
+FCFLAGS=$ac_save_FCFLAGS
 
+rm -rf conftest*
 
+# On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where
+# /foo, /bar, and /baz are search directories for the Fortran linker.
+# Here, we change these into -L/foo -L/bar -L/baz (and put it first):
+ac_fc_v_output="`echo $ac_fc_v_output |
+	grep 'LPATH is:' |
+	sed 's|.*LPATH is\(: *[^ ]*\).*|\1|;s|: */| -L/|g'` $ac_fc_v_output"
+
+# FIXME: we keep getting bitten by quoted arguments; a more general fix
+#        that detects unbalanced quotes in FLIBS should be implemented
+#        and (ugh) tested at some point.
+case $ac_fc_v_output in
+  # If we are using xlf then replace all the commas with spaces.
+  *xlfentry*)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed 's/,/ /g'` ;;
+
+  # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted
+  # $LIBS confuse us, and the libraries appear later in the output anyway).
+  *mGLOB_options_string*)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed 's/"-mGLOB[^"]*"/ /g'` ;;
+
+  # Portland Group compiler has singly- or doubly-quoted -cmdline argument
+  # Singly-quoted arguments were reported for versions 5.2-4 and 6.0-4.
+  # Doubly-quoted arguments were reported for "PGF90/x86 Linux/x86 5.0-2".
+  *-cmdline\ * | *-ignore\ * | *-def\ *)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed "\
+	s/-cmdline  *'[^']*'/ /g; s/-cmdline  *\"[^\"]*\"/ /g
+	s/-ignore  *'[^']*'/ /g; s/-ignore  *\"[^\"]*\"/ /g
+	s/-def  *'[^']*'/ /g; s/-def  *\"[^\"]*\"/ /g"` ;;
+
+  # If we are using Cray Fortran then delete quotes.
+  *cft90*)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed 's/"//g'` ;;
+esac
 
 
 
-  # Check whether --enable-fast-install was given.
-if test "${enable_fast_install+set}" = set; then
-  enableval=$enable_fast_install; p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_fast_install=yes ;;
-    no) enable_fast_install=no ;;
-    *)
-      enable_fast_install=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_fast_install=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac
+ac_cv_fc_libs=
+
+# Save positional arguments (if any)
+ac_save_positional="$@"
+
+set X $ac_fc_v_output
+while test $# != 1; do
+  shift
+  ac_arg=$1
+  case $ac_arg in
+	[\\/]*.a | ?:[\\/]*.a)
+	    ac_exists=false
+  for ac_i in $ac_cv_fc_libs; do
+    if test x"$ac_arg" = x"$ac_i"; then
+      ac_exists=true
+      break
+    fi
+  done
+
+  if test x"$ac_exists" = xtrue; then :
+
 else
-  enable_fast_install=yes
+  ac_cv_fc_libs="$ac_cv_fc_libs $ac_arg"
 fi
+	  ;;
+	-bI:*)
+	    ac_exists=false
+  for ac_i in $ac_cv_fc_libs; do
+    if test x"$ac_arg" = x"$ac_i"; then
+      ac_exists=true
+      break
+    fi
+  done
 
+  if test x"$ac_exists" = xtrue; then :
 
+else
+  if test "$ac_compiler_gnu" = yes; then
+  for ac_link_opt in $ac_arg; do
+    ac_cv_fc_libs="$ac_cv_fc_libs -Xlinker $ac_link_opt"
+  done
+else
+  ac_cv_fc_libs="$ac_cv_fc_libs $ac_arg"
+fi
+fi
+	  ;;
+	  # Ignore these flags.
+	-lang* | -lcrt*.o | -lc | -lgcc* | -lSystem | -libmil | -little \
+	  |-LANG:=* | -LIST:* | -LNO:* | -link)
+	  ;;
+	-lkernel32)
+	  test x"$CYGWIN" != xyes && ac_cv_fc_libs="$ac_cv_fc_libs $ac_arg"
+	  ;;
+	-[LRuYz])
+	  # These flags, when seen by themselves, take an argument.
+	  # We remove the space between option and argument and re-iterate
+	  # unless we find an empty arg or a new option (starting with -)
+	  case $2 in
+	     "" | -*);;
+	     *)
+		ac_arg="$ac_arg$2"
+		shift; shift
+		set X $ac_arg "$@"
+		;;
+	  esac
+	  ;;
+	-YP,*)
+	  for ac_j in `$as_echo "$ac_arg" | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do
+	      ac_exists=false
+  for ac_i in $ac_cv_fc_libs; do
+    if test x"$ac_j" = x"$ac_i"; then
+      ac_exists=true
+      break
+    fi
+  done
 
+  if test x"$ac_exists" = xtrue; then :
 
+else
+  ac_arg="$ac_arg $ac_j"
+			       ac_cv_fc_libs="$ac_cv_fc_libs $ac_j"
+fi
+	  done
+	  ;;
+	-[lLR]*)
+	    ac_exists=false
+  for ac_i in $ac_cv_fc_libs; do
+    if test x"$ac_arg" = x"$ac_i"; then
+      ac_exists=true
+      break
+    fi
+  done
 
+  if test x"$ac_exists" = xtrue; then :
 
+else
+  ac_cv_fc_libs="$ac_cv_fc_libs $ac_arg"
+fi
+	  ;;
+	-zallextract*| -zdefaultextract)
+	  ac_cv_fc_libs="$ac_cv_fc_libs $ac_arg"
+	  ;;
+	  # Ignore everything else.
+  esac
+done
+# restore positional arguments
+set X $ac_save_positional; shift
+
+# We only consider "LD_RUN_PATH" on Solaris systems.  If this is seen,
+# then we insist that the "run path" must be an absolute path (i.e. it
+# must begin with a "/").
+case `(uname -sr) 2>/dev/null` in
+   "SunOS 5"*)
+      ac_ld_run_path=`$as_echo "$ac_fc_v_output" |
+			sed -n 's,^.*LD_RUN_PATH *= *\(/[^ ]*\).*$,-R\1,p'`
+      test "x$ac_ld_run_path" != x &&
+	if test "$ac_compiler_gnu" = yes; then
+  for ac_link_opt in $ac_ld_run_path; do
+    ac_cv_fc_libs="$ac_cv_fc_libs -Xlinker $ac_link_opt"
+  done
+else
+  ac_cv_fc_libs="$ac_cv_fc_libs $ac_ld_run_path"
+fi
+      ;;
+esac
+fi # test "x$[]_AC_LANG_PREFIX[]LIBS" = "x"
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fc_libs" >&5
+$as_echo "$ac_cv_fc_libs" >&6; }
+FCLIBS="$ac_cv_fc_libs"
 
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ltmain"
+ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
 
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dummy main to link with Fortran libraries" >&5
+$as_echo_n "checking for dummy main to link with Fortran libraries... " >&6; }
+if ${ac_cv_fc_dummy_main+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_fc_dm_save_LIBS=$LIBS
+ LIBS="$LIBS $FCLIBS"
+ ac_fortran_dm_var=FC_DUMMY_MAIN
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ # First, try linking without a dummy main:
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_fortran_dummy_main=none
+else
+  ac_cv_fortran_dummy_main=unknown
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
+ if test $ac_cv_fortran_dummy_main = unknown; then
+   for ac_func in MAIN__ MAIN_ __main MAIN _MAIN __MAIN main_ main__ _main; do
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define $ac_fortran_dm_var $ac_func
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_fortran_dummy_main=$ac_func; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+   done
+ fi
+ ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
+ ac_cv_fc_dummy_main=$ac_cv_fortran_dummy_main
+ rm -rf conftest*
+ LIBS=$ac_fc_dm_save_LIBS
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fc_dummy_main" >&5
+$as_echo "$ac_cv_fc_dummy_main" >&6; }
+FC_DUMMY_MAIN=$ac_cv_fc_dummy_main
+if test "$FC_DUMMY_MAIN" != unknown; then :
+  if test $FC_DUMMY_MAIN != none; then
 
+cat >>confdefs.h <<_ACEOF
+#define FC_DUMMY_MAIN $FC_DUMMY_MAIN
+_ACEOF
 
+  if test "x$ac_cv_fc_dummy_main" = "x$ac_cv_f77_dummy_main"; then
 
+$as_echo "#define FC_DUMMY_MAIN_EQ_F77 1" >>confdefs.h
 
+  fi
+fi
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "linking to Fortran libraries from C fails
+See \`config.log' for more details" "$LINENO" 5; }
+fi
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran name-mangling scheme" >&5
+$as_echo_n "checking for Fortran name-mangling scheme... " >&6; }
+if ${ac_cv_fc_mangling+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.$ac_ext <<_ACEOF
+      subroutine foobar()
+      return
+      end
+      subroutine foo_bar()
+      return
+      end
+_ACEOF
+if ac_fn_fc_try_compile "$LINENO"; then :
+  mv conftest.$ac_objext cfortran_test.$ac_objext
 
+  ac_save_LIBS=$LIBS
+  LIBS="cfortran_test.$ac_objext $LIBS $FCLIBS"
 
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+  ac_success=no
+  for ac_foobar in foobar FOOBAR; do
+    for ac_underscore in "" "_"; do
+      ac_func="$ac_foobar$ac_underscore"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_success=yes; break 2
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    done
+  done
+  ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
 
+  if test "$ac_success" = "yes"; then
+     case $ac_foobar in
+	foobar)
+	   ac_case=lower
+	   ac_foo_bar=foo_bar
+	   ;;
+	FOOBAR)
+	   ac_case=upper
+	   ac_foo_bar=FOO_BAR
+	   ;;
+     esac
 
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+     ac_success_extra=no
+     for ac_extra in "" "_"; do
+	ac_func="$ac_foo_bar$ac_underscore$ac_extra"
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_success_extra=yes; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     done
+     ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
 
+     if test "$ac_success_extra" = "yes"; then
+	ac_cv_fc_mangling="$ac_case case"
+	if test -z "$ac_underscore"; then
+	   ac_cv_fc_mangling="$ac_cv_fc_mangling, no underscore"
+	else
+	   ac_cv_fc_mangling="$ac_cv_fc_mangling, underscore"
+	fi
+	if test -z "$ac_extra"; then
+	   ac_cv_fc_mangling="$ac_cv_fc_mangling, no extra underscore"
+	else
+	   ac_cv_fc_mangling="$ac_cv_fc_mangling, extra underscore"
+	fi
+      else
+	ac_cv_fc_mangling="unknown"
+      fi
+  else
+     ac_cv_fc_mangling="unknown"
+  fi
 
+  LIBS=$ac_save_LIBS
+  rm -rf conftest*
+  rm -f cfortran_test*
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compile a simple Fortran program
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fc_mangling" >&5
+$as_echo "$ac_cv_fc_mangling" >&6; }
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
+case $ac_cv_fc_mangling in
+  "lower case, no underscore, no extra underscore")
+	  $as_echo "#define FC_FUNC(name,NAME) name" >>confdefs.h
 
+	  $as_echo "#define FC_FUNC_(name,NAME) name" >>confdefs.h
+ ;;
+  "lower case, no underscore, extra underscore")
+	  $as_echo "#define FC_FUNC(name,NAME) name" >>confdefs.h
 
+	  $as_echo "#define FC_FUNC_(name,NAME) name ## _" >>confdefs.h
+ ;;
+  "lower case, underscore, no extra underscore")
+	  $as_echo "#define FC_FUNC(name,NAME) name ## _" >>confdefs.h
 
-test -z "$LN_S" && LN_S="ln -s"
+	  $as_echo "#define FC_FUNC_(name,NAME) name ## _" >>confdefs.h
+ ;;
+  "lower case, underscore, extra underscore")
+	  $as_echo "#define FC_FUNC(name,NAME) name ## _" >>confdefs.h
 
+	  $as_echo "#define FC_FUNC_(name,NAME) name ## __" >>confdefs.h
+ ;;
+  "upper case, no underscore, no extra underscore")
+	  $as_echo "#define FC_FUNC(name,NAME) NAME" >>confdefs.h
 
+	  $as_echo "#define FC_FUNC_(name,NAME) NAME" >>confdefs.h
+ ;;
+  "upper case, no underscore, extra underscore")
+	  $as_echo "#define FC_FUNC(name,NAME) NAME" >>confdefs.h
 
+	  $as_echo "#define FC_FUNC_(name,NAME) NAME ## _" >>confdefs.h
+ ;;
+  "upper case, underscore, no extra underscore")
+	  $as_echo "#define FC_FUNC(name,NAME) NAME ## _" >>confdefs.h
 
+	  $as_echo "#define FC_FUNC_(name,NAME) NAME ## _" >>confdefs.h
+ ;;
+  "upper case, underscore, extra underscore")
+	  $as_echo "#define FC_FUNC(name,NAME) NAME ## _" >>confdefs.h
 
+	  $as_echo "#define FC_FUNC_(name,NAME) NAME ## __" >>confdefs.h
+ ;;
+  *)
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unknown Fortran name-mangling scheme" >&5
+$as_echo "$as_me: WARNING: unknown Fortran name-mangling scheme" >&2;}
+	  ;;
+esac
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+   ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to get verbose linking output from $FC" >&5
+$as_echo_n "checking how to get verbose linking output from $FC... " >&6; }
+if ${ac_cv_prog_fc_v+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.$ac_ext <<_ACEOF
+      program main
 
+      end
+_ACEOF
+if ac_fn_fc_try_compile "$LINENO"; then :
+  ac_cv_prog_fc_v=
+# Try some options frequently used verbose output
+for ac_verb in -v -verbose --verbose -V -\#\#\#; do
+  cat > conftest.$ac_ext <<_ACEOF
+      program main
 
+      end
+_ACEOF
 
+# Compile and link our simple test program by passing a flag (argument
+# 1 to this macro) to the Fortran compiler in order to get
+# "verbose" output that we can then parse for the Fortran linker
+# flags.
+ac_save_FCFLAGS=$FCFLAGS
+FCFLAGS="$FCFLAGS $ac_verb"
+eval "set x $ac_link"
+shift
+$as_echo "$as_me:${as_lineno-$LINENO}: $*" >&5
+# gfortran 4.3 outputs lines setting COLLECT_GCC_OPTIONS, COMPILER_PATH,
+# LIBRARY_PATH; skip all such settings.
+ac_fc_v_output=`eval $ac_link 5>&1 2>&1 |
+  sed '/^Driving:/d; /^Configured with:/d;
+      '"/^[_$as_cr_Letters][_$as_cr_alnum]*=/d"`
+$as_echo "$ac_fc_v_output" >&5
+FCFLAGS=$ac_save_FCFLAGS
 
+rm -rf conftest*
 
+# On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where
+# /foo, /bar, and /baz are search directories for the Fortran linker.
+# Here, we change these into -L/foo -L/bar -L/baz (and put it first):
+ac_fc_v_output="`echo $ac_fc_v_output |
+	grep 'LPATH is:' |
+	sed 's|.*LPATH is\(: *[^ ]*\).*|\1|;s|: */| -L/|g'` $ac_fc_v_output"
+
+# FIXME: we keep getting bitten by quoted arguments; a more general fix
+#        that detects unbalanced quotes in FLIBS should be implemented
+#        and (ugh) tested at some point.
+case $ac_fc_v_output in
+  # If we are using xlf then replace all the commas with spaces.
+  *xlfentry*)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed 's/,/ /g'` ;;
+
+  # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted
+  # $LIBS confuse us, and the libraries appear later in the output anyway).
+  *mGLOB_options_string*)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed 's/"-mGLOB[^"]*"/ /g'` ;;
+
+  # Portland Group compiler has singly- or doubly-quoted -cmdline argument
+  # Singly-quoted arguments were reported for versions 5.2-4 and 6.0-4.
+  # Doubly-quoted arguments were reported for "PGF90/x86 Linux/x86 5.0-2".
+  *-cmdline\ * | *-ignore\ * | *-def\ *)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed "\
+	s/-cmdline  *'[^']*'/ /g; s/-cmdline  *\"[^\"]*\"/ /g
+	s/-ignore  *'[^']*'/ /g; s/-ignore  *\"[^\"]*\"/ /g
+	s/-def  *'[^']*'/ /g; s/-def  *\"[^\"]*\"/ /g"` ;;
+
+  # If we are using Cray Fortran then delete quotes.
+  *cft90*)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed 's/"//g'` ;;
+esac
 
 
-if test -n "${ZSH_VERSION+set}" ; then
-   setopt NO_GLOB_SUBST
+  # look for -l* and *.a constructs in the output
+  for ac_arg in $ac_fc_v_output; do
+     case $ac_arg in
+	[\\/]*.a | ?:[\\/]*.a | -[lLRu]*)
+	  ac_cv_prog_fc_v=$ac_verb
+	  break 2 ;;
+     esac
+  done
+done
+if test -z "$ac_cv_prog_fc_v"; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine how to obtain linking information from $FC" >&5
+$as_echo "$as_me: WARNING: cannot determine how to obtain linking information from $FC" >&2;}
+fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compilation failed" >&5
+$as_echo "$as_me: WARNING: compilation failed" >&2;}
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-{ $as_echo "$as_me:$LINENO: checking for objdir" >&5
-$as_echo_n "checking for objdir... " >&6; }
-if test "${lt_cv_objdir+set}" = set; then
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_fc_v" >&5
+$as_echo "$ac_cv_prog_fc_v" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran libraries of $FC" >&5
+$as_echo_n "checking for Fortran libraries of $FC... " >&6; }
+if ${ac_cv_fc_libs+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  rm -f .libs 2>/dev/null
-mkdir .libs 2>/dev/null
-if test -d .libs; then
-  lt_cv_objdir=.libs
+  if test "x$FCLIBS" != "x"; then
+  ac_cv_fc_libs="$FCLIBS" # Let the user override the test.
 else
-  # MS-DOS does not allow filenames that begin with a dot.
-  lt_cv_objdir=_libs
-fi
-rmdir .libs 2>/dev/null
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
-$as_echo "$lt_cv_objdir" >&6; }
-objdir=$lt_cv_objdir
-
-
-
 
+cat > conftest.$ac_ext <<_ACEOF
+      program main
 
-cat >>confdefs.h <<_ACEOF
-#define LT_OBJDIR "$lt_cv_objdir/"
+      end
 _ACEOF
 
+# Compile and link our simple test program by passing a flag (argument
+# 1 to this macro) to the Fortran compiler in order to get
+# "verbose" output that we can then parse for the Fortran linker
+# flags.
+ac_save_FCFLAGS=$FCFLAGS
+FCFLAGS="$FCFLAGS $ac_cv_prog_fc_v"
+eval "set x $ac_link"
+shift
+$as_echo "$as_me:${as_lineno-$LINENO}: $*" >&5
+# gfortran 4.3 outputs lines setting COLLECT_GCC_OPTIONS, COMPILER_PATH,
+# LIBRARY_PATH; skip all such settings.
+ac_fc_v_output=`eval $ac_link 5>&1 2>&1 |
+  sed '/^Driving:/d; /^Configured with:/d;
+      '"/^[_$as_cr_Letters][_$as_cr_alnum]*=/d"`
+$as_echo "$ac_fc_v_output" >&5
+FCFLAGS=$ac_save_FCFLAGS
 
+rm -rf conftest*
 
+# On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where
+# /foo, /bar, and /baz are search directories for the Fortran linker.
+# Here, we change these into -L/foo -L/bar -L/baz (and put it first):
+ac_fc_v_output="`echo $ac_fc_v_output |
+	grep 'LPATH is:' |
+	sed 's|.*LPATH is\(: *[^ ]*\).*|\1|;s|: */| -L/|g'` $ac_fc_v_output"
+
+# FIXME: we keep getting bitten by quoted arguments; a more general fix
+#        that detects unbalanced quotes in FLIBS should be implemented
+#        and (ugh) tested at some point.
+case $ac_fc_v_output in
+  # If we are using xlf then replace all the commas with spaces.
+  *xlfentry*)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed 's/,/ /g'` ;;
+
+  # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted
+  # $LIBS confuse us, and the libraries appear later in the output anyway).
+  *mGLOB_options_string*)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed 's/"-mGLOB[^"]*"/ /g'` ;;
+
+  # Portland Group compiler has singly- or doubly-quoted -cmdline argument
+  # Singly-quoted arguments were reported for versions 5.2-4 and 6.0-4.
+  # Doubly-quoted arguments were reported for "PGF90/x86 Linux/x86 5.0-2".
+  *-cmdline\ * | *-ignore\ * | *-def\ *)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed "\
+	s/-cmdline  *'[^']*'/ /g; s/-cmdline  *\"[^\"]*\"/ /g
+	s/-ignore  *'[^']*'/ /g; s/-ignore  *\"[^\"]*\"/ /g
+	s/-def  *'[^']*'/ /g; s/-def  *\"[^\"]*\"/ /g"` ;;
+
+  # If we are using Cray Fortran then delete quotes.
+  *cft90*)
+    ac_fc_v_output=`echo $ac_fc_v_output | sed 's/"//g'` ;;
+esac
 
 
 
+ac_cv_fc_libs=
 
+# Save positional arguments (if any)
+ac_save_positional="$@"
 
+set X $ac_fc_v_output
+while test $# != 1; do
+  shift
+  ac_arg=$1
+  case $ac_arg in
+	[\\/]*.a | ?:[\\/]*.a)
+	    ac_exists=false
+  for ac_i in $ac_cv_fc_libs; do
+    if test x"$ac_arg" = x"$ac_i"; then
+      ac_exists=true
+      break
+    fi
+  done
 
+  if test x"$ac_exists" = xtrue; then :
 
+else
+  ac_cv_fc_libs="$ac_cv_fc_libs $ac_arg"
+fi
+	  ;;
+	-bI:*)
+	    ac_exists=false
+  for ac_i in $ac_cv_fc_libs; do
+    if test x"$ac_arg" = x"$ac_i"; then
+      ac_exists=true
+      break
+    fi
+  done
 
+  if test x"$ac_exists" = xtrue; then :
 
+else
+  if test "$ac_compiler_gnu" = yes; then
+  for ac_link_opt in $ac_arg; do
+    ac_cv_fc_libs="$ac_cv_fc_libs -Xlinker $ac_link_opt"
+  done
+else
+  ac_cv_fc_libs="$ac_cv_fc_libs $ac_arg"
+fi
+fi
+	  ;;
+	  # Ignore these flags.
+	-lang* | -lcrt*.o | -lc | -lgcc* | -lSystem | -libmil | -little \
+	  |-LANG:=* | -LIST:* | -LNO:* | -link)
+	  ;;
+	-lkernel32)
+	  test x"$CYGWIN" != xyes && ac_cv_fc_libs="$ac_cv_fc_libs $ac_arg"
+	  ;;
+	-[LRuYz])
+	  # These flags, when seen by themselves, take an argument.
+	  # We remove the space between option and argument and re-iterate
+	  # unless we find an empty arg or a new option (starting with -)
+	  case $2 in
+	     "" | -*);;
+	     *)
+		ac_arg="$ac_arg$2"
+		shift; shift
+		set X $ac_arg "$@"
+		;;
+	  esac
+	  ;;
+	-YP,*)
+	  for ac_j in `$as_echo "$ac_arg" | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do
+	      ac_exists=false
+  for ac_i in $ac_cv_fc_libs; do
+    if test x"$ac_j" = x"$ac_i"; then
+      ac_exists=true
+      break
+    fi
+  done
 
+  if test x"$ac_exists" = xtrue; then :
 
+else
+  ac_arg="$ac_arg $ac_j"
+			       ac_cv_fc_libs="$ac_cv_fc_libs $ac_j"
+fi
+	  done
+	  ;;
+	-[lLR]*)
+	    ac_exists=false
+  for ac_i in $ac_cv_fc_libs; do
+    if test x"$ac_arg" = x"$ac_i"; then
+      ac_exists=true
+      break
+    fi
+  done
 
+  if test x"$ac_exists" = xtrue; then :
 
-
-case $host_os in
-aix3*)
-  # AIX sometimes has problems with the GCC collect2 program.  For some
-  # reason, if we set the COLLECT_NAMES environment variable, the problems
-  # vanish in a puff of smoke.
-  if test "X${COLLECT_NAMES+set}" != Xset; then
-    COLLECT_NAMES=
-    export COLLECT_NAMES
-  fi
-  ;;
+else
+  ac_cv_fc_libs="$ac_cv_fc_libs $ac_arg"
+fi
+	  ;;
+	-zallextract*| -zdefaultextract)
+	  ac_cv_fc_libs="$ac_cv_fc_libs $ac_arg"
+	  ;;
+	  # Ignore everything else.
+  esac
+done
+# restore positional arguments
+set X $ac_save_positional; shift
+
+# We only consider "LD_RUN_PATH" on Solaris systems.  If this is seen,
+# then we insist that the "run path" must be an absolute path (i.e. it
+# must begin with a "/").
+case `(uname -sr) 2>/dev/null` in
+   "SunOS 5"*)
+      ac_ld_run_path=`$as_echo "$ac_fc_v_output" |
+			sed -n 's,^.*LD_RUN_PATH *= *\(/[^ ]*\).*$,-R\1,p'`
+      test "x$ac_ld_run_path" != x &&
+	if test "$ac_compiler_gnu" = yes; then
+  for ac_link_opt in $ac_ld_run_path; do
+    ac_cv_fc_libs="$ac_cv_fc_libs -Xlinker $ac_link_opt"
+  done
+else
+  ac_cv_fc_libs="$ac_cv_fc_libs $ac_ld_run_path"
+fi
+      ;;
 esac
+fi # test "x$[]_AC_LANG_PREFIX[]LIBS" = "x"
 
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
-# Global variables:
-ofile=libtool
-can_build_shared=yes
-
-# All known linkers require a `.a' archive for static linking (except MSVC,
-# which needs '.lib').
-libext=a
-
-with_gnu_ld="$lt_cv_prog_gnu_ld"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fc_libs" >&5
+$as_echo "$ac_cv_fc_libs" >&6; }
+FCLIBS="$ac_cv_fc_libs"
 
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
 
-# Set sane defaults for various variables
-test -z "$CC" && CC=cc
-test -z "$LTCC" && LTCC=$CC
-test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
-test -z "$LD" && LD=ld
-test -z "$ac_objext" && ac_objext=o
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+   LIBS="$LIBS $FCLIBS"
 
+   if test "x$nc_build_f90" = xyes; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: configuring fortran" >&5
+$as_echo "$as_me: configuring fortran" >&6;}
+      # Some f90 compilers change the case of the mod file names. Others
+      # require special flags to be set to deal with .f90 files. Find out
+      # about this compiler.
+      ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
 
-# Only perform the check for file, if the check method requires it
-test -z "$MAGIC_CMD" && MAGIC_CMD=file
-case $deplibs_check_method in
-file_magic*)
-  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
-    { $as_echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
-$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+      ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran flag to compile .f90 files" >&5
+$as_echo_n "checking for Fortran flag to compile .f90 files... " >&6; }
+if ${ac_cv_fc_srcext_f90+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case $MAGIC_CMD in
-[\\/*] |  ?:[\\/]*)
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
-  ;;
-*)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
-  for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/${ac_tool_prefix}file; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
-      if test -n "$file_magic_test_file"; then
-	case $deplibs_check_method in
-	"file_magic "*)
-	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
-	    $EGREP "$file_magic_regex" > /dev/null; then
-	    :
-	  else
-	    cat <<_LT_EOF 1>&2
+  ac_ext=f90
+ac_fcflags_srcext_save=$ac_fcflags_srcext
+ac_fcflags_srcext=
+ac_cv_fc_srcext_f90=unknown
+for ac_flag in none -qsuffix=f=f90 -Tf; do
+  test "x$ac_flag" != xnone && ac_fcflags_srcext="$ac_flag"
+  cat > conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+if ac_fn_fc_try_compile "$LINENO"; then :
+  ac_cv_fc_srcext_f90=$ac_flag; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest.$ac_objext conftest.f90
+ac_fcflags_srcext=$ac_fcflags_srcext_save
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fc_srcext_f90" >&5
+$as_echo "$ac_cv_fc_srcext_f90" >&6; }
+if test "x$ac_cv_fc_srcext_f90" = xunknown; then
+  as_fn_error $? "Fortran could not compile .f90 files" "$LINENO" 5
+else
+  ac_fc_srcext=f90
+  if test "x$ac_cv_fc_srcext_f90" = xnone; then
+    ac_fcflags_srcext=""
+    FCFLAGS_f90=""
+  else
+    ac_fcflags_srcext=$ac_cv_fc_srcext_f90
+    FCFLAGS_f90=$ac_cv_fc_srcext_f90
+  fi
 
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such.  This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem.  Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool at gnu.org
 
-_LT_EOF
-	  fi ;;
-	esac
-      fi
-      break
-    fi
-  done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
-  ;;
-esac
 fi
+ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
 
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
-  { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-$as_echo "$MAGIC_CMD" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nf90_open" >&5
+$as_echo_n "checking for library containing nf90_open... " >&6; }
+if ${ac_cv_search_nf90_open+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
+  ac_func_search_save_LIBS=$LIBS
+cat > conftest.$ac_ext <<_ACEOF
+      program main
+      call nf90_open
+      end
+_ACEOF
+for ac_lib in '' netcdf; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_fc_try_link "$LINENO"; then :
+  ac_cv_search_nf90_open=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_nf90_open+:} false; then :
+  break
 fi
+done
+if ${ac_cv_search_nf90_open+:} false; then :
 
+else
+  ac_cv_search_nf90_open=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nf90_open" >&5
+$as_echo "$ac_cv_search_nf90_open" >&6; }
+ac_res=$ac_cv_search_nf90_open
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
+fi
 
+      ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-if test -z "$lt_cv_path_MAGIC_CMD"; then
-  if test -n "$ac_tool_prefix"; then
-    { $as_echo "$as_me:$LINENO: checking for file" >&5
-$as_echo_n "checking for file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking fortran 90 modules inclusion flag" >&5
+$as_echo_n "checking fortran 90 modules inclusion flag... " >&6; }
+if ${ax_cv_f90_modflag+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case $MAGIC_CMD in
-[\\/*] |  ?:[\\/]*)
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
-  ;;
-*)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
-  for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/file; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/file"
-      if test -n "$file_magic_test_file"; then
-	case $deplibs_check_method in
-	"file_magic "*)
-	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
-	    $EGREP "$file_magic_regex" > /dev/null; then
-	    :
-	  else
-	    cat <<_LT_EOF 1>&2
+  ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
 
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such.  This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem.  Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool at gnu.org
+i=0
+while test \( -f tmpdir_$i \) -o \( -d tmpdir_$i \) ; do
+  i=`expr $i + 1`
+done
+mkdir tmpdir_$i
+cd tmpdir_$i
+cat > conftest.$ac_ext <<_ACEOF
+module conftest_module
+   contains
+   subroutine conftest_routine
+   write(*,'(a)') 'gotcha!'
+   end subroutine conftest_routine
+   end module conftest_module
 
-_LT_EOF
-	  fi ;;
-	esac
-      fi
-      break
-    fi
-  done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
-  ;;
-esac
-fi
+_ACEOF
+if ac_fn_fc_try_compile "$LINENO"; then :
 
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
-  { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-$as_echo "$MAGIC_CMD" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+cd ..
+ax_cv_f90_modflag="not found"
+for ax_flag in "-I" "-M" "-p"; do
+  if test "$ax_cv_f90_modflag" = "not found" ; then
+    ax_save_FCFLAGS="$FCFLAGS"
+    FCFLAGS="$ax_save_FCFLAGS ${ax_flag}tmpdir_$i"
+    cat > conftest.$ac_ext <<_ACEOF
+program conftest_program
+       use conftest_module
+       call conftest_routine
+       end program conftest_program
 
-
-  else
-    MAGIC_CMD=:
-  fi
+_ACEOF
+if ac_fn_fc_try_compile "$LINENO"; then :
+  ax_cv_f90_modflag="$ax_flag"
 fi
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    FCFLAGS="$ax_save_FCFLAGS"
   fi
-  ;;
-esac
-
-# Use C for the default configuration in the libtool script
-
-lt_save_CC="$CC"
+done
+rm -fr tmpdir_$i
+if test "$ax_flag" = "not found" ; then
+  as_fn_error $? "unable to find compiler flag for modules inclusion" "$LINENO" 5
+fi
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -9348,1770 +5832,1588 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-# Source file extension for C test sources.
-ac_ext=c
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_f90_modflag" >&5
+$as_echo "$ax_cv_f90_modflag" >&6; }
+      MOD_FLAG=${ax_cv_f90_modflag}
 
-# Object file extension for compiled C test sources.
-objext=o
-objext=$objext
+   fi
+fi
 
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
+# Does the user want to build documentation?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether documentation is to be built" >&5
+$as_echo_n "checking whether documentation is to be built... " >&6; }
+# Check whether --enable-docs was given.
+if test "${enable_docs+set}" = set; then :
+  enableval=$enable_docs;
+fi
 
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}'
+test "x$enable_docs" = xyes || enable_docs=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_docs" >&5
+$as_echo "$enable_docs" >&6; }
+ if test x$enable_docs = xyes; then
+  BUILD_DOCS_TRUE=
+  BUILD_DOCS_FALSE='#'
+else
+  BUILD_DOCS_TRUE='#'
+  BUILD_DOCS_FALSE=
+fi
 
 
+# Does the user want to fetch test data and run extra gridspec tests?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gridspec test data should be fetched from Unidata FTP site" >&5
+$as_echo_n "checking whether gridspec test data should be fetched from Unidata FTP site... " >&6; }
+# Check whether --enable-gridspec-file-tests was given.
+if test "${enable_gridspec_file_tests+set}" = set; then :
+  enableval=$enable_gridspec_file_tests;
+fi
 
+test "x$enable_gridspec_file_tests" = xyes || enable_gridspec_file_tests=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_gridspec_file_tests" >&5
+$as_echo "$enable_gridspec_file_tests" >&6; }
+ if test x$enable_gridspec_file_tests = xyes; then
+  BUILD_GRIDSPEC_FILE_TESTS_TRUE=
+  BUILD_GRIDSPEC_FILE_TESTS_FALSE='#'
+else
+  BUILD_GRIDSPEC_FILE_TESTS_TRUE='#'
+  BUILD_GRIDSPEC_FILE_TESTS_FALSE=
+fi
 
 
+# Does the user want to enable logging?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether logging is enabled (useful to CF developers, mainly" >&5
+$as_echo_n "checking whether logging is enabled (useful to CF developers, mainly... " >&6; }
+# Check whether --enable-logging was given.
+if test "${enable_logging+set}" = set; then :
+  enableval=$enable_logging;
+fi
 
+test "x$enable_logging" = "xyes" || enable_logging=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_logging" >&5
+$as_echo "$enable_logging" >&6; }
+if test "x$enable_logging" = xyes; then
 
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
+$as_echo "#define LOGGING 1" >>confdefs.h
 
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+fi
 
-# Allow CC to be a program name with arguments.
-compiler=$CC
+# Does the user want parallel processing?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether parallel processing is enabled (CC should be set to mpicc or equivalent" >&5
+$as_echo_n "checking whether parallel processing is enabled (CC should be set to mpicc or equivalent... " >&6; }
+# Check whether --enable-parallel was given.
+if test "${enable_parallel+set}" = set; then :
+  enableval=$enable_parallel;
+fi
 
-# Save the default compiler, since it gets overwritten when the other
-# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
-compiler_DEFAULT=$CC
+test "x$enable_parallel" = "xyes" || enable_parallel=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_parallel" >&5
+$as_echo "$enable_parallel" >&6; }
+if test "x$enable_parallel" = xyes; then
 
-# save warnings/boilerplate of simple test code
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$RM conftest*
+$as_echo "#define USE_PARALLEL 1" >>confdefs.h
 
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$RM -r conftest*
+fi
+ if test x$enable_parallel = xyes; then
+  BUILD_PARALLEL_TRUE=
+  BUILD_PARALLEL_FALSE='#'
+else
+  BUILD_PARALLEL_TRUE='#'
+  BUILD_PARALLEL_FALSE=
+fi
 
 
-## CAVEAT EMPTOR:
-## There is no encapsulation within the following macros, do not change
-## the running order or otherwise move them around unless you know exactly
-## what you are doing...
-if test -n "$compiler"; then
+# Does the user want to run extra parallel tests?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether parallel tests should be run" >&5
+$as_echo_n "checking whether parallel tests should be run... " >&6; }
+# Check whether --enable-parallel-tests was given.
+if test "${enable_parallel_tests+set}" = set; then :
+  enableval=$enable_parallel_tests;
+fi
 
-lt_prog_compiler_no_builtin_flag=
+test "x$enable_parallel_tests" = xyes || enable_parallel_tests=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_parallel_tests" >&5
+$as_echo "$enable_parallel_tests" >&6; }
+ if test "x$enable_parallel" = xyes -a "x$enable_parallel_tests" = xyes; then
+  TEST_PARALLEL_TRUE=
+  TEST_PARALLEL_FALSE='#'
+else
+  TEST_PARALLEL_TRUE='#'
+  TEST_PARALLEL_FALSE=
+fi
 
-if test "$GCC" = yes; then
-  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
 
-  { $as_echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
-if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
-  $as_echo_n "(cached) " >&6
+# Does the user want extra tests on CF sample files?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether extra tests on sample data should be performed" >&5
+$as_echo_n "checking whether extra tests on sample data should be performed... " >&6; }
+# Check whether --enable-extra-data-tests was given.
+if test "${enable_extra_data_tests+set}" = set; then :
+  enableval=$enable_extra_data_tests;
+fi
+
+test "x$enable_extra_data_tests" = xyes || enable_extra_data_tests=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_extra_data_tests" >&5
+$as_echo "$enable_extra_data_tests" >&6; }
+ if test x$enable_extra_data_tests = xyes; then
+  EXTRA_DATA_TESTS_TRUE=
+  EXTRA_DATA_TESTS_FALSE='#'
 else
-  lt_cv_prog_compiler_rtti_exceptions=no
-   ac_outfile=conftest.$ac_objext
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="-fno-rtti -fno-exceptions"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9426: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&5
-   echo "$as_me:9430: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_rtti_exceptions=yes
-     fi
-   fi
-   $RM conftest*
+  EXTRA_DATA_TESTS_TRUE='#'
+  EXTRA_DATA_TESTS_FALSE=
+fi
+
 
+libcf_build_regrid=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether regridding API is desired" >&5
+$as_echo_n "checking whether regridding API is desired... " >&6; }
+# Check whether --enable-regrid was given.
+if test "${enable_regrid+set}" = set; then :
+  enableval=$enable_regrid;
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
-$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
 
-if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
-    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
-else
-    :
+if test "x$enable_regrid" != "xno"; then
+   libcf_build_regrid=yes
 fi
 
+# Do we want to build the fortran API? Check for --disable-f90
+nc_build_f90=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Fortran 90 API is desired" >&5
+$as_echo_n "checking whether Fortran 90 API is desired... " >&6; }
+# Check whether --enable-f90 was given.
+if test "${enable_f90+set}" = set; then :
+  enableval=$enable_f90;
 fi
 
+test "x$enable_f90" = "xno" && nc_build_f90=no
+test "x$nc_null_fc" = xyes && nc_build_f90=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $nc_build_f90" >&5
+$as_echo "$nc_build_f90" >&6; }
+ if test "x$nc_build_f90" = xyes; then
+  BUILD_F90_TRUE=
+  BUILD_F90_FALSE='#'
+else
+  BUILD_F90_TRUE='#'
+  BUILD_F90_FALSE=
+fi
 
 
+# Did the user specify a location for the netcdf library?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a location for the netCDF library was specified" >&5
+$as_echo_n "checking whether a location for the netCDF library was specified... " >&6; }
 
+# Check whether --with-netcdf was given.
+if test "${with_netcdf+set}" = set; then :
+  withval=$with_netcdf;
+else
+  with_netcdf=no
+fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_netcdf" >&5
+$as_echo "$with_netcdf" >&6; }
+ if test ! x$with_netcdf = xno; then
+  USE_NETCDF_DIR_TRUE=
+  USE_NETCDF_DIR_FALSE='#'
+else
+  USE_NETCDF_DIR_TRUE='#'
+  USE_NETCDF_DIR_FALSE=
+fi
 
-  lt_prog_compiler_wl=
-lt_prog_compiler_pic=
-lt_prog_compiler_static=
+if test ! x$with_netcdf = xno; then
+   NETCDFDIR=$with_netcdf
 
-{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+   NCDUMPDIR=$with_netcdf/bin
 
-  if test "$GCC" = yes; then
-    lt_prog_compiler_wl='-Wl,'
-    lt_prog_compiler_static='-static'
+   LDFLAGS="${LDFLAGS} -L$NETCDFDIR/lib"
+   # Extract the first word of "ncdump", so it can be a program name with args.
+set dummy ncdump; 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_NCDUMP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $NCDUMP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_NCDUMP="$NCDUMP" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $with_netcdf/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_NCDUMP="$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
 
-    case $host_os in
-      aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	lt_prog_compiler_static='-Bstatic'
-      fi
-      ;;
+  test -z "$ac_cv_path_NCDUMP" && ac_cv_path_NCDUMP="ncdump"
+  ;;
+esac
+fi
+NCDUMP=$ac_cv_path_NCDUMP
+if test -n "$NCDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NCDUMP" >&5
+$as_echo "$NCDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            lt_prog_compiler_pic='-fPIC'
-        ;;
-      m68k)
-            # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
-            lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
-        ;;
-      esac
-      ;;
 
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
+else
+   NCDUMPDIR=../../../../ncdump
 
-    mingw* | cygwin* | pw32* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      lt_prog_compiler_pic='-DDLL_EXPORT'
-      ;;
+   # Extract the first word of "ncdump", so it can be a program name with args.
+set dummy ncdump; 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_NCDUMP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $NCDUMP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_NCDUMP="$NCDUMP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_NCDUMP="$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
 
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      lt_prog_compiler_pic='-fno-common'
-      ;;
+  test -z "$ac_cv_path_NCDUMP" && ac_cv_path_NCDUMP="ncdump"
+  ;;
+esac
+fi
+NCDUMP=$ac_cv_path_NCDUMP
+if test -n "$NCDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NCDUMP" >&5
+$as_echo "$NCDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-    hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	lt_prog_compiler_pic='-fPIC'
-	;;
-      esac
-      ;;
 
-    interix[3-9]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
+fi
 
-    msdosdjgpp*)
-      # Just because we use GCC doesn't mean we suddenly get shared libraries
-      # on systems that don't support them.
-      lt_prog_compiler_can_build_shared=no
-      enable_shared=no
-      ;;
+lapacklibdir_l=""
 
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      lt_prog_compiler_pic='-fPIC -shared'
-      ;;
+# Check whether --with-lapack-libdir was given.
+if test "${with_lapack_libdir+set}" = set; then :
+  withval=$with_lapack_libdir; lapacklibdir_l="-L$withval"
+fi
 
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	lt_prog_compiler_pic=-Kconform_pic
-      fi
-      ;;
+LDFLAGS="$lapacklibdir_l $LDFLAGS"
 
-    *)
-      lt_prog_compiler_pic='-fPIC'
-      ;;
-    esac
-  else
-    # PORTME Check for flag to pass linker flags through the system compiler.
-    case $host_os in
-    aix*)
-      lt_prog_compiler_wl='-Wl,'
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	lt_prog_compiler_static='-Bstatic'
-      else
-	lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
-      fi
-      ;;
+blaslib=""
 
-    mingw* | cygwin* | pw32* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      lt_prog_compiler_pic='-DDLL_EXPORT'
-      ;;
+# Check whether --with-blas-lib was given.
+if test "${with_blas_lib+set}" = set; then :
+  withval=$with_blas_lib; blaslib="$withval"
+fi
 
-    hpux9* | hpux10* | hpux11*)
-      lt_prog_compiler_wl='-Wl,'
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	lt_prog_compiler_pic='+Z'
-	;;
-      esac
-      # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      lt_prog_compiler_static='${wl}-a ${wl}archive'
-      ;;
+LIBS="$blaslib $LIBS"
 
-    irix5* | irix6* | nonstopux*)
-      lt_prog_compiler_wl='-Wl,'
-      # PIC (with -KPIC) is the default.
-      lt_prog_compiler_static='-non_shared'
-      ;;
+lapacklib=""
 
-    linux* | k*bsd*-gnu)
-      case $cc_basename in
-      icc* | ecc* | ifort*)
-	lt_prog_compiler_wl='-Wl,'
-	lt_prog_compiler_pic='-KPIC'
-	lt_prog_compiler_static='-static'
-        ;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
-        # Portland Group compilers (*not* the Pentium gcc compiler,
-	# which looks to be a dead project)
-	lt_prog_compiler_wl='-Wl,'
-	lt_prog_compiler_pic='-fpic'
-	lt_prog_compiler_static='-Bstatic'
-        ;;
-      ccc*)
-        lt_prog_compiler_wl='-Wl,'
-        # All Alpha code is PIC.
-        lt_prog_compiler_static='-non_shared'
-        ;;
-      xl*)
-	# IBM XL C 8.0/Fortran 10.1 on PPC
-	lt_prog_compiler_wl='-Wl,'
-	lt_prog_compiler_pic='-qpic'
-	lt_prog_compiler_static='-qstaticlink'
-	;;
-      *)
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
-	  lt_prog_compiler_pic='-KPIC'
-	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl='-Wl,'
-	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  lt_prog_compiler_pic='-KPIC'
-	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl=''
-	  ;;
-	esac
-	;;
-      esac
-      ;;
+# Check whether --with-lapack-lib was given.
+if test "${with_lapack_lib+set}" = set; then :
+  withval=$with_lapack_lib; lapacklib="$withval"
+fi
+
+LIBS="$lapacklib $LIBS"
+
+# check if compiler supports MPI directives
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if ${ac_cv_prog_CPP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
 
-    newsos6)
-      lt_prog_compiler_pic='-KPIC'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      lt_prog_compiler_pic='-fPIC -shared'
-      ;;
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
-    osf3* | osf4* | osf5*)
-      lt_prog_compiler_wl='-Wl,'
-      # All OSF/1 code is PIC.
-      lt_prog_compiler_static='-non_shared'
-      ;;
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
 
-    rdos*)
-      lt_prog_compiler_static='-non_shared'
-      ;;
+    done
+    ac_cv_prog_CPP=$CPP
 
-    solaris*)
-      lt_prog_compiler_pic='-KPIC'
-      lt_prog_compiler_static='-Bstatic'
-      case $cc_basename in
-      f77* | f90* | f95*)
-	lt_prog_compiler_wl='-Qoption ld ';;
-      *)
-	lt_prog_compiler_wl='-Wl,';;
-      esac
-      ;;
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
 
-    sunos4*)
-      lt_prog_compiler_wl='-Qoption ld '
-      lt_prog_compiler_pic='-PIC'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
-    sysv4 | sysv4.2uw2* | sysv4.3*)
-      lt_prog_compiler_wl='-Wl,'
-      lt_prog_compiler_pic='-KPIC'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
-    sysv4*MP*)
-      if test -d /usr/nec ;then
-	lt_prog_compiler_pic='-Kconform_pic'
-	lt_prog_compiler_static='-Bstatic'
-      fi
-      ;;
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
 
-    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-      lt_prog_compiler_wl='-Wl,'
-      lt_prog_compiler_pic='-KPIC'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
 
-    unicos*)
-      lt_prog_compiler_wl='-Wl,'
-      lt_prog_compiler_can_build_shared=no
-      ;;
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-    uts4*)
-      lt_prog_compiler_pic='-pic'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
 
-    *)
-      lt_prog_compiler_can_build_shared=no
-      ;;
-    esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
+else
+  ac_cv_path_GREP=$GREP
+fi
 
-case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
-  *djgpp*)
-    lt_prog_compiler_pic=
-    ;;
-  *)
-    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
-    ;;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
 esac
-{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
-$as_echo "$lt_prog_compiler_pic" >&6; }
-
-
 
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
 
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
 
 
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$lt_prog_compiler_pic"; then
-  { $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
-$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
-if test "${lt_cv_prog_compiler_pic_works+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  lt_cv_prog_compiler_pic_works=no
-   ac_outfile=conftest.$ac_objext
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9750: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&5
-   echo "$as_me:9754: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_pic_works=yes
-     fi
-   fi
-   $RM conftest*
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5
-$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
 
-if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
-    case $lt_prog_compiler_pic in
-     "" | " "*) ;;
-     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
-     esac
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
 else
-    lt_prog_compiler_pic=
-     lt_prog_compiler_can_build_shared=no
-fi
-
+  ac_cv_header_stdc=no
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
 
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
 
-
-
-
-#
-# Check to make sure the static flag actually works.
-#
-wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
-{ $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
-if test "${lt_cv_prog_compiler_static_works+set}" = set; then
-  $as_echo_n "(cached) " >&6
 else
-  lt_cv_prog_compiler_static_works=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The linker can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test -s conftest.err; then
-       # Append any errors to the config.log.
-       cat conftest.err 1>&5
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_cv_prog_compiler_static_works=yes
-       fi
-     else
-       lt_cv_prog_compiler_static_works=yes
-     fi
-   fi
-   $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
-
+  ac_cv_header_stdc=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5
-$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+rm -f conftest*
 
-if test x"$lt_cv_prog_compiler_static_works" = xyes; then
-    :
-else
-    lt_prog_compiler_static=
 fi
 
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
 
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
 
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
 
+fi
 
-
-
-  { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then
-  $as_echo_n "(cached) " >&6
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
 else
-  lt_cv_prog_compiler_c_o=no
-   $RM -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
 
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9855: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:9859: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_c_o=yes
-     fi
-   fi
-   chmod u+w . 2>&5
-   $RM conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
-   $RM out/* && rmdir out
-   cd ..
-   $RM -r conftest
-   $RM conftest*
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
 
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
-$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
 
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
+fi
 
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
 
+fi
 
-  { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_c_o=no
-   $RM -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+done
 
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9910: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:9914: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_c_o=yes
-     fi
-   fi
-   chmod u+w . 2>&5
-   $RM conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
-   $RM out/* && rmdir out
-   cd ..
-   $RM -r conftest
-   $RM conftest*
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
-$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+for ac_header in mpi.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "mpi.h" "ac_cv_header_mpi_h" "$ac_includes_default"
+if test "x$ac_cv_header_mpi_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_MPI_H 1
+_ACEOF
 
+fi
 
+done
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing MPI_Init" >&5
+$as_echo_n "checking for library containing MPI_Init... " >&6; }
+if ${ac_cv_search_MPI_Init+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-hard_links="nottested"
-if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
-  # do not overwrite the value of need_locks provided by the user
-  { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-$as_echo_n "checking if we can lock with hard links... " >&6; }
-  hard_links=yes
-  $RM conftest*
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  touch conftest.a
-  ln conftest.a conftest.b 2>&5 || hard_links=no
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { $as_echo "$as_me:$LINENO: result: $hard_links" >&5
-$as_echo "$hard_links" >&6; }
-  if test "$hard_links" = no; then
-    { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
-    need_locks=warn
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char MPI_Init ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+return MPI_Init ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' mpi mpich pmpi; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
   fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_MPI_Init=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_MPI_Init+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_MPI_Init+:} false; then :
+
 else
-  need_locks=no
+  ac_cv_search_MPI_Init=no
 fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_MPI_Init" >&5
+$as_echo "$ac_cv_search_MPI_Init" >&6; }
+ac_res=$ac_cv_search_MPI_Init
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
+fi
 
+ if test "$ac_cv_header_mpi_h" = "yes" -a test "$ac_cv_lib_MPI_Init" != "no"; then
+  HAVE_MPI_TRUE=
+  HAVE_MPI_FALSE='#'
+else
+  HAVE_MPI_TRUE='#'
+  HAVE_MPI_FALSE=
+fi
 
 
+# Can we find the nccmp utility?
+#AC_PATH_PROG([NCCMP], [nccmp])
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: finding other utilities" >&5
+$as_echo "$as_me: finding other utilities" >&6;}
 
-  { $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
 
-  runpath_var=
-  allow_undefined_flag=
-  always_export_symbols=no
-  archive_cmds=
-  archive_expsym_cmds=
-  compiler_needs_object=no
-  enable_shared_with_static_runtimes=no
-  export_dynamic_flag_spec=
-  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  hardcode_automatic=no
-  hardcode_direct=no
-  hardcode_direct_absolute=no
-  hardcode_libdir_flag_spec=
-  hardcode_libdir_flag_spec_ld=
-  hardcode_libdir_separator=
-  hardcode_minus_L=no
-  hardcode_shlibpath_var=unsupported
-  inherit_rpath=no
-  link_all_deplibs=unknown
-  module_cmds=
-  module_expsym_cmds=
-  old_archive_from_new_cmds=
-  old_archive_from_expsyms_cmds=
-  thread_safe_flag_spec=
-  whole_archive_flag_spec=
-  # include_expsyms should be a list of space-separated symbols to be *always*
-  # included in the symbol list
-  include_expsyms=
-  # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
-  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
-  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
-  # platforms (ab)use it in PIC code, but their linkers get confused if
-  # the symbol is explicitly referenced.  Since portable code cannot
-  # rely on this symbol name, it's probably fine to never include it in
-  # preloaded symbol tables.
-  # Exclude shared library initialization/finalization symbols.
-  extract_expsyms_cmds=
 
-  case $host_os in
-  cygwin* | mingw* | pw32*)
-    # FIXME: the MSVC++ port hasn't been tested in a loooong time
-    # When not using gcc, we currently assume that we are using
-    # Microsoft Visual C++.
-    if test "$GCC" != yes; then
-      with_gnu_ld=no
-    fi
-    ;;
-  interix*)
-    # we just hope/assume this is gcc and not c89 (= MSVC++)
-    with_gnu_ld=yes
-    ;;
-  openbsd*)
-    with_gnu_ld=no
-    ;;
-  esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: setting up libtool" >&5
+$as_echo "$as_me: setting up libtool" >&6;}
 
-  ld_shlibs=yes
-  if test "$with_gnu_ld" = yes; then
-    # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
+# Use libtool.
+case `pwd` in
+  *\ * | *\	*)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
 
-    # Set some defaults for GNU ld with shared library support. These
-    # are reset later if shared libraries are not supported. Putting them
-    # here allows them to be overridden if necessary.
-    runpath_var=LD_RUN_PATH
-    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-    export_dynamic_flag_spec='${wl}--export-dynamic'
-    # ancient GNU ld didn't support --whole-archive et. al.
-    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
-      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-    else
-      whole_archive_flag_spec=
-    fi
-    supports_anon_versioning=no
-    case `$LD -v 2>&1` in
-      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
-      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
-      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
-      *\ 2.11.*) ;; # other 2.11 versions
-      *) supports_anon_versioning=yes ;;
-    esac
 
-    # See if GNU ld supports shared libraries.
-    case $host_os in
-    aix[3-9]*)
-      # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
-	ld_shlibs=no
-	cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
+macro_version='2.4'
+macro_revision='1.3293'
 
-_LT_EOF
-      fi
-      ;;
 
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            archive_expsym_cmds=''
-        ;;
-      m68k)
-            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            hardcode_libdir_flag_spec='-L$libdir'
-            hardcode_minus_L=yes
-        ;;
-      esac
-      ;;
 
-    beos*)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	allow_undefined_flag=unsupported
-	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	# support --undefined.  This deserves some investigation.  FIXME
-	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      else
-	ld_shlibs=no
-      fi
-      ;;
 
-    cygwin* | mingw* | pw32*)
-      # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
-      # as there is no search path for DLLs.
-      hardcode_libdir_flag_spec='-L$libdir'
-      allow_undefined_flag=unsupported
-      always_export_symbols=no
-      enable_shared_with_static_runtimes=yes
-      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
 
-      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	# If the export-symbols file already is a .def file (1st line
-	# is EXPORTS), use it as is; otherwise, prepend...
-	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	  cp $export_symbols $output_objdir/$soname.def;
-	else
-	  echo EXPORTS > $output_objdir/$soname.def;
-	  cat $export_symbols >> $output_objdir/$soname.def;
-	fi~
-	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-      else
-	ld_shlibs=no
-      fi
-      ;;
 
-    interix[3-9]*)
-      hardcode_direct=no
-      hardcode_shlibpath_var=no
-      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-      export_dynamic_flag_spec='${wl}-E'
-      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-      # Instead, shared libraries are loaded at an image base (0x10000000 by
-      # default) and relocated if they conflict, which is a slow very memory
-      # consuming and fragmenting process.  To avoid this, we pick a random,
-      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      ;;
 
-    gnu* | linux* | tpf* | k*bsd*-gnu)
-      tmp_diet=no
-      if test "$host_os" = linux-dietlibc; then
-	case $cc_basename in
-	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
-	esac
-      fi
-      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
-	 && test "$tmp_diet" = no
-      then
-	tmp_addflag=
-	tmp_sharedflag='-shared'
-	case $cc_basename,$host_cpu in
-        pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag'
-	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag -Mnomain' ;;
-	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
-	  tmp_addflag=' -i_dynamic' ;;
-	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
-	  tmp_addflag=' -i_dynamic -nofor_main' ;;
-	ifc* | ifort*)			# Intel Fortran compiler
-	  tmp_addflag=' -nofor_main' ;;
-	xl[cC]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
-	  tmp_sharedflag='-qmkshrobj'
-	  tmp_addflag= ;;
-	esac
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
-	  compiler_needs_object=yes
-	  tmp_sharedflag='-G' ;;
-	*Sun\ F*)			# Sun Fortran 8.3
-	  tmp_sharedflag='-G' ;;
-	esac
-	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
 
-        if test "x$supports_anon_versioning" = xyes; then
-          archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
-	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	    echo "local: *; };" >> $output_objdir/$libname.ver~
-	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-        fi
 
-	case $cc_basename in
-	xlf*)
-	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
-	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
-	  hardcode_libdir_flag_spec=
-	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
-	  archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
-	  if test "x$supports_anon_versioning" = xyes; then
-	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
-	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
-	  fi
-	  ;;
-	esac
-      else
-        ld_shlibs=no
-      fi
-      ;;
 
-    netbsd*)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
-	wlarc=
-      else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      fi
-      ;;
 
-    solaris*)
-      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
-	ld_shlibs=no
-	cat <<_LT_EOF 1>&2
 
-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
-*** create shared libraries on Solaris systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.9.1 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
 
-_LT_EOF
-      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	ld_shlibs=no
-      fi
-      ;;
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO ""
+}
+
+case "$ECHO" in
+  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
 
-    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
-      case `$LD -v 2>&1` in
-        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
-	ld_shlibs=no
-	cat <<_LT_EOF 1>&2
 
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
 
-_LT_EOF
-	;;
-	*)
-	  # For security reasons, it is highly recommended that you always
-	  # use absolute paths for naming shared libraries, and exclude the
-	  # DT_RUNPATH tag from executables and libraries.  But doing so
-	  # requires that you compile everything twice, which is a pain.
-	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-	  else
-	    ld_shlibs=no
-	  fi
-	;;
-      esac
-      ;;
 
-    sunos4*)
-      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      wlarc=
-      hardcode_direct=yes
-      hardcode_shlibpath_var=no
-      ;;
 
-    *)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	ld_shlibs=no
-      fi
-      ;;
-    esac
 
-    if test "$ld_shlibs" = no; then
-      runpath_var=
-      hardcode_libdir_flag_spec=
-      export_dynamic_flag_spec=
-      whole_archive_flag_spec=
-    fi
-  else
-    # PORTME fill in a description of your system's linker (not GNU ld)
-    case $host_os in
-    aix3*)
-      allow_undefined_flag=unsupported
-      always_export_symbols=yes
-      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
-      # Note: this linker hardcodes the directories in LIBPATH if there
-      # are no directories specified by -L.
-      hardcode_minus_L=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
-	# Neither direct hardcoding nor static linking is supported with a
-	# broken collect2.
-	hardcode_direct=unsupported
-      fi
-      ;;
 
-    aix[4-9]*)
-      if test "$host_cpu" = ia64; then
-	# On IA64, the linker does run time linking by default, so we don't
-	# have to do anything special.
-	aix_use_runtimelinking=no
-	exp_sym_flag='-Bexport'
-	no_entry_flag=""
-      else
-	# If we're using GNU nm, then we don't want the "-C" option.
-	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-	else
-	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-	fi
-	aix_use_runtimelinking=no
 
-	# Test if we are trying to use run time linking or normal
-	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
-	# need to do runtime linking.
-	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
-	  for ld_flag in $LDFLAGS; do
-	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
-	    aix_use_runtimelinking=yes
-	    break
-	  fi
-	  done
-	  ;;
-	esac
 
-	exp_sym_flag='-bexport'
-	no_entry_flag='-bnoentry'
-      fi
 
-      # When large executables or shared objects are built, AIX ld can
-      # have problems creating the table of contents.  If linking a library
-      # or program results in "error TOC overflow" add -mminimal-toc to
-      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
 
-      archive_cmds=''
-      hardcode_direct=yes
-      hardcode_direct_absolute=yes
-      hardcode_libdir_separator=':'
-      link_all_deplibs=yes
-      file_list_spec='${wl}-f,'
 
-      if test "$GCC" = yes; then
-	case $host_os in aix4.[012]|aix4.[012].*)
-	# We only want to do this on AIX 4.2 and lower, the check
-	# below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
-	  if test -f "$collect2name" &&
-	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
-	  then
-	  # We have reworked collect2
-	  :
-	  else
-	  # We have old collect2
-	  hardcode_direct=unsupported
-	  # It fails to find uninstalled libraries when the uninstalled
-	  # path is not listed in the libpath.  Setting hardcode_minus_L
-	  # to unsupported forces relinking
-	  hardcode_minus_L=yes
-	  hardcode_libdir_flag_spec='-L$libdir'
-	  hardcode_libdir_separator=
-	  fi
-	  ;;
-	esac
-	shared_flag='-shared'
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag="$shared_flag "'${wl}-G'
-	fi
-      else
-	# not using gcc
-	if test "$host_cpu" = ia64; then
-	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-	# chokes on -Wl,-G. The following line is correct:
-	  shared_flag='-G'
-	else
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag='${wl}-G'
-	  else
-	    shared_flag='${wl}-bM:SRE'
-	  fi
-	fi
-      fi
 
-      # It seems that -bexpall does not export symbols beginning with
-      # underscore (_), so it is better to generate a list of symbols to export.
-      always_export_symbols=yes
-      if test "$aix_use_runtimelinking" = yes; then
-	# Warning - without using the other runtime loading flags (-brtl),
-	# -berok will link without error, but may produce a broken library.
-	allow_undefined_flag='-berok'
-        # Determine the default libpath from the value encoded in an
-        # empty executable.
-        cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  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_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
+else
+  ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
 
-int
-main ()
-{
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
 
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
-        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-      else
-	if test "$host_cpu" = ia64; then
-	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
-	  allow_undefined_flag="-z nodefs"
-	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-	else
-	 # Determine the default libpath from the value encoded in an
-	 # empty executable.
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
 
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if ${ac_cv_path_FGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+   then ac_cv_path_FGREP="$GREP -F"
+   else
+     if test -z "$FGREP"; then
+  ac_path_FGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in fgrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+  # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'FGREP' >> "conftest.nl"
+    "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_FGREP="$ac_path_FGREP"
+      ac_path_FGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
 
+      $ac_path_FGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_FGREP"; then
+    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_FGREP=$FGREP
+fi
 
+   fi
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
-	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-	  # Warning - without using the other run time loading flags,
-	  # -berok will link without error, but may produce a broken library.
-	  no_undefined_flag=' ${wl}-bernotok'
-	  allow_undefined_flag=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  whole_archive_flag_spec='$convenience'
-	  archive_cmds_need_lc=yes
-	  # This is similar to how AIX traditionally builds its shared libraries.
-	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-	fi
-      fi
-      ;;
+test -z "$GREP" && GREP=grep
 
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            archive_expsym_cmds=''
-        ;;
-      m68k)
-            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            hardcode_libdir_flag_spec='-L$libdir'
-            hardcode_minus_L=yes
-        ;;
-      esac
-      ;;
 
-    bsdi[45]*)
-      export_dynamic_flag_spec=-rdynamic
-      ;;
 
-    cygwin* | mingw* | pw32*)
-      # When not using gcc, we currently assume that we are using
-      # Microsoft Visual C++.
-      # hardcode_libdir_flag_spec is actually meaningless, as there is
-      # no search path for DLLs.
-      hardcode_libdir_flag_spec=' '
-      allow_undefined_flag=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      old_archive_from_new_cmds='true'
-      # FIXME: Should let the user specify the lib program.
-      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      fix_srcfile_path='`cygpath -w "$srcfile"`'
-      enable_shared_with_static_runtimes=yes
-      ;;
 
-    darwin* | rhapsody*)
 
 
-  archive_cmds_need_lc=no
-  hardcode_direct=no
-  hardcode_automatic=yes
-  hardcode_shlibpath_var=unsupported
-  whole_archive_flag_spec=''
-  link_all_deplibs=yes
-  allow_undefined_flag="$_lt_dar_allow_undefined"
-  if test "$GCC" = "yes"; then
-    output_verbose_link_cmd=echo
-    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-    module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
 
-  else
-  ld_shlibs=no
-  fi
 
-      ;;
 
-    dgux*)
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_shlibpath_var=no
-      ;;
 
-    freebsd1*)
-      ld_shlibs=no
-      ;;
 
-    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
-    # support.  Future versions do this automatically, but an explicit c++rt0.o
-    # does not break anything, and helps significantly (at the cost of a little
-    # extra space).
-    freebsd2.2*)
-      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
-      hardcode_libdir_flag_spec='-R$libdir'
-      hardcode_direct=yes
-      hardcode_shlibpath_var=no
-      ;;
 
-    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
-      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct=yes
-      hardcode_minus_L=yes
-      hardcode_shlibpath_var=no
-      ;;
 
-    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
-      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
-      hardcode_libdir_flag_spec='-R$libdir'
-      hardcode_direct=yes
-      hardcode_shlibpath_var=no
-      ;;
 
-    hpux9*)
-      if test "$GCC" = yes; then
-	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      else
-	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      fi
-      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-      hardcode_libdir_separator=:
-      hardcode_direct=yes
 
-      # hardcode_minus_L: Not really in the search PATH,
-      # but as the default location of the library.
-      hardcode_minus_L=yes
-      export_dynamic_flag_spec='${wl}-E'
-      ;;
 
-    hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-	hardcode_libdir_flag_spec_ld='+b $libdir'
-	hardcode_libdir_separator=:
-	hardcode_direct=yes
-	hardcode_direct_absolute=yes
-	export_dynamic_flag_spec='${wl}-E'
-	# hardcode_minus_L: Not really in the search PATH,
-	# but as the default location of the library.
-	hardcode_minus_L=yes
-      fi
-      ;;
 
-    hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	case $host_cpu in
-	hppa*64*)
-	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      else
-	case $host_cpu in
-	hppa*64*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if ${lt_cv_path_NM+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
 	  ;;
 	*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
 	  ;;
 	esac
       fi
-      if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-	hardcode_libdir_separator=:
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in dumpbin "link -dump"
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$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_DUMPBIN+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DUMPBIN"; then
+  ac_cv_prog_DUMPBIN="$DUMPBIN" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DUMPBIN="$ac_tool_prefix$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
 
-	case $host_cpu in
-	hppa*64*|ia64*)
-	  hardcode_direct=no
-	  hardcode_shlibpath_var=no
-	  ;;
-	*)
-	  hardcode_direct=yes
-	  hardcode_direct_absolute=yes
-	  export_dynamic_flag_spec='${wl}-E'
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-	  # hardcode_minus_L: Not really in the search PATH,
-	  # but as the default location of the library.
-	  hardcode_minus_L=yes
-	  ;;
-	esac
-      fi
-      ;;
 
-    irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	# Try to use the -exported_symbol ld option, if it does not
-	# work, assume that -exports_file does not work either and
-	# implicitly export all symbols.
-        save_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-        cat >conftest.$ac_ext <<_ACEOF
-int foo(void) {}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+    test -n "$DUMPBIN" && break
+  done
+fi
+if test -z "$DUMPBIN"; then
+  ac_ct_DUMPBIN=$DUMPBIN
+  for ac_prog in dumpbin "link -dump"
+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_ac_ct_DUMPBIN+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DUMPBIN"; then
+  ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DUMPBIN="$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
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
+  test -n "$ac_ct_DUMPBIN" && break
+done
 
+  if test "x$ac_ct_DUMPBIN" = x; then
+    DUMPBIN=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DUMPBIN=$ac_ct_DUMPBIN
+  fi
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-        LDFLAGS="$save_LDFLAGS"
-      else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
-      fi
-      archive_cmds_need_lc='no'
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator=:
-      inherit_rpath=yes
-      link_all_deplibs=yes
-      ;;
-
-    netbsd*)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
-      else
-	archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
-      fi
-      hardcode_libdir_flag_spec='-R$libdir'
-      hardcode_direct=yes
-      hardcode_shlibpath_var=no
-      ;;
-
-    newsos6)
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct=yes
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator=:
-      hardcode_shlibpath_var=no
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
       ;;
-
-    *nto* | *qnx*)
+    *)
+      DUMPBIN=:
       ;;
+    esac
+  fi
 
-    openbsd*)
-      if test -f /usr/libexec/ld.so; then
-	hardcode_direct=yes
-	hardcode_shlibpath_var=no
-	hardcode_direct_absolute=yes
-	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-	  export_dynamic_flag_spec='${wl}-E'
-	else
-	  case $host_os in
-	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-	     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     hardcode_libdir_flag_spec='-R$libdir'
-	     ;;
-	   *)
-	     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-	     ;;
-	  esac
-	fi
-      else
-	ld_shlibs=no
-      fi
-      ;;
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
 
-    os2*)
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_minus_L=yes
-      allow_undefined_flag=unsupported
-      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
-      ;;
 
-    osf3*)
-      if test "$GCC" = yes; then
-	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-      fi
-      archive_cmds_need_lc='no'
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator=:
-      ;;
 
-    osf4* | osf5*)	# as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-      else
-	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
-	# Both c and cxx compiler support -rpath directly
-	hardcode_libdir_flag_spec='-rpath $libdir'
-      fi
-      archive_cmds_need_lc='no'
-      hardcode_libdir_separator=:
-      ;;
 
-    solaris*)
-      no_undefined_flag=' -z defs'
-      if test "$GCC" = yes; then
-	wlarc='${wl}'
-	archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-      else
-	case `$CC -V 2>&1` in
-	*"Compilers 5.0"*)
-	  wlarc=''
-	  archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
-	  ;;
-	*)
-	  wlarc='${wl}'
-	  archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
-	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-	  ;;
-	esac
-      fi
-      hardcode_libdir_flag_spec='-R$libdir'
-      hardcode_shlibpath_var=no
-      case $host_os in
-      solaris2.[0-5] | solaris2.[0-5].*) ;;
-      *)
-	# The compiler driver will combine and reorder linker options,
-	# but understands `-z linker_flag'.  GCC discards it without `$wl',
-	# but is careful enough not to reorder.
-	# Supported since Solaris 2.6 (maybe 2.5.1?)
-	if test "$GCC" = yes; then
-	  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	else
-	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
-	fi
-	;;
-      esac
-      link_all_deplibs=yes
-      ;;
 
-    sunos4*)
-      if test "x$host_vendor" = xsequent; then
-	# Use $CC to link under sequent, because it throws in some extra .o
-	# files that make .init and .fini sections work.
-	archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_direct=yes
-      hardcode_minus_L=yes
-      hardcode_shlibpath_var=no
-      ;;
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if ${lt_cv_nm_interface+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+  cat conftest.out >&5
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
 
-    sysv4)
-      case $host_vendor in
-	sni)
-	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  hardcode_direct=yes # is this really true???
-	;;
-	siemens)
-	  ## LD is ld it makes a PLAMLIB
-	  ## CC just makes a GrossModule.
-	  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
-	  reload_cmds='$CC -r -o $output$reload_objs'
-	  hardcode_direct=no
-        ;;
-	motorola)
-	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  hardcode_direct=no #Motorola manual says yes, but my tests say they lie
-	;;
-      esac
-      runpath_var='LD_RUN_PATH'
-      hardcode_shlibpath_var=no
-      ;;
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
 
-    sysv4.3*)
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_shlibpath_var=no
-      export_dynamic_flag_spec='-Bexport'
-      ;;
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if ${lt_cv_sys_max_cmd_len+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+    i=0
+  teststring="ABCD"
 
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	hardcode_shlibpath_var=no
-	runpath_var=LD_RUN_PATH
-	hardcode_runpath_var=yes
-	ld_shlibs=yes
-      fi
-      ;;
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
 
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
-      no_undefined_flag='${wl}-z,text'
-      archive_cmds_need_lc=no
-      hardcode_shlibpath_var=no
-      runpath_var='LD_RUN_PATH'
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
 
-      if test "$GCC" = yes; then
-	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
 
-    sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
-      # link with -lc, and that would cause any symbols used from libc to
-      # always be unresolved, which means just about no library would
-      # ever link correctly.  If we're not using GNU ld we use -z text
-      # though, which does catch some bad symbols but isn't as heavy-handed
-      # as -z defs.
-      no_undefined_flag='${wl}-z,text'
-      allow_undefined_flag='${wl}-z,nodefs'
-      archive_cmds_need_lc=no
-      hardcode_shlibpath_var=no
-      hardcode_libdir_flag_spec='${wl}-R,$libdir'
-      hardcode_libdir_separator=':'
-      link_all_deplibs=yes
-      export_dynamic_flag_spec='${wl}-Bexport'
-      runpath_var='LD_RUN_PATH'
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
 
-      if test "$GCC" = yes; then
-	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
 
-    uts4*)
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_shlibpath_var=no
-      ;;
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
 
-    *)
-      ld_shlibs=no
-      ;;
-    esac
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
 
-    if test x$host_vendor = xsni; then
-      case $host in
-      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-	export_dynamic_flag_spec='${wl}-Blargedynsym'
-	;;
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
       esac
     fi
-  fi
-
-{ $as_echo "$as_me:$LINENO: result: $ld_shlibs" >&5
-$as_echo "$ld_shlibs" >&6; }
-test "$ld_shlibs" = no && can_build_shared=no
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[	 ]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
 
-with_gnu_ld=$with_gnu_ld
+fi
 
+if test -n $lt_cv_sys_max_cmd_len ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
 
 
 
 
 
 
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
 
 
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
 
 
 
-#
-# Do we need to explicitly link libc?
-#
-case "x$archive_cmds_need_lc" in
-x|xyes)
-  # Assume -lc should be added
-  archive_cmds_need_lc=yes
 
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
-    case $archive_cmds in
-    *'~'*)
-      # FIXME: we may have to deal with multi-command sequences.
-      ;;
-    '$CC '*)
-      # Test whether the compiler implicitly links with -lc since on some
-      # systems, -lgcc has to come before -lc. If gcc already passes -lc
-      # to ld, don't add -lc before -lgcc.
-      { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-      $RM conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$lt_prog_compiler_wl
-	pic_flag=$lt_prog_compiler_pic
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$allow_undefined_flag
-        allow_undefined_flag=
-        if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5
-  (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-        then
-	  archive_cmds_need_lc=no
-        else
-	  archive_cmds_need_lc=yes
-        fi
-        allow_undefined_flag=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $RM conftest*
-      { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
-$as_echo "$archive_cmds_need_lc" >&6; }
-      ;;
-    esac
-  fi
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
   ;;
 esac
 
@@ -11123,20 +7425,109 @@ esac
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
 
+fi
 
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
 
 
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
 
+fi
 
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
 
 
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if ${lt_cv_ld_reload_flag+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
 
 
 
@@ -11146,12 +7537,99 @@ esac
 
 
 
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; 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_OBJDUMP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+    $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
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+  ac_ct_OBJDUMP=$OBJDUMP
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; 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_ac_ct_OBJDUMP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OBJDUMP"; then
+  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OBJDUMP="objdump"
+    $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
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
+  if test "x$ac_ct_OBJDUMP" = x; then
+    OBJDUMP="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OBJDUMP=$ac_ct_OBJDUMP
+  fi
+else
+  OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
 
+test -z "$OBJDUMP" && OBJDUMP=objdump
 
 
 
@@ -11161,33 +7639,228 @@ esac
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if ${lt_cv_deplibs_check_method+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
 
+case $host_os in
+aix[4-9]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
+bsdi[45]*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
 
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
 
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
 
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
 
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
 
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
 
+interix[3-9]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+  ;;
 
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
+netbsd*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
+  ;;
 
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
 
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  fi
+  ;;
 
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
 
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
 
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
 
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
 
 
 
@@ -11210,12 +7883,99 @@ esac
 
 
 
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; 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_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+    $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
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+  ac_ct_DLLTOOL=$DLLTOOL
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; 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_ac_ct_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DLLTOOL"; then
+  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+    $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
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
+  if test "x$ac_ct_DLLTOOL" = x; then
+    DLLTOOL="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DLLTOOL=$ac_ct_DLLTOOL
+  fi
+else
+  DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
 
+test -z "$DLLTOOL" && DLLTOOL=dlltool
 
 
 
@@ -11226,8 +7986,37 @@ esac
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_sharedlib_from_linklib_cmd='unknown'
 
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
 
 
 
@@ -11235,14 +8024,108 @@ esac
 
 
 
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in ar
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$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_AR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AR="$ac_tool_prefix$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
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
+    test -n "$AR" && break
+  done
+fi
+if test -z "$AR"; then
+  ac_ct_AR=$AR
+  for ac_prog in ar
+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_ac_ct_AR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_AR="$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
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
+  test -n "$ac_ct_AR" && break
+done
 
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    AR=$ac_ct_AR
+  fi
+fi
 
+: ${AR=ar}
+: ${AR_FLAGS=cru}
 
 
 
@@ -11254,11 +8137,65 @@ esac
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ar_at_file=no
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+      { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
 
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
 
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
 
 
 
@@ -11266,725 +8203,523 @@ esac
 
 
 
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; 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_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $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
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
-
-
-  { $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-$as_echo_n "checking dynamic linker characteristics... " >&6; }
-
-if test "$GCC" = yes; then
-  case $host_os in
-    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
-    *) lt_awk_arg="/^libraries:/" ;;
-  esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
-    # if the path contains ";" then we assume it to be the separator
-    # otherwise default to the standard path separator (i.e. ":") - it is
-    # assumed that no part of a normal pathname contains ";" but that should
-    # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; 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_ac_ct_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
   fi
-  # Ok, now we have the path, separated by spaces, we can step through it
-  # and add multilib dir if necessary.
-  lt_tmp_lt_search_path_spec=
-  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
-  for lt_sys_path in $lt_search_path_spec; do
-    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
-      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
-    else
-      test -d "$lt_sys_path" && \
-	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
-    fi
+done
   done
-  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
-BEGIN {RS=" "; FS="/|\n";} {
-  lt_foo="";
-  lt_count=0;
-  for (lt_i = NF; lt_i > 0; lt_i--) {
-    if ($lt_i != "" && $lt_i != ".") {
-      if ($lt_i == "..") {
-        lt_count++;
-      } else {
-        if (lt_count == 0) {
-          lt_foo="/" $lt_i lt_foo;
-        } else {
-          lt_count--;
-        }
-      }
-    }
-  }
-  if (lt_foo != "") { lt_freq[lt_foo]++; }
-  if (lt_freq[lt_foo] == 1) { print lt_foo; }
-}'`
-  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
 else
-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-shrext_cmds=".so"
-postinstall_cmds=
-postuninstall_cmds=
-finish_cmds=
-finish_eval=
-shlibpath_var=
-shlibpath_overrides_runpath=unknown
-version_type=none
-dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib"
-need_lib_prefix=unknown
-hardcode_into_libs=no
-
-# when you set need_version to no, make sure it does not cause -set_version
-# flags to be left without arguments
-need_version=unknown
-
-case $host_os in
-aix3*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
-  shlibpath_var=LIBPATH
 
-  # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
-  ;;
-
-aix[4-9]*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
-    # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
-    shlibpath_var=LD_LIBRARY_PATH
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
   else
-    # With GCC up to 2.95.x, collect2 would create an import file
-    # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
-    # development snapshots of GCC prior to 3.0.
-    case $host_os in
-      aix4 | aix4.[01] | aix4.[01].*)
-      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
-	   echo ' yes '
-	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
-	:
-      else
-	can_build_shared=no
-      fi
-      ;;
-    esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
-    # soname into executable. Probably we can add versioning support to
-    # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
-      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
-      # instead of lib<name>.a to let people know that these are not
-      # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    else
-      # We preserve .a as extension for shared libraries through AIX4.2
-      # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
-    fi
-    shlibpath_var=LIBPATH
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
   fi
-  ;;
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
 
-amigaos*)
-  case $host_cpu in
-  powerpc)
-    # Since July 2007 AmigaOS4 officially supports .so libraries.
-    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    ;;
-  m68k)
-    library_names_spec='$libname.ixlibrary $libname.a'
-    # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
-    ;;
-  esac
-  ;;
+test -z "$STRIP" && STRIP=:
 
-beos*)
-  library_names_spec='${libname}${shared_ext}'
-  dynamic_linker="$host_os ld.so"
-  shlibpath_var=LIBRARY_PATH
-  ;;
 
-bsdi[45]*)
-  version_type=linux
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
-  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
-  # the default ld.so.conf also contains /usr/contrib/lib and
-  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
-  # libtool to hard-code these into programs
-  ;;
 
-cygwin* | mingw* | pw32*)
-  version_type=windows
-  shrext_cmds=".dll"
-  need_version=no
-  need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32*)
-    library_names_spec='$libname.dll.a'
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname~
-      chmod a+x \$dldir/$dlname~
-      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
-        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
-      fi'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
 
-    case $host_os in
-    cygwin*)
-      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
-      ;;
-    mingw*)
-      # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    ;;
 
-  *)
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    ;;
-  esac
-  dynamic_linker='Win32 ld.exe'
-  # FIXME: first we should search . and the directory the executable is in
-  shlibpath_var=PATH
-  ;;
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; 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_RANLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    $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
 
-darwin* | rhapsody*)
-  dynamic_linker="$host_os dyld"
-  version_type=darwin
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
-  shlibpath_overrides_runpath=yes
-  shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
-  ;;
 
-dgux*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; 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_ac_ct_RANLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    $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
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-freebsd* | dragonfly*)
-  # DragonFly does not have aout.  When/if they implement a new
-  # versioning mechanism, adjust this.
-  if test -x /usr/bin/objformat; then
-    objformat=`/usr/bin/objformat`
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
   else
-    case $host_os in
-    freebsd[123]*) objformat=aout ;;
-    *) objformat=elf ;;
-    esac
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
   fi
-  version_type=freebsd-$objformat
-  case $version_type in
-    freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-      need_version=no
-      need_lib_prefix=no
-      ;;
-    freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
-      need_version=yes
-      ;;
-  esac
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_os in
-  freebsd2*)
-    shlibpath_overrides_runpath=yes
-    ;;
-  freebsd3.[01]* | freebsdelf3.[01]*)
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
-  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
-    shlibpath_overrides_runpath=no
-    hardcode_into_libs=yes
-    ;;
-  *) # from 4.6 on, and DragonFly
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  esac
-  ;;
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
 
-gnu*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  hardcode_into_libs=yes
-  ;;
+test -z "$RANLIB" && RANLIB=:
 
-hpux9* | hpux10* | hpux11*)
-  # Give a soname corresponding to the major version so that dld.sl refuses to
-  # link against other versions.
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  case $host_cpu in
-  ia64*)
-    shrext_cmds='.so'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.so"
-    shlibpath_var=LD_LIBRARY_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
-      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
-    else
-      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
-    fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-  hppa*64*)
-    shrext_cmds='.sl'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-  *)
-    shrext_cmds='.sl'
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=SHLIB_PATH
-    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    ;;
-  esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
-  postinstall_cmds='chmod 555 $lib'
-  ;;
 
-interix[3-9]*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
 
-irix5* | irix6* | nonstopux*)
-  case $host_os in
-    nonstopux*) version_type=nonstopux ;;
-    *)
-	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
-	else
-		version_type=irix
-	fi ;;
-  esac
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
   case $host_os in
-  irix5* | nonstopux*)
-    libsuff= shlibsuff=
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
     ;;
   *)
-    case $LD in # libtool.m4 will add one of these switches to LD
-    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
-      libsuff= shlibsuff= libmagic=32-bit;;
-    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
-      libsuff=32 shlibsuff=N32 libmagic=N32;;
-    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
-      libsuff=64 shlibsuff=64 libmagic=64-bit;;
-    *) libsuff= shlibsuff= libmagic=never-match;;
-    esac
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
     ;;
   esac
-  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
-  shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-  hardcode_into_libs=yes
-  ;;
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
 
-# No shared lib support for Linux oldld, aout, or coff.
-linux*oldld* | linux*aout* | linux*coff*)
-  dynamic_linker=no
-  ;;
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  # Some binutils ld are patched to set DT_RUNPATH
-  save_LDFLAGS=$LDFLAGS
-  save_libdir=$libdir
-  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
-       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then
-  shlibpath_overrides_runpath=yes
-fi
 
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-  LDFLAGS=$save_LDFLAGS
-  libdir=$save_libdir
 
-  # This implies no fast_install, which is unacceptable.
-  # Some rework will be needed to allow for fast_install
-  # before this can be enabled.
-  hardcode_into_libs=yes
 
-  # Append ld.so.conf contents to the search path
-  if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
-  fi
 
-  # We used to test for /lib/ld.so.1 and disable shared libraries on
-  # powerpc, because MkLinux only supported shared libraries with the
-  # GNU dynamic linker.  Since this was broken with cross compilers,
-  # most powerpc-linux boxes support dynamic linking these days and
-  # people can always --disable-shared, the test was removed, and we
-  # assume the GNU/Linux dynamic linker is in use.
-  dynamic_linker='GNU/Linux ld.so'
-  ;;
 
-netbsd*)
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-    dynamic_linker='NetBSD (a.out) ld.so'
-  else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    dynamic_linker='NetBSD ld.elf_so'
-  fi
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  ;;
 
-newsos6)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
   ;;
-
-*nto* | *qnx*)
-  version_type=qnx
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='ldqnx.so'
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[ABCDGISTW]'
   ;;
-
-openbsd*)
-  version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
-  need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
-    *)				need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[89] | openbsd2.[89].*)
-	shlibpath_overrides_runpath=no
-	;;
-      *)
-	shlibpath_overrides_runpath=yes
-	;;
-      esac
-  else
-    shlibpath_overrides_runpath=yes
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDEGRST]'
   fi
   ;;
-
-os2*)
-  libname_spec='$name'
-  shrext_cmds=".dll"
-  need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
-  dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
-  ;;
-
-osf3* | osf4* | osf5*)
-  version_type=osf
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
   ;;
-
-rdos*)
-  dynamic_linker=no
+osf*)
+  symcode='[BCDEGQRST]'
   ;;
-
 solaris*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  # ldd complains unless libraries are executable
-  postinstall_cmds='chmod +x $lib'
+  symcode='[BDRT]'
   ;;
-
-sunos4*)
-  version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
-    need_lib_prefix=no
-  fi
-  need_version=yes
+sco3.2v5*)
+  symcode='[DT]'
   ;;
-
-sysv4 | sysv4.3*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_vendor in
-    sni)
-      shlibpath_overrides_runpath=no
-      need_lib_prefix=no
-      runpath_var=LD_RUN_PATH
-      ;;
-    siemens)
-      need_lib_prefix=no
-      ;;
-    motorola)
-      need_lib_prefix=no
-      need_version=no
-      shlibpath_overrides_runpath=no
-      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
-      ;;
-  esac
+sysv4.2uw2*)
+  symcode='[DT]'
   ;;
-
-sysv4*MP*)
-  if test -d /usr/nec ;then
-    version_type=linux
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
-    shlibpath_var=LD_LIBRARY_PATH
-  fi
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[ABDT]'
   ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
-    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
-  else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    case $host_os in
-      sco3.2v5*)
-        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
-	;;
-    esac
-  fi
-  sys_lib_dlsearch_path_spec='/usr/lib'
+sysv4)
+  symcode='[DFNSTU]'
   ;;
+esac
 
-tpf*)
-  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
 
-uts4*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
 
-*)
-  dynamic_linker=no
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
   ;;
 esac
-{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-$as_echo "$dynamic_linker" >&6; }
-test "$dynamic_linker" = no && can_build_shared=no
-
-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
-  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
-fi
 
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-fi
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-fi
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
 
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
 
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK '"\
+"     {last_section=section; section=\$ 3};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
 
+  # Check to see that the pipe works correctly.
+  pipe_works=no
 
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
 
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
 
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
+_LT_EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
 
+	  cat <<_LT_EOF >> conftest.$ac_ext
 
+/* The mapping between symbol names and symbols.  */
+LT_DLSYM_CONST struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
 
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
 
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
 
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
 
+fi
 
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
 
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
 
 
 
@@ -12012,1059 +8747,1422 @@ fi
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
 
+# Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+  withval=$with_sysroot;
+else
+  with_sysroot=no
+fi
 
 
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+   as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+   ;;
+esac
 
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
 
 
 
 
 
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+  enableval=$enable_libtool_lock;
+fi
 
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
 
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
+	;;
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
+	;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
 
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_i386_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_i386"
+	    ;;
+	  ppc64-*linux*|powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_x86_64_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  ppc*-*linux*|powerpc*-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
 
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if ${lt_cv_cc_needs_belf+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_cc_needs_belf=yes
+else
+  lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)
+	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
 
+need_locks="$enable_libtool_lock"
 
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; 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_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$MANIFEST_TOOL"; then
+  ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+    $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
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+  ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+  # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; 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_ac_ct_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_MANIFEST_TOOL"; then
+  ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+    $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
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
+  if test "x$ac_ct_MANIFEST_TOOL" = x; then
+    MANIFEST_TOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+  fi
+else
+  MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
 
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&5
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
 
 
 
 
 
 
+  case $host_os in
+    rhapsody* | darwin*)
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; 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_DSYMUTIL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DSYMUTIL"; then
+  ac_cv_prog_DSYMUTIL="$DSYMUTIL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+    $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
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+  ac_ct_DSYMUTIL=$DSYMUTIL
+  # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; 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_ac_ct_DSYMUTIL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DSYMUTIL"; then
+  ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+    $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
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
+  if test "x$ac_ct_DSYMUTIL" = x; then
+    DSYMUTIL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DSYMUTIL=$ac_ct_DSYMUTIL
+  fi
+else
+  DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
 
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; 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_NMEDIT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NMEDIT"; then
+  ac_cv_prog_NMEDIT="$NMEDIT" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+    $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
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+  ac_ct_NMEDIT=$NMEDIT
+  # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; 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_ac_ct_NMEDIT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_NMEDIT"; then
+  ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_NMEDIT="nmedit"
+    $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
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
+  if test "x$ac_ct_NMEDIT" = x; then
+    NMEDIT=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    NMEDIT=$ac_ct_NMEDIT
+  fi
+else
+  NMEDIT="$ac_cv_prog_NMEDIT"
+fi
 
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; 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_LIPO+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$LIPO"; then
+  ac_cv_prog_LIPO="$LIPO" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+    $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
 
-  { $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
-hardcode_action=
-if test -n "$hardcode_libdir_flag_spec" ||
-   test -n "$runpath_var" ||
-   test "X$hardcode_automatic" = "Xyes" ; then
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-  # We can hardcode non-existent directories.
-  if test "$hardcode_direct" != no &&
-     # If the only mechanism to avoid hardcoding is shlibpath_var, we
-     # have to relink, otherwise we might link with an installed library
-     # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
-     test "$hardcode_minus_L" != no; then
-    # Linking always hardcodes the temporary library directory.
-    hardcode_action=relink
-  else
-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
-    hardcode_action=immediate
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+  ac_ct_LIPO=$LIPO
+  # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; 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_ac_ct_LIPO+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_LIPO"; then
+  ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_LIPO="lipo"
+    $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
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
 else
-  # We cannot hardcode anything, or else we can only hardcode existing
-  # directories.
-  hardcode_action=unsupported
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-{ $as_echo "$as_me:$LINENO: result: $hardcode_action" >&5
-$as_echo "$hardcode_action" >&6; }
 
-if test "$hardcode_action" = relink ||
-   test "$inherit_rpath" = yes; then
-  # Fast installation is not supported
-  enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
-  # Fast installation is not necessary
-  enable_fast_install=needless
+  if test "x$ac_ct_LIPO" = x; then
+    LIPO=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    LIPO=$ac_ct_LIPO
+  fi
+else
+  LIPO="$ac_cv_prog_LIPO"
 fi
 
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; 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_OTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL"; then
+  ac_cv_prog_OTOOL="$OTOOL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+    $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
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+  ac_ct_OTOOL=$OTOOL
+  # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; 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_ac_ct_OTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL"; then
+  ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OTOOL="otool"
+    $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
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-  if test "x$enable_dlopen" != xyes; then
-  enable_dlopen=unknown
-  enable_dlopen_self=unknown
-  enable_dlopen_self_static=unknown
+  if test "x$ac_ct_OTOOL" = x; then
+    OTOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL=$ac_ct_OTOOL
+  fi
 else
-  lt_cv_dlopen=no
-  lt_cv_dlopen_libs=
+  OTOOL="$ac_cv_prog_OTOOL"
+fi
 
-  case $host_os in
-  beos*)
-    lt_cv_dlopen="load_add_on"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
-    ;;
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; 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_OTOOL64+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL64"; then
+  ac_cv_prog_OTOOL64="$OTOOL64" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+    $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
 
-  mingw* | pw32*)
-    lt_cv_dlopen="LoadLibrary"
-    lt_cv_dlopen_libs=
-    ;;
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-  cygwin*)
-    lt_cv_dlopen="dlopen"
-    lt_cv_dlopen_libs=
-    ;;
 
-  darwin*)
-  # if libdl is installed we need to link against it
-    { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+  ac_ct_OTOOL64=$OTOOL64
+  # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; 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_ac_ct_OTOOL64+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_dl_dlopen=yes
+  if test -n "$ac_ct_OTOOL64"; then
+  ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OTOOL64="otool64"
+    $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
 
-	ac_cv_lib_dl_dlopen=no
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+  if test "x$ac_ct_OTOOL64" = x; then
+    OTOOL64=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL64=$ac_ct_OTOOL64
+  fi
 else
+  OTOOL64="$ac_cv_prog_OTOOL64"
+fi
 
-    lt_cv_dlopen="dyld"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
 
-fi
 
-    ;;
 
-  *)
-    { $as_echo "$as_me:$LINENO: checking for shl_load" >&5
-$as_echo_n "checking for shl_load... " >&6; }
-if test "${ac_cv_func_shl_load+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define shl_load innocuous_shl_load
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char shl_load (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
 
-#undef shl_load
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char shl_load ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_shl_load || defined __stub___shl_load
-choke me
-#endif
 
-int
-main ()
-{
-return shl_load ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_shl_load=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_func_shl_load=no
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
-$as_echo "$ac_cv_func_shl_load" >&6; }
-if test "x$ac_cv_func_shl_load" = x""yes; then
-  lt_cv_dlopen="shl_load"
-else
-  { $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
-$as_echo_n "checking for shl_load in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_shl_load+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char shl_load ();
-int
-main ()
-{
-return shl_load ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_dld_shl_load=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_dld_shl_load=no
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
-$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
-if test "x$ac_cv_lib_dld_shl_load" = x""yes; then
-  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
-else
-  { $as_echo "$as_me:$LINENO: checking for dlopen" >&5
-$as_echo_n "checking for dlopen... " >&6; }
-if test "${ac_cv_func_dlopen+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define dlopen innocuous_dlopen
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char dlopen (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
 
-#undef dlopen
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_dlopen || defined __stub___dlopen
-choke me
-#endif
 
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_dlopen=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_func_dlopen=no
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
-$as_echo "$ac_cv_func_dlopen" >&6; }
-if test "x$ac_cv_func_dlopen" = x""yes; then
-  lt_cv_dlopen="dlopen"
-else
-  { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_dl_dlopen=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_dl_dlopen=no
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
-else
-  { $as_echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
-$as_echo_n "checking for dlopen in -lsvld... " >&6; }
-if test "${ac_cv_lib_svld_dlopen+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsvld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_svld_dlopen=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_svld_dlopen=no
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
-$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
-if test "x$ac_cv_lib_svld_dlopen" = x""yes; then
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if ${lt_cv_apple_cc_single_mod+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  { $as_echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
-$as_echo_n "checking for dld_link in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+  lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+	# By default we will add the -single_module flag. You can override
+	# by either setting the environment variable LT_MULTI_MODULE
+	# non-empty at configure time, or by adding -multi_module to the
+	# link flags.
+	rm -rf libconftest.dylib*
+	echo "int foo(void){return 1;}" > conftest.c
+	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	  lt_cv_apple_cc_single_mod=yes
+	else
+	  cat conftest.err >&5
+	fi
+	rm -rf libconftest.dylib*
+	rm -f conftest.*
+      fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
 #endif
-char dld_link ();
 int
 main ()
 {
-return dld_link ();
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_dld_dld_link=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_ld_exported_symbols_list=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_dld_dld_link=no
+  lt_cv_ld_exported_symbols_list=no
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+	LDFLAGS="$save_LDFLAGS"
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
-$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
-if test "x$ac_cv_lib_dld_dld_link" = x""yes; then
-  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+      echo "$AR cru libconftest.a conftest.o" >&5
+      $AR cru libconftest.a conftest.o 2>&5
+      echo "$RANLIB libconftest.a" >&5
+      $RANLIB libconftest.a 2>&5
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&5
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
+    case $host_os in
+    rhapsody* | darwin1.[012])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+	10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	10.[012]*)
+	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	10.*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
 
+for ac_header in dlfcn.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
 
 fi
 
+done
+
+
+
+func_stripname_cnf ()
+{
+  case ${2} in
+  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+} # func_stripname_cnf
+
+
+
+
+
+# Set options
+
+
+
+        enable_dlopen=no
+
+
+  enable_win32_dll=no
 
+
+            # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+  enableval=$enable_shared; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=yes
 fi
 
 
+
+
+
+
+
+
+
+  # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=yes
 fi
 
 
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+  withval=$with_pic; pic_mode="$withval"
+else
+  pic_mode=default
 fi
 
 
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+  # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+  enableval=$enable_fast_install; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
 fi
 
-    ;;
-  esac
 
-  if test "x$lt_cv_dlopen" != xno; then
-    enable_dlopen=yes
-  else
-    enable_dlopen=no
-  fi
 
-  case $lt_cv_dlopen in
-  dlopen)
-    save_CPPFLAGS="$CPPFLAGS"
-    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
 
-    save_LDFLAGS="$LDFLAGS"
-    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
 
-    save_LIBS="$LIBS"
-    LIBS="$lt_cv_dlopen_libs $LIBS"
 
-    { $as_echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
-$as_echo_n "checking whether a program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  	  if test "$cross_compiling" = yes; then :
-  lt_cv_dlopen_self=cross
-else
-  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-  lt_status=$lt_dlunknown
-  cat > conftest.$ac_ext <<_LT_EOF
-#line 12702 "configure"
-#include "confdefs.h"
 
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
 
-#include <stdio.h>
 
-#ifdef RTLD_GLOBAL
-#  define LT_DLGLOBAL		RTLD_GLOBAL
-#else
-#  ifdef DL_GLOBAL
-#    define LT_DLGLOBAL		DL_GLOBAL
-#  else
-#    define LT_DLGLOBAL		0
-#  endif
-#endif
 
-/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
-   find out it does not work in some platform. */
-#ifndef LT_DLLAZY_OR_NOW
-#  ifdef RTLD_LAZY
-#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
-#  else
-#    ifdef DL_LAZY
-#      define LT_DLLAZY_OR_NOW		DL_LAZY
-#    else
-#      ifdef RTLD_NOW
-#        define LT_DLLAZY_OR_NOW	RTLD_NOW
-#      else
-#        ifdef DL_NOW
-#          define LT_DLLAZY_OR_NOW	DL_NOW
-#        else
-#          define LT_DLLAZY_OR_NOW	0
-#        endif
-#      endif
-#    endif
-#  endif
-#endif
 
-#ifdef __cplusplus
-extern "C" void exit (int);
-#endif
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
 
-void fnord() { int i=42;}
-int main ()
-{
-  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
-  int status = $lt_dlunknown;
 
-  if (self)
-    {
-      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
-      /* dlclose (self); */
-    }
-  else
-    puts (dlerror ());
 
-    exit (status);
-}
-_LT_EOF
-  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) >&5 2>/dev/null
-    lt_status=$?
-    case x$lt_status in
-      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
-      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
-      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
-    esac
-  else :
-    # compilation failed
-    lt_cv_dlopen_self=no
-  fi
-fi
-rm -fr conftest*
 
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
-$as_echo "$lt_cv_dlopen_self" >&6; }
 
-    if test "x$lt_cv_dlopen_self" = xyes; then
-      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
-      { $as_echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
-$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self_static+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  	  if test "$cross_compiling" = yes; then :
-  lt_cv_dlopen_self_static=cross
-else
-  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-  lt_status=$lt_dlunknown
-  cat > conftest.$ac_ext <<_LT_EOF
-#line 12802 "configure"
-#include "confdefs.h"
 
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
 
-#include <stdio.h>
 
-#ifdef RTLD_GLOBAL
-#  define LT_DLGLOBAL		RTLD_GLOBAL
-#else
-#  ifdef DL_GLOBAL
-#    define LT_DLGLOBAL		DL_GLOBAL
-#  else
-#    define LT_DLGLOBAL		0
-#  endif
-#endif
 
-/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
-   find out it does not work in some platform. */
-#ifndef LT_DLLAZY_OR_NOW
-#  ifdef RTLD_LAZY
-#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
-#  else
-#    ifdef DL_LAZY
-#      define LT_DLLAZY_OR_NOW		DL_LAZY
-#    else
-#      ifdef RTLD_NOW
-#        define LT_DLLAZY_OR_NOW	RTLD_NOW
-#      else
-#        ifdef DL_NOW
-#          define LT_DLLAZY_OR_NOW	DL_NOW
-#        else
-#          define LT_DLLAZY_OR_NOW	0
-#        endif
-#      endif
-#    endif
-#  endif
-#endif
 
-#ifdef __cplusplus
-extern "C" void exit (int);
-#endif
 
-void fnord() { int i=42;}
-int main ()
-{
-  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
-  int status = $lt_dlunknown;
 
-  if (self)
-    {
-      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
-      /* dlclose (self); */
-    }
-  else
-    puts (dlerror ());
 
-    exit (status);
-}
-_LT_EOF
-  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) >&5 2>/dev/null
-    lt_status=$?
-    case x$lt_status in
-      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
-      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
-      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
-    esac
-  else :
-    # compilation failed
-    lt_cv_dlopen_self_static=no
-  fi
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
 fi
-rm -fr conftest*
-
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if ${lt_cv_objdir+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
-$as_echo "$lt_cv_dlopen_self_static" >&6; }
-    fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
 
-    CPPFLAGS="$save_CPPFLAGS"
-    LDFLAGS="$save_LDFLAGS"
-    LIBS="$save_LIBS"
-    ;;
-  esac
 
-  case $lt_cv_dlopen_self in
-  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
-  *) enable_dlopen_self=unknown ;;
-  esac
 
-  case $lt_cv_dlopen_self_static in
-  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
-  *) enable_dlopen_self_static=unknown ;;
-  esac
-fi
 
 
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
 
 
 
 
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
 
+# Global variables:
+ofile=libtool
+can_build_shared=yes
 
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
 
+with_gnu_ld="$lt_cv_prog_gnu_ld"
 
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
 
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
 
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
 
 
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
 
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
 
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
 
-striplib=
-old_striplib=
-{ $as_echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
-$as_echo_n "checking whether stripping libraries is possible... " >&6; }
-if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
-  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
-  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
 else
-# FIXME - insert some real tests, host_os isn't really good enough
-  case $host_os in
-  darwin*)
-    if test -n "$STRIP" ; then
-      striplib="$STRIP -x"
-      old_striplib="$STRIP -S"
-      { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-    else
-      { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-    fi
-    ;;
-  *)
-    { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-    ;;
-  esac
 fi
 
 
 
 
 
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
 
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
 
-
-
-
-
-
-  # Report which library types will actually be built
-  { $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
-$as_echo_n "checking if libtool supports shared libraries... " >&6; }
-  { $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5
-$as_echo "$can_build_shared" >&6; }
-
-  { $as_echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
-$as_echo_n "checking whether to build shared libraries... " >&6; }
-  test "$can_build_shared" = "no" && enable_shared=no
-
-  # On AIX, shared libraries and static libraries use the same namespace, and
-  # are all built from PIC.
-  case $host_os in
-  aix3*)
-    test "$enable_shared" = yes && enable_static=no
-    if test -n "$RANLIB"; then
-      archive_cmds="$archive_cmds~\$RANLIB \$lib"
-      postinstall_cmds='$RANLIB $lib'
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
     fi
-    ;;
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
 
-  aix[4-9]*)
-    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-      test "$enable_shared" = yes && enable_static=no
-    fi
-    ;;
-  esac
-  { $as_echo "$as_me:$LINENO: result: $enable_shared" >&5
-$as_echo "$enable_shared" >&6; }
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-  { $as_echo "$as_me:$LINENO: checking whether to build static libraries" >&5
-$as_echo_n "checking whether to build static libraries... " >&6; }
-  # Make sure either enable_shared or enable_static is yes.
-  test "$enable_shared" = yes || enable_static=yes
-  { $as_echo "$as_me:$LINENO: result: $enable_static" >&5
-$as_echo "$enable_static" >&6; }
 
+  else
+    MAGIC_CMD=:
+  fi
+fi
 
+  fi
+  ;;
+esac
 
+# Use C for the default configuration in the libtool script
 
-fi
+lt_save_CC="$CC"
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-CC="$lt_save_CC"
-
 
+# Source file extension for C test sources.
+ac_ext=c
 
-      ac_ext=f
-ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
-ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_f77_compiler_gnu
-
-
-archive_cmds_need_lc_F77=no
-allow_undefined_flag_F77=
-always_export_symbols_F77=no
-archive_expsym_cmds_F77=
-export_dynamic_flag_spec_F77=
-hardcode_direct_F77=no
-hardcode_direct_absolute_F77=no
-hardcode_libdir_flag_spec_F77=
-hardcode_libdir_flag_spec_ld_F77=
-hardcode_libdir_separator_F77=
-hardcode_minus_L_F77=no
-hardcode_automatic_F77=no
-inherit_rpath_F77=no
-module_cmds_F77=
-module_expsym_cmds_F77=
-link_all_deplibs_F77=unknown
-old_archive_cmds_F77=$old_archive_cmds
-no_undefined_flag_F77=
-whole_archive_flag_spec_F77=
-enable_shared_with_static_runtimes_F77=no
-
-# Source file extension for f77 test sources.
-ac_ext=f
-
-# Object file extension for compiled f77 test sources.
+# Object file extension for compiled C test sources.
 objext=o
-objext_F77=$objext
+objext=$objext
 
-# No sense in running all these tests if we already determined that
-# the F77 compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_disable_F77" != yes; then
-  # Code to be used in simple compile tests
-  lt_simple_compile_test_code="\
-      subroutine t
-      return
-      end
-"
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
 
-  # Code to be used in simple link tests
-  lt_simple_link_test_code="\
-      program t
-      end
-"
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
 
-  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 
 
 
@@ -13080,98 +10178,106 @@ LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
 # Allow CC to be a program name with arguments.
 compiler=$CC
 
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
 
-  # save warnings/boilerplate of simple test code
-  ac_outfile=conftest.$ac_objext
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
 echo "$lt_simple_compile_test_code" >conftest.$ac_ext
 eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_compiler_boilerplate=`cat conftest.err`
 $RM conftest*
 
-  ac_outfile=conftest.$ac_objext
+ac_outfile=conftest.$ac_objext
 echo "$lt_simple_link_test_code" >conftest.$ac_ext
 eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_linker_boilerplate=`cat conftest.err`
 $RM -r conftest*
 
 
-  # Allow CC to be a program name with arguments.
-  lt_save_CC="$CC"
-  lt_save_GCC=$GCC
-  CC=${F77-"f77"}
-  compiler=$CC
-  compiler_F77=$CC
-  for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+  case $cc_basename in
+  nvcc*)
+    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+  *)
+    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
   esac
-done
-cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 
-  GCC=$G77
-  if test -n "$compiler"; then
-    { $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
-$as_echo_n "checking if libtool supports shared libraries... " >&6; }
-    { $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5
-$as_echo "$can_build_shared" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
 
-    { $as_echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
-$as_echo_n "checking whether to build shared libraries... " >&6; }
-    test "$can_build_shared" = "no" && enable_shared=no
 
-    # On AIX, shared libraries and static libraries use the same namespace, and
-    # are all built from PIC.
-    case $host_os in
-      aix3*)
-        test "$enable_shared" = yes && enable_static=no
-        if test -n "$RANLIB"; then
-          archive_cmds="$archive_cmds~\$RANLIB \$lib"
-          postinstall_cmds='$RANLIB $lib'
-        fi
-        ;;
-      aix[4-9]*)
-	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-	  test "$enable_shared" = yes && enable_static=no
-	fi
-        ;;
-    esac
-    { $as_echo "$as_me:$LINENO: result: $enable_shared" >&5
-$as_echo "$enable_shared" >&6; }
 
-    { $as_echo "$as_me:$LINENO: checking whether to build static libraries" >&5
-$as_echo_n "checking whether to build static libraries... " >&6; }
-    # Make sure either enable_shared or enable_static is yes.
-    test "$enable_shared" = yes || enable_static=yes
-    { $as_echo "$as_me:$LINENO: result: $enable_static" >&5
-$as_echo "$enable_static" >&6; }
 
-    GCC_F77="$G77"
-    LD_F77="$LD"
 
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    lt_prog_compiler_wl_F77=
-lt_prog_compiler_pic_F77=
-lt_prog_compiler_static_F77=
 
-{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+  lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
 
   if test "$GCC" = yes; then
-    lt_prog_compiler_wl_F77='-Wl,'
-    lt_prog_compiler_static_F77='-static'
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
 
     case $host_os in
       aix*)
       # All AIX code is PIC.
       if test "$host_cpu" = ia64; then
 	# AIX 5 now supports IA64 processor
-	lt_prog_compiler_static_F77='-Bstatic'
+	lt_prog_compiler_static='-Bstatic'
       fi
       ;;
 
@@ -13179,13 +10285,13 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       case $host_cpu in
       powerpc)
             # see comment about AmigaOS4 .so support
-            lt_prog_compiler_pic_F77='-fPIC'
+            lt_prog_compiler_pic='-fPIC'
         ;;
       m68k)
             # FIXME: we need at least 68020 code to build shared libraries, but
             # adding the `-m68020' flag to GCC prevents building anything better,
             # like `-m68040'.
-            lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4'
+            lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
         ;;
       esac
       ;;
@@ -13194,29 +10300,36 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       # PIC is the default for these OSes.
       ;;
 
-    mingw* | cygwin* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       # Although the cygwin gcc ignores -fPIC, still need this for old-style
       # (--disable-auto-import) libraries
-      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      lt_prog_compiler_pic='-DDLL_EXPORT'
       ;;
 
     darwin* | rhapsody*)
       # PIC is the default on this platform
       # Common symbols not allowed in MH_DYLIB files
-      lt_prog_compiler_pic_F77='-fno-common'
+      lt_prog_compiler_pic='-fno-common'
+      ;;
+
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static=
       ;;
 
     hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
       case $host_cpu in
-      hppa*64*|ia64*)
+      hppa*64*)
 	# +Z the default
 	;;
       *)
-	lt_prog_compiler_pic_F77='-fPIC'
+	lt_prog_compiler_pic='-fPIC'
 	;;
       esac
       ;;
@@ -13229,47 +10342,54 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
     msdosdjgpp*)
       # Just because we use GCC doesn't mean we suddenly get shared libraries
       # on systems that don't support them.
-      lt_prog_compiler_can_build_shared_F77=no
+      lt_prog_compiler_can_build_shared=no
       enable_shared=no
       ;;
 
     *nto* | *qnx*)
       # QNX uses GNU C++, but need to define -shared option too, otherwise
       # it will coredump.
-      lt_prog_compiler_pic_F77='-fPIC -shared'
+      lt_prog_compiler_pic='-fPIC -shared'
       ;;
 
     sysv4*MP*)
       if test -d /usr/nec; then
-	lt_prog_compiler_pic_F77=-Kconform_pic
+	lt_prog_compiler_pic=-Kconform_pic
       fi
       ;;
 
     *)
-      lt_prog_compiler_pic_F77='-fPIC'
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      lt_prog_compiler_wl='-Xlinker '
+      lt_prog_compiler_pic='-Xcompiler -fPIC'
       ;;
     esac
   else
     # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
     aix*)
-      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_wl='-Wl,'
       if test "$host_cpu" = ia64; then
 	# AIX 5 now supports IA64 processor
-	lt_prog_compiler_static_F77='-Bstatic'
+	lt_prog_compiler_static='-Bstatic'
       else
-	lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp'
+	lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
       fi
       ;;
 
-    mingw* | cygwin* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
-      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      lt_prog_compiler_pic='-DDLL_EXPORT'
       ;;
 
     hpux9* | hpux10* | hpux11*)
-      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_wl='-Wl,'
       # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
       # not for PA HP-UX.
       case $host_cpu in
@@ -13277,57 +10397,77 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 	# +Z the default
 	;;
       *)
-	lt_prog_compiler_pic_F77='+Z'
+	lt_prog_compiler_pic='+Z'
 	;;
       esac
       # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      lt_prog_compiler_static_F77='${wl}-a ${wl}archive'
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
       ;;
 
     irix5* | irix6* | nonstopux*)
-      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_wl='-Wl,'
       # PIC (with -KPIC) is the default.
-      lt_prog_compiler_static_F77='-non_shared'
+      lt_prog_compiler_static='-non_shared'
       ;;
 
-    linux* | k*bsd*-gnu)
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
       case $cc_basename in
-      icc* | ecc* | ifort*)
-	lt_prog_compiler_wl_F77='-Wl,'
-	lt_prog_compiler_pic_F77='-KPIC'
-	lt_prog_compiler_static_F77='-static'
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-KPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fPIC'
+	lt_prog_compiler_static='-static'
         ;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
+      # Lahey Fortran 8.1.
+      lf95*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='--shared'
+	lt_prog_compiler_static='--static'
+	;;
+      nagfor*)
+	# NAG Fortran compiler
+	lt_prog_compiler_wl='-Wl,-Wl,,'
+	lt_prog_compiler_pic='-PIC'
+	lt_prog_compiler_static='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
 	# which looks to be a dead project)
-	lt_prog_compiler_wl_F77='-Wl,'
-	lt_prog_compiler_pic_F77='-fpic'
-	lt_prog_compiler_static_F77='-Bstatic'
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fpic'
+	lt_prog_compiler_static='-Bstatic'
         ;;
       ccc*)
-        lt_prog_compiler_wl_F77='-Wl,'
+        lt_prog_compiler_wl='-Wl,'
         # All Alpha code is PIC.
-        lt_prog_compiler_static_F77='-non_shared'
+        lt_prog_compiler_static='-non_shared'
         ;;
-      xl*)
-	# IBM XL C 8.0/Fortran 10.1 on PPC
-	lt_prog_compiler_wl_F77='-Wl,'
-	lt_prog_compiler_pic_F77='-qpic'
-	lt_prog_compiler_static_F77='-qstaticlink'
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-qpic'
+	lt_prog_compiler_static='-qstaticlink'
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ F* | *Sun*Fortran*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl=''
+	  ;;
 	*Sun\ C*)
 	  # Sun C 5.9
-	  lt_prog_compiler_pic_F77='-KPIC'
-	  lt_prog_compiler_static_F77='-Bstatic'
-	  lt_prog_compiler_wl_F77='-Wl,'
-	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  lt_prog_compiler_pic_F77='-KPIC'
-	  lt_prog_compiler_static_F77='-Bstatic'
-	  lt_prog_compiler_wl_F77=''
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Wl,'
 	  ;;
 	esac
 	;;
@@ -13335,74 +10475,74 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       ;;
 
     newsos6)
-      lt_prog_compiler_pic_F77='-KPIC'
-      lt_prog_compiler_static_F77='-Bstatic'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
       ;;
 
     *nto* | *qnx*)
       # QNX uses GNU C++, but need to define -shared option too, otherwise
       # it will coredump.
-      lt_prog_compiler_pic_F77='-fPIC -shared'
+      lt_prog_compiler_pic='-fPIC -shared'
       ;;
 
     osf3* | osf4* | osf5*)
-      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_wl='-Wl,'
       # All OSF/1 code is PIC.
-      lt_prog_compiler_static_F77='-non_shared'
+      lt_prog_compiler_static='-non_shared'
       ;;
 
     rdos*)
-      lt_prog_compiler_static_F77='-non_shared'
+      lt_prog_compiler_static='-non_shared'
       ;;
 
     solaris*)
-      lt_prog_compiler_pic_F77='-KPIC'
-      lt_prog_compiler_static_F77='-Bstatic'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
       case $cc_basename in
-      f77* | f90* | f95*)
-	lt_prog_compiler_wl_F77='-Qoption ld ';;
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+	lt_prog_compiler_wl='-Qoption ld ';;
       *)
-	lt_prog_compiler_wl_F77='-Wl,';;
+	lt_prog_compiler_wl='-Wl,';;
       esac
       ;;
 
     sunos4*)
-      lt_prog_compiler_wl_F77='-Qoption ld '
-      lt_prog_compiler_pic_F77='-PIC'
-      lt_prog_compiler_static_F77='-Bstatic'
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
       ;;
 
     sysv4 | sysv4.2uw2* | sysv4.3*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      lt_prog_compiler_pic_F77='-KPIC'
-      lt_prog_compiler_static_F77='-Bstatic'
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
       ;;
 
     sysv4*MP*)
       if test -d /usr/nec ;then
-	lt_prog_compiler_pic_F77='-Kconform_pic'
-	lt_prog_compiler_static_F77='-Bstatic'
+	lt_prog_compiler_pic='-Kconform_pic'
+	lt_prog_compiler_static='-Bstatic'
       fi
       ;;
 
     sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      lt_prog_compiler_pic_F77='-KPIC'
-      lt_prog_compiler_static_F77='-Bstatic'
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
       ;;
 
     unicos*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      lt_prog_compiler_can_build_shared_F77=no
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
       ;;
 
     uts4*)
-      lt_prog_compiler_pic_F77='-pic'
-      lt_prog_compiler_static_F77='-Bstatic'
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
       ;;
 
     *)
-      lt_prog_compiler_can_build_shared_F77=no
+      lt_prog_compiler_can_build_shared=no
       ;;
     esac
   fi
@@ -13410,30 +10550,37 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 case $host_os in
   # For platforms which do not support PIC, -DPIC is meaningless:
   *djgpp*)
-    lt_prog_compiler_pic_F77=
+    lt_prog_compiler_pic=
     ;;
   *)
-    lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77"
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
     ;;
 esac
-{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
-$as_echo "$lt_prog_compiler_pic_F77" >&6; }
-
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
 
 #
 # Check to make sure the PIC flag actually works.
 #
-if test -n "$lt_prog_compiler_pic_F77"; then
-  { $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
-$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... " >&6; }
-if test "${lt_cv_prog_compiler_pic_works_F77+set}" = set; then
+if test -n "$lt_prog_compiler_pic"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  lt_cv_prog_compiler_pic_works_F77=no
+  lt_cv_prog_compiler_pic_works=no
    ac_outfile=conftest.$ac_objext
    echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$lt_prog_compiler_pic_F77"
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
    # Note that $ac_compile itself does not contain backslashes and begins
@@ -13443,50 +10590,58 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13446: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:13450: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_pic_works_F77=yes
+       lt_cv_prog_compiler_pic_works=yes
      fi
    fi
    $RM conftest*
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_F77" >&5
-$as_echo "$lt_cv_prog_compiler_pic_works_F77" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
 
-if test x"$lt_cv_prog_compiler_pic_works_F77" = xyes; then
-    case $lt_prog_compiler_pic_F77 in
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
      "" | " "*) ;;
-     *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
      esac
 else
-    lt_prog_compiler_pic_F77=
-     lt_prog_compiler_can_build_shared_F77=no
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
 fi
 
 fi
 
 
 
+
+
+
+
+
+
+
+
 #
 # Check to make sure the static flag actually works.
 #
-wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\"
-{ $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
-if test "${lt_cv_prog_compiler_static_works_F77+set}" = set; then
+if ${lt_cv_prog_compiler_static_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  lt_cv_prog_compiler_static_works_F77=no
+  lt_cv_prog_compiler_static_works=no
    save_LDFLAGS="$LDFLAGS"
    LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
    echo "$lt_simple_link_test_code" > conftest.$ac_ext
@@ -13496,37 +10651,40 @@ else
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&5
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_cv_prog_compiler_static_works_F77=yes
+         lt_cv_prog_compiler_static_works=yes
        fi
      else
-       lt_cv_prog_compiler_static_works_F77=yes
+       lt_cv_prog_compiler_static_works=yes
      fi
    fi
    $RM -r conftest*
    LDFLAGS="$save_LDFLAGS"
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_F77" >&5
-$as_echo "$lt_cv_prog_compiler_static_works_F77" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
 
-if test x"$lt_cv_prog_compiler_static_works_F77" = xyes; then
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
     :
 else
-    lt_prog_compiler_static_F77=
+    lt_prog_compiler_static=
 fi
 
 
 
 
-    { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then
+if ${lt_cv_prog_compiler_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  lt_cv_prog_compiler_c_o_F77=no
+  lt_cv_prog_compiler_c_o=no
    $RM -r conftest 2>/dev/null
    mkdir conftest
    cd conftest
@@ -13542,19 +10700,19 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13545: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13549: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_c_o_F77=yes
+       lt_cv_prog_compiler_c_o=yes
      fi
    fi
    chmod u+w . 2>&5
@@ -13568,17 +10726,20 @@ else
    $RM conftest*
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
-$as_echo "$lt_cv_prog_compiler_c_o_F77" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
 
 
-    { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then
+if ${lt_cv_prog_compiler_c_o+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  lt_cv_prog_compiler_c_o_F77=no
+  lt_cv_prog_compiler_c_o=no
    $RM -r conftest 2>/dev/null
    mkdir conftest
    cd conftest
@@ -13594,19 +10755,19 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13597: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13601: \$? = $ac_status" >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_c_o_F77=yes
+       lt_cv_prog_compiler_c_o=yes
      fi
    fi
    chmod u+w . 2>&5
@@ -13620,16 +10781,16 @@ else
    $RM conftest*
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
-$as_echo "$lt_cv_prog_compiler_c_o_F77" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
 
 
 
 hard_links="nottested"
-if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
   # do not overwrite the value of need_locks provided by the user
-  { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
 $as_echo_n "checking if we can lock with hard links... " >&6; }
   hard_links=yes
   $RM conftest*
@@ -13637,10 +10798,10 @@ $as_echo_n "checking if we can lock with hard links... " >&6; }
   touch conftest.a
   ln conftest.a conftest.b 2>&5 || hard_links=no
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { $as_echo "$as_me:$LINENO: result: $hard_links" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
 $as_echo "$hard_links" >&6; }
   if test "$hard_links" = no; then
-    { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
     need_locks=warn
   fi
@@ -13650,42 +10811,45 @@ fi
 
 
 
-    { $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
 
   runpath_var=
-  allow_undefined_flag_F77=
-  always_export_symbols_F77=no
-  archive_cmds_F77=
-  archive_expsym_cmds_F77=
-  compiler_needs_object_F77=no
-  enable_shared_with_static_runtimes_F77=no
-  export_dynamic_flag_spec_F77=
-  export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  hardcode_automatic_F77=no
-  hardcode_direct_F77=no
-  hardcode_direct_absolute_F77=no
-  hardcode_libdir_flag_spec_F77=
-  hardcode_libdir_flag_spec_ld_F77=
-  hardcode_libdir_separator_F77=
-  hardcode_minus_L_F77=no
-  hardcode_shlibpath_var_F77=unsupported
-  inherit_rpath_F77=no
-  link_all_deplibs_F77=unknown
-  module_cmds_F77=
-  module_expsym_cmds_F77=
-  old_archive_from_new_cmds_F77=
-  old_archive_from_expsyms_cmds_F77=
-  thread_safe_flag_spec_F77=
-  whole_archive_flag_spec_F77=
+  allow_undefined_flag=
+  always_export_symbols=no
+  archive_cmds=
+  archive_expsym_cmds=
+  compiler_needs_object=no
+  enable_shared_with_static_runtimes=no
+  export_dynamic_flag_spec=
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  hardcode_automatic=no
+  hardcode_direct=no
+  hardcode_direct_absolute=no
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
+  hardcode_libdir_separator=
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  inherit_rpath=no
+  link_all_deplibs=unknown
+  module_cmds=
+  module_expsym_cmds=
+  old_archive_from_new_cmds=
+  old_archive_from_expsyms_cmds=
+  thread_safe_flag_spec=
+  whole_archive_flag_spec=
   # include_expsyms should be a list of space-separated symbols to be *always*
   # included in the symbol list
-  include_expsyms_F77=
+  include_expsyms=
   # exclude_expsyms can be an extended regexp of symbols to exclude
   # it will be wrapped by ` (' and `)$', so one must not match beginning or
   # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
   # as well as any symbol that contains `d'.
-  exclude_expsyms_F77='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
   # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
   # platforms (ab)use it in PIC code, but their linkers get confused if
   # the symbol is explicitly referenced.  Since portable code cannot
@@ -13695,7 +10859,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   extract_expsyms_cmds=
 
   case $host_os in
-  cygwin* | mingw* | pw32*)
+  cygwin* | mingw* | pw32* | cegcc*)
     # FIXME: the MSVC++ port hasn't been tested in a loooong time
     # When not using gcc, we currently assume that we are using
     # Microsoft Visual C++.
@@ -13712,8 +10876,34 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     ;;
   esac
 
-  ld_shlibs_F77=yes
+  ld_shlibs=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
   if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+	  *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
@@ -13721,16 +10911,17 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     # are reset later if shared libraries are not supported. Putting them
     # here allows them to be overridden if necessary.
     runpath_var=LD_RUN_PATH
-    hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-    export_dynamic_flag_spec_F77='${wl}--export-dynamic'
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
     # ancient GNU ld didn't support --whole-archive et. al.
     if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
-      whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
     else
-      whole_archive_flag_spec_F77=
+      whole_archive_flag_spec=
     fi
     supports_anon_versioning=no
     case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
       *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
       *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
       *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
@@ -13743,14 +10934,15 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     aix[3-9]*)
       # On AIX/PPC, the GNU linker is very broken
       if test "$host_cpu" != ia64; then
-	ld_shlibs_F77=no
+	ld_shlibs=no
 	cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** Warning: the GNU linker, at least up to release 2.19, is reported
 *** to be unable to reliably create shared libraries on AIX.
 *** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
 
 _LT_EOF
       fi
@@ -13760,42 +10952,44 @@ _LT_EOF
       case $host_cpu in
       powerpc)
             # see comment about AmigaOS4 .so support
-            archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            archive_expsym_cmds_F77=''
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
         ;;
       m68k)
-            archive_cmds_F77='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            hardcode_libdir_flag_spec_F77='-L$libdir'
-            hardcode_minus_L_F77=yes
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
         ;;
       esac
       ;;
 
     beos*)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	allow_undefined_flag_F77=unsupported
+	allow_undefined_flag=unsupported
 	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
 	# support --undefined.  This deserves some investigation.  FIXME
-	archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
       else
-	ld_shlibs_F77=no
+	ld_shlibs=no
       fi
       ;;
 
-    cygwin* | mingw* | pw32*)
-      # _LT_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless,
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
       # as there is no search path for DLLs.
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      allow_undefined_flag_F77=unsupported
-      always_export_symbols_F77=no
-      enable_shared_with_static_runtimes_F77=yes
-      export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+      hardcode_libdir_flag_spec='-L$libdir'
+      export_dynamic_flag_spec='${wl}--export-all-symbols'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-        archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
 	# If the export-symbols file already is a .def file (1st line
 	# is EXPORTS), use it as is; otherwise, prepend...
-	archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
 	  cp $export_symbols $output_objdir/$soname.def;
 	else
 	  echo EXPORTS > $output_objdir/$soname.def;
@@ -13803,26 +10997,31 @@ _LT_EOF
 	fi~
 	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
       else
-	ld_shlibs_F77=no
+	ld_shlibs=no
       fi
       ;;
 
+    haiku*)
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      link_all_deplibs=yes
+      ;;
+
     interix[3-9]*)
-      hardcode_direct_F77=no
-      hardcode_shlibpath_var_F77=no
-      hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
-      export_dynamic_flag_spec_F77='${wl}-E'
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
       # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
       # Instead, shared libraries are loaded at an image base (0x10000000 by
       # default) and relocated if they conflict, which is a slow very memory
       # consuming and fragmenting process.  To avoid this, we pick a random,
       # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
       # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
-    gnu* | linux* | tpf* | k*bsd*-gnu)
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
       tmp_diet=no
       if test "$host_os" = linux-dietlibc; then
 	case $cc_basename in
@@ -13832,15 +11031,16 @@ _LT_EOF
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
 	 && test "$tmp_diet" = no
       then
-	tmp_addflag=
+	tmp_addflag=' $pic_flag'
 	tmp_sharedflag='-shared'
 	case $cc_basename,$host_cpu in
         pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag'
 	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
 	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
@@ -13848,60 +11048,67 @@ _LT_EOF
 	  tmp_addflag=' -i_dynamic -nofor_main' ;;
 	ifc* | ifort*)			# Intel Fortran compiler
 	  tmp_addflag=' -nofor_main' ;;
-	xl[cC]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
+	lf95*)				# Lahey Fortran 8.1
+	  whole_archive_flag_spec=
+	  tmp_sharedflag='--shared' ;;
+	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
 	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
+	  ;;
 	esac
 	case `$CC -V 2>&1 | sed 5q` in
 	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
-	  compiler_needs_object_F77=yes
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
 	  tmp_sharedflag='-G' ;;
 	*Sun\ F*)			# Sun Fortran 8.3
 	  tmp_sharedflag='-G' ;;
 	esac
-	archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
 
         if test "x$supports_anon_versioning" = xyes; then
-          archive_expsym_cmds_F77='echo "{ global:" > $output_objdir/$libname.ver~
+          archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
 	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
 	    echo "local: *; };" >> $output_objdir/$libname.ver~
 	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
         fi
 
 	case $cc_basename in
-	xlf*)
+	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
-	  whole_archive_flag_spec_F77='--whole-archive$convenience --no-whole-archive'
-	  hardcode_libdir_flag_spec_F77=
-	  hardcode_libdir_flag_spec_ld_F77='-rpath $libdir'
-	  archive_cmds_F77='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+	  hardcode_libdir_flag_spec=
+	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
+	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
-	    archive_expsym_cmds_F77='echo "{ global:" > $output_objdir/$libname.ver~
+	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
 	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
 	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
       else
-        ld_shlibs_F77=no
+        ld_shlibs=no
       fi
       ;;
 
     netbsd*)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
       else
-	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
     solaris*)
       if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
-	ld_shlibs_F77=no
+	ld_shlibs=no
 	cat <<_LT_EOF 1>&2
 
 *** Warning: The releases 2.8.* of the GNU linker cannot reliably
@@ -13913,17 +11120,17 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
-	ld_shlibs_F77=no
+	ld_shlibs=no
       fi
       ;;
 
     sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
       case `$LD -v 2>&1` in
         *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
-	ld_shlibs_F77=no
+	ld_shlibs=no
 	cat <<_LT_EOF 1>&2
 
 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
@@ -13941,53 +11148,53 @@ _LT_EOF
 	  # DT_RUNPATH tag from executables and libraries.  But doing so
 	  # requires that you compile everything twice, which is a pain.
 	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	    hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-	    archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
 	  else
-	    ld_shlibs_F77=no
+	    ld_shlibs=no
 	  fi
 	;;
       esac
       ;;
 
     sunos4*)
-      archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       wlarc=
-      hardcode_direct_F77=yes
-      hardcode_shlibpath_var_F77=no
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
       ;;
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
-	ld_shlibs_F77=no
+	ld_shlibs=no
       fi
       ;;
     esac
 
-    if test "$ld_shlibs_F77" = no; then
+    if test "$ld_shlibs" = no; then
       runpath_var=
-      hardcode_libdir_flag_spec_F77=
-      export_dynamic_flag_spec_F77=
-      whole_archive_flag_spec_F77=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
     fi
   else
     # PORTME fill in a description of your system's linker (not GNU ld)
     case $host_os in
     aix3*)
-      allow_undefined_flag_F77=unsupported
-      always_export_symbols_F77=yes
-      archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
       # Note: this linker hardcodes the directories in LIBPATH if there
       # are no directories specified by -L.
-      hardcode_minus_L_F77=yes
+      hardcode_minus_L=yes
       if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
 	# Neither direct hardcoding nor static linking is supported with a
 	# broken collect2.
-	hardcode_direct_F77=unsupported
+	hardcode_direct=unsupported
       fi
       ;;
 
@@ -14001,10 +11208,12 @@ _LT_EOF
       else
 	# If we're using GNU nm, then we don't want the "-C" option.
 	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
 	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	else
-	  export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	fi
 	aix_use_runtimelinking=no
 
@@ -14031,12 +11240,12 @@ _LT_EOF
       # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
       # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
 
-      archive_cmds_F77=''
-      hardcode_direct_F77=yes
-      hardcode_direct_absolute_F77=yes
-      hardcode_libdir_separator_F77=':'
-      link_all_deplibs_F77=yes
-      file_list_spec_F77='${wl}-f,'
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_direct_absolute=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      file_list_spec='${wl}-f,'
 
       if test "$GCC" = yes; then
 	case $host_os in aix4.[012]|aix4.[012].*)
@@ -14050,13 +11259,13 @@ _LT_EOF
 	  :
 	  else
 	  # We have old collect2
-	  hardcode_direct_F77=unsupported
+	  hardcode_direct=unsupported
 	  # It fails to find uninstalled libraries when the uninstalled
 	  # path is not listed in the libpath.  Setting hardcode_minus_L
 	  # to unsupported forces relinking
-	  hardcode_minus_L_F77=yes
-	  hardcode_libdir_flag_spec_F77='-L$libdir'
-	  hardcode_libdir_separator_F77=
+	  hardcode_minus_L=yes
+	  hardcode_libdir_flag_spec='-L$libdir'
+	  hardcode_libdir_separator=
 	  fi
 	  ;;
 	esac
@@ -14079,137 +11288,143 @@ _LT_EOF
 	fi
       fi
 
+      export_dynamic_flag_spec='${wl}-bexpall'
       # It seems that -bexpall does not export symbols beginning with
       # underscore (_), so it is better to generate a list of symbols to export.
-      always_export_symbols_F77=yes
+      always_export_symbols=yes
       if test "$aix_use_runtimelinking" = yes; then
 	# Warning - without using the other runtime loading flags (-brtl),
 	# -berok will link without error, but may produce a broken library.
-	allow_undefined_flag_F77='-berok'
+	allow_undefined_flag='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        cat >conftest.$ac_ext <<_ACEOF
-      program main
+        if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-      end
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
 
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
 fi
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
 
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+  aix_libpath=$lt_cv_aix_libpath_
+fi
 
-        hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
-        archive_expsym_cmds_F77='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
       else
 	if test "$host_cpu" = ia64; then
-	  hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib'
-	  allow_undefined_flag_F77="-z nodefs"
-	  archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag="-z nodefs"
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
 	else
 	 # Determine the default libpath from the value encoded in an
 	 # empty executable.
-	 cat >conftest.$ac_ext <<_ACEOF
-      program main
+	 if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-      end
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
 
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
 fi
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
 
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+  aix_libpath=$lt_cv_aix_libpath_
+fi
 
-	 hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
 	  # Warning - without using the other run time loading flags,
 	  # -berok will link without error, but may produce a broken library.
-	  no_undefined_flag_F77=' ${wl}-bernotok'
-	  allow_undefined_flag_F77=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  whole_archive_flag_spec_F77='$convenience'
-	  archive_cmds_need_lc_F77=yes
+	  no_undefined_flag=' ${wl}-bernotok'
+	  allow_undefined_flag=' ${wl}-berok'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    whole_archive_flag_spec='$convenience'
+	  fi
+	  archive_cmds_need_lc=yes
 	  # This is similar to how AIX traditionally builds its shared libraries.
-	  archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
 	fi
       fi
       ;;
@@ -14218,73 +11433,124 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       case $host_cpu in
       powerpc)
             # see comment about AmigaOS4 .so support
-            archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            archive_expsym_cmds_F77=''
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
         ;;
       m68k)
-            archive_cmds_F77='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            hardcode_libdir_flag_spec_F77='-L$libdir'
-            hardcode_minus_L_F77=yes
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
         ;;
       esac
       ;;
 
     bsdi[45]*)
-      export_dynamic_flag_spec_F77=-rdynamic
+      export_dynamic_flag_spec=-rdynamic
       ;;
 
-    cygwin* | mingw* | pw32*)
+    cygwin* | mingw* | pw32* | cegcc*)
       # When not using gcc, we currently assume that we are using
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
-      hardcode_libdir_flag_spec_F77=' '
-      allow_undefined_flag_F77=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      old_archive_from_new_cmds_F77='true'
-      # FIXME: Should let the user specify the lib program.
-      old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      fix_srcfile_path_F77='`cygpath -w "$srcfile"`'
-      enable_shared_with_static_runtimes_F77=yes
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	always_export_symbols=yes
+	file_list_spec='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+	enable_shared_with_static_runtimes=yes
+	export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	old_postinstall_cmds='chmod 644 $oldlib'
+	postlink_cmds='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	old_archive_from_new_cmds='true'
+	# FIXME: Should let the user specify the lib program.
+	old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	enable_shared_with_static_runtimes=yes
+	;;
+      esac
       ;;
 
     darwin* | rhapsody*)
 
 
-  archive_cmds_need_lc_F77=no
-  hardcode_direct_F77=no
-  hardcode_automatic_F77=yes
-  hardcode_shlibpath_var_F77=unsupported
-  whole_archive_flag_spec_F77=''
-  link_all_deplibs_F77=yes
-  allow_undefined_flag_F77="$_lt_dar_allow_undefined"
-  if test "$GCC" = "yes"; then
-    output_verbose_link_cmd=echo
-    archive_cmds_F77="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-    module_cmds_F77="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    archive_expsym_cmds_F77="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-    module_expsym_cmds_F77="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+  archive_cmds_need_lc=no
+  hardcode_direct=no
+  hardcode_automatic=yes
+  hardcode_shlibpath_var=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  else
+    whole_archive_flag_spec=''
+  fi
+  link_all_deplibs=yes
+  allow_undefined_flag="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
 
   else
-  ld_shlibs_F77=no
+  ld_shlibs=no
   fi
 
       ;;
 
     dgux*)
-      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      hardcode_shlibpath_var_F77=no
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
       ;;
 
     freebsd1*)
-      ld_shlibs_F77=no
+      ld_shlibs=no
       ;;
 
     # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
@@ -14292,106 +11558,145 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
     # does not break anything, and helps significantly (at the cost of a little
     # extra space).
     freebsd2.2*)
-      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
-      hardcode_libdir_flag_spec_F77='-R$libdir'
-      hardcode_direct_F77=yes
-      hardcode_shlibpath_var_F77=no
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
     freebsd2*)
-      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct_F77=yes
-      hardcode_minus_L_F77=yes
-      hardcode_shlibpath_var_F77=no
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
       ;;
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
     freebsd* | dragonfly*)
-      archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
-      hardcode_libdir_flag_spec_F77='-R$libdir'
-      hardcode_direct_F77=yes
-      hardcode_shlibpath_var_F77=no
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
       ;;
 
     hpux9*)
       if test "$GCC" = yes; then
-	archive_cmds_F77='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       else
-	archive_cmds_F77='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       fi
-      hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
-      hardcode_libdir_separator_F77=:
-      hardcode_direct_F77=yes
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
 
       # hardcode_minus_L: Not really in the search PATH,
       # but as the default location of the library.
-      hardcode_minus_L_F77=yes
-      export_dynamic_flag_spec_F77='${wl}-E'
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
       ;;
 
     hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
-	archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
       if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
-	hardcode_libdir_flag_spec_ld_F77='+b $libdir'
-	hardcode_libdir_separator_F77=:
-	hardcode_direct_F77=yes
-	hardcode_direct_absolute_F77=yes
-	export_dynamic_flag_spec_F77='${wl}-E'
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_flag_spec_ld='+b $libdir'
+	hardcode_libdir_separator=:
+	hardcode_direct=yes
+	hardcode_direct_absolute=yes
+	export_dynamic_flag_spec='${wl}-E'
 	# hardcode_minus_L: Not really in the search PATH,
 	# but as the default location of the library.
-	hardcode_minus_L_F77=yes
+	hardcode_minus_L=yes
       fi
       ;;
 
     hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
 	case $host_cpu in
 	hppa*64*)
-	  archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       else
 	case $host_cpu in
 	hppa*64*)
-	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler__b=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS -b"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler__b=yes
+       fi
+     else
+       lt_cv_prog_compiler__b=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+    archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
 	  ;;
 	esac
       fi
       if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
-	hardcode_libdir_separator_F77=:
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator=:
 
 	case $host_cpu in
 	hppa*64*|ia64*)
-	  hardcode_direct_F77=no
-	  hardcode_shlibpath_var_F77=no
+	  hardcode_direct=no
+	  hardcode_shlibpath_var=no
 	  ;;
 	*)
-	  hardcode_direct_F77=yes
-	  hardcode_direct_absolute_F77=yes
-	  export_dynamic_flag_spec_F77='${wl}-E'
+	  hardcode_direct=yes
+	  hardcode_direct_absolute=yes
+	  export_dynamic_flag_spec='${wl}-E'
 
 	  # hardcode_minus_L: Not really in the search PATH,
 	  # but as the default location of the library.
-	  hardcode_minus_L_F77=yes
+	  hardcode_minus_L=yes
 	  ;;
 	esac
       fi
@@ -14399,77 +11704,64 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
     irix5* | irix6* | nonstopux*)
       if test "$GCC" = yes; then
-	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	# Try to use the -exported_symbol ld option, if it does not
 	# work, assume that -exports_file does not work either and
 	# implicitly export all symbols.
-        save_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-        cat >conftest.$ac_ext <<_ACEOF
-int foo(void) {}
+	# This should be the same for all languages, so no per-tag cache variable.
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int foo (void) { return 0; }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_irix_exported_symbol=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
+  lt_cv_irix_exported_symbol=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-        LDFLAGS="$save_LDFLAGS"
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+           LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
       else
-	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
       fi
-      archive_cmds_need_lc_F77='no'
-      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator_F77=:
-      inherit_rpath_F77=yes
-      link_all_deplibs_F77=yes
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      inherit_rpath=yes
+      link_all_deplibs=yes
       ;;
 
     netbsd*)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
       else
-	archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+	archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
       fi
-      hardcode_libdir_flag_spec_F77='-R$libdir'
-      hardcode_direct_F77=yes
-      hardcode_shlibpath_var_F77=no
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
       ;;
 
     newsos6)
-      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct_F77=yes
-      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator_F77=:
-      hardcode_shlibpath_var_F77=no
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
       ;;
 
     *nto* | *qnx*)
@@ -14477,95 +11769,95 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
 
     openbsd*)
       if test -f /usr/libexec/ld.so; then
-	hardcode_direct_F77=yes
-	hardcode_shlibpath_var_F77=no
-	hardcode_direct_absolute_F77=yes
+	hardcode_direct=yes
+	hardcode_shlibpath_var=no
+	hardcode_direct_absolute=yes
 	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	  archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
-	  export_dynamic_flag_spec_F77='${wl}-E'
+	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec='${wl}-E'
 	else
 	  case $host_os in
 	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-	     archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     hardcode_libdir_flag_spec_F77='-R$libdir'
+	     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec='-R$libdir'
 	     ;;
 	   *)
-	     archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+	     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
 	     ;;
 	  esac
 	fi
       else
-	ld_shlibs_F77=no
+	ld_shlibs=no
       fi
       ;;
 
     os2*)
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      hardcode_minus_L_F77=yes
-      allow_undefined_flag_F77=unsupported
-      archive_cmds_F77='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      old_archive_from_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
       ;;
 
     osf3*)
       if test "$GCC" = yes; then
-	allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
       else
-	allow_undefined_flag_F77=' -expect_unresolved \*'
-	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
       fi
-      archive_cmds_need_lc_F77='no'
-      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator_F77=:
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
       ;;
 
     osf4* | osf5*)	# as osf3* with the addition of -msym flag
       if test "$GCC" = yes; then
-	allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
       else
-	allow_undefined_flag_F77=' -expect_unresolved \*'
-	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
-	hardcode_libdir_flag_spec_F77='-rpath $libdir'
+	hardcode_libdir_flag_spec='-rpath $libdir'
       fi
-      archive_cmds_need_lc_F77='no'
-      hardcode_libdir_separator_F77=:
+      archive_cmds_need_lc='no'
+      hardcode_libdir_separator=:
       ;;
 
     solaris*)
-      no_undefined_flag_F77=' -z defs'
+      no_undefined_flag=' -z defs'
       if test "$GCC" = yes; then
 	wlarc='${wl}'
-	archive_cmds_F77='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_F77='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
 	  wlarc=''
-	  archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  archive_expsym_cmds_F77='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
 	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
 	  ;;
 	*)
 	  wlarc='${wl}'
-	  archive_cmds_F77='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
-	  archive_expsym_cmds_F77='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
 	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
 	  ;;
 	esac
       fi
-      hardcode_libdir_flag_spec_F77='-R$libdir'
-      hardcode_shlibpath_var_F77=no
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
       case $host_os in
       solaris2.[0-5] | solaris2.[0-5].*) ;;
       *)
@@ -14574,79 +11866,79 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
 	# but is careful enough not to reorder.
 	# Supported since Solaris 2.6 (maybe 2.5.1?)
 	if test "$GCC" = yes; then
-	  whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
 	else
-	  whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract'
+	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
 	fi
 	;;
       esac
-      link_all_deplibs_F77=yes
+      link_all_deplibs=yes
       ;;
 
     sunos4*)
       if test "x$host_vendor" = xsequent; then
 	# Use $CC to link under sequent, because it throws in some extra .o
 	# files that make .init and .fini sections work.
-	archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
       else
-	archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+	archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
       fi
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      hardcode_direct_F77=yes
-      hardcode_minus_L_F77=yes
-      hardcode_shlibpath_var_F77=no
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
       ;;
 
     sysv4)
       case $host_vendor in
 	sni)
-	  archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  hardcode_direct_F77=yes # is this really true???
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=yes # is this really true???
 	;;
 	siemens)
 	  ## LD is ld it makes a PLAMLIB
 	  ## CC just makes a GrossModule.
-	  archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags'
-	  reload_cmds_F77='$CC -r -o $output$reload_objs'
-	  hardcode_direct_F77=no
+	  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds='$CC -r -o $output$reload_objs'
+	  hardcode_direct=no
         ;;
 	motorola)
-	  archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=no #Motorola manual says yes, but my tests say they lie
 	;;
       esac
       runpath_var='LD_RUN_PATH'
-      hardcode_shlibpath_var_F77=no
+      hardcode_shlibpath_var=no
       ;;
 
     sysv4.3*)
-      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_shlibpath_var_F77=no
-      export_dynamic_flag_spec_F77='-Bexport'
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
       ;;
 
     sysv4*MP*)
       if test -d /usr/nec; then
-	archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	hardcode_shlibpath_var_F77=no
+	archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var=no
 	runpath_var=LD_RUN_PATH
 	hardcode_runpath_var=yes
-	ld_shlibs_F77=yes
+	ld_shlibs=yes
       fi
       ;;
 
     sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
-      no_undefined_flag_F77='${wl}-z,text'
-      archive_cmds_need_lc_F77=no
-      hardcode_shlibpath_var_F77=no
+      no_undefined_flag='${wl}-z,text'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
       runpath_var='LD_RUN_PATH'
 
       if test "$GCC" = yes; then
-	archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       else
-	archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       fi
       ;;
 
@@ -14657,50 +11949,59 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       # ever link correctly.  If we're not using GNU ld we use -z text
       # though, which does catch some bad symbols but isn't as heavy-handed
       # as -z defs.
-      no_undefined_flag_F77='${wl}-z,text'
-      allow_undefined_flag_F77='${wl}-z,nodefs'
-      archive_cmds_need_lc_F77=no
-      hardcode_shlibpath_var_F77=no
-      hardcode_libdir_flag_spec_F77='${wl}-R,$libdir'
-      hardcode_libdir_separator_F77=':'
-      link_all_deplibs_F77=yes
-      export_dynamic_flag_spec_F77='${wl}-Bexport'
+      no_undefined_flag='${wl}-z,text'
+      allow_undefined_flag='${wl}-z,nodefs'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-R,$libdir'
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      export_dynamic_flag_spec='${wl}-Bexport'
       runpath_var='LD_RUN_PATH'
 
       if test "$GCC" = yes; then
-	archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       else
-	archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       fi
       ;;
 
     uts4*)
-      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      hardcode_shlibpath_var_F77=no
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
       ;;
 
     *)
-      ld_shlibs_F77=no
+      ld_shlibs=no
       ;;
     esac
 
     if test x$host_vendor = xsni; then
       case $host in
       sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-	export_dynamic_flag_spec_F77='${wl}-Blargedynsym'
+	export_dynamic_flag_spec='${wl}-Blargedynsym'
 	;;
       esac
     fi
   fi
 
-{ $as_echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
-$as_echo "$ld_shlibs_F77" >&6; }
-test "$ld_shlibs_F77" = no && can_build_shared=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
 
-with_gnu_ld_F77=$with_gnu_ld
 
 
 
@@ -14710,13 +12011,13 @@ with_gnu_ld_F77=$with_gnu_ld
 #
 # Do we need to explicitly link libc?
 #
-case "x$archive_cmds_need_lc_F77" in
+case "x$archive_cmds_need_lc" in
 x|xyes)
   # Assume -lc should be added
-  archive_cmds_need_lc_F77=yes
+  archive_cmds_need_lc=yes
 
   if test "$enable_shared" = yes && test "$GCC" = yes; then
-    case $archive_cmds_F77 in
+    case $archive_cmds in
     *'~'*)
       # FIXME: we may have to deal with multi-command sequences.
       ;;
@@ -14724,46 +12025,52 @@ x|xyes)
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-      $RM conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$lt_prog_compiler_wl_F77
-	pic_flag=$lt_prog_compiler_pic_F77
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$allow_undefined_flag_F77
-        allow_undefined_flag_F77=
-        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5
-  (eval $archive_cmds_F77 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$lt_prog_compiler_wl
+	  pic_flag=$lt_prog_compiler_pic
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$allow_undefined_flag
+	  allow_undefined_flag=
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-        then
-	  archive_cmds_need_lc_F77=no
-        else
-	  archive_cmds_need_lc_F77=yes
-        fi
-        allow_undefined_flag_F77=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $RM conftest*
-      { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
-$as_echo "$archive_cmds_need_lc_F77" >&6; }
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	  then
+	    lt_cv_archive_cmds_need_lc=no
+	  else
+	    lt_cv_archive_cmds_need_lc=yes
+	  fi
+	  allow_undefined_flag=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
       ;;
     esac
   fi
@@ -14833,9 +12140,166 @@ esac
 
 
 
-    { $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
 $as_echo_n "checking dynamic linker characteristics... " >&6; }
 
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[lt_foo]++; }
+  if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
@@ -14920,7 +12384,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
@@ -14945,14 +12409,15 @@ bsdi[45]*)
   # libtool to hard-code these into programs
   ;;
 
-cygwin* | mingw* | pw32*)
+cygwin* | mingw* | pw32* | cegcc*)
   version_type=windows
   shrext_cmds=".dll"
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32*)
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -14973,36 +12438,83 @@ cygwin* | mingw* | pw32*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
       ;;
-    mingw*)
+    mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
       library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
     ;;
 
   *)
+    # Assume MSVC wrapper
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
     ;;
   esac
-  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -15018,6 +12530,7 @@ darwin* | rhapsody*)
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
 
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
   sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
   ;;
 
@@ -15078,13 +12591,26 @@ freebsd* | dragonfly*)
   esac
   ;;
 
-gnu*)
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
+  dynamic_linker="$host_os runtime_loader"
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -15122,704 +12648,355 @@ hpux9* | hpux10* | hpux11*)
     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
     ;;
   *)
-    shrext_cmds='.sl'
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=SHLIB_PATH
-    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    ;;
-  esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
-  postinstall_cmds='chmod 555 $lib'
-  ;;
-
-interix[3-9]*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-irix5* | irix6* | nonstopux*)
-  case $host_os in
-    nonstopux*) version_type=nonstopux ;;
-    *)
-	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
-	else
-		version_type=irix
-	fi ;;
-  esac
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
-  case $host_os in
-  irix5* | nonstopux*)
-    libsuff= shlibsuff=
-    ;;
-  *)
-    case $LD in # libtool.m4 will add one of these switches to LD
-    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
-      libsuff= shlibsuff= libmagic=32-bit;;
-    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
-      libsuff=32 shlibsuff=N32 libmagic=N32;;
-    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
-      libsuff=64 shlibsuff=64 libmagic=64-bit;;
-    *) libsuff= shlibsuff= libmagic=never-match;;
-    esac
-    ;;
-  esac
-  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
-  shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-  hardcode_into_libs=yes
-  ;;
-
-# No shared lib support for Linux oldld, aout, or coff.
-linux*oldld* | linux*aout* | linux*coff*)
-  dynamic_linker=no
-  ;;
-
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  # Some binutils ld are patched to set DT_RUNPATH
-  save_LDFLAGS=$LDFLAGS
-  save_libdir=$libdir
-  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_F77\"; \
-       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_F77\""
-  cat >conftest.$ac_ext <<_ACEOF
-      program main
-
-      end
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then
-  shlibpath_overrides_runpath=yes
-fi
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-  LDFLAGS=$save_LDFLAGS
-  libdir=$save_libdir
-
-  # This implies no fast_install, which is unacceptable.
-  # Some rework will be needed to allow for fast_install
-  # before this can be enabled.
-  hardcode_into_libs=yes
-
-  # Append ld.so.conf contents to the search path
-  if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
-  fi
-
-  # We used to test for /lib/ld.so.1 and disable shared libraries on
-  # powerpc, because MkLinux only supported shared libraries with the
-  # GNU dynamic linker.  Since this was broken with cross compilers,
-  # most powerpc-linux boxes support dynamic linking these days and
-  # people can always --disable-shared, the test was removed, and we
-  # assume the GNU/Linux dynamic linker is in use.
-  dynamic_linker='GNU/Linux ld.so'
-  ;;
-
-netbsd*)
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-    dynamic_linker='NetBSD (a.out) ld.so'
-  else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    dynamic_linker='NetBSD ld.elf_so'
-  fi
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  ;;
-
-newsos6)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  ;;
-
-*nto* | *qnx*)
-  version_type=qnx
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='ldqnx.so'
-  ;;
-
-openbsd*)
-  version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
-  need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
-    *)				need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[89] | openbsd2.[89].*)
-	shlibpath_overrides_runpath=no
-	;;
-      *)
-	shlibpath_overrides_runpath=yes
-	;;
-      esac
-  else
-    shlibpath_overrides_runpath=yes
-  fi
-  ;;
-
-os2*)
-  libname_spec='$name'
-  shrext_cmds=".dll"
-  need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
-  dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
-  ;;
-
-osf3* | osf4* | osf5*)
-  version_type=osf
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
-  ;;
-
-rdos*)
-  dynamic_linker=no
-  ;;
-
-solaris*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  # ldd complains unless libraries are executable
-  postinstall_cmds='chmod +x $lib'
-  ;;
-
-sunos4*)
-  version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
-    need_lib_prefix=no
-  fi
-  need_version=yes
-  ;;
-
-sysv4 | sysv4.3*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_vendor in
-    sni)
-      shlibpath_overrides_runpath=no
-      need_lib_prefix=no
-      runpath_var=LD_RUN_PATH
-      ;;
-    siemens)
-      need_lib_prefix=no
-      ;;
-    motorola)
-      need_lib_prefix=no
-      need_version=no
-      shlibpath_overrides_runpath=no
-      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
-      ;;
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
   esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
   ;;
 
-sysv4*MP*)
-  if test -d /usr/nec ;then
-    version_type=linux
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
-    shlibpath_var=LD_LIBRARY_PATH
-  fi
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
+interix[3-9]*)
+  version_type=linux
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
   shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
+  shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
-    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
-  else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    case $host_os in
-      sco3.2v5*)
-        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
-	;;
-    esac
-  fi
-  sys_lib_dlsearch_path_spec='/usr/lib'
   ;;
 
-tpf*)
-  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
   need_lib_prefix=no
   need_version=no
-  library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
   shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
   hardcode_into_libs=yes
   ;;
 
-uts4*)
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
   version_type=linux
+  need_lib_prefix=no
+  need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
-  ;;
-
-*)
-  dynamic_linker=no
-  ;;
-esac
-{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-$as_echo "$dynamic_linker" >&6; }
-test "$dynamic_linker" = no && can_build_shared=no
-
-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
-  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
-fi
-
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-fi
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-    { $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
-hardcode_action_F77=
-if test -n "$hardcode_libdir_flag_spec_F77" ||
-   test -n "$runpath_var_F77" ||
-   test "X$hardcode_automatic_F77" = "Xyes" ; then
-
-  # We can hardcode non-existent directories.
-  if test "$hardcode_direct_F77" != no &&
-     # If the only mechanism to avoid hardcoding is shlibpath_var, we
-     # have to relink, otherwise we might link with an installed library
-     # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, F77)" != no &&
-     test "$hardcode_minus_L_F77" != no; then
-    # Linking always hardcodes the temporary library directory.
-    hardcode_action_F77=relink
-  else
-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
-    hardcode_action_F77=immediate
-  fi
-else
-  # We cannot hardcode anything, or else we can only hardcode existing
-  # directories.
-  hardcode_action_F77=unsupported
-fi
-{ $as_echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
-$as_echo "$hardcode_action_F77" >&6; }
-
-if test "$hardcode_action_F77" = relink ||
-   test "$inherit_rpath_F77" = yes; then
-  # Fast installation is not supported
-  enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
-  # Fast installation is not necessary
-  enable_fast_install=needless
-fi
-
-
-
-
-
-
-
-  fi # test -n "$compiler"
-
-  GCC=$lt_save_GCC
-  CC="$lt_save_CC"
-fi # test "$_lt_disable_F77" != yes
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-      ac_ext=${ac_fc_srcext-f}
-ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
-ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_fc_compiler_gnu
-
-
-archive_cmds_need_lc_FC=no
-allow_undefined_flag_FC=
-always_export_symbols_FC=no
-archive_expsym_cmds_FC=
-export_dynamic_flag_spec_FC=
-hardcode_direct_FC=no
-hardcode_direct_absolute_FC=no
-hardcode_libdir_flag_spec_FC=
-hardcode_libdir_flag_spec_ld_FC=
-hardcode_libdir_separator_FC=
-hardcode_minus_L_FC=no
-hardcode_automatic_FC=no
-inherit_rpath_FC=no
-module_cmds_FC=
-module_expsym_cmds_FC=
-link_all_deplibs_FC=unknown
-old_archive_cmds_FC=$old_archive_cmds
-no_undefined_flag_FC=
-whole_archive_flag_spec_FC=
-enable_shared_with_static_runtimes_FC=no
-
-# Source file extension for fc test sources.
-ac_ext=${ac_fc_srcext-f}
-
-# Object file extension for compiled fc test sources.
-objext=o
-objext_FC=$objext
-
-# No sense in running all these tests if we already determined that
-# the FC compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_disable_FC" != yes; then
-  # Code to be used in simple compile tests
-  lt_simple_compile_test_code="\
-      subroutine t
-      return
-      end
-"
-
-  # Code to be used in simple link tests
-  lt_simple_link_test_code="\
-      program t
-      end
-"
-
-  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
-
-
-
-
-
-
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
-
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
-
-# Allow CC to be a program name with arguments.
-compiler=$CC
-
+  shlibpath_overrides_runpath=no
 
-  # save warnings/boilerplate of simple test code
-  ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$RM conftest*
+  # Some binutils ld are patched to set DT_RUNPATH
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-  ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$RM -r conftest*
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
 
-  # Allow CC to be a program name with arguments.
-  lt_save_CC="$CC"
-  lt_save_GCC=$GCC
-  CC=${FC-"f95"}
-  compiler=$CC
-  GCC=$ac_cv_fc_compiler_gnu
+fi
 
-  compiler_FC=$CC
-  for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
 
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
 
-  if test -n "$compiler"; then
-    { $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
-$as_echo_n "checking if libtool supports shared libraries... " >&6; }
-    { $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5
-$as_echo "$can_build_shared" >&6; }
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
 
-    { $as_echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
-$as_echo_n "checking whether to build shared libraries... " >&6; }
-    test "$can_build_shared" = "no" && enable_shared=no
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
 
-    # On AIX, shared libraries and static libraries use the same namespace, and
-    # are all built from PIC.
-    case $host_os in
-      aix3*)
-        test "$enable_shared" = yes && enable_static=no
-        if test -n "$RANLIB"; then
-          archive_cmds="$archive_cmds~\$RANLIB \$lib"
-          postinstall_cmds='$RANLIB $lib'
-        fi
-        ;;
-      aix[4-9]*)
-	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-	  test "$enable_shared" = yes && enable_static=no
-	fi
-        ;;
-    esac
-    { $as_echo "$as_me:$LINENO: result: $enable_shared" >&5
-$as_echo "$enable_shared" >&6; }
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
 
-    { $as_echo "$as_me:$LINENO: checking whether to build static libraries" >&5
-$as_echo_n "checking whether to build static libraries... " >&6; }
-    # Make sure either enable_shared or enable_static is yes.
-    test "$enable_shared" = yes || enable_static=yes
-    { $as_echo "$as_me:$LINENO: result: $enable_static" >&5
-$as_echo "$enable_static" >&6; }
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
 
-    GCC_FC="$ac_cv_fc_compiler_gnu"
-    LD_FC="$LD"
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
 
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    # Dependencies to place before and after the object being linked:
-predep_objects_FC=
-postdep_objects_FC=
-predeps_FC=
-postdeps_FC=
-compiler_lib_search_path_FC=
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
 
-cat > conftest.$ac_ext <<_LT_EOF
-      subroutine foo
-      implicit none
-      integer a
-      a=0
-      return
-      end
-_LT_EOF
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
 
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  # Parse the compiler output and extract the necessary
-  # objects, libraries and library flags.
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
 
-  # Sentinel used to keep track of whether or not we are before
-  # the conftest object file.
-  pre_test_object_deps_done=no
+rdos*)
+  dynamic_linker=no
+  ;;
 
-  for p in `eval "$output_verbose_link_cmd"`; do
-    case $p in
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
 
-    -L* | -R* | -l*)
-       # Some compilers place space between "-{L,R}" and the path.
-       # Remove the space.
-       if test $p = "-L" ||
-          test $p = "-R"; then
-	 prev=$p
-	 continue
-       else
-	 prev=
-       fi
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
 
-       if test "$pre_test_object_deps_done" = no; then
-	 case $p in
-	 -L* | -R*)
-	   # Internal compiler library paths should come after those
-	   # provided the user.  The postdeps already come after the
-	   # user supplied libs so there is no need to process them.
-	   if test -z "$compiler_lib_search_path_FC"; then
-	     compiler_lib_search_path_FC="${prev}${p}"
-	   else
-	     compiler_lib_search_path_FC="${compiler_lib_search_path_FC} ${prev}${p}"
-	   fi
-	   ;;
-	 # The "-l" case would never come before the object being
-	 # linked, so don't bother handling this case.
-	 esac
-       else
-	 if test -z "$postdeps_FC"; then
-	   postdeps_FC="${prev}${p}"
-	 else
-	   postdeps_FC="${postdeps_FC} ${prev}${p}"
-	 fi
-       fi
-       ;;
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
 
-    *.$objext)
-       # This assumes that the test object file only shows up
-       # once in the compiler output.
-       if test "$p" = "conftest.$objext"; then
-	 pre_test_object_deps_done=yes
-	 continue
-       fi
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
 
-       if test "$pre_test_object_deps_done" = no; then
-	 if test -z "$predep_objects_FC"; then
-	   predep_objects_FC="$p"
-	 else
-	   predep_objects_FC="$predep_objects_FC $p"
-	 fi
-       else
-	 if test -z "$postdep_objects_FC"; then
-	   postdep_objects_FC="$p"
-	 else
-	   postdep_objects_FC="$postdep_objects_FC $p"
-	 fi
-       fi
-       ;;
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
 
-    *) ;; # Ignore the rest.
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
 
-    esac
-  done
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
 
-  # Clean up.
-  rm -f a.out a.exe
-else
-  echo "libtool.m4: error: problem compiling FC test program"
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
 
-$RM -f confest.$objext
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
 
-# PORTME: override above test on systems where it is broken
 
 
-case " $postdeps_FC " in
-*" -lc "*) archive_cmds_need_lc_FC=no ;;
-esac
- compiler_lib_search_dirs_FC=
-if test -n "${compiler_lib_search_path_FC}"; then
- compiler_lib_search_dirs_FC=`echo " ${compiler_lib_search_path_FC}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
-fi
 
 
 
@@ -15851,1643 +13028,1043 @@ fi
 
 
 
-    lt_prog_compiler_wl_FC=
-lt_prog_compiler_pic_FC=
-lt_prog_compiler_static_FC=
 
-{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
-  if test "$GCC" = yes; then
-    lt_prog_compiler_wl_FC='-Wl,'
-    lt_prog_compiler_static_FC='-static'
 
-    case $host_os in
-      aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	lt_prog_compiler_static_FC='-Bstatic'
-      fi
-      ;;
 
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            lt_prog_compiler_pic_FC='-fPIC'
-        ;;
-      m68k)
-            # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
-            lt_prog_compiler_pic_FC='-m68020 -resident32 -malways-restore-a4'
-        ;;
-      esac
-      ;;
 
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
 
-    mingw* | cygwin* | pw32* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      lt_prog_compiler_pic_FC='-DDLL_EXPORT'
-      ;;
 
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      lt_prog_compiler_pic_FC='-fno-common'
-      ;;
 
-    hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	lt_prog_compiler_pic_FC='-fPIC'
-	;;
-      esac
-      ;;
 
-    interix[3-9]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
 
-    msdosdjgpp*)
-      # Just because we use GCC doesn't mean we suddenly get shared libraries
-      # on systems that don't support them.
-      lt_prog_compiler_can_build_shared_FC=no
-      enable_shared=no
-      ;;
 
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      lt_prog_compiler_pic_FC='-fPIC -shared'
-      ;;
 
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	lt_prog_compiler_pic_FC=-Kconform_pic
-      fi
-      ;;
 
-    *)
-      lt_prog_compiler_pic_FC='-fPIC'
-      ;;
-    esac
-  else
-    # PORTME Check for flag to pass linker flags through the system compiler.
-    case $host_os in
-    aix*)
-      lt_prog_compiler_wl_FC='-Wl,'
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	lt_prog_compiler_static_FC='-Bstatic'
-      else
-	lt_prog_compiler_static_FC='-bnso -bI:/lib/syscalls.exp'
-      fi
-      ;;
 
-    mingw* | cygwin* | pw32* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      lt_prog_compiler_pic_FC='-DDLL_EXPORT'
-      ;;
 
-    hpux9* | hpux10* | hpux11*)
-      lt_prog_compiler_wl_FC='-Wl,'
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	lt_prog_compiler_pic_FC='+Z'
-	;;
-      esac
-      # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      lt_prog_compiler_static_FC='${wl}-a ${wl}archive'
-      ;;
 
-    irix5* | irix6* | nonstopux*)
-      lt_prog_compiler_wl_FC='-Wl,'
-      # PIC (with -KPIC) is the default.
-      lt_prog_compiler_static_FC='-non_shared'
-      ;;
 
-    linux* | k*bsd*-gnu)
-      case $cc_basename in
-      icc* | ecc* | ifort*)
-	lt_prog_compiler_wl_FC='-Wl,'
-	lt_prog_compiler_pic_FC='-KPIC'
-	lt_prog_compiler_static_FC='-static'
-        ;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
-        # Portland Group compilers (*not* the Pentium gcc compiler,
-	# which looks to be a dead project)
-	lt_prog_compiler_wl_FC='-Wl,'
-	lt_prog_compiler_pic_FC='-fpic'
-	lt_prog_compiler_static_FC='-Bstatic'
-        ;;
-      ccc*)
-        lt_prog_compiler_wl_FC='-Wl,'
-        # All Alpha code is PIC.
-        lt_prog_compiler_static_FC='-non_shared'
-        ;;
-      xl*)
-	# IBM XL C 8.0/Fortran 10.1 on PPC
-	lt_prog_compiler_wl_FC='-Wl,'
-	lt_prog_compiler_pic_FC='-qpic'
-	lt_prog_compiler_static_FC='-qstaticlink'
-	;;
-      *)
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
-	  lt_prog_compiler_pic_FC='-KPIC'
-	  lt_prog_compiler_static_FC='-Bstatic'
-	  lt_prog_compiler_wl_FC='-Wl,'
-	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  lt_prog_compiler_pic_FC='-KPIC'
-	  lt_prog_compiler_static_FC='-Bstatic'
-	  lt_prog_compiler_wl_FC=''
-	  ;;
-	esac
-	;;
-      esac
-      ;;
 
-    newsos6)
-      lt_prog_compiler_pic_FC='-KPIC'
-      lt_prog_compiler_static_FC='-Bstatic'
-      ;;
 
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      lt_prog_compiler_pic_FC='-fPIC -shared'
-      ;;
 
-    osf3* | osf4* | osf5*)
-      lt_prog_compiler_wl_FC='-Wl,'
-      # All OSF/1 code is PIC.
-      lt_prog_compiler_static_FC='-non_shared'
-      ;;
 
-    rdos*)
-      lt_prog_compiler_static_FC='-non_shared'
-      ;;
 
-    solaris*)
-      lt_prog_compiler_pic_FC='-KPIC'
-      lt_prog_compiler_static_FC='-Bstatic'
-      case $cc_basename in
-      f77* | f90* | f95*)
-	lt_prog_compiler_wl_FC='-Qoption ld ';;
-      *)
-	lt_prog_compiler_wl_FC='-Wl,';;
-      esac
-      ;;
 
-    sunos4*)
-      lt_prog_compiler_wl_FC='-Qoption ld '
-      lt_prog_compiler_pic_FC='-PIC'
-      lt_prog_compiler_static_FC='-Bstatic'
-      ;;
 
-    sysv4 | sysv4.2uw2* | sysv4.3*)
-      lt_prog_compiler_wl_FC='-Wl,'
-      lt_prog_compiler_pic_FC='-KPIC'
-      lt_prog_compiler_static_FC='-Bstatic'
-      ;;
 
-    sysv4*MP*)
-      if test -d /usr/nec ;then
-	lt_prog_compiler_pic_FC='-Kconform_pic'
-	lt_prog_compiler_static_FC='-Bstatic'
-      fi
-      ;;
 
-    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-      lt_prog_compiler_wl_FC='-Wl,'
-      lt_prog_compiler_pic_FC='-KPIC'
-      lt_prog_compiler_static_FC='-Bstatic'
-      ;;
 
-    unicos*)
-      lt_prog_compiler_wl_FC='-Wl,'
-      lt_prog_compiler_can_build_shared_FC=no
-      ;;
 
-    uts4*)
-      lt_prog_compiler_pic_FC='-pic'
-      lt_prog_compiler_static_FC='-Bstatic'
-      ;;
 
-    *)
-      lt_prog_compiler_can_build_shared_FC=no
-      ;;
-    esac
-  fi
 
-case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
-  *djgpp*)
-    lt_prog_compiler_pic_FC=
-    ;;
-  *)
-    lt_prog_compiler_pic_FC="$lt_prog_compiler_pic_FC"
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_FC" >&5
-$as_echo "$lt_prog_compiler_pic_FC" >&6; }
 
 
 
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$lt_prog_compiler_pic_FC"; then
-  { $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_FC works" >&5
-$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_FC works... " >&6; }
-if test "${lt_cv_prog_compiler_pic_works_FC+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_pic_works_FC=no
-   ac_outfile=conftest.$ac_objext
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$lt_prog_compiler_pic_FC"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16142: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&5
-   echo "$as_me:16146: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_pic_works_FC=yes
-     fi
-   fi
-   $RM conftest*
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_FC" >&5
-$as_echo "$lt_cv_prog_compiler_pic_works_FC" >&6; }
 
-if test x"$lt_cv_prog_compiler_pic_works_FC" = xyes; then
-    case $lt_prog_compiler_pic_FC in
-     "" | " "*) ;;
-     *) lt_prog_compiler_pic_FC=" $lt_prog_compiler_pic_FC" ;;
-     esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+   test -n "$runpath_var" ||
+   test "X$hardcode_automatic" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
 else
-    lt_prog_compiler_pic_FC=
-     lt_prog_compiler_can_build_shared_FC=no
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
 
+if test "$hardcode_action" = relink ||
+   test "$inherit_rpath" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
 fi
 
 
 
-#
-# Check to make sure the static flag actually works.
-#
-wl=$lt_prog_compiler_wl_FC eval lt_tmp_static_flag=\"$lt_prog_compiler_static_FC\"
-{ $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
-if test "${lt_cv_prog_compiler_static_works_FC+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_static_works_FC=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The linker can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test -s conftest.err; then
-       # Append any errors to the config.log.
-       cat conftest.err 1>&5
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_cv_prog_compiler_static_works_FC=yes
-       fi
-     else
-       lt_cv_prog_compiler_static_works_FC=yes
-     fi
-   fi
-   $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_FC" >&5
-$as_echo "$lt_cv_prog_compiler_static_works_FC" >&6; }
 
-if test x"$lt_cv_prog_compiler_static_works_FC" = xyes; then
-    :
+
+  if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
 else
-    lt_prog_compiler_static_FC=
-fi
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
 
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
 
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
 
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
 
-    { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o_FC+set}" = set; then
+  darwin*)
+  # if libdl is installed we need to link against it
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  lt_cv_prog_compiler_c_o_FC=no
-   $RM -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16241: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:16245: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_c_o_FC=yes
-     fi
-   fi
-   chmod u+w . 2>&5
-   $RM conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
-   $RM out/* && rmdir out
-   cd ..
-   $RM -r conftest
-   $RM conftest*
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_FC" >&5
-$as_echo "$lt_cv_prog_compiler_c_o_FC" >&6; }
-
-
-
-    { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o_FC+set}" = set; then
-  $as_echo_n "(cached) " >&6
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
-  lt_cv_prog_compiler_c_o_FC=no
-   $RM -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16293: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:16297: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_c_o_FC=yes
-     fi
-   fi
-   chmod u+w . 2>&5
-   $RM conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
-   $RM out/* && rmdir out
-   cd ..
-   $RM -r conftest
-   $RM conftest*
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_FC" >&5
-$as_echo "$lt_cv_prog_compiler_c_o_FC" >&6; }
-
 
+    ;;
 
+  *)
+    ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = xyes; then :
+  lt_cv_dlopen="shl_load"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if ${ac_cv_lib_dld_shl_load+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-hard_links="nottested"
-if test "$lt_cv_prog_compiler_c_o_FC" = no && test "$need_locks" != no; then
-  # do not overwrite the value of need_locks provided by the user
-  { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-$as_echo_n "checking if we can lock with hard links... " >&6; }
-  hard_links=yes
-  $RM conftest*
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  touch conftest.a
-  ln conftest.a conftest.b 2>&5 || hard_links=no
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { $as_echo "$as_me:$LINENO: result: $hard_links" >&5
-$as_echo "$hard_links" >&6; }
-  if test "$hard_links" = no; then
-    { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
-    need_locks=warn
-  fi
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_shl_load=yes
 else
-  need_locks=no
+  ac_cv_lib_dld_shl_load=no
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+  ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if ${ac_cv_lib_svld_dlopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_svld_dlopen=yes
+else
+  ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if ${ac_cv_lib_dld_dld_link+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-    { $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
-
-  runpath_var=
-  allow_undefined_flag_FC=
-  always_export_symbols_FC=no
-  archive_cmds_FC=
-  archive_expsym_cmds_FC=
-  compiler_needs_object_FC=no
-  enable_shared_with_static_runtimes_FC=no
-  export_dynamic_flag_spec_FC=
-  export_symbols_cmds_FC='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  hardcode_automatic_FC=no
-  hardcode_direct_FC=no
-  hardcode_direct_absolute_FC=no
-  hardcode_libdir_flag_spec_FC=
-  hardcode_libdir_flag_spec_ld_FC=
-  hardcode_libdir_separator_FC=
-  hardcode_minus_L_FC=no
-  hardcode_shlibpath_var_FC=unsupported
-  inherit_rpath_FC=no
-  link_all_deplibs_FC=unknown
-  module_cmds_FC=
-  module_expsym_cmds_FC=
-  old_archive_from_new_cmds_FC=
-  old_archive_from_expsyms_cmds_FC=
-  thread_safe_flag_spec_FC=
-  whole_archive_flag_spec_FC=
-  # include_expsyms should be a list of space-separated symbols to be *always*
-  # included in the symbol list
-  include_expsyms_FC=
-  # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
-  exclude_expsyms_FC='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
-  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
-  # platforms (ab)use it in PIC code, but their linkers get confused if
-  # the symbol is explicitly referenced.  Since portable code cannot
-  # rely on this symbol name, it's probably fine to never include it in
-  # preloaded symbol tables.
-  # Exclude shared library initialization/finalization symbols.
-  extract_expsyms_cmds=
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+return dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_dld_link=yes
+else
+  ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
 
-  case $host_os in
-  cygwin* | mingw* | pw32*)
-    # FIXME: the MSVC++ port hasn't been tested in a loooong time
-    # When not using gcc, we currently assume that we are using
-    # Microsoft Visual C++.
-    if test "$GCC" != yes; then
-      with_gnu_ld=no
-    fi
-    ;;
-  interix*)
-    # we just hope/assume this is gcc and not c89 (= MSVC++)
-    with_gnu_ld=yes
-    ;;
-  openbsd*)
-    with_gnu_ld=no
-    ;;
-  esac
 
-  ld_shlibs_FC=yes
-  if test "$with_gnu_ld" = yes; then
-    # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
+fi
 
-    # Set some defaults for GNU ld with shared library support. These
-    # are reset later if shared libraries are not supported. Putting them
-    # here allows them to be overridden if necessary.
-    runpath_var=LD_RUN_PATH
-    hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir'
-    export_dynamic_flag_spec_FC='${wl}--export-dynamic'
-    # ancient GNU ld didn't support --whole-archive et. al.
-    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
-      whole_archive_flag_spec_FC="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-    else
-      whole_archive_flag_spec_FC=
-    fi
-    supports_anon_versioning=no
-    case `$LD -v 2>&1` in
-      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
-      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
-      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
-      *\ 2.11.*) ;; # other 2.11 versions
-      *) supports_anon_versioning=yes ;;
-    esac
 
-    # See if GNU ld supports shared libraries.
-    case $host_os in
-    aix[3-9]*)
-      # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
-	ld_shlibs_FC=no
-	cat <<_LT_EOF 1>&2
+fi
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
 
-_LT_EOF
-      fi
-      ;;
+fi
 
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            archive_expsym_cmds_FC=''
-        ;;
-      m68k)
-            archive_cmds_FC='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            hardcode_libdir_flag_spec_FC='-L$libdir'
-            hardcode_minus_L_FC=yes
-        ;;
-      esac
-      ;;
 
-    beos*)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	allow_undefined_flag_FC=unsupported
-	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	# support --undefined.  This deserves some investigation.  FIXME
-	archive_cmds_FC='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      else
-	ld_shlibs_FC=no
-      fi
-      ;;
+fi
 
-    cygwin* | mingw* | pw32*)
-      # _LT_TAGVAR(hardcode_libdir_flag_spec, FC) is actually meaningless,
-      # as there is no search path for DLLs.
-      hardcode_libdir_flag_spec_FC='-L$libdir'
-      allow_undefined_flag_FC=unsupported
-      always_export_symbols_FC=no
-      enable_shared_with_static_runtimes_FC=yes
-      export_symbols_cmds_FC='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
 
-      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-        archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	# If the export-symbols file already is a .def file (1st line
-	# is EXPORTS), use it as is; otherwise, prepend...
-	archive_expsym_cmds_FC='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	  cp $export_symbols $output_objdir/$soname.def;
-	else
-	  echo EXPORTS > $output_objdir/$soname.def;
-	  cat $export_symbols >> $output_objdir/$soname.def;
-	fi~
-	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-      else
-	ld_shlibs_FC=no
-      fi
-      ;;
+fi
 
-    interix[3-9]*)
-      hardcode_direct_FC=no
-      hardcode_shlibpath_var_FC=no
-      hardcode_libdir_flag_spec_FC='${wl}-rpath,$libdir'
-      export_dynamic_flag_spec_FC='${wl}-E'
-      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-      # Instead, shared libraries are loaded at an image base (0x10000000 by
-      # default) and relocated if they conflict, which is a slow very memory
-      # consuming and fragmenting process.  To avoid this, we pick a random,
-      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      archive_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      archive_expsym_cmds_FC='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      ;;
+    ;;
+  esac
 
-    gnu* | linux* | tpf* | k*bsd*-gnu)
-      tmp_diet=no
-      if test "$host_os" = linux-dietlibc; then
-	case $cc_basename in
-	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
-	esac
-      fi
-      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
-	 && test "$tmp_diet" = no
-      then
-	tmp_addflag=
-	tmp_sharedflag='-shared'
-	case $cc_basename,$host_cpu in
-        pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec_FC='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag'
-	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec_FC='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag -Mnomain' ;;
-	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
-	  tmp_addflag=' -i_dynamic' ;;
-	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
-	  tmp_addflag=' -i_dynamic -nofor_main' ;;
-	ifc* | ifort*)			# Intel Fortran compiler
-	  tmp_addflag=' -nofor_main' ;;
-	xl[cC]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
-	  tmp_sharedflag='-qmkshrobj'
-	  tmp_addflag= ;;
-	esac
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec_FC='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
-	  compiler_needs_object_FC=yes
-	  tmp_sharedflag='-G' ;;
-	*Sun\ F*)			# Sun Fortran 8.3
-	  tmp_sharedflag='-G' ;;
-	esac
-	archive_cmds_FC='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
 
-        if test "x$supports_anon_versioning" = xyes; then
-          archive_expsym_cmds_FC='echo "{ global:" > $output_objdir/$libname.ver~
-	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	    echo "local: *; };" >> $output_objdir/$libname.ver~
-	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-        fi
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
 
-	case $cc_basename in
-	xlf*)
-	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
-	  whole_archive_flag_spec_FC='--whole-archive$convenience --no-whole-archive'
-	  hardcode_libdir_flag_spec_FC=
-	  hardcode_libdir_flag_spec_ld_FC='-rpath $libdir'
-	  archive_cmds_FC='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
-	  if test "x$supports_anon_versioning" = xyes; then
-	    archive_expsym_cmds_FC='echo "{ global:" > $output_objdir/$libname.ver~
-	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
-	  fi
-	  ;;
-	esac
-      else
-        ld_shlibs_FC=no
-      fi
-      ;;
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
 
-    netbsd*)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	archive_cmds_FC='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
-	wlarc=
-      else
-	archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      fi
-      ;;
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
 
-    solaris*)
-      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
-	ld_shlibs_FC=no
-	cat <<_LT_EOF 1>&2
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
 
-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
-*** create shared libraries on Solaris systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.9.1 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
 
-_LT_EOF
-      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	ld_shlibs_FC=no
-      fi
-      ;;
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
 
-    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
-      case `$LD -v 2>&1` in
-        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
-	ld_shlibs_FC=no
-	cat <<_LT_EOF 1>&2
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
 
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
 
+  return status;
+}
 _LT_EOF
-	;;
-	*)
-	  # For security reasons, it is highly recommended that you always
-	  # use absolute paths for naming shared libraries, and exclude the
-	  # DT_RUNPATH tag from executables and libraries.  But doing so
-	  # requires that you compile everything twice, which is a pain.
-	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	    hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir'
-	    archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    archive_expsym_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-	  else
-	    ld_shlibs_FC=no
-	  fi
-	;;
-      esac
-      ;;
-
-    sunos4*)
-      archive_cmds_FC='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      wlarc=
-      hardcode_direct_FC=yes
-      hardcode_shlibpath_var_FC=no
-      ;;
-
-    *)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	ld_shlibs_FC=no
-      fi
-      ;;
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
     esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
 
-    if test "$ld_shlibs_FC" = no; then
-      runpath_var=
-      hardcode_libdir_flag_spec_FC=
-      export_dynamic_flag_spec_FC=
-      whole_archive_flag_spec_FC=
-    fi
-  else
-    # PORTME fill in a description of your system's linker (not GNU ld)
-    case $host_os in
-    aix3*)
-      allow_undefined_flag_FC=unsupported
-      always_export_symbols_FC=yes
-      archive_expsym_cmds_FC='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
-      # Note: this linker hardcodes the directories in LIBPATH if there
-      # are no directories specified by -L.
-      hardcode_minus_L_FC=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
-	# Neither direct hardcoding nor static linking is supported with a
-	# broken collect2.
-	hardcode_direct_FC=unsupported
-      fi
-      ;;
 
-    aix[4-9]*)
-      if test "$host_cpu" = ia64; then
-	# On IA64, the linker does run time linking by default, so we don't
-	# have to do anything special.
-	aix_use_runtimelinking=no
-	exp_sym_flag='-Bexport'
-	no_entry_flag=""
-      else
-	# If we're using GNU nm, then we don't want the "-C" option.
-	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  export_symbols_cmds_FC='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-	else
-	  export_symbols_cmds_FC='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-	fi
-	aix_use_runtimelinking=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
 
-	# Test if we are trying to use run time linking or normal
-	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
-	# need to do runtime linking.
-	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
-	  for ld_flag in $LDFLAGS; do
-	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
-	    aix_use_runtimelinking=yes
-	    break
-	  fi
-	  done
-	  ;;
-	esac
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self_static+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
 
-	exp_sym_flag='-bexport'
-	no_entry_flag='-bnoentry'
-      fi
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
 
-      # When large executables or shared objects are built, AIX ld can
-      # have problems creating the table of contents.  If linking a library
-      # or program results in "error TOC overflow" add -mminimal-toc to
-      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+#include <stdio.h>
 
-      archive_cmds_FC=''
-      hardcode_direct_FC=yes
-      hardcode_direct_absolute_FC=yes
-      hardcode_libdir_separator_FC=':'
-      link_all_deplibs_FC=yes
-      file_list_spec_FC='${wl}-f,'
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
 
-      if test "$GCC" = yes; then
-	case $host_os in aix4.[012]|aix4.[012].*)
-	# We only want to do this on AIX 4.2 and lower, the check
-	# below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
-	  if test -f "$collect2name" &&
-	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
-	  then
-	  # We have reworked collect2
-	  :
-	  else
-	  # We have old collect2
-	  hardcode_direct_FC=unsupported
-	  # It fails to find uninstalled libraries when the uninstalled
-	  # path is not listed in the libpath.  Setting hardcode_minus_L
-	  # to unsupported forces relinking
-	  hardcode_minus_L_FC=yes
-	  hardcode_libdir_flag_spec_FC='-L$libdir'
-	  hardcode_libdir_separator_FC=
-	  fi
-	  ;;
-	esac
-	shared_flag='-shared'
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag="$shared_flag "'${wl}-G'
-	fi
-      else
-	# not using gcc
-	if test "$host_cpu" = ia64; then
-	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-	# chokes on -Wl,-G. The following line is correct:
-	  shared_flag='-G'
-	else
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag='${wl}-G'
-	  else
-	    shared_flag='${wl}-bM:SRE'
-	  fi
-	fi
-      fi
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
 
-      # It seems that -bexpall does not export symbols beginning with
-      # underscore (_), so it is better to generate a list of symbols to export.
-      always_export_symbols_FC=yes
-      if test "$aix_use_runtimelinking" = yes; then
-	# Warning - without using the other runtime loading flags (-brtl),
-	# -berok will link without error, but may produce a broken library.
-	allow_undefined_flag_FC='-berok'
-        # Determine the default libpath from the value encoded in an
-        # empty executable.
-        cat >conftest.$ac_ext <<_ACEOF
-      program main
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
 
-      end
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_fc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
 
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
 	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}
+_LT_EOF
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
 fi
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+rm -fr conftest*
 
 
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+    fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
-
-        hardcode_libdir_flag_spec_FC='${wl}-blibpath:$libdir:'"$aix_libpath"
-        archive_expsym_cmds_FC='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-      else
-	if test "$host_cpu" = ia64; then
-	  hardcode_libdir_flag_spec_FC='${wl}-R $libdir:/usr/lib:/lib'
-	  allow_undefined_flag_FC="-z nodefs"
-	  archive_expsym_cmds_FC="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-	else
-	 # Determine the default libpath from the value encoded in an
-	 # empty executable.
-	 cat >conftest.$ac_ext <<_ACEOF
-      program main
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
 
-      end
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_fc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
 
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
 fi
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
-	 hardcode_libdir_flag_spec_FC='${wl}-blibpath:$libdir:'"$aix_libpath"
-	  # Warning - without using the other run time loading flags,
-	  # -berok will link without error, but may produce a broken library.
-	  no_undefined_flag_FC=' ${wl}-bernotok'
-	  allow_undefined_flag_FC=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  whole_archive_flag_spec_FC='$convenience'
-	  archive_cmds_need_lc_FC=yes
-	  # This is similar to how AIX traditionally builds its shared libraries.
-	  archive_expsym_cmds_FC="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-	fi
-      fi
-      ;;
 
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            archive_expsym_cmds_FC=''
-        ;;
-      m68k)
-            archive_cmds_FC='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            hardcode_libdir_flag_spec_FC='-L$libdir'
-            hardcode_minus_L_FC=yes
-        ;;
-      esac
-      ;;
 
-    bsdi[45]*)
-      export_dynamic_flag_spec_FC=-rdynamic
-      ;;
 
-    cygwin* | mingw* | pw32*)
-      # When not using gcc, we currently assume that we are using
-      # Microsoft Visual C++.
-      # hardcode_libdir_flag_spec is actually meaningless, as there is
-      # no search path for DLLs.
-      hardcode_libdir_flag_spec_FC=' '
-      allow_undefined_flag_FC=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      archive_cmds_FC='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      old_archive_from_new_cmds_FC='true'
-      # FIXME: Should let the user specify the lib program.
-      old_archive_cmds_FC='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      fix_srcfile_path_FC='`cygpath -w "$srcfile"`'
-      enable_shared_with_static_runtimes_FC=yes
-      ;;
 
-    darwin* | rhapsody*)
 
 
-  archive_cmds_need_lc_FC=no
-  hardcode_direct_FC=no
-  hardcode_automatic_FC=yes
-  hardcode_shlibpath_var_FC=unsupported
-  whole_archive_flag_spec_FC=''
-  link_all_deplibs_FC=yes
-  allow_undefined_flag_FC="$_lt_dar_allow_undefined"
-  if test "$GCC" = "yes"; then
-    output_verbose_link_cmd=echo
-    archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-    module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-    module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
 
-  else
-  ld_shlibs_FC=no
-  fi
 
-      ;;
 
-    dgux*)
-      archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec_FC='-L$libdir'
-      hardcode_shlibpath_var_FC=no
-      ;;
 
-    freebsd1*)
-      ld_shlibs_FC=no
-      ;;
 
-    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
-    # support.  Future versions do this automatically, but an explicit c++rt0.o
-    # does not break anything, and helps significantly (at the cost of a little
-    # extra space).
-    freebsd2.2*)
-      archive_cmds_FC='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
-      hardcode_libdir_flag_spec_FC='-R$libdir'
-      hardcode_direct_FC=yes
-      hardcode_shlibpath_var_FC=no
-      ;;
 
-    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
-      archive_cmds_FC='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct_FC=yes
-      hardcode_minus_L_FC=yes
-      hardcode_shlibpath_var_FC=no
-      ;;
 
-    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
-      archive_cmds_FC='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
-      hardcode_libdir_flag_spec_FC='-R$libdir'
-      hardcode_direct_FC=yes
-      hardcode_shlibpath_var_FC=no
-      ;;
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    fi
+    ;;
+  *)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    ;;
+  esac
+fi
 
-    hpux9*)
-      if test "$GCC" = yes; then
-	archive_cmds_FC='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      else
-	archive_cmds_FC='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      fi
-      hardcode_libdir_flag_spec_FC='${wl}+b ${wl}$libdir'
-      hardcode_libdir_separator_FC=:
-      hardcode_direct_FC=yes
 
-      # hardcode_minus_L: Not really in the search PATH,
-      # but as the default location of the library.
-      hardcode_minus_L_FC=yes
-      export_dynamic_flag_spec_FC='${wl}-E'
-      ;;
 
-    hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	archive_cmds_FC='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds_FC='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec_FC='${wl}+b ${wl}$libdir'
-	hardcode_libdir_flag_spec_ld_FC='+b $libdir'
-	hardcode_libdir_separator_FC=:
-	hardcode_direct_FC=yes
-	hardcode_direct_absolute_FC=yes
-	export_dynamic_flag_spec_FC='${wl}-E'
-	# hardcode_minus_L: Not really in the search PATH,
-	# but as the default location of the library.
-	hardcode_minus_L_FC=yes
-      fi
-      ;;
 
-    hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	case $host_cpu in
-	hppa*64*)
-	  archive_cmds_FC='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  archive_cmds_FC='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  archive_cmds_FC='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      else
-	case $host_cpu in
-	hppa*64*)
-	  archive_cmds_FC='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  archive_cmds_FC='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  archive_cmds_FC='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      fi
-      if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec_FC='${wl}+b ${wl}$libdir'
-	hardcode_libdir_separator_FC=:
 
-	case $host_cpu in
-	hppa*64*|ia64*)
-	  hardcode_direct_FC=no
-	  hardcode_shlibpath_var_FC=no
-	  ;;
-	*)
-	  hardcode_direct_FC=yes
-	  hardcode_direct_absolute_FC=yes
-	  export_dynamic_flag_spec_FC='${wl}-E'
 
-	  # hardcode_minus_L: Not really in the search PATH,
-	  # but as the default location of the library.
-	  hardcode_minus_L_FC=yes
-	  ;;
-	esac
-      fi
-      ;;
 
-    irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-	archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	# Try to use the -exported_symbol ld option, if it does not
-	# work, assume that -exports_file does not work either and
-	# implicitly export all symbols.
-        save_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-        cat >conftest.$ac_ext <<_ACEOF
-int foo(void) {}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_fc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  archive_expsym_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
 
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+
+
+
+
+  # Report which library types will actually be built
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[4-9]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
 
 
 fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-        LDFLAGS="$save_LDFLAGS"
-      else
-	archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
-      fi
-      archive_cmds_need_lc_FC='no'
-      hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator_FC=:
-      inherit_rpath_FC=yes
-      link_all_deplibs_FC=yes
-      ;;
+CC="$lt_save_CC"
 
-    netbsd*)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	archive_cmds_FC='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
-      else
-	archive_cmds_FC='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
-      fi
-      hardcode_libdir_flag_spec_FC='-R$libdir'
-      hardcode_direct_FC=yes
-      hardcode_shlibpath_var_FC=no
-      ;;
 
-    newsos6)
-      archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct_FC=yes
-      hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator_FC=:
-      hardcode_shlibpath_var_FC=no
-      ;;
 
-    *nto* | *qnx*)
-      ;;
 
-    openbsd*)
-      if test -f /usr/libexec/ld.so; then
-	hardcode_direct_FC=yes
-	hardcode_shlibpath_var_FC=no
-	hardcode_direct_absolute_FC=yes
-	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	  archive_cmds_FC='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  archive_expsym_cmds_FC='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  hardcode_libdir_flag_spec_FC='${wl}-rpath,$libdir'
-	  export_dynamic_flag_spec_FC='${wl}-E'
-	else
-	  case $host_os in
-	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-	     archive_cmds_FC='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     hardcode_libdir_flag_spec_FC='-R$libdir'
-	     ;;
-	   *)
-	     archive_cmds_FC='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     hardcode_libdir_flag_spec_FC='${wl}-rpath,$libdir'
-	     ;;
-	  esac
-	fi
-      else
-	ld_shlibs_FC=no
-      fi
-      ;;
 
-    os2*)
-      hardcode_libdir_flag_spec_FC='-L$libdir'
-      hardcode_minus_L_FC=yes
-      allow_undefined_flag_FC=unsupported
-      archive_cmds_FC='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      old_archive_from_new_cmds_FC='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
-      ;;
+      ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
 
-    osf3*)
-      if test "$GCC" = yes; then
-	allow_undefined_flag_FC=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds_FC='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	allow_undefined_flag_FC=' -expect_unresolved \*'
-	archive_cmds_FC='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-      fi
-      archive_cmds_need_lc_FC='no'
-      hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator_FC=:
-      ;;
 
-    osf4* | osf5*)	# as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-	allow_undefined_flag_FC=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds_FC='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir'
-      else
-	allow_undefined_flag_FC=' -expect_unresolved \*'
-	archive_cmds_FC='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds_FC='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
 
-	# Both c and cxx compiler support -rpath directly
-	hardcode_libdir_flag_spec_FC='-rpath $libdir'
-      fi
-      archive_cmds_need_lc_FC='no'
-      hardcode_libdir_separator_FC=:
-      ;;
+archive_cmds_need_lc_FC=no
+allow_undefined_flag_FC=
+always_export_symbols_FC=no
+archive_expsym_cmds_FC=
+export_dynamic_flag_spec_FC=
+hardcode_direct_FC=no
+hardcode_direct_absolute_FC=no
+hardcode_libdir_flag_spec_FC=
+hardcode_libdir_flag_spec_ld_FC=
+hardcode_libdir_separator_FC=
+hardcode_minus_L_FC=no
+hardcode_automatic_FC=no
+inherit_rpath_FC=no
+module_cmds_FC=
+module_expsym_cmds_FC=
+link_all_deplibs_FC=unknown
+old_archive_cmds_FC=$old_archive_cmds
+reload_flag_FC=$reload_flag
+reload_cmds_FC=$reload_cmds
+no_undefined_flag_FC=
+whole_archive_flag_spec_FC=
+enable_shared_with_static_runtimes_FC=no
 
-    solaris*)
-      no_undefined_flag_FC=' -z defs'
-      if test "$GCC" = yes; then
-	wlarc='${wl}'
-	archive_cmds_FC='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_FC='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-      else
-	case `$CC -V 2>&1` in
-	*"Compilers 5.0"*)
-	  wlarc=''
-	  archive_cmds_FC='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  archive_expsym_cmds_FC='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
-	  ;;
-	*)
-	  wlarc='${wl}'
-	  archive_cmds_FC='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
-	  archive_expsym_cmds_FC='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-	  ;;
-	esac
-      fi
-      hardcode_libdir_flag_spec_FC='-R$libdir'
-      hardcode_shlibpath_var_FC=no
-      case $host_os in
-      solaris2.[0-5] | solaris2.[0-5].*) ;;
-      *)
-	# The compiler driver will combine and reorder linker options,
-	# but understands `-z linker_flag'.  GCC discards it without `$wl',
-	# but is careful enough not to reorder.
-	# Supported since Solaris 2.6 (maybe 2.5.1?)
-	if test "$GCC" = yes; then
-	  whole_archive_flag_spec_FC='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	else
-	  whole_archive_flag_spec_FC='-z allextract$convenience -z defaultextract'
-	fi
-	;;
-      esac
-      link_all_deplibs_FC=yes
-      ;;
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
 
-    sunos4*)
-      if test "x$host_vendor" = xsequent; then
-	# Use $CC to link under sequent, because it throws in some extra .o
-	# files that make .init and .fini sections work.
-	archive_cmds_FC='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds_FC='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      hardcode_libdir_flag_spec_FC='-L$libdir'
-      hardcode_direct_FC=yes
-      hardcode_minus_L_FC=yes
-      hardcode_shlibpath_var_FC=no
-      ;;
+# Object file extension for compiled fc test sources.
+objext=o
+objext_FC=$objext
 
-    sysv4)
-      case $host_vendor in
-	sni)
-	  archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  hardcode_direct_FC=yes # is this really true???
-	;;
-	siemens)
-	  ## LD is ld it makes a PLAMLIB
-	  ## CC just makes a GrossModule.
-	  archive_cmds_FC='$LD -G -o $lib $libobjs $deplibs $linker_flags'
-	  reload_cmds_FC='$CC -r -o $output$reload_objs'
-	  hardcode_direct_FC=no
-        ;;
-	motorola)
-	  archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  hardcode_direct_FC=no #Motorola manual says yes, but my tests say they lie
-	;;
-      esac
-      runpath_var='LD_RUN_PATH'
-      hardcode_shlibpath_var_FC=no
-      ;;
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
 
-    sysv4.3*)
-      archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_shlibpath_var_FC=no
-      export_dynamic_flag_spec_FC='-Bexport'
-      ;;
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	hardcode_shlibpath_var_FC=no
-	runpath_var=LD_RUN_PATH
-	hardcode_runpath_var=yes
-	ld_shlibs_FC=yes
-      fi
-      ;;
 
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
-      no_undefined_flag_FC='${wl}-z,text'
-      archive_cmds_need_lc_FC=no
-      hardcode_shlibpath_var_FC=no
-      runpath_var='LD_RUN_PATH'
 
-      if test "$GCC" = yes; then
-	archive_cmds_FC='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_FC='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds_FC='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_FC='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
 
-    sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
-      # link with -lc, and that would cause any symbols used from libc to
-      # always be unresolved, which means just about no library would
-      # ever link correctly.  If we're not using GNU ld we use -z text
-      # though, which does catch some bad symbols but isn't as heavy-handed
-      # as -z defs.
-      no_undefined_flag_FC='${wl}-z,text'
-      allow_undefined_flag_FC='${wl}-z,nodefs'
-      archive_cmds_need_lc_FC=no
-      hardcode_shlibpath_var_FC=no
-      hardcode_libdir_flag_spec_FC='${wl}-R,$libdir'
-      hardcode_libdir_separator_FC=':'
-      link_all_deplibs_FC=yes
-      export_dynamic_flag_spec_FC='${wl}-Bexport'
-      runpath_var='LD_RUN_PATH'
 
-      if test "$GCC" = yes; then
-	archive_cmds_FC='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_FC='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds_FC='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_FC='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
 
-    uts4*)
-      archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec_FC='-L$libdir'
-      hardcode_shlibpath_var_FC=no
-      ;;
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
 
-    *)
-      ld_shlibs_FC=no
-      ;;
-    esac
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
 
-    if test x$host_vendor = xsni; then
-      case $host in
-      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-	export_dynamic_flag_spec_FC='${wl}-Blargedynsym'
-	;;
-      esac
-    fi
-  fi
+# Allow CC to be a program name with arguments.
+compiler=$CC
 
-{ $as_echo "$as_me:$LINENO: result: $ld_shlibs_FC" >&5
-$as_echo "$ld_shlibs_FC" >&6; }
-test "$ld_shlibs_FC" = no && can_build_shared=no
 
-with_gnu_ld_FC=$with_gnu_ld
+  # save warnings/boilerplate of simple test code
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
 
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
 
 
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${FC-"f95"}
+  CFLAGS=$FCFLAGS
+  compiler=$CC
+  GCC=$ac_cv_fc_compiler_gnu
 
+  compiler_FC=$CC
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
 
 
-#
-# Do we need to explicitly link libc?
-#
-case "x$archive_cmds_need_lc_FC" in
-x|xyes)
-  # Assume -lc should be added
-  archive_cmds_need_lc_FC=yes
+  if test -n "$compiler"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
 
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
-    case $archive_cmds_FC in
-    *'~'*)
-      # FIXME: we may have to deal with multi-command sequences.
-      ;;
-    '$CC '*)
-      # Test whether the compiler implicitly links with -lc since on some
-      # systems, -lgcc has to come before -lc. If gcc already passes -lc
-      # to ld, don't add -lc before -lgcc.
-      { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-      $RM conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+    test "$can_build_shared" = "no" && enable_shared=no
 
-      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$lt_prog_compiler_wl_FC
-	pic_flag=$lt_prog_compiler_pic_FC
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$allow_undefined_flag_FC
-        allow_undefined_flag_FC=
-        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_FC 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5
-  (eval $archive_cmds_FC 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-        then
-	  archive_cmds_need_lc_FC=no
-        else
-	  archive_cmds_need_lc_FC=yes
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
         fi
-        allow_undefined_flag_FC=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $RM conftest*
-      { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc_FC" >&5
-$as_echo "$archive_cmds_need_lc_FC" >&6; }
-      ;;
+        ;;
+      aix[4-9]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
     esac
-  fi
-  ;;
-esac
-
-
-
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
 
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
 
+    GCC_FC="$ac_cv_fc_compiler_gnu"
+    LD_FC="$LD"
 
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    # Dependencies to place before and after the object being linked:
+predep_objects_FC=
+postdep_objects_FC=
+predeps_FC=
+postdeps_FC=
+compiler_lib_search_path_FC=
 
+cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer a
+      a=0
+      return
+      end
+_LT_EOF
 
 
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+esac
 
+if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
 
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
 
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case ${prev}${p} in
 
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+	 prev=$p
+	 continue
+       fi
 
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
+       if test "$pre_test_object_deps_done" = no; then
+	 case ${prev} in
+	 -L | -R)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$compiler_lib_search_path_FC"; then
+	     compiler_lib_search_path_FC="${prev}${p}"
+	   else
+	     compiler_lib_search_path_FC="${compiler_lib_search_path_FC} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$postdeps_FC"; then
+	   postdeps_FC="${prev}${p}"
+	 else
+	   postdeps_FC="${postdeps_FC} ${prev}${p}"
+	 fi
+       fi
+       prev=
+       ;;
 
+    *.lto.$objext) ;; # Ignore GCC LTO objects
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
 
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$predep_objects_FC"; then
+	   predep_objects_FC="$p"
+	 else
+	   predep_objects_FC="$predep_objects_FC $p"
+	 fi
+       else
+	 if test -z "$postdep_objects_FC"; then
+	   postdep_objects_FC="$p"
+	 else
+	   postdep_objects_FC="$postdep_objects_FC $p"
+	 fi
+       fi
+       ;;
 
+    *) ;; # Ignore the rest.
 
+    esac
+  done
 
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling FC test program"
+fi
 
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
 
+# PORTME: override above test on systems where it is broken
 
 
+case " $postdeps_FC " in
+*" -lc "*) archive_cmds_need_lc_FC=no ;;
+esac
+ compiler_lib_search_dirs_FC=
+if test -n "${compiler_lib_search_path_FC}"; then
+ compiler_lib_search_dirs_FC=`echo " ${compiler_lib_search_path_FC}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
 
 
 
@@ -17519,4631 +14096,3595 @@ esac
 
 
 
+    lt_prog_compiler_wl_FC=
+lt_prog_compiler_pic_FC=
+lt_prog_compiler_static_FC=
 
 
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl_FC='-Wl,'
+    lt_prog_compiler_static_FC='-static'
 
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_FC='-Bstatic'
+      fi
+      ;;
 
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic_FC='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            lt_prog_compiler_pic_FC='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
 
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
 
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic_FC='-DDLL_EXPORT'
+      ;;
 
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_FC='-fno-common'
+      ;;
 
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static_FC=
+      ;;
 
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_FC='-fPIC'
+	;;
+      esac
+      ;;
 
-    { $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-$as_echo_n "checking dynamic linker characteristics... " >&6; }
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
 
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-shrext_cmds=".so"
-postinstall_cmds=
-postuninstall_cmds=
-finish_cmds=
-finish_eval=
-shlibpath_var=
-shlibpath_overrides_runpath=unknown
-version_type=none
-dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib"
-need_lib_prefix=unknown
-hardcode_into_libs=no
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared_FC=no
+      enable_shared=no
+      ;;
 
-# when you set need_version to no, make sure it does not cause -set_version
-# flags to be left without arguments
-need_version=unknown
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic_FC='-fPIC -shared'
+      ;;
 
-case $host_os in
-aix3*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
-  shlibpath_var=LIBPATH
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_FC=-Kconform_pic
+      fi
+      ;;
 
-  # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
-  ;;
+    *)
+      lt_prog_compiler_pic_FC='-fPIC'
+      ;;
+    esac
 
-aix[4-9]*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
-    # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
-    shlibpath_var=LD_LIBRARY_PATH
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      lt_prog_compiler_wl_FC='-Xlinker '
+      lt_prog_compiler_pic_FC='-Xcompiler -fPIC'
+      ;;
+    esac
   else
-    # With GCC up to 2.95.x, collect2 would create an import file
-    # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
-    # development snapshots of GCC prior to 3.0.
+    # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
-      aix4 | aix4.[01] | aix4.[01].*)
-      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
-	   echo ' yes '
-	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
-	:
+    aix*)
+      lt_prog_compiler_wl_FC='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_FC='-Bstatic'
       else
-	can_build_shared=no
+	lt_prog_compiler_static_FC='-bnso -bI:/lib/syscalls.exp'
       fi
       ;;
-    esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
-    # soname into executable. Probably we can add versioning support to
-    # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
-      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
-      # instead of lib<name>.a to let people know that these are not
-      # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    else
-      # We preserve .a as extension for shared libraries through AIX4.2
-      # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
-    fi
-    shlibpath_var=LIBPATH
-  fi
-  ;;
-
-amigaos*)
-  case $host_cpu in
-  powerpc)
-    # Since July 2007 AmigaOS4 officially supports .so libraries.
-    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    ;;
-  m68k)
-    library_names_spec='$libname.ixlibrary $libname.a'
-    # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
-    ;;
-  esac
-  ;;
-
-beos*)
-  library_names_spec='${libname}${shared_ext}'
-  dynamic_linker="$host_os ld.so"
-  shlibpath_var=LIBRARY_PATH
-  ;;
-
-bsdi[45]*)
-  version_type=linux
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
-  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
-  # the default ld.so.conf also contains /usr/contrib/lib and
-  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
-  # libtool to hard-code these into programs
-  ;;
-
-cygwin* | mingw* | pw32*)
-  version_type=windows
-  shrext_cmds=".dll"
-  need_version=no
-  need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32*)
-    library_names_spec='$libname.dll.a'
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname~
-      chmod a+x \$dldir/$dlname~
-      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
-        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
-      fi'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_FC='-DDLL_EXPORT'
+      ;;
 
-    case $host_os in
-    cygwin*)
-      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl_FC='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_FC='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static_FC='${wl}-a ${wl}archive'
       ;;
-    mingw*)
-      # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl_FC='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static_FC='-non_shared'
       ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	lt_prog_compiler_wl_FC='-Wl,'
+	lt_prog_compiler_pic_FC='-KPIC'
+	lt_prog_compiler_static_FC='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	lt_prog_compiler_wl_FC='-Wl,'
+	lt_prog_compiler_pic_FC='-fPIC'
+	lt_prog_compiler_static_FC='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	lt_prog_compiler_wl_FC='-Wl,'
+	lt_prog_compiler_pic_FC='--shared'
+	lt_prog_compiler_static_FC='--static'
+	;;
+      nagfor*)
+	# NAG Fortran compiler
+	lt_prog_compiler_wl_FC='-Wl,-Wl,,'
+	lt_prog_compiler_pic_FC='-PIC'
+	lt_prog_compiler_static_FC='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl_FC='-Wl,'
+	lt_prog_compiler_pic_FC='-fpic'
+	lt_prog_compiler_static_FC='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl_FC='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static_FC='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+	lt_prog_compiler_wl_FC='-Wl,'
+	lt_prog_compiler_pic_FC='-qpic'
+	lt_prog_compiler_static_FC='-qstaticlink'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ F* | *Sun*Fortran*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic_FC='-KPIC'
+	  lt_prog_compiler_static_FC='-Bstatic'
+	  lt_prog_compiler_wl_FC=''
+	  ;;
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic_FC='-KPIC'
+	  lt_prog_compiler_static_FC='-Bstatic'
+	  lt_prog_compiler_wl_FC='-Wl,'
+	  ;;
+	esac
+	;;
+      esac
       ;;
-    esac
-    ;;
-
-  *)
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    ;;
-  esac
-  dynamic_linker='Win32 ld.exe'
-  # FIXME: first we should search . and the directory the executable is in
-  shlibpath_var=PATH
-  ;;
 
-darwin* | rhapsody*)
-  dynamic_linker="$host_os dyld"
-  version_type=darwin
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
-  shlibpath_overrides_runpath=yes
-  shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+    newsos6)
+      lt_prog_compiler_pic_FC='-KPIC'
+      lt_prog_compiler_static_FC='-Bstatic'
+      ;;
 
-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
-  ;;
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic_FC='-fPIC -shared'
+      ;;
 
-dgux*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl_FC='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static_FC='-non_shared'
+      ;;
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
+    rdos*)
+      lt_prog_compiler_static_FC='-non_shared'
+      ;;
 
-freebsd* | dragonfly*)
-  # DragonFly does not have aout.  When/if they implement a new
-  # versioning mechanism, adjust this.
-  if test -x /usr/bin/objformat; then
-    objformat=`/usr/bin/objformat`
-  else
-    case $host_os in
-    freebsd[123]*) objformat=aout ;;
-    *) objformat=elf ;;
-    esac
-  fi
-  version_type=freebsd-$objformat
-  case $version_type in
-    freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-      need_version=no
-      need_lib_prefix=no
+    solaris*)
+      lt_prog_compiler_pic_FC='-KPIC'
+      lt_prog_compiler_static_FC='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+	lt_prog_compiler_wl_FC='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl_FC='-Wl,';;
+      esac
       ;;
-    freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
-      need_version=yes
+
+    sunos4*)
+      lt_prog_compiler_wl_FC='-Qoption ld '
+      lt_prog_compiler_pic_FC='-PIC'
+      lt_prog_compiler_static_FC='-Bstatic'
       ;;
-  esac
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_os in
-  freebsd2*)
-    shlibpath_overrides_runpath=yes
-    ;;
-  freebsd3.[01]* | freebsdelf3.[01]*)
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
-  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
-    shlibpath_overrides_runpath=no
-    hardcode_into_libs=yes
-    ;;
-  *) # from 4.6 on, and DragonFly
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  esac
-  ;;
 
-gnu*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  hardcode_into_libs=yes
-  ;;
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl_FC='-Wl,'
+      lt_prog_compiler_pic_FC='-KPIC'
+      lt_prog_compiler_static_FC='-Bstatic'
+      ;;
 
-hpux9* | hpux10* | hpux11*)
-  # Give a soname corresponding to the major version so that dld.sl refuses to
-  # link against other versions.
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  case $host_cpu in
-  ia64*)
-    shrext_cmds='.so'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.so"
-    shlibpath_var=LD_LIBRARY_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
-      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
-    else
-      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
-    fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-  hppa*64*)
-    shrext_cmds='.sl'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-  *)
-    shrext_cmds='.sl'
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=SHLIB_PATH
-    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    ;;
-  esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
-  postinstall_cmds='chmod 555 $lib'
-  ;;
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic_FC='-Kconform_pic'
+	lt_prog_compiler_static_FC='-Bstatic'
+      fi
+      ;;
 
-interix[3-9]*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl_FC='-Wl,'
+      lt_prog_compiler_pic_FC='-KPIC'
+      lt_prog_compiler_static_FC='-Bstatic'
+      ;;
 
-irix5* | irix6* | nonstopux*)
-  case $host_os in
-    nonstopux*) version_type=nonstopux ;;
-    *)
-	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
-	else
-		version_type=irix
-	fi ;;
-  esac
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
-  case $host_os in
-  irix5* | nonstopux*)
-    libsuff= shlibsuff=
-    ;;
-  *)
-    case $LD in # libtool.m4 will add one of these switches to LD
-    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
-      libsuff= shlibsuff= libmagic=32-bit;;
-    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
-      libsuff=32 shlibsuff=N32 libmagic=N32;;
-    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
-      libsuff=64 shlibsuff=64 libmagic=64-bit;;
-    *) libsuff= shlibsuff= libmagic=never-match;;
-    esac
-    ;;
-  esac
-  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
-  shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-  hardcode_into_libs=yes
-  ;;
+    unicos*)
+      lt_prog_compiler_wl_FC='-Wl,'
+      lt_prog_compiler_can_build_shared_FC=no
+      ;;
 
-# No shared lib support for Linux oldld, aout, or coff.
-linux*oldld* | linux*aout* | linux*coff*)
-  dynamic_linker=no
-  ;;
+    uts4*)
+      lt_prog_compiler_pic_FC='-pic'
+      lt_prog_compiler_static_FC='-Bstatic'
+      ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  # Some binutils ld are patched to set DT_RUNPATH
-  save_LDFLAGS=$LDFLAGS
-  save_libdir=$libdir
-  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_FC\"; \
-       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_FC\""
-  cat >conftest.$ac_ext <<_ACEOF
-      program main
+    *)
+      lt_prog_compiler_can_build_shared_FC=no
+      ;;
+    esac
+  fi
 
-      end
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_FC=
+    ;;
+  *)
+    lt_prog_compiler_pic_FC="$lt_prog_compiler_pic_FC"
+    ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_fc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then
-  shlibpath_overrides_runpath=yes
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic_FC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_FC=$lt_prog_compiler_pic_FC
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_FC" >&5
+$as_echo "$lt_cv_prog_compiler_pic_FC" >&6; }
+lt_prog_compiler_pic_FC=$lt_cv_prog_compiler_pic_FC
 
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_FC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_FC works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_FC works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works_FC+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  lt_cv_prog_compiler_pic_works_FC=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_FC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works_FC=yes
+     fi
+   fi
+   $RM conftest*
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_FC" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works_FC" >&6; }
 
+if test x"$lt_cv_prog_compiler_pic_works_FC" = xyes; then
+    case $lt_prog_compiler_pic_FC in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_FC=" $lt_prog_compiler_pic_FC" ;;
+     esac
+else
+    lt_prog_compiler_pic_FC=
+     lt_prog_compiler_can_build_shared_FC=no
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-  LDFLAGS=$save_LDFLAGS
-  libdir=$save_libdir
+fi
 
-  # This implies no fast_install, which is unacceptable.
-  # Some rework will be needed to allow for fast_install
-  # before this can be enabled.
-  hardcode_into_libs=yes
 
-  # Append ld.so.conf contents to the search path
-  if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
-  fi
 
-  # We used to test for /lib/ld.so.1 and disable shared libraries on
-  # powerpc, because MkLinux only supported shared libraries with the
-  # GNU dynamic linker.  Since this was broken with cross compilers,
-  # most powerpc-linux boxes support dynamic linking these days and
-  # people can always --disable-shared, the test was removed, and we
-  # assume the GNU/Linux dynamic linker is in use.
-  dynamic_linker='GNU/Linux ld.so'
-  ;;
 
-netbsd*)
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-    dynamic_linker='NetBSD (a.out) ld.so'
-  else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    dynamic_linker='NetBSD ld.elf_so'
-  fi
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  ;;
 
-newsos6)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  ;;
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_FC eval lt_tmp_static_flag=\"$lt_prog_compiler_static_FC\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works_FC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_static_works_FC=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works_FC=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works_FC=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
 
-*nto* | *qnx*)
-  version_type=qnx
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='ldqnx.so'
-  ;;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_FC" >&5
+$as_echo "$lt_cv_prog_compiler_static_works_FC" >&6; }
 
-openbsd*)
-  version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
-  need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
-    *)				need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[89] | openbsd2.[89].*)
-	shlibpath_overrides_runpath=no
-	;;
-      *)
-	shlibpath_overrides_runpath=yes
-	;;
-      esac
-  else
-    shlibpath_overrides_runpath=yes
-  fi
-  ;;
+if test x"$lt_cv_prog_compiler_static_works_FC" = xyes; then
+    :
+else
+    lt_prog_compiler_static_FC=
+fi
 
-os2*)
-  libname_spec='$name'
-  shrext_cmds=".dll"
-  need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
-  dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
-  ;;
 
-osf3* | osf4* | osf5*)
-  version_type=osf
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
-  ;;
 
-rdos*)
-  dynamic_linker=no
-  ;;
 
-solaris*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  # ldd complains unless libraries are executable
-  postinstall_cmds='chmod +x $lib'
-  ;;
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o_FC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o_FC=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_FC=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_FC" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_FC" >&6; }
+
 
-sunos4*)
-  version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
-    need_lib_prefix=no
-  fi
-  need_version=yes
-  ;;
 
-sysv4 | sysv4.3*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_vendor in
-    sni)
-      shlibpath_overrides_runpath=no
-      need_lib_prefix=no
-      runpath_var=LD_RUN_PATH
-      ;;
-    siemens)
-      need_lib_prefix=no
-      ;;
-    motorola)
-      need_lib_prefix=no
-      need_version=no
-      shlibpath_overrides_runpath=no
-      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
-      ;;
-  esac
-  ;;
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o_FC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o_FC=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-sysv4*MP*)
-  if test -d /usr/nec ;then
-    version_type=linux
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
-    shlibpath_var=LD_LIBRARY_PATH
-  fi
-  ;;
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_FC=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
 
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
-    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
-  else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    case $host_os in
-      sco3.2v5*)
-        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
-	;;
-    esac
-  fi
-  sys_lib_dlsearch_path_spec='/usr/lib'
-  ;;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_FC" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_FC" >&6; }
 
-tpf*)
-  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
 
-uts4*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
 
-*)
-  dynamic_linker=no
-  ;;
-esac
-{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-$as_echo "$dynamic_linker" >&6; }
-test "$dynamic_linker" = no && can_build_shared=no
 
-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
-  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_FC" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
 fi
 
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-fi
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-fi
 
 
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+  runpath_var=
+  allow_undefined_flag_FC=
+  always_export_symbols_FC=no
+  archive_cmds_FC=
+  archive_expsym_cmds_FC=
+  compiler_needs_object_FC=no
+  enable_shared_with_static_runtimes_FC=no
+  export_dynamic_flag_spec_FC=
+  export_symbols_cmds_FC='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  hardcode_automatic_FC=no
+  hardcode_direct_FC=no
+  hardcode_direct_absolute_FC=no
+  hardcode_libdir_flag_spec_FC=
+  hardcode_libdir_flag_spec_ld_FC=
+  hardcode_libdir_separator_FC=
+  hardcode_minus_L_FC=no
+  hardcode_shlibpath_var_FC=unsupported
+  inherit_rpath_FC=no
+  link_all_deplibs_FC=unknown
+  module_cmds_FC=
+  module_expsym_cmds_FC=
+  old_archive_from_new_cmds_FC=
+  old_archive_from_expsyms_cmds_FC=
+  thread_safe_flag_spec_FC=
+  whole_archive_flag_spec_FC=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms_FC=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms_FC='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
 
+  ld_shlibs_FC=yes
 
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+	  *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
 
+  if test "$lt_use_gnu_ld_interface" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
 
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir'
+    export_dynamic_flag_spec_FC='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec_FC="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec_FC=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
 
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs_FC=no
+	cat <<_LT_EOF 1>&2
 
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
 
+_LT_EOF
+      fi
+      ;;
 
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds_FC=''
+        ;;
+      m68k)
+            archive_cmds_FC='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec_FC='-L$libdir'
+            hardcode_minus_L_FC=yes
+        ;;
+      esac
+      ;;
 
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag_FC=unsupported
+	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds_FC='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs_FC=no
+      fi
+      ;;
 
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, FC) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec_FC='-L$libdir'
+      export_dynamic_flag_spec_FC='${wl}--export-all-symbols'
+      allow_undefined_flag_FC=unsupported
+      always_export_symbols_FC=no
+      enable_shared_with_static_runtimes_FC=yes
+      export_symbols_cmds_FC='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms_FC='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
 
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds_FC='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs_FC=no
+      fi
+      ;;
 
+    haiku*)
+      archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      link_all_deplibs_FC=yes
+      ;;
 
+    interix[3-9]*)
+      hardcode_direct_FC=no
+      hardcode_shlibpath_var_FC=no
+      hardcode_libdir_flag_spec_FC='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec_FC='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds_FC='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
 
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=' $pic_flag'
+	tmp_sharedflag='-shared'
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec_FC='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec_FC='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	lf95*)				# Lahey Fortran 8.1
+	  whole_archive_flag_spec_FC=
+	  tmp_sharedflag='--shared' ;;
+	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	  tmp_sharedflag='-qmkshrobj'
+	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  whole_archive_flag_spec_FC='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object_FC=yes
+	  ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec_FC='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object_FC=yes
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	esac
+	archive_cmds_FC='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
 
+        if test "x$supports_anon_versioning" = xyes; then
+          archive_expsym_cmds_FC='echo "{ global:" > $output_objdir/$libname.ver~
+	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	    echo "local: *; };" >> $output_objdir/$libname.ver~
+	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
 
+	case $cc_basename in
+	xlf* | bgf* | bgxlf* | mpixlf*)
+	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+	  whole_archive_flag_spec_FC='--whole-archive$convenience --no-whole-archive'
+	  hardcode_libdir_flag_spec_FC=
+	  hardcode_libdir_flag_spec_ld_FC='-rpath $libdir'
+	  archive_cmds_FC='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+	  if test "x$supports_anon_versioning" = xyes; then
+	    archive_expsym_cmds_FC='echo "{ global:" > $output_objdir/$libname.ver~
+	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	      echo "local: *; };" >> $output_objdir/$libname.ver~
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	  fi
+	  ;;
+	esac
+      else
+        ld_shlibs_FC=no
+      fi
+      ;;
 
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds_FC='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
 
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	ld_shlibs_FC=no
+	cat <<_LT_EOF 1>&2
 
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
 
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_FC=no
+      fi
+      ;;
 
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs_FC=no
+	cat <<_LT_EOF 1>&2
 
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
 
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir'
+	    archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    archive_expsym_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    ld_shlibs_FC=no
+	  fi
+	;;
+      esac
+      ;;
 
+    sunos4*)
+      archive_cmds_FC='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct_FC=yes
+      hardcode_shlibpath_var_FC=no
+      ;;
 
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_FC=no
+      fi
+      ;;
+    esac
 
+    if test "$ld_shlibs_FC" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec_FC=
+      export_dynamic_flag_spec_FC=
+      whole_archive_flag_spec_FC=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag_FC=unsupported
+      always_export_symbols_FC=yes
+      archive_expsym_cmds_FC='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L_FC=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct_FC=unsupported
+      fi
+      ;;
 
+    aix[4-9]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  export_symbols_cmds_FC='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds_FC='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
 
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+	  for ld_flag in $LDFLAGS; do
+	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	    aix_use_runtimelinking=yes
+	    break
+	  fi
+	  done
+	  ;;
+	esac
 
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
 
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
 
+      archive_cmds_FC=''
+      hardcode_direct_FC=yes
+      hardcode_direct_absolute_FC=yes
+      hardcode_libdir_separator_FC=':'
+      link_all_deplibs_FC=yes
+      file_list_spec_FC='${wl}-f,'
 
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	  # We have reworked collect2
+	  :
+	  else
+	  # We have old collect2
+	  hardcode_direct_FC=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L_FC=yes
+	  hardcode_libdir_flag_spec_FC='-L$libdir'
+	  hardcode_libdir_separator_FC=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
 
+      export_dynamic_flag_spec_FC='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols_FC=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag_FC='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath__FC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.$ac_ext <<_ACEOF
+      program main
 
-    { $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
-hardcode_action_FC=
-if test -n "$hardcode_libdir_flag_spec_FC" ||
-   test -n "$runpath_var_FC" ||
-   test "X$hardcode_automatic_FC" = "Xyes" ; then
+      end
+_ACEOF
+if ac_fn_fc_try_link "$LINENO"; then :
 
-  # We can hardcode non-existent directories.
-  if test "$hardcode_direct_FC" != no &&
-     # If the only mechanism to avoid hardcoding is shlibpath_var, we
-     # have to relink, otherwise we might link with an installed library
-     # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, FC)" != no &&
-     test "$hardcode_minus_L_FC" != no; then
-    # Linking always hardcodes the temporary library directory.
-    hardcode_action_FC=relink
-  else
-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
-    hardcode_action_FC=immediate
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath__FC=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath__FC"; then
+    lt_cv_aix_libpath__FC=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
   fi
-else
-  # We cannot hardcode anything, or else we can only hardcode existing
-  # directories.
-  hardcode_action_FC=unsupported
 fi
-{ $as_echo "$as_me:$LINENO: result: $hardcode_action_FC" >&5
-$as_echo "$hardcode_action_FC" >&6; }
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath__FC"; then
+    lt_cv_aix_libpath__FC="/usr/lib:/lib"
+  fi
 
-if test "$hardcode_action_FC" = relink ||
-   test "$inherit_rpath_FC" = yes; then
-  # Fast installation is not supported
-  enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
-  # Fast installation is not necessary
-  enable_fast_install=needless
 fi
 
+  aix_libpath=$lt_cv_aix_libpath__FC
+fi
 
+        hardcode_libdir_flag_spec_FC='${wl}-blibpath:$libdir:'"$aix_libpath"
+        archive_expsym_cmds_FC='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec_FC='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag_FC="-z nodefs"
+	  archive_expsym_cmds_FC="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath__FC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.$ac_ext <<_ACEOF
+      program main
 
+      end
+_ACEOF
+if ac_fn_fc_try_link "$LINENO"; then :
 
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath__FC=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath__FC"; then
+    lt_cv_aix_libpath__FC=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath__FC"; then
+    lt_cv_aix_libpath__FC="/usr/lib:/lib"
+  fi
 
+fi
 
+  aix_libpath=$lt_cv_aix_libpath__FC
+fi
 
-  fi # test -n "$compiler"
-
-  GCC=$lt_save_GCC
-  CC="$lt_save_CC"
-fi # test "$_lt_disable_FC" != yes
+	 hardcode_libdir_flag_spec_FC='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag_FC=' ${wl}-bernotok'
+	  allow_undefined_flag_FC=' ${wl}-berok'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    whole_archive_flag_spec_FC='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    whole_archive_flag_spec_FC='$convenience'
+	  fi
+	  archive_cmds_need_lc_FC=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds_FC="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds_FC=''
+        ;;
+      m68k)
+            archive_cmds_FC='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec_FC='-L$libdir'
+            hardcode_minus_L_FC=yes
+        ;;
+      esac
+      ;;
 
+    bsdi[45]*)
+      export_dynamic_flag_spec_FC=-rdynamic
+      ;;
 
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	hardcode_libdir_flag_spec_FC=' '
+	allow_undefined_flag_FC=unsupported
+	always_export_symbols_FC=yes
+	file_list_spec_FC='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds_FC='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	archive_expsym_cmds_FC='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, FC)='true'
+	enable_shared_with_static_runtimes_FC=yes
+	export_symbols_cmds_FC='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	old_postinstall_cmds_FC='chmod 644 $oldlib'
+	postlink_cmds_FC='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	hardcode_libdir_flag_spec_FC=' '
+	allow_undefined_flag_FC=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds_FC='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	old_archive_from_new_cmds_FC='true'
+	# FIXME: Should let the user specify the lib program.
+	old_archive_cmds_FC='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	enable_shared_with_static_runtimes_FC=yes
+	;;
+      esac
+      ;;
 
+    darwin* | rhapsody*)
 
 
+  archive_cmds_need_lc_FC=no
+  hardcode_direct_FC=no
+  hardcode_automatic_FC=yes
+  hardcode_shlibpath_var_FC=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec_FC='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  else
+    whole_archive_flag_spec_FC=''
+  fi
+  link_all_deplibs_FC=yes
+  allow_undefined_flag_FC="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
 
+  else
+  ld_shlibs_FC=no
+  fi
 
+      ;;
 
+    dgux*)
+      archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_FC='-L$libdir'
+      hardcode_shlibpath_var_FC=no
+      ;;
 
-        ac_config_commands="$ac_config_commands libtool"
+    freebsd1*)
+      ld_shlibs_FC=no
+      ;;
 
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds_FC='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec_FC='-R$libdir'
+      hardcode_direct_FC=yes
+      hardcode_shlibpath_var_FC=no
+      ;;
 
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds_FC='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_FC=yes
+      hardcode_minus_L_FC=yes
+      hardcode_shlibpath_var_FC=no
+      ;;
 
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds_FC='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec_FC='-R$libdir'
+      hardcode_direct_FC=yes
+      hardcode_shlibpath_var_FC=no
+      ;;
 
-# Only expand once:
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds_FC='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds_FC='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec_FC='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_FC=:
+      hardcode_direct_FC=yes
 
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L_FC=yes
+      export_dynamic_flag_spec_FC='${wl}-E'
+      ;;
 
+    hpux10*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	archive_cmds_FC='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_FC='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_FC='${wl}+b ${wl}$libdir'
+	hardcode_libdir_flag_spec_ld_FC='+b $libdir'
+	hardcode_libdir_separator_FC=:
+	hardcode_direct_FC=yes
+	hardcode_direct_absolute_FC=yes
+	export_dynamic_flag_spec_FC='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L_FC=yes
+      fi
+      ;;
 
-{ $as_echo "$as_me:$LINENO: checking for large file support" >&5
-$as_echo "$as_me: checking for large file support" >&6;}
+    hpux11*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_FC='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_FC='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_FC='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_FC='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_FC='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	archive_cmds_FC='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_FC='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_FC=:
 
-# Check whether --enable-largefile was given.
-if test "${enable_largefile+set}" = set; then
-  enableval=$enable_largefile;
-fi
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_direct_FC=no
+	  hardcode_shlibpath_var_FC=no
+	  ;;
+	*)
+	  hardcode_direct_FC=yes
+	  hardcode_direct_absolute_FC=yes
+	  export_dynamic_flag_spec_FC='${wl}-E'
 
-if test "$enable_largefile" != no; then
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L_FC=yes
+	  ;;
+	esac
+      fi
+      ;;
 
-  { $as_echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
-$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
-if test "${ac_cv_sys_largefile_CC+set}" = set; then
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+	# This should be the same for all languages, so no per-tag cache variable.
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_sys_largefile_CC=no
-     if test "$GCC" != yes; then
-       ac_save_CC=$CC
-       while :; do
-	 # IRIX 6.2 and later do not support large files by default,
-	 # so use the C compiler's -n32 option if that helps.
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
+  save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   cat > conftest.$ac_ext <<_ACEOF
 
-  ;
-  return 0;
-}
+      subroutine foo
+      end
 _ACEOF
-	 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  break
+if ac_fn_fc_try_link "$LINENO"; then :
+  lt_cv_irix_exported_symbol=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  lt_cv_irix_exported_symbol=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+           LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          archive_expsym_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
+      else
+	archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      archive_cmds_need_lc_FC='no'
+      hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_FC=:
+      inherit_rpath_FC=yes
+      link_all_deplibs_FC=yes
+      ;;
 
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds_FC='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds_FC='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec_FC='-R$libdir'
+      hardcode_direct_FC=yes
+      hardcode_shlibpath_var_FC=no
+      ;;
 
-fi
+    newsos6)
+      archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_FC=yes
+      hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_FC=:
+      hardcode_shlibpath_var_FC=no
+      ;;
 
-rm -f core conftest.err conftest.$ac_objext
-	 CC="$CC -n32"
-	 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_sys_largefile_CC=' -n32'; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+    *nto* | *qnx*)
+      ;;
 
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct_FC=yes
+	hardcode_shlibpath_var_FC=no
+	hardcode_direct_absolute_FC=yes
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds_FC='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_FC='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec_FC='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec_FC='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds_FC='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec_FC='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds_FC='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec_FC='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+	fi
+      else
+	ld_shlibs_FC=no
+      fi
+      ;;
 
-fi
+    os2*)
+      hardcode_libdir_flag_spec_FC='-L$libdir'
+      hardcode_minus_L_FC=yes
+      allow_undefined_flag_FC=unsupported
+      archive_cmds_FC='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_from_new_cmds_FC='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
 
-rm -f core conftest.err conftest.$ac_objext
-	 break
-       done
-       CC=$ac_save_CC
-       rm -f conftest.$ac_ext
-    fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
-$as_echo "$ac_cv_sys_largefile_CC" >&6; }
-  if test "$ac_cv_sys_largefile_CC" != no; then
-    CC=$CC$ac_cv_sys_largefile_CC
-  fi
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag_FC=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_FC='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag_FC=' -expect_unresolved \*'
+	archive_cmds_FC='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      archive_cmds_need_lc_FC='no'
+      hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_FC=:
+      ;;
 
-  { $as_echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
-$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
-if test "${ac_cv_sys_file_offset_bits+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  while :; do
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag_FC=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_FC='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag_FC=' -expect_unresolved \*'
+	archive_cmds_FC='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds_FC='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec_FC='-rpath $libdir'
+      fi
+      archive_cmds_need_lc_FC='no'
+      hardcode_libdir_separator_FC=:
+      ;;
+
+    solaris*)
+      no_undefined_flag_FC=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds_FC='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_FC='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  archive_cmds_FC='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  archive_expsym_cmds_FC='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  archive_cmds_FC='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_FC='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      hardcode_libdir_flag_spec_FC='-R$libdir'
+      hardcode_shlibpath_var_FC=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec_FC='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec_FC='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs_FC=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds_FC='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_FC='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec_FC='-L$libdir'
+      hardcode_direct_FC=yes
+      hardcode_minus_L_FC=yes
+      hardcode_shlibpath_var_FC=no
+      ;;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_sys_file_offset_bits=no; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_FC=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds_FC='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds_FC='$CC -r -o $output$reload_objs'
+	  hardcode_direct_FC=no
+        ;;
+	motorola)
+	  archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_FC=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_FC=no
+      ;;
 
+    sysv4.3*)
+      archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_FC=no
+      export_dynamic_flag_spec_FC='-Bexport'
+      ;;
 
-fi
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var_FC=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs_FC=yes
+      fi
+      ;;
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#define _FILE_OFFSET_BITS 64
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag_FC='${wl}-z,text'
+      archive_cmds_need_lc_FC=no
+      hardcode_shlibpath_var_FC=no
+      runpath_var='LD_RUN_PATH'
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_sys_file_offset_bits=64; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+      if test "$GCC" = yes; then
+	archive_cmds_FC='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_FC='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_FC='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_FC='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
 
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag_FC='${wl}-z,text'
+      allow_undefined_flag_FC='${wl}-z,nodefs'
+      archive_cmds_need_lc_FC=no
+      hardcode_shlibpath_var_FC=no
+      hardcode_libdir_flag_spec_FC='${wl}-R,$libdir'
+      hardcode_libdir_separator_FC=':'
+      link_all_deplibs_FC=yes
+      export_dynamic_flag_spec_FC='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
 
-fi
+      if test "$GCC" = yes; then
+	archive_cmds_FC='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_FC='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_FC='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_FC='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_cv_sys_file_offset_bits=unknown
-  break
-done
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
-$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
-case $ac_cv_sys_file_offset_bits in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
-_ACEOF
-;;
-esac
-rm -rf conftest*
-  if test $ac_cv_sys_file_offset_bits = unknown; then
-    { $as_echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
-$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
-if test "${ac_cv_sys_large_files+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  while :; do
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
+    uts4*)
+      archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_FC='-L$libdir'
+      hardcode_shlibpath_var_FC=no
+      ;;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_sys_large_files=no; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+    *)
+      ld_shlibs_FC=no
+      ;;
+    esac
 
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	export_dynamic_flag_spec_FC='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
 
-fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_FC" >&5
+$as_echo "$ld_shlibs_FC" >&6; }
+test "$ld_shlibs_FC" = no && can_build_shared=no
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#define _LARGE_FILES 1
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
+with_gnu_ld_FC=$with_gnu_ld
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_sys_large_files=1; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_cv_sys_large_files=unknown
-  break
-done
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
-$as_echo "$ac_cv_sys_large_files" >&6; }
-case $ac_cv_sys_large_files in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _LARGE_FILES $ac_cv_sys_large_files
-_ACEOF
-;;
-esac
-rm -rf conftest*
-  fi
-fi
 
 
-{ $as_echo "$as_me:$LINENO: checking types, headers, and functions" >&5
-$as_echo "$as_me: checking types, headers, and functions" >&6;}
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_FC" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_FC=yes
 
-if test "${ac_cv_header_stdlib_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for stdlib.h" >&5
-$as_echo_n "checking for stdlib.h... " >&6; }
-if test "${ac_cv_header_stdlib_h+set}" = set; then
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_FC in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc_FC+:} false; then :
   $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5
-$as_echo "$ac_cv_header_stdlib_h" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking stdlib.h usability" >&5
-$as_echo_n "checking stdlib.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <stdlib.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
+  $RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$lt_prog_compiler_wl_FC
+	  pic_flag=$lt_prog_compiler_pic_FC
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$allow_undefined_flag_FC
+	  allow_undefined_flag_FC=
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_FC 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds_FC 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	  then
+	    lt_cv_archive_cmds_need_lc_FC=no
+	  else
+	    lt_cv_archive_cmds_need_lc_FC=yes
+	  fi
+	  allow_undefined_flag_FC=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
 
-	ac_header_compiler=no
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_FC" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc_FC" >&6; }
+      archive_cmds_need_lc_FC=$lt_cv_archive_cmds_need_lc_FC
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+
+
+
+
+
+
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking stdlib.h presence" >&5
-$as_echo_n "checking stdlib.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
-fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: stdlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: stdlib.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: stdlib.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: stdlib.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: stdlib.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: stdlib.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: stdlib.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: stdlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: stdlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: stdlib.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: stdlib.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to support at unidata.ucar.edu ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for stdlib.h" >&5
-$as_echo_n "checking for stdlib.h... " >&6; }
-if test "${ac_cv_header_stdlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_stdlib_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5
-$as_echo "$ac_cv_header_stdlib_h" >&6; }
 
-fi
-if test "x$ac_cv_header_stdlib_h" = x""yes; then
-  :
-else
 
-cat >>confdefs.h <<\_ACEOF
-#define NO_STDLIB_H /**/
-_ACEOF
 
-fi
 
 
-if test "${ac_cv_header_sys_types_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sys/types.h" >&5
-$as_echo_n "checking for sys/types.h... " >&6; }
-if test "${ac_cv_header_sys_types_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h" >&5
-$as_echo "$ac_cv_header_sys_types_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sys/types.h usability" >&5
-$as_echo_n "checking sys/types.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <sys/types.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_header_compiler=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sys/types.h presence" >&5
-$as_echo_n "checking sys/types.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
-fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sys/types.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sys/types.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sys/types.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/types.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sys/types.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sys/types.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/types.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sys/types.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sys/types.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/types.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sys/types.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to support at unidata.ucar.edu ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for sys/types.h" >&5
-$as_echo_n "checking for sys/types.h... " >&6; }
-if test "${ac_cv_header_sys_types_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_sys_types_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h" >&5
-$as_echo "$ac_cv_header_sys_types_h" >&6; }
 
-fi
-if test "x$ac_cv_header_sys_types_h" = x""yes; then
-  :
-else
 
-cat >>confdefs.h <<\_ACEOF
-#define NO_SYS_TYPES_H /**/
-_ACEOF
 
-fi
 
 
-if test "${ac_cv_header_unistd_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for unistd.h" >&5
-$as_echo_n "checking for unistd.h... " >&6; }
-if test "${ac_cv_header_unistd_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_unistd_h" >&5
-$as_echo "$ac_cv_header_unistd_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking unistd.h usability" >&5
-$as_echo_n "checking unistd.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <unistd.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_header_compiler=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking unistd.h presence" >&5
-$as_echo_n "checking unistd.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <unistd.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
-fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: unistd.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: unistd.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: unistd.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: unistd.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: unistd.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: unistd.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: unistd.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: unistd.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: unistd.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: unistd.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: unistd.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: unistd.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: unistd.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: unistd.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: unistd.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: unistd.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to support at unidata.ucar.edu ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for unistd.h" >&5
-$as_echo_n "checking for unistd.h... " >&6; }
-if test "${ac_cv_header_unistd_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_unistd_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_unistd_h" >&5
-$as_echo "$ac_cv_header_unistd_h" >&6; }
 
-fi
 
 
-{ $as_echo "$as_me:$LINENO: checking for strerror" >&5
-$as_echo_n "checking for strerror... " >&6; }
-if test "${ac_cv_func_strerror+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define strerror to an innocuous variant, in case <limits.h> declares strerror.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define strerror innocuous_strerror
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char strerror (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
 
-#undef strerror
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char strerror ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_strerror || defined __stub___strerror
-choke me
-#endif
 
-int
-main ()
-{
-return strerror ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_strerror=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_func_strerror=no
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_strerror" >&5
-$as_echo "$ac_cv_func_strerror" >&6; }
-if test "x$ac_cv_func_strerror" = x""yes; then
-  :
-else
 
-cat >>confdefs.h <<\_ACEOF
-#define NO_STRERROR /**/
-_ACEOF
 
-fi
 
-{ $as_echo "$as_me:$LINENO: checking for strlcat" >&5
-$as_echo_n "checking for strlcat... " >&6; }
-if test "${ac_cv_func_strlcat+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define strlcat to an innocuous variant, in case <limits.h> declares strlcat.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define strlcat innocuous_strlcat
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char strlcat (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
 
-#undef strlcat
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char strlcat ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_strlcat || defined __stub___strlcat
-choke me
-#endif
 
-int
-main ()
-{
-return strlcat ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_strlcat=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_func_strlcat=no
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_strlcat" >&5
-$as_echo "$ac_cv_func_strlcat" >&6; }
-if test "x$ac_cv_func_strlcat" = x""yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_STRLCAT 1
-_ACEOF
 
-fi
 
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments.  Useless!
-{ $as_echo "$as_me:$LINENO: checking for working alloca.h" >&5
-$as_echo_n "checking for working alloca.h... " >&6; }
-if test "${ac_cv_working_alloca_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <alloca.h>
-int
-main ()
-{
-char *p = (char *) alloca (2 * sizeof (int));
-			  if (p) return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_working_alloca_h=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_working_alloca_h=no
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5
-$as_echo "$ac_cv_working_alloca_h" >&6; }
-if test $ac_cv_working_alloca_h = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ALLOCA_H 1
-_ACEOF
 
-fi
 
-{ $as_echo "$as_me:$LINENO: checking for alloca" >&5
-$as_echo_n "checking for alloca... " >&6; }
-if test "${ac_cv_func_alloca_works+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-#  include <malloc.h>
-#  define alloca _alloca
-# else
-#  ifdef HAVE_ALLOCA_H
-#   include <alloca.h>
-#  else
-#   ifdef _AIX
- #pragma alloca
-#   else
-#    ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#    endif
-#   endif
-#  endif
-# endif
-#endif
 
-int
-main ()
-{
-char *p = (char *) alloca (1);
-				    if (p) return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_alloca_works=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_func_alloca_works=no
-fi
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5
-$as_echo "$ac_cv_func_alloca_works" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
 
-if test $ac_cv_func_alloca_works = yes; then
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ALLOCA 1
-_ACEOF
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
 
-else
-  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
-# that cause trouble.  Some versions do not even contain alloca or
-# contain a buggy version.  If you still want to use their alloca,
-# use ar to extract alloca.o from them instead of compiling alloca.c.
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
 
-ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
+aix[4-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
 
-cat >>confdefs.h <<\_ACEOF
-#define C_ALLOCA 1
-_ACEOF
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
 
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
 
-{ $as_echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5
-$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
-if test "${ac_cv_os_cray+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#if defined CRAY && ! defined CRAY2
-webecray
-#else
-wenotbecray
-#endif
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "webecray" >/dev/null 2>&1; then
-  ac_cv_os_cray=yes
-else
-  ac_cv_os_cray=no
-fi
-rm -f conftest*
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
-$as_echo "$ac_cv_os_cray" >&6; }
-if test $ac_cv_os_cray = yes; then
-  for ac_func in _getb67 GETB67 getb67; do
-    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
 
-#undef $ac_func
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
 
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
 
-	eval "$as_ac_var=no"
-fi
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
 
-cat >>confdefs.h <<_ACEOF
-#define CRAY_STACKSEG_END $ac_func
-_ACEOF
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
 
-    break
-fi
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
 
-  done
-fi
+freebsd1*)
+  dynamic_linker=no
+  ;;
 
-{ $as_echo "$as_me:$LINENO: checking stack direction for C alloca" >&5
-$as_echo_n "checking stack direction for C alloca... " >&6; }
-if test "${ac_cv_c_stack_direction+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  ac_cv_c_stack_direction=0
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-find_stack_direction ()
-{
-  static char *addr = 0;
-  auto char dummy;
-  if (addr == 0)
-    {
-      addr = &dummy;
-      return find_stack_direction ();
-    }
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
   else
-    return (&dummy > addr) ? 1 : -1;
-}
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
 
-int
-main ()
-{
-  return find_stack_direction () < 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_c_stack_direction=1
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
 
-( exit $ac_status )
-ac_cv_c_stack_direction=-1
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
+haiku*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
 
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
-$as_echo "$ac_cv_c_stack_direction" >&6; }
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
 
-cat >>confdefs.h <<_ACEOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
-_ACEOF
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
 
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
 
-fi
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
 
-{ $as_echo "$as_me:$LINENO: checking for struct stat.st_blksize" >&5
-$as_echo_n "checking for struct stat.st_blksize... " >&6; }
-if test "${ac_cv_member_struct_stat_st_blksize+set}" = set; then
+  # Some binutils ld are patched to set DT_RUNPATH
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static struct stat ac_aggr;
-if (ac_aggr.st_blksize)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_stat_st_blksize=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_FC\"; \
+	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_FC\""
+    cat > conftest.$ac_ext <<_ACEOF
+      program main
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static struct stat ac_aggr;
-if (sizeof ac_aggr.st_blksize)
-return 0;
-  ;
-  return 0;
-}
+      end
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_stat_st_blksize=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_member_struct_stat_st_blksize=no
+if ac_fn_fc_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  lt_cv_shlibpath_overrides_runpath=yes
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blksize" >&5
-$as_echo "$ac_cv_member_struct_stat_st_blksize" >&6; }
-if test "x$ac_cv_member_struct_stat_st_blksize" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
-_ACEOF
-
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ST_BLKSIZE 1
-_ACEOF
-
-fi
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
 
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
 
-{ $as_echo "$as_me:$LINENO: checking for size_t" >&5
-$as_echo_n "checking for size_t... " >&6; }
-if test "${ac_cv_type_size_t+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_type_size_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (size_t))
-       return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((size_t)))
-	  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
 
-	ac_cv_type_size_t=yes
-fi
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
 
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
 
-fi
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-$as_echo "$ac_cv_type_size_t" >&6; }
-if test "x$ac_cv_type_size_t" = x""yes; then
-  :
-else
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
 
-cat >>confdefs.h <<_ACEOF
-#define size_t unsigned int
-_ACEOF
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
 
-fi
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
 
-{ $as_echo "$as_me:$LINENO: checking for off_t" >&5
-$as_echo_n "checking for off_t... " >&6; }
-if test "${ac_cv_type_off_t+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_type_off_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (off_t))
-       return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((off_t)))
-	  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+rdos*)
+  dynamic_linker=no
+  ;;
 
-	ac_cv_type_off_t=yes
-fi
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
 
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
 
-fi
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
-$as_echo "$ac_cv_type_off_t" >&6; }
-if test "x$ac_cv_type_off_t" = x""yes; then
-  :
-else
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
 
-cat >>confdefs.h <<_ACEOF
-#define off_t long int
-_ACEOF
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
 
-fi
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
 
-{ $as_echo "$as_me:$LINENO: checking for ssize_t" >&5
-$as_echo_n "checking for ssize_t... " >&6; }
-if test "${ac_cv_type_ssize_t+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_type_ssize_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (ssize_t))
-       return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((ssize_t)))
-	  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+*)
+  dynamic_linker=no
+  ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
 
-	ac_cv_type_ssize_t=yes
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5
-$as_echo "$ac_cv_type_ssize_t" >&6; }
-if test "x$ac_cv_type_ssize_t" = x""yes; then
-  :
-else
 
-cat >>confdefs.h <<_ACEOF
-#define ssize_t int
-_ACEOF
 
-fi
 
-{ $as_echo "$as_me:$LINENO: checking for ptrdiff_t" >&5
-$as_echo_n "checking for ptrdiff_t... " >&6; }
-if test "${ac_cv_type_ptrdiff_t+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_type_ptrdiff_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (ptrdiff_t))
-       return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((ptrdiff_t)))
-	  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_type_ptrdiff_t=yes
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5
-$as_echo "$ac_cv_type_ptrdiff_t" >&6; }
-if test "x$ac_cv_type_ptrdiff_t" = x""yes; then
-  :
-else
 
-cat >>confdefs.h <<_ACEOF
-#define ptrdiff_t int
-_ACEOF
 
-fi
 
-{ $as_echo "$as_me:$LINENO: checking for uchar" >&5
-$as_echo_n "checking for uchar... " >&6; }
-if test "${ac_cv_type_uchar+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_type_uchar=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (uchar))
-       return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((uchar)))
-	  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_type_uchar=yes
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uchar" >&5
-$as_echo "$ac_cv_type_uchar" >&6; }
-if test "x$ac_cv_type_uchar" = x""yes; then
-  :
-else
 
-cat >>confdefs.h <<_ACEOF
-#define uchar unsigned char
-_ACEOF
 
-fi
 
 
-{ $as_echo "$as_me:$LINENO: checking whether char is unsigned" >&5
-$as_echo_n "checking whether char is unsigned... " >&6; }
-if test "${ac_cv_c_char_unsigned+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((char) -1) < 0)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_c_char_unsigned=no
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_c_char_unsigned=yes
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5
-$as_echo "$ac_cv_c_char_unsigned" >&6; }
-if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
-  cat >>confdefs.h <<\_ACEOF
-#define __CHAR_UNSIGNED__ 1
-_ACEOF
 
-fi
 
 
- { $as_echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
-$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
-if test "${ac_cv_c_bigendian+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_c_bigendian=unknown
-    # See if we're dealing with a universal compiler.
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifndef __APPLE_CC__
-	       not a universal capable compiler
-	     #endif
-	     typedef int dummy;
 
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
 
-	# Check for potential -arch flags.  It is not universal unless
-	# there are some -arch flags.  Note that *ppc* also matches
-	# ppc64.  This check is also rather less than ideal.
-	case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in  #(
-	  *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;;
-	esac
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    if test $ac_cv_c_bigendian = unknown; then
-      # See if sys/param.h defines the BYTE_ORDER macro.
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-	     #include <sys/param.h>
 
-int
-main ()
-{
-#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
-		     && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
-		     && LITTLE_ENDIAN)
-	      bogus endian macros
-	     #endif
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  # It does; now see whether it defined to BIG_ENDIAN or not.
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-		#include <sys/param.h>
 
-int
-main ()
-{
-#if BYTE_ORDER != BIG_ENDIAN
-		 not big endian
-		#endif
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_c_bigendian=yes
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action_FC=
+if test -n "$hardcode_libdir_flag_spec_FC" ||
+   test -n "$runpath_var_FC" ||
+   test "X$hardcode_automatic_FC" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct_FC" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, FC)" != no &&
+     test "$hardcode_minus_L_FC" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_FC=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_FC=immediate
+  fi
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_FC=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_FC" >&5
+$as_echo "$hardcode_action_FC" >&6; }
 
-	ac_cv_c_bigendian=no
+if test "$hardcode_action_FC" = relink ||
+   test "$inherit_rpath_FC" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    fi
-    if test $ac_cv_c_bigendian = unknown; then
-      # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <limits.h>
 
-int
-main ()
-{
-#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
-	      bogus endian macros
-	     #endif
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  # It does; now see whether it defined to _BIG_ENDIAN or not.
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <limits.h>
 
-int
-main ()
-{
-#ifndef _BIG_ENDIAN
-		 not big endian
-		#endif
+  fi # test -n "$compiler"
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_c_bigendian=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  GCC=$lt_save_GCC
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+fi # test "$_lt_disable_FC" != yes
 
-	ac_cv_c_bigendian=no
-fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    fi
-    if test $ac_cv_c_bigendian = unknown; then
-      # Compile a test program.
-      if test "$cross_compiling" = yes; then
-  # Try to guess by grepping values from an object file.
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-short int ascii_mm[] =
-		  { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
-		short int ascii_ii[] =
-		  { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
-		int use_ascii (int i) {
-		  return ascii_mm[i] + ascii_ii[i];
-		}
-		short int ebcdic_ii[] =
-		  { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
-		short int ebcdic_mm[] =
-		  { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
-		int use_ebcdic (int i) {
-		  return ebcdic_mm[i] + ebcdic_ii[i];
-		}
-		extern int foo;
 
-int
-main ()
-{
-return use_ascii (foo) == use_ebcdic (foo);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
-	      ac_cv_c_bigendian=yes
-	    fi
-	    if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
-	      if test "$ac_cv_c_bigendian" = unknown; then
-		ac_cv_c_bigendian=no
-	      else
-		# finding both strings is unlikely to happen, but who knows?
-		ac_cv_c_bigendian=unknown
-	      fi
-	    fi
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
 
-	     /* Are we little or big endian?  From Harbison&Steele.  */
-	     union
-	     {
-	       long int l;
-	       char c[sizeof (long int)];
-	     } u;
-	     u.l = 1;
-	     return u.c[sizeof (long int) - 1] == 1;
+        ac_config_commands="$ac_config_commands libtool"
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_c_bigendian=no
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-( exit $ac_status )
-ac_cv_c_bigendian=yes
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
 
 
-    fi
+# Only expand once:
+
+
+
+# must set ranlib when compiling on Darwin
+if test "x$darwin_os" = "xyes"; then
+   RANLIB="ranlib -c"
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
-$as_echo "$ac_cv_c_bigendian" >&6; }
- case $ac_cv_c_bigendian in #(
-   yes)
-     cat >>confdefs.h <<\_ACEOF
-#define WORDS_BIGENDIAN 1
-_ACEOF
-;; #(
-   no)
-      ;; #(
-   universal)
 
-cat >>confdefs.h <<\_ACEOF
-#define AC_APPLE_UNIVERSAL_BUILD 1
-_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for large file support" >&5
+$as_echo "$as_me: checking for large file support" >&6;}
 
-     ;; #(
-   *)
-     { { $as_echo "$as_me:$LINENO: error: unknown endianness
- presetting ac_cv_c_bigendian=no (or yes) will help" >&5
-$as_echo "$as_me: error: unknown endianness
- presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
-   { (exit 1); exit 1; }; } ;;
- esac
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+  enableval=$enable_largefile;
+fi
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of short" >&5
-$as_echo_n "checking size of short... " >&6; }
-if test "${ac_cv_sizeof_short+set}" = set; then
+if test "$enable_largefile" != no; then
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
+if ${ac_cv_sys_largefile_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (short))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+	 # IRIX 6.2 and later do not support large files by default,
+	 # so use the C compiler's -n32 option if that helps.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (short))) <= $ac_mid)];
-test_array [0] = 0
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
+	 if ac_fn_c_try_compile "$LINENO"; then :
+  break
+fi
+rm -f core conftest.err conftest.$ac_objext
+	 CC="$CC -n32"
+	 if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_largefile_CC=' -n32'; break
+fi
+rm -f core conftest.err conftest.$ac_objext
+	 break
+       done
+       CC=$ac_save_CC
+       rm -f conftest.$ac_ext
+    fi
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if ${ac_cv_sys_file_offset_bits+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (short))) < 0)];
-test_array [0] = 0
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (short))) >= $ac_mid)];
-test_array [0] = 0
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_lo= ac_hi=
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=64; break
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_file_offset_bits=unknown
+  break
+done
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+;;
+esac
+rm -rf conftest*
+  if test $ac_cv_sys_file_offset_bits = unknown; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if ${ac_cv_sys_large_files+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (short))) <= $ac_mid)];
-test_array [0] = 0
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_lo=`expr '(' $ac_mid ')' + 1`
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=no; break
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_short=$ac_lo;;
-'') if test "$ac_cv_type_short" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_short=0
-   fi ;;
-esac
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (short)); }
-static unsigned long int ulongval () { return (long int) (sizeof (short)); }
-#include <stdio.h>
-#include <stdlib.h>
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (short))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (short))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (short))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
-
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_large_files=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_short=`cat conftest.val`
+rm -rf conftest*
+  fi
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking types, headers, and functions" >&5
+$as_echo "$as_me: checking types, headers, and functions" >&6;}
+
+ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdlib_h" = xyes; then :
+
+else
+
+$as_echo "#define NO_STDLIB_H /**/" >>confdefs.h
+
+fi
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_types_h" = xyes; then :
+
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-( exit $ac_status )
-if test "$ac_cv_type_short" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_short=0
-   fi
+$as_echo "#define NO_SYS_TYPES_H /**/" >>confdefs.h
+
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
+if test "x$ac_cv_header_unistd_h" = xyes; then :
+
 fi
-rm -f conftest.val
+
+
+ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror"
+if test "x$ac_cv_func_strerror" = xyes; then :
+
+else
+
+$as_echo "#define NO_STRERROR /**/" >>confdefs.h
+
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5
-$as_echo "$ac_cv_sizeof_short" >&6; }
 
+ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat"
+if test "x$ac_cv_func_strlcat" = xyes; then :
+
+$as_echo "#define HAVE_STRLCAT 1" >>confdefs.h
 
+fi
+
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
+else
 
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_SHORT $ac_cv_sizeof_short
+#define size_t unsigned int
 _ACEOF
 
+fi
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of int" >&5
-$as_echo_n "checking size of int... " >&6; }
-if test "${ac_cv_sizeof_int+set}" = set; then
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
+$as_echo_n "checking for working alloca.h... " >&6; }
+if ${ac_cv_working_alloca_h+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#include <alloca.h>
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)];
-test_array [0] = 0
-
+char *p = (char *) alloca (2 * sizeof (int));
+			  if (p) return 0;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_working_alloca_h=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_working_alloca_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
+$as_echo "$ac_cv_working_alloca_h" >&6; }
+if test $ac_cv_working_alloca_h = yes; then
+
+$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
+$as_echo_n "checking for alloca... " >&6; }
+if ${ac_cv_func_alloca_works+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) < 0)];
-test_array [0] = 0
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  ifdef HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
+void *alloca (size_t);
+#    endif
+#   endif
+#  endif
+# endif
+#endif
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= $ac_mid)];
-test_array [0] = 0
-
+char *p = (char *) alloca (1);
+				    if (p) return 0;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_func_alloca_works=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
+  ac_cv_func_alloca_works=no
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
+$as_echo "$ac_cv_func_alloca_works" >&6; }
+
+if test $ac_cv_func_alloca_works = yes; then
+
+$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+# that cause trouble.  Some versions do not even contain alloca or
+# contain a buggy version.  If you still want to use their alloca,
+# use ar to extract alloca.o from them instead of compiling alloca.c.
 
-	ac_lo= ac_hi=
-fi
+ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
+$as_echo "#define C_ALLOCA 1" >>confdefs.h
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
+$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
+if ${ac_cv_os_cray+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)];
-test_array [0] = 0
+#if defined CRAY && ! defined CRAY2
+webecray
+#else
+wenotbecray
+#endif
 
-  ;
-  return 0;
-}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "webecray" >/dev/null 2>&1; then :
+  ac_cv_os_cray=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_os_cray=no
+fi
+rm -f conftest*
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
+$as_echo "$ac_cv_os_cray" >&6; }
+if test $ac_cv_os_cray = yes; then
+  for ac_func in _getb67 GETB67 getb67; do
+    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_int=$ac_lo;;
-'') if test "$ac_cv_type_int" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_int=0
-   fi ;;
-esac
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+cat >>confdefs.h <<_ACEOF
+#define CRAY_STACKSEG_END $ac_func
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+
+    break
+fi
+
+  done
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
+$as_echo_n "checking stack direction for C alloca... " >&6; }
+if ${ac_cv_c_stack_direction+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  ac_cv_c_stack_direction=0
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
-static long int longval () { return (long int) (sizeof (int)); }
-static unsigned long int ulongval () { return (long int) (sizeof (int)); }
-#include <stdio.h>
-#include <stdlib.h>
 int
-main ()
+find_stack_direction ()
 {
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (int))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (int))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
+  static char *addr = 0;
+  auto char dummy;
+  if (addr == 0)
     {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (int))))
-	return 1;
-      fprintf (f, "%lu", i);
+      addr = &dummy;
+      return find_stack_direction ();
     }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
+  else
+    return (&dummy > addr) ? 1 : -1;
+}
 
-  ;
-  return 0;
+int
+main ()
+{
+  return find_stack_direction () < 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_int=`cat conftest.val`
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_c_stack_direction=1
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_int" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_int=0
-   fi
+  ac_cv_c_stack_direction=-1
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-rm -f conftest.val
+
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
-$as_echo "$ac_cv_sizeof_int" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
+$as_echo "$ac_cv_c_stack_direction" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+_ACEOF
 
 
+fi
+
+ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_INT $ac_cv_sizeof_int
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
 _ACEOF
 
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of long" >&5
-$as_echo_n "checking size of long... " >&6; }
-if test "${ac_cv_sizeof_long+set}" = set; then
-  $as_echo_n "(cached) " >&6
+$as_echo "#define HAVE_ST_BLKSIZE 1" >>confdefs.h
+
+fi
+
+
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
 else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= 0)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
+fi
+
+ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
+if test "x$ac_cv_type_off_t" = xyes; then :
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
+cat >>confdefs.h <<_ACEOF
+#define off_t long int
+_ACEOF
+
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
+ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default"
+if test "x$ac_cv_type_ssize_t" = xyes; then :
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+cat >>confdefs.h <<_ACEOF
+#define ssize_t int
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) < 0)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
+fi
+
+ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default"
+if test "x$ac_cv_type_ptrdiff_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define ptrdiff_t int
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+
+fi
+
+ac_fn_c_check_type "$LINENO" "uchar" "ac_cv_type_uchar" "$ac_includes_default"
+if test "x$ac_cv_type_uchar" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define uchar unsigned char
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5
+$as_echo_n "checking whether char is unsigned... " >&6; }
+if ${ac_cv_c_char_unsigned+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((char) -1) < 0)];
 test_array [0] = 0
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_char_unsigned=no
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_c_char_unsigned=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_char_unsigned" >&5
+$as_echo "$ac_cv_c_char_unsigned" >&6; }
+if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
+  $as_echo "#define __CHAR_UNSIGNED__ 1" >>confdefs.h
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
+$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
+if ${ac_cv_c_bigendian+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_c_bigendian=unknown
+    # See if we're dealing with a universal compiler.
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifndef __APPLE_CC__
+	       not a universal capable compiler
+	     #endif
+	     typedef int dummy;
 
-	ac_lo= ac_hi=
-fi
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	# Check for potential -arch flags.  It is not universal unless
+	# there are at least two -arch flags with different values.
+	ac_arch=
+	ac_prev=
+	for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
+	 if test -n "$ac_prev"; then
+	   case $ac_word in
+	     i?86 | x86_64 | ppc | ppc64)
+	       if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
+		 ac_arch=$ac_word
+	       else
+		 ac_cv_c_bigendian=universal
+		 break
+	       fi
+	       ;;
+	   esac
+	   ac_prev=
+	 elif test "x$ac_word" = "x-arch"; then
+	   ac_prev=arch
+	 fi
+       done
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+    if test $ac_cv_c_bigendian = unknown; then
+      # See if sys/param.h defines the BYTE_ORDER macro.
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#include <sys/types.h>
+	     #include <sys/param.h>
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
-test_array [0] = 0
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
+		     && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
+		     && LITTLE_ENDIAN)
+	      bogus endian macros
+	     #endif
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_long=$ac_lo;;
-'') if test "$ac_cv_type_long" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long=0
-   fi ;;
-esac
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (long)); }
-static unsigned long int ulongval () { return (long int) (sizeof (long)); }
-#include <stdio.h>
-#include <stdlib.h>
+if ac_fn_c_try_compile "$LINENO"; then :
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+		#include <sys/param.h>
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (long))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (long))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (long))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
+#if BYTE_ORDER != BIG_ENDIAN
+		 not big endian
+		#endif
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_long=`cat conftest.val`
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_bigendian=yes
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_long" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long=0
-   fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+  ac_cv_c_bigendian=no
 fi
-rm -f conftest.val
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
-$as_echo "$ac_cv_sizeof_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG $ac_cv_sizeof_long
-_ACEOF
-
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of float" >&5
-$as_echo_n "checking size of float... " >&6; }
-if test "${ac_cv_sizeof_float+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    fi
+    if test $ac_cv_c_bigendian = unknown; then
+      # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#include <limits.h>
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (float))) >= 0)];
-test_array [0] = 0
+#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
+	      bogus endian macros
+	     #endif
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  # It does; now see whether it defined to _BIG_ENDIAN or not.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#include <limits.h>
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (float))) <= $ac_mid)];
-test_array [0] = 0
+#ifndef _BIG_ENDIAN
+		 not big endian
+		#endif
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_bigendian=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
+  ac_cv_c_bigendian=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    fi
+    if test $ac_cv_c_bigendian = unknown; then
+      # Compile a test program.
+      if test "$cross_compiling" = yes; then :
+  # Try to guess by grepping values from an object file.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+short int ascii_mm[] =
+		  { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+		short int ascii_ii[] =
+		  { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+		int use_ascii (int i) {
+		  return ascii_mm[i] + ascii_ii[i];
+		}
+		short int ebcdic_ii[] =
+		  { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+		short int ebcdic_mm[] =
+		  { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+		int use_ebcdic (int i) {
+		  return ebcdic_mm[i] + ebcdic_ii[i];
+		}
+		extern int foo;
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (float))) < 0)];
-test_array [0] = 0
-
+return use_ascii (foo) == use_ebcdic (foo);
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
+	      ac_cv_c_bigendian=yes
+	    fi
+	    if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+	      if test "$ac_cv_c_bigendian" = unknown; then
+		ac_cv_c_bigendian=no
+	      else
+		# finding both strings is unlikely to happen, but who knows?
+		ac_cv_c_bigendian=unknown
+	      fi
+	    fi
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (float))) >= $ac_mid)];
-test_array [0] = 0
+
+	     /* Are we little or big endian?  From Harbison&Steele.  */
+	     union
+	     {
+	       long int l;
+	       char c[sizeof (long int)];
+	     } u;
+	     u.l = 1;
+	     return u.c[sizeof (long int) - 1] == 1;
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_c_bigendian=no
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_c_bigendian=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
+    fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
+$as_echo "$ac_cv_c_bigendian" >&6; }
+ case $ac_cv_c_bigendian in #(
+   yes)
+     $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
+;; #(
+   no)
+      ;; #(
+   universal)
+
+$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
+
+     ;; #(
+   *)
+     as_fn_error $? "unknown endianness
+ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
+ esac
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5
+$as_echo_n "checking size of short... " >&6; }
+if ${ac_cv_sizeof_short+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_short" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (short)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_short=0
+   fi
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5
+$as_echo "$ac_cv_sizeof_short" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
+$as_echo_n "checking size of int... " >&6; }
+if ${ac_cv_sizeof_int+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int"        "$ac_includes_default"; then :
 
-	ac_lo= ac_hi=
+else
+  if test "$ac_cv_type_int" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (int)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_int=0
+   fi
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
+$as_echo "$ac_cv_sizeof_int" >&6; }
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (float))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_float=$ac_lo;;
-'') if test "$ac_cv_type_float" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if ${ac_cv_sizeof_long+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_long" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (float)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (float)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
+as_fn_error 77 "cannot compute sizeof (long)
+See \`config.log' for more details" "$LINENO" 5; }
    else
-     ac_cv_sizeof_float=0
-   fi ;;
-esac
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (float)); }
-static unsigned long int ulongval () { return (long int) (sizeof (float)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
+     ac_cv_sizeof_long=0
+   fi
+fi
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (float))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (float))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (float))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
 
-  ;
-  return 0;
-}
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_float=`cat conftest.val`
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of float" >&5
+$as_echo_n "checking size of float... " >&6; }
+if ${ac_cv_sizeof_float+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (float))" "ac_cv_sizeof_float"        "$ac_includes_default"; then :
 
-( exit $ac_status )
-if test "$ac_cv_type_float" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+else
+  if test "$ac_cv_type_float" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (float)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (float)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
+as_fn_error 77 "cannot compute sizeof (float)
+See \`config.log' for more details" "$LINENO" 5; }
    else
      ac_cv_sizeof_float=0
    fi
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
+
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_float" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_float" >&5
 $as_echo "$ac_cv_sizeof_float" >&6; }
 
 
@@ -22157,734 +17698,884 @@ _ACEOF
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of double" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5
 $as_echo_n "checking size of double... " >&6; }
-if test "${ac_cv_sizeof_double+set}" = set; then
+if ${ac_cv_sizeof_double+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (double))) >= 0)];
-test_array [0] = 0
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double"        "$ac_includes_default"; then :
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (double))) <= $ac_mid)];
-test_array [0] = 0
+else
+  if test "$ac_cv_type_double" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (double)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_double=0
+   fi
+fi
 
-  ;
-  return 0;
-}
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_double" >&5
+$as_echo "$ac_cv_sizeof_double" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_DOUBLE $ac_cv_sizeof_double
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5
+$as_echo_n "checking size of off_t... " >&6; }
+if ${ac_cv_sizeof_off_t+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t"        "$ac_includes_default"; then :
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
+else
+  if test "$ac_cv_type_off_t" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (off_t)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_off_t=0
+   fi
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_off_t" >&5
+$as_echo "$ac_cv_sizeof_off_t" >&6; }
+
+
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_OFF_T $ac_cv_sizeof_off_t
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+
+
+#AC_CHECK_SIZEOF(size_t)
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing deflate" >&5
+$as_echo_n "checking for library containing deflate... " >&6; }
+if ${ac_cv_search_deflate+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char deflate ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (double))) < 0)];
-test_array [0] = 0
-
+return deflate ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+for ac_lib in '' z; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_deflate=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_deflate+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_deflate+:} false; then :
+
+else
+  ac_cv_search_deflate=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_deflate" >&5
+$as_echo "$ac_cv_search_deflate" >&6; }
+ac_res=$ac_cv_search_deflate
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ceil" >&5
+$as_echo_n "checking for library containing ceil... " >&6; }
+if ${ac_cv_search_ceil+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ceil ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (double))) >= $ac_mid)];
-test_array [0] = 0
-
+return ceil ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
+for ac_lib in '' m; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_ceil=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_ceil+:} false; then :
+  break
 fi
+done
+if ${ac_cv_search_ceil+:} false; then :
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_lo= ac_hi=
+  ac_cv_search_ceil=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ceil" >&5
+$as_echo "$ac_cv_search_ceil" >&6; }
+ac_res=$ac_cv_search_ceil
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing Curl_cfree" >&5
+$as_echo_n "checking for library containing Curl_cfree... " >&6; }
+if ${ac_cv_search_Curl_cfree+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char Curl_cfree ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (double))) <= $ac_mid)];
-test_array [0] = 0
-
+return Curl_cfree ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
+for ac_lib in '' curl; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_Curl_cfree=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_Curl_cfree+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_Curl_cfree+:} false; then :
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_search_Curl_cfree=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_Curl_cfree" >&5
+$as_echo "$ac_cv_search_Curl_cfree" >&6; }
+ac_res=$ac_cv_search_Curl_cfree
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_double=$ac_lo;;
-'') if test "$ac_cv_type_double" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (double)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (double)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_double=0
-   fi ;;
-esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nc_open" >&5
+$as_echo_n "checking for library containing nc_open... " >&6; }
+if ${ac_cv_search_nc_open+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (double)); }
-static unsigned long int ulongval () { return (long int) (sizeof (double)); }
-#include <stdio.h>
-#include <stdlib.h>
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char nc_open ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (double))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (double))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (double))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
-
+return nc_open ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_double=`cat conftest.val`
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_double" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (double)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (double)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_double=0
-   fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+for ac_lib in '' netcdf; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_nc_open=$ac_res
 fi
-rm -f conftest.val
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_nc_open+:} false; then :
+  break
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_double" >&5
-$as_echo "$ac_cv_sizeof_double" >&6; }
-
+done
+if ${ac_cv_search_nc_open+:} false; then :
 
+else
+  ac_cv_search_nc_open=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nc_open" >&5
+$as_echo "$ac_cv_search_nc_open" >&6; }
+ac_res=$ac_cv_search_nc_open
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_DOUBLE $ac_cv_sizeof_double
-_ACEOF
+fi
 
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of off_t" >&5
-$as_echo_n "checking size of off_t... " >&6; }
-if test "${ac_cv_sizeof_off_t+set}" = set; then
+# These tests are written in such a way that a fortran compiler is not
+# necessary. Therefore not using AC_FC_FUNC to determine the number of
+# underscores
+have_blas="no"
+have_blas_underscore="no"
+have_lapack="no"
+have_lapack_underscore="no"
+if test "$libcf_build_regrid" != "no"; then
+possible_blas_library_names="sci_quadcore_mp nag essl mkl f77blas blas"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dcopy" >&5
+$as_echo_n "checking for library containing dcopy... " >&6; }
+if ${ac_cv_search_dcopy+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dcopy ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) >= 0)];
-test_array [0] = 0
-
+return dcopy ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+for ac_lib in '' $possible_blas_library_names; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_dcopy=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_dcopy+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_dcopy+:} false; then :
+
+else
+  ac_cv_search_dcopy=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dcopy" >&5
+$as_echo "$ac_cv_search_dcopy" >&6; }
+ac_res=$ac_cv_search_dcopy
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+  have_blas="yes"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dcopy_" >&5
+$as_echo_n "checking for library containing dcopy_... " >&6; }
+if ${ac_cv_search_dcopy_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dcopy_ ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) <= $ac_mid)];
-test_array [0] = 0
-
+return dcopy_ ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
+for ac_lib in '' $possible_blas_library_names; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_dcopy_=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_dcopy_+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_dcopy_+:} false; then :
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_search_dcopy_=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dcopy_" >&5
+$as_echo "$ac_cv_search_dcopy_" >&6; }
+ac_res=$ac_cv_search_dcopy_
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+  have_blas_underscore="yes"
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+fi
+
+possible_lapack_library_names="sci_quadcore_mp nag essl mkl lapack"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dgetrf" >&5
+$as_echo_n "checking for library containing dgetrf... " >&6; }
+if ${ac_cv_search_dgetrf+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dgetrf ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) < 0)];
-test_array [0] = 0
-
+{
+return dgetrf ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+for ac_lib in '' $possible_lapack_library_names; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_dgetrf=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_dgetrf+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_dgetrf+:} false; then :
+
+else
+  ac_cv_search_dgetrf=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dgetrf" >&5
+$as_echo "$ac_cv_search_dgetrf" >&6; }
+ac_res=$ac_cv_search_dgetrf
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+  have_lapack="yes"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dgetrf_" >&5
+$as_echo_n "checking for library containing dgetrf_... " >&6; }
+if ${ac_cv_search_dgetrf_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dgetrf_ ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) >= $ac_mid)];
-test_array [0] = 0
-
+return dgetrf_ ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
+for ac_lib in '' $possible_lapack_library_names; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_dgetrf_=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_dgetrf_+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_dgetrf_+:} false; then :
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_search_dgetrf_=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dgetrf_" >&5
+$as_echo "$ac_cv_search_dgetrf_" >&6; }
+ac_res=$ac_cv_search_dgetrf_
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+  have_lapack_underscore="yes"
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo= ac_hi=
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+HAVE_LAPACK_NO_UNDERSCORE=0
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+HAVE_LAPACK_UNDERSCORE=0
+
+HAVE_LAPACK_LIB=0
+
+if test "$have_lapack" = "yes"; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: lapack and blas were found, symbols have no underscore" >&5
+$as_echo "$as_me: lapack and blas were found, symbols have no underscore" >&6;}
+
+$as_echo "#define HAVE_LAPACK_NO_UNDERSCORE 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_LAPACK_LIB 1" >>confdefs.h
+
+   HAVE_LAPACK_NO_UNDERSCORE=1
+
+   HAVE_LAPACK_LIB=1
+
+fi
+if test "$have_lapack_underscore" = "yes"; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: lapack and blas were found, symbols have underscore" >&5
+$as_echo "$as_me: lapack and blas were found, symbols have underscore" >&6;}
+
+$as_echo "#define HAVE_LAPACK_UNDERSCORE 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_LAPACK_LIB 1" >>confdefs.h
+
+   HAVE_LAPACK_UNDERSCORE=1
+
+   HAVE_LAPACK_LIB=1
+
+fi
+
+for ac_header in netcdf.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "netcdf.h" "ac_cv_header_netcdf_h" "$ac_includes_default"
+if test "x$ac_cv_header_netcdf_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_NETCDF_H 1
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+
+else
+  as_fn_error $? "Header netcdf.h could
+	not be found. Please set CPPFLAGS." "$LINENO" 5
+fi
+
+done
+
+
+# some parts rely on uuid, if not found we will fall back on own code to
+# generate unique identifiers
+HAVE_UUID_H="no"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#include <uuid/uuid.h>
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) <= $ac_mid)];
-test_array [0] = 0
-
+uuid_t x; uuid_clear(x);
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
+if ac_fn_c_try_link "$LINENO"; then :
+  uuid_clear_compiles=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_lo=`expr '(' $ac_mid ')' + 1`
+  uuid_clear_compiles=no
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_off_t=$ac_lo;;
-'') if test "$ac_cv_type_off_t" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (off_t)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_off_t=0
-   fi ;;
-esac
+libuuid=""
+if test "$uuid_clear_compiles" = "no"; then
+   # on some platforms (e.g. linux), need to link against -luuid
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_generate in -luuid" >&5
+$as_echo_n "checking for uuid_generate in -luuid... " >&6; }
+if ${ac_cv_lib_uuid_uuid_generate+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-luuid  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (off_t)); }
-static unsigned long int ulongval () { return (long int) (sizeof (off_t)); }
-#include <stdio.h>
-#include <stdlib.h>
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char uuid_generate ();
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
 int
 main ()
 {
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (off_t))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (off_t))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (off_t))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
-
+return uuid_generate ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_off_t=`cat conftest.val`
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_uuid_uuid_generate=yes
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_lib_uuid_uuid_generate=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_generate" >&5
+$as_echo "$ac_cv_lib_uuid_uuid_generate" >&6; }
+if test "x$ac_cv_lib_uuid_uuid_generate" = xyes; then :
+  libuuid="-luuid"
+fi
 
-( exit $ac_status )
-if test "$ac_cv_type_off_t" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (off_t)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_off_t=0
+   if test "x$libuuid" != "x"; then
+      LIBS="$LIBS $libuuid"
+      uuid_clear_compiles=yes
    fi
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Successfully compiling code containing uuid? $uuid_clear_compiles" >&5
+$as_echo "$as_me: Successfully compiling code containing uuid? $uuid_clear_compiles" >&6;}
+if test "$uuid_clear_compiles" = "yes"; then
+   HAVE_UUID_H="yes"
+
+$as_echo "#define HAVE_UUID_H 1" >>confdefs.h
+
 fi
-rm -f conftest.val
+ if test "x$HAVE_UUID_H" = "xyes"; then
+  HAVE_UUID_TRUE=
+  HAVE_UUID_FALSE='#'
+else
+  HAVE_UUID_TRUE='#'
+  HAVE_UUID_FALSE=
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5
-$as_echo "$ac_cv_sizeof_off_t" >&6; }
 
+if test "x$HAVE_UUID_H" = "xyes"; then
+   HAVE_UUID=1
 
+else
+   HAVE_UUID=0
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_OFF_T $ac_cv_sizeof_off_t
+fi
+
+# test if the fortran compiler supports some Fortran 2003 features
+FORTRAN_2003="no"
+ac_ext=${ac_fc_srcext-f}
+ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
+ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_fc_compiler_gnu
+
+cat > conftest.$ac_ext <<_ACEOF
+      program main
+
+       contains
+       subroutine foo(x, y)
+         use iso_c_binding
+         integer, value :: x
+         type(c_ptr) :: y, z
+    	 integer, pointer :: fpy
+		 call c_f_pointer(y, fpy)
+         z = c_loc(fpy)
+       end subroutine
+
+      end
 _ACEOF
+if ac_fn_fc_try_compile "$LINENO"; then :
+  fortran_2003=yes
+else
+  fortran_2003=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+if test "$fortran_2003" = "yes"; then
+    HAVE_FORTRAN_2003=1
 
-#AC_CHECK_SIZEOF(size_t)
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: Fortran compiler supports 2003 features" >&5
+$as_echo "$as_me: Fortran compiler supports 2003 features" >&6;}
+else
+    HAVE_FORTRAN_2003=0
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Fortran compiler does not support 2003 features" >&5
+$as_echo "$as_me: WARNING: Fortran compiler does not support 2003 features" >&2;}
+fi
+ if test x$fortran_2003 = xyes; then
+  HAVE_FORTRAN_2003_TRUE=
+  HAVE_FORTRAN_2003_FALSE='#'
+else
+  HAVE_FORTRAN_2003_TRUE='#'
+  HAVE_FORTRAN_2003_FALSE=
+fi
+
+
+# Python (not required but nice to have)
+PYTHON=""
+for ac_prog in python python2
+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_PYTHON+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$PYTHON"; then
+  ac_cv_prog_PYTHON="$PYTHON" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_PYTHON="$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
+PYTHON=$ac_cv_prog_PYTHON
+if test -n "$PYTHON"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
+$as_echo "$PYTHON" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-{ $as_echo "$as_me:$LINENO: generating header files and makefiles" >&5
-$as_echo "$as_me: generating header files and makefiles" >&6;}
 
-ac_config_files="$ac_config_files gridspec/tools/make_hgrid/run_tests"
+  test -n "$PYTHON" && break
+done
 
-ac_config_files="$ac_config_files gridspec/tools/make_vgrid/run_tests"
+ if test "x$PYTHON" != "x"; then
+  HAVE_PYTHON_TRUE=
+  HAVE_PYTHON_FALSE='#'
+else
+  HAVE_PYTHON_TRUE='#'
+  HAVE_PYTHON_FALSE=
+fi
 
-ac_config_files="$ac_config_files gridspec/tools/make_topog/run_tests"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: generating header files and makefiles" >&5
+$as_echo "$as_me: generating header files and makefiles" >&6;}
 
-ac_config_files="$ac_config_files Makefile doc/Makefile cfcheck/Makefile src/Makefile gridspec/Makefile gridspec/shared/Makefile gridspec/shared/mosaic/Makefile gridspec/tools/Makefile gridspec/tools/shared/Makefile gridspec/tools/make_hgrid/Makefile gridspec/tools/make_mosaic/Makefile gridspec/tools/make_coupler_mosaic/Makefile gridspec/tools/fregrid/Makefile gridspec/tools/make_topog/Makefile gridspec/tools/make_vgrid/Makefile"
 
+ac_config_files="$ac_config_files Makefile pycf/Makefile pycf/__init__.py src/Makefile include/Makefile gridspec_api/Makefile gridspec_api/global/Makefile gridspec_api/axis/Makefile gridspec_api/coord/Makefile gridspec_api/grid/Makefile gridspec_api/data/Makefile gridspec_api/regrid/Makefile gridspec_api/mosaic/Makefile gridspec_api/host/Makefile examples/Makefile setup.py"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -22913,13 +18604,13 @@ _ACEOF
     case $ac_val in #(
     *${as_nl}*)
       case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       esac
       case $ac_var in #(
       _ | IFS | as_nl) ;; #(
       BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) $as_unset $ac_var ;;
+      *) { eval $ac_var=; unset $ac_var;} ;;
       esac ;;
     esac
   done
@@ -22927,8 +18618,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
   (set) 2>&1 |
     case $as_nl`(ac_space=' '; set) 2>&1` in #(
     *${as_nl}ac_space=\ *)
-      # `set' does not quote correctly, so add quotes (double-quote
-      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      # `set' does not quote correctly, so add quotes: double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \.
       sed -n \
 	"s/'/'\\\\''/g;
 	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
@@ -22950,12 +18641,23 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      :end' >>confcache
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
-    test "x$cache_file" != "x/dev/null" &&
-      { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+    if test "x$cache_file" != "x/dev/null"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
 $as_echo "$as_me: updating cache $cache_file" >&6;}
-    cat confcache >$cache_file
+      if test ! -f "$cache_file" || test -h "$cache_file"; then
+	cat confcache >"$cache_file"
+      else
+        case $cache_file in #(
+        */* | ?:*)
+	  mv -f confcache "$cache_file"$$ &&
+	  mv -f "$cache_file"$$ "$cache_file" ;; #(
+        *)
+	  mv -f confcache "$cache_file" ;;
+	esac
+      fi
+    fi
   else
-    { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
   fi
 fi
@@ -22969,14 +18671,15 @@ DEFS=-DHAVE_CONFIG_H
 
 ac_libobjs=
 ac_ltlibobjs=
+U=
 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
   # 1. Remove the extension, and $U if already installed.
   ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
   ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
   # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
   #    will be set to the directory where LIBOBJS objects are built.
-  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
-  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
 done
 LIBOBJS=$ac_libobjs
 
@@ -22991,120 +18694,76 @@ else
   am__EXEEXT_FALSE=
 fi
 
+if test -z "${HAVE_SHARED_TRUE}" && test -z "${HAVE_SHARED_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_SHARED\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_DARWIN_TRUE}" && test -z "${HAVE_DARWIN_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_DARWIN\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${BUILD_DOCS_TRUE}" && test -z "${BUILD_DOCS_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"BUILD_DOCS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"BUILD_DOCS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${BUILD_GRIDSPEC_TRUE}" && test -z "${BUILD_GRIDSPEC_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"BUILD_GRIDSPEC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"BUILD_GRIDSPEC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"BUILD_DOCS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${BUILD_GRIDSPEC_FILE_TESTS_TRUE}" && test -z "${BUILD_GRIDSPEC_FILE_TESTS_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"BUILD_GRIDSPEC_FILE_TESTS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"BUILD_GRIDSPEC_FILE_TESTS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${BUILD_CFCHECK_TRUE}" && test -z "${BUILD_CFCHECK_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"BUILD_CFCHECK\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"BUILD_CFCHECK\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${USE_NETCDF4_TRUE}" && test -z "${USE_NETCDF4_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"USE_NETCDF4\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"USE_NETCDF4\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"BUILD_GRIDSPEC_FILE_TESTS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${BUILD_PARALLEL_TRUE}" && test -z "${BUILD_PARALLEL_FALSE}"; then
+  as_fn_error $? "conditional \"BUILD_PARALLEL\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${TEST_PARALLEL_TRUE}" && test -z "${TEST_PARALLEL_FALSE}"; then
+  as_fn_error $? "conditional \"TEST_PARALLEL\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${EXTRA_DATA_TESTS_TRUE}" && test -z "${EXTRA_DATA_TESTS_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"EXTRA_DATA_TESTS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"EXTRA_DATA_TESTS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${USE_HDF5_DIR_TRUE}" && test -z "${USE_HDF5_DIR_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"USE_HDF5_DIR\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"USE_HDF5_DIR\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${USE_HDF4_DIR_TRUE}" && test -z "${USE_HDF4_DIR_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"USE_HDF4_DIR\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"USE_HDF4_DIR\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${USE_HDF4_TRUE}" && test -z "${USE_HDF4_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"USE_HDF4\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"USE_HDF4\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${USE_ZLIB_DIR_TRUE}" && test -z "${USE_ZLIB_DIR_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"USE_ZLIB_DIR\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"USE_ZLIB_DIR\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${USE_SZLIB_DIR_TRUE}" && test -z "${USE_SZLIB_DIR_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"USE_SZLIB_DIR\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"USE_SZLIB_DIR\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"EXTRA_DATA_TESTS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${BUILD_F90_TRUE}" && test -z "${BUILD_F90_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"BUILD_F90\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"BUILD_F90\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"BUILD_F90\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${USE_NETCDF_DIR_TRUE}" && test -z "${USE_NETCDF_DIR_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"USE_NETCDF_DIR\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"USE_NETCDF_DIR\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"USE_NETCDF_DIR\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+if test -z "${HAVE_MPI_TRUE}" && test -z "${HAVE_MPI_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_MPI\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
+if test -z "${HAVE_UUID_TRUE}" && test -z "${HAVE_UUID_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_UUID\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_FORTRAN_2003_TRUE}" && test -z "${HAVE_FORTRAN_2003_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_FORTRAN_2003\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_PYTHON_TRUE}" && test -z "${HAVE_PYTHON_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_PYTHON\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
 #! $SHELL
 # Generated by $as_me.
 # Run this file to recreate the current configuration.
@@ -23114,17 +18773,18 @@ cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 debug=false
 ac_cs_recheck=false
 ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
@@ -23132,23 +18792,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
 esac
-
 fi
 
 
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
 as_nl='
 '
 export as_nl
@@ -23156,7 +18808,13 @@ export as_nl
 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
   as_echo='printf %s\n'
   as_echo_n='printf %s'
 else
@@ -23167,7 +18825,7 @@ else
     as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
     as_echo_n_body='eval
       arg=$1;
-      case $arg in
+      case $arg in #(
       *"$as_nl"*)
 	expr "X$arg" : "X\\(.*\\)$as_nl";
 	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
@@ -23190,13 +18848,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
   }
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
 
 # IFS
 # We need space, tab and new line, in precisely that order.  Quoting is
@@ -23206,15 +18857,16 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
+as_myself=
+case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
 IFS=$as_save_IFS
 
      ;;
@@ -23226,12 +18878,16 @@ if test "x$as_myself" = x; then
 fi
 if test ! -f "$as_myself"; then
   $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
+  exit 1
 fi
 
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
 done
 PS1='$ '
 PS2='> '
@@ -23243,7 +18899,89 @@ export LC_ALL
 LANGUAGE=C
 export LANGUAGE
 
-# Required to use basename.
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
 if expr a : '\(a\)' >/dev/null 2>&1 &&
    test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
@@ -23257,8 +18995,12 @@ else
   as_basename=false
 fi
 
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
 
-# Name of the executable.
 as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
 	 X"$0" : 'X\(//\)$' \| \
@@ -23278,76 +19020,25 @@ $as_echo X/"$0" |
 	  }
 	  s/.*/./; q'`
 
-# CDPATH.
-$as_unset CDPATH
-
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
-
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
 
 ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
+case `echo -n x` in #(((((
 -n*)
-  case `echo 'x\c'` in
+  case `echo 'xy\c'` in
   *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
   esac;;
 *)
   ECHO_N='-n';;
 esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
 
 rm -f conf$$ conf$$.exe conf$$.file
 if test -d conf$$.dir; then
@@ -23376,8 +19067,56 @@ fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
 
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
 if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
+  as_mkdir_p='mkdir -p "$as_dir"'
 else
   test -d ./-p && rmdir ./-p
   as_mkdir_p=false
@@ -23396,10 +19135,10 @@ else
       if test -d "$1"; then
 	test -d "$1/.";
       else
-	case $1 in
+	case $1 in #(
 	-*)set "./$1";;
 	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
 	???[sx]*):;;*)false;;esac;fi
     '\'' sh
   '
@@ -23414,13 +19153,19 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
 exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
 
-# Save the log message, to keep $[0] and so on meaningful, and to
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libcf $as_me 1.0-alpha5, which was
-generated by GNU Autoconf 2.63.  Invocation command line was
+This file was extended by libcf $as_me 1.0-beta10, which was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -23452,13 +19197,15 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration.  Unless the files
+and actions are specified as TAGs, all are instantiated by default.
 
-Usage: $0 [OPTION]... [FILE]...
+Usage: $0 [OPTION]... [TAG]...
 
   -h, --help       print this help, then exit
   -V, --version    print version number and configuration settings, then exit
+      --config     print configuration, then exit
   -q, --quiet, --silent
                    do not print progress messages
   -d, --debug      don't remove temporary files
@@ -23477,16 +19224,17 @@ $config_headers
 Configuration commands:
 $config_commands
 
-Report bugs to <bug-autoconf at gnu.org>."
+Report bugs to <pletzer at txcorp.com>."
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-libcf config.status 1.0-alpha5
-configured by $0, generated by GNU Autoconf 2.63,
-  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+libcf config.status 1.0-beta10
+configured by $0, generated by GNU Autoconf 2.68,
+  with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2008 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -23504,11 +19252,16 @@ ac_need_defaults=:
 while test $# != 0
 do
   case $1 in
-  --*=*)
+  --*=?*)
     ac_option=`expr "X$1" : 'X\([^=]*\)='`
     ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
     ac_shift=:
     ;;
+  --*=)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=
+    ac_shift=:
+    ;;
   *)
     ac_option=$1
     ac_optarg=$2
@@ -23522,27 +19275,29 @@ do
     ac_cs_recheck=: ;;
   --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
     $as_echo "$ac_cs_version"; exit ;;
+  --config | --confi | --conf | --con | --co | --c )
+    $as_echo "$ac_cs_config"; exit ;;
   --debug | --debu | --deb | --de | --d | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
     $ac_shift
     case $ac_optarg in
     *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    '') as_fn_error $? "missing file argument" ;;
     esac
-    CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
+    as_fn_append CONFIG_FILES " '$ac_optarg'"
     ac_need_defaults=false;;
   --header | --heade | --head | --hea )
     $ac_shift
     case $ac_optarg in
     *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
-    CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'"
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
     ac_need_defaults=false;;
   --he | --h)
     # Conflict between --help and --header
-    { $as_echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; };;
+    as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
   --help | --hel | -h )
     $as_echo "$ac_cs_usage"; exit ;;
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
@@ -23550,11 +19305,10 @@ Try \`$0 --help' for more information." >&2
     ac_cs_silent=: ;;
 
   # This is an error.
-  -*) { $as_echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; } ;;
+  -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
 
-  *) ac_config_targets="$ac_config_targets $1"
+  *) as_fn_append ac_config_targets " $1"
      ac_need_defaults=false ;;
 
   esac
@@ -23605,233 +19359,208 @@ AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
 sed_quote_subst='$sed_quote_subst'
 double_quote_subst='$double_quote_subst'
 delay_variable_subst='$delay_variable_subst'
-enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
-AS='`$ECHO "X$AS" | $Xsed -e "$delay_single_quote_subst"`'
-DLLTOOL='`$ECHO "X$DLLTOOL" | $Xsed -e "$delay_single_quote_subst"`'
-OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
-macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
-macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
-enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
-pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
-enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
-host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
-host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
-host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
-build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
-build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
-build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
-SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
-Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
-GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
-EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
-FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
-LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
-NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
-LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
-max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
-ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
-exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
-lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
-lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
-lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
-reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
-reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
-file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
-AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
-AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
-RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
-old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
-CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
-compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
-GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
-SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
-ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
-MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
-need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
-DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
-NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
-LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
-OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
-libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
-shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
-export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
-allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
-inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
-link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
-fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
-always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
-export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
-prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
-variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
-need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
-need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
-version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
-runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
-shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
-libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
-soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
-postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
-finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
-enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
-old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
-striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_lib_search_dirs='`$ECHO "X$compiler_lib_search_dirs" | $Xsed -e "$delay_single_quote_subst"`'
-predep_objects='`$ECHO "X$predep_objects" | $Xsed -e "$delay_single_quote_subst"`'
-postdep_objects='`$ECHO "X$postdep_objects" | $Xsed -e "$delay_single_quote_subst"`'
-predeps='`$ECHO "X$predeps" | $Xsed -e "$delay_single_quote_subst"`'
-postdeps='`$ECHO "X$postdeps" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_lib_search_path='`$ECHO "X$compiler_lib_search_path" | $Xsed -e "$delay_single_quote_subst"`'
-LD_F77='`$ECHO "X$LD_F77" | $Xsed -e "$delay_single_quote_subst"`'
-LD_FC='`$ECHO "X$LD_FC" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_cmds_F77='`$ECHO "X$old_archive_cmds_F77" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_cmds_FC='`$ECHO "X$old_archive_cmds_FC" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_F77='`$ECHO "X$compiler_F77" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_FC='`$ECHO "X$compiler_FC" | $Xsed -e "$delay_single_quote_subst"`'
-GCC_F77='`$ECHO "X$GCC_F77" | $Xsed -e "$delay_single_quote_subst"`'
-GCC_FC='`$ECHO "X$GCC_FC" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag_F77='`$ECHO "X$lt_prog_compiler_no_builtin_flag_F77" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag_FC='`$ECHO "X$lt_prog_compiler_no_builtin_flag_FC" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_wl_F77='`$ECHO "X$lt_prog_compiler_wl_F77" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_wl_FC='`$ECHO "X$lt_prog_compiler_wl_FC" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_pic_F77='`$ECHO "X$lt_prog_compiler_pic_F77" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_pic_FC='`$ECHO "X$lt_prog_compiler_pic_FC" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_static_F77='`$ECHO "X$lt_prog_compiler_static_F77" | $Xsed -e "$delay_single_quote_subst"`'
-lt_prog_compiler_static_FC='`$ECHO "X$lt_prog_compiler_static_FC" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o_F77='`$ECHO "X$lt_cv_prog_compiler_c_o_F77" | $Xsed -e "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o_FC='`$ECHO "X$lt_cv_prog_compiler_c_o_FC" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds_need_lc_F77='`$ECHO "X$archive_cmds_need_lc_F77" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds_need_lc_FC='`$ECHO "X$archive_cmds_need_lc_FC" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes_F77='`$ECHO "X$enable_shared_with_static_runtimes_F77" | $Xsed -e "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes_FC='`$ECHO "X$enable_shared_with_static_runtimes_FC" | $Xsed -e "$delay_single_quote_subst"`'
-export_dynamic_flag_spec_F77='`$ECHO "X$export_dynamic_flag_spec_F77" | $Xsed -e "$delay_single_quote_subst"`'
-export_dynamic_flag_spec_FC='`$ECHO "X$export_dynamic_flag_spec_FC" | $Xsed -e "$delay_single_quote_subst"`'
-whole_archive_flag_spec_F77='`$ECHO "X$whole_archive_flag_spec_F77" | $Xsed -e "$delay_single_quote_subst"`'
-whole_archive_flag_spec_FC='`$ECHO "X$whole_archive_flag_spec_FC" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_needs_object_F77='`$ECHO "X$compiler_needs_object_F77" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_needs_object_FC='`$ECHO "X$compiler_needs_object_FC" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_new_cmds_F77='`$ECHO "X$old_archive_from_new_cmds_F77" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_new_cmds_FC='`$ECHO "X$old_archive_from_new_cmds_FC" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds_F77='`$ECHO "X$old_archive_from_expsyms_cmds_F77" | $Xsed -e "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds_FC='`$ECHO "X$old_archive_from_expsyms_cmds_FC" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds_F77='`$ECHO "X$archive_cmds_F77" | $Xsed -e "$delay_single_quote_subst"`'
-archive_cmds_FC='`$ECHO "X$archive_cmds_FC" | $Xsed -e "$delay_single_quote_subst"`'
-archive_expsym_cmds_F77='`$ECHO "X$archive_expsym_cmds_F77" | $Xsed -e "$delay_single_quote_subst"`'
-archive_expsym_cmds_FC='`$ECHO "X$archive_expsym_cmds_FC" | $Xsed -e "$delay_single_quote_subst"`'
-module_cmds_F77='`$ECHO "X$module_cmds_F77" | $Xsed -e "$delay_single_quote_subst"`'
-module_cmds_FC='`$ECHO "X$module_cmds_FC" | $Xsed -e "$delay_single_quote_subst"`'
-module_expsym_cmds_F77='`$ECHO "X$module_expsym_cmds_F77" | $Xsed -e "$delay_single_quote_subst"`'
-module_expsym_cmds_FC='`$ECHO "X$module_expsym_cmds_FC" | $Xsed -e "$delay_single_quote_subst"`'
-with_gnu_ld_F77='`$ECHO "X$with_gnu_ld_F77" | $Xsed -e "$delay_single_quote_subst"`'
-with_gnu_ld_FC='`$ECHO "X$with_gnu_ld_FC" | $Xsed -e "$delay_single_quote_subst"`'
-allow_undefined_flag_F77='`$ECHO "X$allow_undefined_flag_F77" | $Xsed -e "$delay_single_quote_subst"`'
-allow_undefined_flag_FC='`$ECHO "X$allow_undefined_flag_FC" | $Xsed -e "$delay_single_quote_subst"`'
-no_undefined_flag_F77='`$ECHO "X$no_undefined_flag_F77" | $Xsed -e "$delay_single_quote_subst"`'
-no_undefined_flag_FC='`$ECHO "X$no_undefined_flag_FC" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_F77='`$ECHO "X$hardcode_libdir_flag_spec_F77" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_FC='`$ECHO "X$hardcode_libdir_flag_spec_FC" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld_F77='`$ECHO "X$hardcode_libdir_flag_spec_ld_F77" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld_FC='`$ECHO "X$hardcode_libdir_flag_spec_ld_FC" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_separator_F77='`$ECHO "X$hardcode_libdir_separator_F77" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_libdir_separator_FC='`$ECHO "X$hardcode_libdir_separator_FC" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct_F77='`$ECHO "X$hardcode_direct_F77" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct_FC='`$ECHO "X$hardcode_direct_FC" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct_absolute_F77='`$ECHO "X$hardcode_direct_absolute_F77" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_direct_absolute_FC='`$ECHO "X$hardcode_direct_absolute_FC" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_minus_L_F77='`$ECHO "X$hardcode_minus_L_F77" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_minus_L_FC='`$ECHO "X$hardcode_minus_L_FC" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_shlibpath_var_F77='`$ECHO "X$hardcode_shlibpath_var_F77" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_shlibpath_var_FC='`$ECHO "X$hardcode_shlibpath_var_FC" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_automatic_F77='`$ECHO "X$hardcode_automatic_F77" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_automatic_FC='`$ECHO "X$hardcode_automatic_FC" | $Xsed -e "$delay_single_quote_subst"`'
-inherit_rpath_F77='`$ECHO "X$inherit_rpath_F77" | $Xsed -e "$delay_single_quote_subst"`'
-inherit_rpath_FC='`$ECHO "X$inherit_rpath_FC" | $Xsed -e "$delay_single_quote_subst"`'
-link_all_deplibs_F77='`$ECHO "X$link_all_deplibs_F77" | $Xsed -e "$delay_single_quote_subst"`'
-link_all_deplibs_FC='`$ECHO "X$link_all_deplibs_FC" | $Xsed -e "$delay_single_quote_subst"`'
-fix_srcfile_path_F77='`$ECHO "X$fix_srcfile_path_F77" | $Xsed -e "$delay_single_quote_subst"`'
-fix_srcfile_path_FC='`$ECHO "X$fix_srcfile_path_FC" | $Xsed -e "$delay_single_quote_subst"`'
-always_export_symbols_F77='`$ECHO "X$always_export_symbols_F77" | $Xsed -e "$delay_single_quote_subst"`'
-always_export_symbols_FC='`$ECHO "X$always_export_symbols_FC" | $Xsed -e "$delay_single_quote_subst"`'
-export_symbols_cmds_F77='`$ECHO "X$export_symbols_cmds_F77" | $Xsed -e "$delay_single_quote_subst"`'
-export_symbols_cmds_FC='`$ECHO "X$export_symbols_cmds_FC" | $Xsed -e "$delay_single_quote_subst"`'
-exclude_expsyms_F77='`$ECHO "X$exclude_expsyms_F77" | $Xsed -e "$delay_single_quote_subst"`'
-exclude_expsyms_FC='`$ECHO "X$exclude_expsyms_FC" | $Xsed -e "$delay_single_quote_subst"`'
-include_expsyms_F77='`$ECHO "X$include_expsyms_F77" | $Xsed -e "$delay_single_quote_subst"`'
-include_expsyms_FC='`$ECHO "X$include_expsyms_FC" | $Xsed -e "$delay_single_quote_subst"`'
-prelink_cmds_F77='`$ECHO "X$prelink_cmds_F77" | $Xsed -e "$delay_single_quote_subst"`'
-prelink_cmds_FC='`$ECHO "X$prelink_cmds_FC" | $Xsed -e "$delay_single_quote_subst"`'
-file_list_spec_F77='`$ECHO "X$file_list_spec_F77" | $Xsed -e "$delay_single_quote_subst"`'
-file_list_spec_FC='`$ECHO "X$file_list_spec_FC" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_action_F77='`$ECHO "X$hardcode_action_F77" | $Xsed -e "$delay_single_quote_subst"`'
-hardcode_action_FC='`$ECHO "X$hardcode_action_FC" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_lib_search_dirs_F77='`$ECHO "X$compiler_lib_search_dirs_F77" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_lib_search_dirs_FC='`$ECHO "X$compiler_lib_search_dirs_FC" | $Xsed -e "$delay_single_quote_subst"`'
-predep_objects_F77='`$ECHO "X$predep_objects_F77" | $Xsed -e "$delay_single_quote_subst"`'
-predep_objects_FC='`$ECHO "X$predep_objects_FC" | $Xsed -e "$delay_single_quote_subst"`'
-postdep_objects_F77='`$ECHO "X$postdep_objects_F77" | $Xsed -e "$delay_single_quote_subst"`'
-postdep_objects_FC='`$ECHO "X$postdep_objects_FC" | $Xsed -e "$delay_single_quote_subst"`'
-predeps_F77='`$ECHO "X$predeps_F77" | $Xsed -e "$delay_single_quote_subst"`'
-predeps_FC='`$ECHO "X$predeps_FC" | $Xsed -e "$delay_single_quote_subst"`'
-postdeps_F77='`$ECHO "X$postdeps_F77" | $Xsed -e "$delay_single_quote_subst"`'
-postdeps_FC='`$ECHO "X$postdeps_FC" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_lib_search_path_F77='`$ECHO "X$compiler_lib_search_path_F77" | $Xsed -e "$delay_single_quote_subst"`'
-compiler_lib_search_path_FC='`$ECHO "X$compiler_lib_search_path_FC" | $Xsed -e "$delay_single_quote_subst"`'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`'
+predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`'
+postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`'
+predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`'
+postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
+LD_FC='`$ECHO "$LD_FC" | $SED "$delay_single_quote_subst"`'
+reload_flag_FC='`$ECHO "$reload_flag_FC" | $SED "$delay_single_quote_subst"`'
+reload_cmds_FC='`$ECHO "$reload_cmds_FC" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds_FC='`$ECHO "$old_archive_cmds_FC" | $SED "$delay_single_quote_subst"`'
+compiler_FC='`$ECHO "$compiler_FC" | $SED "$delay_single_quote_subst"`'
+GCC_FC='`$ECHO "$GCC_FC" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag_FC='`$ECHO "$lt_prog_compiler_no_builtin_flag_FC" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic_FC='`$ECHO "$lt_prog_compiler_pic_FC" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl_FC='`$ECHO "$lt_prog_compiler_wl_FC" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static_FC='`$ECHO "$lt_prog_compiler_static_FC" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o_FC='`$ECHO "$lt_cv_prog_compiler_c_o_FC" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc_FC='`$ECHO "$archive_cmds_need_lc_FC" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes_FC='`$ECHO "$enable_shared_with_static_runtimes_FC" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec_FC='`$ECHO "$export_dynamic_flag_spec_FC" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec_FC='`$ECHO "$whole_archive_flag_spec_FC" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object_FC='`$ECHO "$compiler_needs_object_FC" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds_FC='`$ECHO "$old_archive_from_new_cmds_FC" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds_FC='`$ECHO "$old_archive_from_expsyms_cmds_FC" | $SED "$delay_single_quote_subst"`'
+archive_cmds_FC='`$ECHO "$archive_cmds_FC" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds_FC='`$ECHO "$archive_expsym_cmds_FC" | $SED "$delay_single_quote_subst"`'
+module_cmds_FC='`$ECHO "$module_cmds_FC" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds_FC='`$ECHO "$module_expsym_cmds_FC" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld_FC='`$ECHO "$with_gnu_ld_FC" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag_FC='`$ECHO "$allow_undefined_flag_FC" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag_FC='`$ECHO "$no_undefined_flag_FC" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_FC='`$ECHO "$hardcode_libdir_flag_spec_FC" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld_FC='`$ECHO "$hardcode_libdir_flag_spec_ld_FC" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator_FC='`$ECHO "$hardcode_libdir_separator_FC" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_FC='`$ECHO "$hardcode_direct_FC" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute_FC='`$ECHO "$hardcode_direct_absolute_FC" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L_FC='`$ECHO "$hardcode_minus_L_FC" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var_FC='`$ECHO "$hardcode_shlibpath_var_FC" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic_FC='`$ECHO "$hardcode_automatic_FC" | $SED "$delay_single_quote_subst"`'
+inherit_rpath_FC='`$ECHO "$inherit_rpath_FC" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs_FC='`$ECHO "$link_all_deplibs_FC" | $SED "$delay_single_quote_subst"`'
+always_export_symbols_FC='`$ECHO "$always_export_symbols_FC" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds_FC='`$ECHO "$export_symbols_cmds_FC" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms_FC='`$ECHO "$exclude_expsyms_FC" | $SED "$delay_single_quote_subst"`'
+include_expsyms_FC='`$ECHO "$include_expsyms_FC" | $SED "$delay_single_quote_subst"`'
+prelink_cmds_FC='`$ECHO "$prelink_cmds_FC" | $SED "$delay_single_quote_subst"`'
+postlink_cmds_FC='`$ECHO "$postlink_cmds_FC" | $SED "$delay_single_quote_subst"`'
+file_list_spec_FC='`$ECHO "$file_list_spec_FC" | $SED "$delay_single_quote_subst"`'
+hardcode_action_FC='`$ECHO "$hardcode_action_FC" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs_FC='`$ECHO "$compiler_lib_search_dirs_FC" | $SED "$delay_single_quote_subst"`'
+predep_objects_FC='`$ECHO "$predep_objects_FC" | $SED "$delay_single_quote_subst"`'
+postdep_objects_FC='`$ECHO "$postdep_objects_FC" | $SED "$delay_single_quote_subst"`'
+predeps_FC='`$ECHO "$predeps_FC" | $SED "$delay_single_quote_subst"`'
+postdeps_FC='`$ECHO "$postdeps_FC" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path_FC='`$ECHO "$compiler_lib_search_path_FC" | $SED "$delay_single_quote_subst"`'
 
 LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
 compiler='$compiler_DEFAULT'
 
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
 # Quote evaled strings.
-for var in SED \
+for var in SHELL \
+ECHO \
+SED \
 GREP \
 EGREP \
 FGREP \
@@ -23841,10 +19570,16 @@ LN_S \
 lt_SP2NL \
 lt_NL2SP \
 reload_flag \
+OBJDUMP \
 deplibs_check_method \
 file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+DLLTOOL \
+sharedlib_from_linklib_cmd \
 AR \
 AR_FLAGS \
+archiver_list_spec \
 STRIP \
 RANLIB \
 CC \
@@ -23854,14 +19589,14 @@ lt_cv_sys_global_symbol_pipe \
 lt_cv_sys_global_symbol_to_cdecl \
 lt_cv_sys_global_symbol_to_c_name_address \
 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
-SHELL \
-ECHO \
+nm_file_list_spec \
 lt_prog_compiler_no_builtin_flag \
-lt_prog_compiler_wl \
 lt_prog_compiler_pic \
+lt_prog_compiler_wl \
 lt_prog_compiler_static \
 lt_cv_prog_compiler_c_o \
 need_locks \
+MANIFEST_TOOL \
 DSYMUTIL \
 NMEDIT \
 LIPO \
@@ -23877,7 +19612,6 @@ no_undefined_flag \
 hardcode_libdir_flag_spec \
 hardcode_libdir_flag_spec_ld \
 hardcode_libdir_separator \
-fix_srcfile_path \
 exclude_expsyms \
 include_expsyms \
 file_list_spec \
@@ -23885,6 +19619,7 @@ variables_saved_for_relink \
 libname_spec \
 library_names_spec \
 soname_spec \
+install_override_mode \
 finish_eval \
 old_striplib \
 striplib \
@@ -23894,61 +19629,35 @@ postdep_objects \
 predeps \
 postdeps \
 compiler_lib_search_path \
-LD_F77 \
 LD_FC \
-compiler_F77 \
+reload_flag_FC \
 compiler_FC \
-lt_prog_compiler_no_builtin_flag_F77 \
 lt_prog_compiler_no_builtin_flag_FC \
-lt_prog_compiler_wl_F77 \
-lt_prog_compiler_wl_FC \
-lt_prog_compiler_pic_F77 \
 lt_prog_compiler_pic_FC \
-lt_prog_compiler_static_F77 \
+lt_prog_compiler_wl_FC \
 lt_prog_compiler_static_FC \
-lt_cv_prog_compiler_c_o_F77 \
 lt_cv_prog_compiler_c_o_FC \
-export_dynamic_flag_spec_F77 \
 export_dynamic_flag_spec_FC \
-whole_archive_flag_spec_F77 \
 whole_archive_flag_spec_FC \
-compiler_needs_object_F77 \
 compiler_needs_object_FC \
-with_gnu_ld_F77 \
 with_gnu_ld_FC \
-allow_undefined_flag_F77 \
 allow_undefined_flag_FC \
-no_undefined_flag_F77 \
 no_undefined_flag_FC \
-hardcode_libdir_flag_spec_F77 \
 hardcode_libdir_flag_spec_FC \
-hardcode_libdir_flag_spec_ld_F77 \
 hardcode_libdir_flag_spec_ld_FC \
-hardcode_libdir_separator_F77 \
 hardcode_libdir_separator_FC \
-fix_srcfile_path_F77 \
-fix_srcfile_path_FC \
-exclude_expsyms_F77 \
 exclude_expsyms_FC \
-include_expsyms_F77 \
 include_expsyms_FC \
-file_list_spec_F77 \
 file_list_spec_FC \
-compiler_lib_search_dirs_F77 \
 compiler_lib_search_dirs_FC \
-predep_objects_F77 \
 predep_objects_FC \
-postdep_objects_F77 \
 postdep_objects_FC \
-predeps_F77 \
 predeps_FC \
-postdeps_F77 \
 postdeps_FC \
-compiler_lib_search_path_F77 \
 compiler_lib_search_path_FC; do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -23970,32 +19679,26 @@ module_cmds \
 module_expsym_cmds \
 export_symbols_cmds \
 prelink_cmds \
+postlink_cmds \
 postinstall_cmds \
 postuninstall_cmds \
 finish_cmds \
 sys_lib_search_path_spec \
 sys_lib_dlsearch_path_spec \
-old_archive_cmds_F77 \
+reload_cmds_FC \
 old_archive_cmds_FC \
-old_archive_from_new_cmds_F77 \
 old_archive_from_new_cmds_FC \
-old_archive_from_expsyms_cmds_F77 \
 old_archive_from_expsyms_cmds_FC \
-archive_cmds_F77 \
 archive_cmds_FC \
-archive_expsym_cmds_F77 \
 archive_expsym_cmds_FC \
-module_cmds_F77 \
 module_cmds_FC \
-module_expsym_cmds_F77 \
 module_expsym_cmds_FC \
-export_symbols_cmds_F77 \
 export_symbols_cmds_FC \
-prelink_cmds_F77 \
-prelink_cmds_FC; do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+prelink_cmds_FC \
+postlink_cmds_FC; do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -24003,12 +19706,6 @@ prelink_cmds_FC; do
     esac
 done
 
-# Fix-up fallback echo if it was mangled by the above quoting rules.
-case \$lt_ECHO in
-*'\\\$0 --fallback-echo"')  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
-  ;;
-esac
-
 ac_aux_dir='$ac_aux_dir'
 xsi_shell='$xsi_shell'
 lt_shell_append='$lt_shell_append'
@@ -24031,8 +19728,6 @@ fi
 
 
 
-
-
 _ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
@@ -24041,32 +19736,28 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
-    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+    "cf_config.h") CONFIG_HEADERS="$CONFIG_HEADERS cf_config.h" ;;
     "nfconfig.inc") CONFIG_HEADERS="$CONFIG_HEADERS nfconfig.inc:nfconfig.in" ;;
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
     "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
-    "gridspec/tools/make_hgrid/run_tests") CONFIG_FILES="$CONFIG_FILES gridspec/tools/make_hgrid/run_tests" ;;
-    "gridspec/tools/make_vgrid/run_tests") CONFIG_FILES="$CONFIG_FILES gridspec/tools/make_vgrid/run_tests" ;;
-    "gridspec/tools/make_topog/run_tests") CONFIG_FILES="$CONFIG_FILES gridspec/tools/make_topog/run_tests" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-    "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
-    "cfcheck/Makefile") CONFIG_FILES="$CONFIG_FILES cfcheck/Makefile" ;;
+    "pycf/Makefile") CONFIG_FILES="$CONFIG_FILES pycf/Makefile" ;;
+    "pycf/__init__.py") CONFIG_FILES="$CONFIG_FILES pycf/__init__.py" ;;
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
-    "gridspec/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec/Makefile" ;;
-    "gridspec/shared/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec/shared/Makefile" ;;
-    "gridspec/shared/mosaic/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec/shared/mosaic/Makefile" ;;
-    "gridspec/tools/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec/tools/Makefile" ;;
-    "gridspec/tools/shared/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec/tools/shared/Makefile" ;;
-    "gridspec/tools/make_hgrid/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec/tools/make_hgrid/Makefile" ;;
-    "gridspec/tools/make_mosaic/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec/tools/make_mosaic/Makefile" ;;
-    "gridspec/tools/make_coupler_mosaic/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec/tools/make_coupler_mosaic/Makefile" ;;
-    "gridspec/tools/fregrid/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec/tools/fregrid/Makefile" ;;
-    "gridspec/tools/make_topog/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec/tools/make_topog/Makefile" ;;
-    "gridspec/tools/make_vgrid/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec/tools/make_vgrid/Makefile" ;;
-
-  *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
-   { (exit 1); exit 1; }; };;
+    "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
+    "gridspec_api/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec_api/Makefile" ;;
+    "gridspec_api/global/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec_api/global/Makefile" ;;
+    "gridspec_api/axis/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec_api/axis/Makefile" ;;
+    "gridspec_api/coord/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec_api/coord/Makefile" ;;
+    "gridspec_api/grid/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec_api/grid/Makefile" ;;
+    "gridspec_api/data/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec_api/data/Makefile" ;;
+    "gridspec_api/regrid/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec_api/regrid/Makefile" ;;
+    "gridspec_api/mosaic/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec_api/mosaic/Makefile" ;;
+    "gridspec_api/host/Makefile") CONFIG_FILES="$CONFIG_FILES gridspec_api/host/Makefile" ;;
+    "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
+    "setup.py") CONFIG_FILES="$CONFIG_FILES setup.py" ;;
+
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
 done
 
@@ -24089,26 +19780,24 @@ fi
 # after its creation but before its name has been assigned to `$tmp'.
 $debug ||
 {
-  tmp=
+  tmp= ac_tmp=
   trap 'exit_status=$?
-  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+  : "${ac_tmp:=$tmp}"
+  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
 ' 0
-  trap '{ (exit 1); exit 1; }' 1 2 13 15
+  trap 'as_fn_exit 1' 1 2 13 15
 }
 # Create a (secure) tmp directory for tmp files.
 
 {
   tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -n "$tmp" && test -d "$tmp"
+  test -d "$tmp"
 }  ||
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
-} ||
-{
-   $as_echo "$as_me: cannot create a temporary directory in ." >&2
-   { (exit 1); exit 1; }
-}
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -24116,7 +19805,13 @@ $debug ||
 if test -n "$CONFIG_FILES"; then
 
 
-ac_cr='
'
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+  eval ac_cr=\$\'\\r\'
+fi
 ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
 if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
   ac_cs_awk_cr='\\r'
@@ -24124,7 +19819,7 @@ else
   ac_cs_awk_cr=$ac_cr
 fi
 
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
 _ACEOF
 
 
@@ -24133,24 +19828,18 @@ _ACEOF
   echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
   echo "_ACEOF"
 } >conf$$subs.sh ||
-  { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
-ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   . ./conf$$subs.sh ||
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
 
   ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
   if test $ac_delim_n = $ac_delim_num; then
     break
   elif $ac_last_try; then
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -24158,7 +19847,7 @@ done
 rm -f conf$$subs.sh
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
 _ACEOF
 sed -n '
 h
@@ -24172,7 +19861,7 @@ s/'"$ac_delim"'$//
 t delim
 :nl
 h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
 t more1
 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
 p
@@ -24186,7 +19875,7 @@ s/.\{148\}//
 t nl
 :delim
 h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
 t more2
 s/["\\]/\\&/g; s/^/"/; s/$/"/
 p
@@ -24206,7 +19895,7 @@ t delim
 rm -f conf$$subs.awk
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
   for (key in S) S_is_set[key] = 1
   FS = ""
 
@@ -24238,23 +19927,29 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
   sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
 else
   cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
-  || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
-$as_echo "$as_me: error: could not setup config files machinery" >&2;}
-   { (exit 1); exit 1; }; }
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
 # trailing colons and then remove the whole line if VPATH becomes empty
 # (actually we leave an empty line to preserve line numbers).
 if test "x$srcdir" = x.; then
-  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[	 ]*\):*/\1/
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=[	 ]*/{
+h
+s///
+s/^/:/
+s/[	 ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
 s/:*$//
+x
+s/\(=[	 ]*\).*/\1/
+G
+s/\n//
 s/^[^=]*=[	 ]*$//
 }'
 fi
@@ -24266,7 +19961,7 @@ fi # test -n "$CONFIG_FILES"
 # No need to generate them if there are no CONFIG_HEADERS.
 # This happens for instance with `./config.status Makefile'.
 if test -n "$CONFIG_HEADERS"; then
-cat >"$tmp/defines.awk" <<\_ACAWK ||
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
 BEGIN {
 _ACEOF
 
@@ -24278,13 +19973,11 @@ _ACEOF
 # handling of long lines.
 ac_delim='%!_!# '
 for ac_last_try in false false :; do
-  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
-  if test -z "$ac_t"; then
+  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_tt"; then
     break
   elif $ac_last_try; then
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -24369,9 +20062,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-  { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5
-$as_echo "$as_me: error: could not setup config headers machinery" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
 fi # test -n "$CONFIG_HEADERS"
 
 
@@ -24384,9 +20075,7 @@ do
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
-$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
-   { (exit 1); exit 1; }; };;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -24405,7 +20094,7 @@ $as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
     for ac_f
     do
       case $ac_f in
-      -) ac_f="$tmp/stdin";;
+      -) ac_f="$ac_tmp/stdin";;
       *) # Look for the file first in the build tree, then in the source tree
 	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
 	 # because $ac_f cannot contain `:'.
@@ -24414,12 +20103,10 @@ $as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
-   { (exit 1); exit 1; }; };;
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
-      ac_file_inputs="$ac_file_inputs '$ac_f'"
+      as_fn_append ac_file_inputs " '$ac_f'"
     done
 
     # Let's still pretend it is `configure' which instantiates (i.e., don't
@@ -24430,7 +20117,7 @@ $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
 	`' by configure.'
     if test x"$ac_file" != x-; then
       configure_input="$ac_file.  $configure_input"
-      { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
 $as_echo "$as_me: creating $ac_file" >&6;}
     fi
     # Neutralize special characters interpreted by sed in replacement strings.
@@ -24442,10 +20129,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}
     esac
 
     case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; } ;;
+    *:-:* | *:-) cat >"$ac_tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
     esac
     ;;
   esac
@@ -24473,47 +20158,7 @@ $as_echo X"$ac_file" |
 	    q
 	  }
 	  s/.*/./; q'`
-  { as_dir="$ac_dir"
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_dir" : 'X\(//\)[^/]' \| \
-	 X"$as_dir" : 'X\(//\)$' \| \
-	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
+  as_dir="$ac_dir"; as_fn_mkdir_p
   ac_builddir=.
 
 case "$ac_dir" in
@@ -24570,7 +20215,6 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # If the template does not know about datarootdir, expand it.
 # FIXME: This hack should be removed a few years after 2.60.
 ac_datarootdir_hack=; ac_datarootdir_seen=
-
 ac_sed_dataroot='
 /datarootdir/ {
   p
@@ -24580,12 +20224,11 @@ ac_sed_dataroot='
 /@docdir@/p
 /@infodir@/p
 /@localedir@/p
-/@mandir@/p
-'
+/@mandir@/p'
 case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
 *datarootdir*) ac_datarootdir_seen=yes;;
 *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
@@ -24595,7 +20238,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
   s&@infodir@&$infodir&g
   s&@localedir@&$localedir&g
   s&@mandir@&$mandir&g
-    s&\\\${datarootdir}&$datarootdir&g' ;;
+  s&\\\${datarootdir}&$datarootdir&g' ;;
 esac
 _ACEOF
 
@@ -24623,27 +20266,24 @@ s&@INSTALL@&$ac_INSTALL&;t t
 s&@MKDIR_P@&$ac_MKDIR_P&;t t
 $ac_datarootdir_hack
 "
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
-  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
-  { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&5
+  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
+      "$ac_tmp/out"`; test -z "$ac_out"; } &&
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&2;}
+which seems to be undefined.  Please make sure it is defined" >&2;}
 
-  rm -f "$tmp/stdin"
+  rm -f "$ac_tmp/stdin"
   case $ac_file in
-  -) cat "$tmp/out" && rm -f "$tmp/out";;
-  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
   esac \
-  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
   :H)
   #
@@ -24652,27 +20292,21 @@ $as_echo "$as_me: error: could not create $ac_file" >&2;}
   if test x"$ac_file" != x-; then
     {
       $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
-    } >"$tmp/config.h" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
-    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
-      { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+    } >"$ac_tmp/config.h" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
-      mv "$tmp/config.h" "$ac_file" \
-	|| { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+      mv "$ac_tmp/config.h" "$ac_file" \
+	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5
-$as_echo "$as_me: error: could not create -" >&2;}
-   { (exit 1); exit 1; }; }
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error $? "could not create -" "$LINENO" 5
   fi
 # Compute "$ac_file"'s index in $config_headers.
 _am_arg="$ac_file"
@@ -24710,7 +20344,7 @@ $as_echo X"$_am_arg" |
 	  s/.*/./; q'`/stamp-h$_am_stamp_count
  ;;
 
-  :C)  { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5
+  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
 $as_echo "$as_me: executing $ac_file commands" >&6;}
  ;;
   esac
@@ -24782,48 +20416,13 @@ $as_echo X"$mf" |
       s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
 	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
       # Make sure the directory exists.
-      test -f "$dirpart/$file" && continue
-      fdir=`$as_dirname -- "$file" ||
-$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$file" : 'X\(//\)[^/]' \| \
-	 X"$file" : 'X\(//\)$' \| \
-	 X"$file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-      { as_dir=$dirpart/$fdir
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_dir" : 'X\(//\)[^/]' \| \
-	 X"$as_dir" : 'X\(//\)$' \| \
-	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
+      test -f "$dirpart/$file" && continue
+      fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$file" : 'X\(//\)[^/]' \| \
+	 X"$file" : 'X\(//\)$' \| \
+	 X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
 	    s//\1/
 	    q
@@ -24841,12 +20440,7 @@ $as_echo X"$as_dir" |
 	    q
 	  }
 	  s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
+      as_dir=$dirpart/$fdir; as_fn_mkdir_p
       # echo "creating $dirpart/$file"
       echo '# dummy' > "$dirpart/$file"
     done
@@ -24874,7 +20468,8 @@ $as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -24902,26 +20497,17 @@ $as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
 
 
 # The names of the tagged configurations supported by this script.
-available_tags="F77 FC "
+available_tags="FC "
 
 # ### BEGIN LIBTOOL CONFIG
 
-# Whether or not to build shared libraries.
-build_libtool_libs=$enable_shared
-
-# Assembler program.
-AS=$AS
-
-# DLL creation program.
-DLLTOOL=$DLLTOOL
-
-# Object dumper program.
-OBJDUMP=$OBJDUMP
-
 # Which release of libtool.m4 was used?
 macro_version=$macro_version
 macro_revision=$macro_revision
 
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
 # Whether or not to build static libraries.
 build_old_libs=$enable_static
 
@@ -24931,6 +20517,12 @@ pic_mode=$pic_mode
 # Whether or not to optimize for fast installation.
 fast_install=$enable_fast_install
 
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
 # The host system.
 host_alias=$host_alias
 host=$host
@@ -24980,20 +20572,42 @@ SP2NL=$lt_lt_SP2NL
 # turn newlines into spaces.
 NL2SP=$lt_lt_NL2SP
 
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+
+# An object symbol dumper.
+OBJDUMP=$lt_OBJDUMP
 
 # Method to check whether dependent libraries are shared objects.
 deplibs_check_method=$lt_deplibs_check_method
 
-# Command to use when deplibs_check_method == "file_magic".
+# Command to use when deplibs_check_method = "file_magic".
 file_magic_cmd=$lt_file_magic_cmd
 
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
 # The archiver.
 AR=$lt_AR
+
+# Flags to create an archive.
 AR_FLAGS=$lt_AR_FLAGS
 
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
 # A symbol stripping program.
 STRIP=$lt_STRIP
 
@@ -25002,6 +20616,9 @@ RANLIB=$lt_RANLIB
 old_postinstall_cmds=$lt_old_postinstall_cmds
 old_postuninstall_cmds=$lt_old_postuninstall_cmds
 
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
 # A C compiler.
 LTCC=$lt_CC
 
@@ -25020,14 +20637,14 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
 # Transform the output of nm in a C name address pair when lib prefix is needed.
 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
 
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
 
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
 
-# An echo program that does not interpret backslashes.
-ECHO=$lt_ECHO
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
 
 # Used to examine libraries when file_magic_cmd begins with "file".
 MAGIC_CMD=$MAGIC_CMD
@@ -25035,6 +20652,9 @@ MAGIC_CMD=$MAGIC_CMD
 # Must we lock files when doing compilation?
 need_locks=$lt_need_locks
 
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
 DSYMUTIL=$lt_DSYMUTIL
 
@@ -25091,6 +20711,9 @@ library_names_spec=$lt_library_names_spec
 # The coded name of the library, if different from the real name.
 soname_spec=$lt_soname_spec
 
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
 # Command to use after installation of a shared archive.
 postinstall_cmds=$lt_postinstall_cmds
 
@@ -25130,6 +20753,10 @@ striplib=$lt_striplib
 # The linker used to build libraries.
 LD=$lt_LD
 
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
 # Commands used to build an old-style archive.
 old_archive_cmds=$lt_old_archive_cmds
 
@@ -25142,12 +20769,12 @@ with_gcc=$GCC
 # Compiler flag to turn off builtin functions.
 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
 
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl
-
 # Additional compiler flags for building library objects.
 pic_flag=$lt_lt_prog_compiler_pic
 
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
 # Compiler flag to prevent dynamic linking.
 link_static_flag=$lt_lt_prog_compiler_static
 
@@ -25234,9 +20861,6 @@ inherit_rpath=$inherit_rpath
 # Whether libtool must link a program against all its dependency libraries.
 link_all_deplibs=$link_all_deplibs
 
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
-
 # Set to "yes" if exported symbols are required.
 always_export_symbols=$always_export_symbols
 
@@ -25252,6 +20876,9 @@ include_expsyms=$lt_include_expsyms
 # Commands necessary for linking programs (against libraries) with templates.
 prelink_cmds=$lt_prelink_cmds
 
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
 # Specify filename containing input files.
 file_list_spec=$lt_file_list_spec
 
@@ -25298,376 +20925,184 @@ ltmain="$ac_aux_dir/ltmain.sh"
   # if finds mixed CR/LF and LF-only lines.  Since sed operates in
   # text mode, it properly converts lines to CR/LF.  This bash problem
   # is reportedly fixed, but why not run on old versions too?
-  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  case $xsi_shell in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result="${1##*/}"
-}
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-  func_basename_result="${1##*/}"
-}
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-func_stripname ()
-{
-  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-  # positional parameters, so assign one to ordinary parameter first.
-  func_stripname_result=${3}
-  func_stripname_result=${func_stripname_result#"${1}"}
-  func_stripname_result=${func_stripname_result%"${2}"}
-}
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=${1%%=*}
-  func_opt_split_arg=${1#*=}
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  case ${1} in
-    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-    *)    func_lo2o_result=${1} ;;
-  esac
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=${1%.*}.lo
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=$(( $* ))
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=${#1}
-}
-
-_LT_EOF
-    ;;
-  *) # Bourne compatible functions.
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
-
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-  case ${2} in
-    .*) func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
-    *)  func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
-  esac
-}
-
-# sed scripts:
-my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
-my_sed_long_arg='1s/^-[^=]*=//'
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
-  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=`expr "$@"`
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
-}
-
-_LT_EOF
-esac
-
-case $lt_shell_append in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1+=\$2"
-}
-_LT_EOF
-    ;;
-  *)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$1=\$$1\$2"
-}
-
-_LT_EOF
-    ;;
-  esac
-
-
-  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  mv -f "$cfgfile" "$ofile" ||
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  if test x"$xsi_shell" = xyes; then
+  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\    # positional parameters, so assign one to ordinary parameter first.\
+\    func_stripname_result=${3}\
+\    func_stripname_result=${func_stripname_result#"${1}"}\
+\    func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\    func_split_long_opt_name=${1%%=*}\
+\    func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\    func_split_short_opt_arg=${1#??}\
+\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\    case ${1} in\
+\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\      *)    func_lo2o_result=${1} ;;\
+\    esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+    func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+    func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+    func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+    eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\    func_quote_for_eval "${2}"\
+\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+   mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
 
 
     cat <<_LT_EOF >> "$ofile"
 
-# ### BEGIN LIBTOOL TAG CONFIG: F77
-
-# The linker used to build libraries.
-LD=$lt_LD_F77
-
-# Commands used to build an old-style archive.
-old_archive_cmds=$lt_old_archive_cmds_F77
-
-# A language specific compiler.
-CC=$lt_compiler_F77
-
-# Is the compiler the GNU compiler?
-with_gcc=$GCC_F77
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77
-
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl_F77
-
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic_F77
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_lt_prog_compiler_static_F77
-
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77
-
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=$archive_cmds_need_lc_F77
-
-# Whether or not to disallow shared libs when runtime libs are static.
-allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77
-
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77
-
-# Whether the compiler copes with passing no objects directly.
-compiler_needs_object=$lt_compiler_needs_object_F77
-
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77
-
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77
-
-# Commands used to build a shared archive.
-archive_cmds=$lt_archive_cmds_F77
-archive_expsym_cmds=$lt_archive_expsym_cmds_F77
-
-# Commands used to build a loadable module if different from building
-# a shared archive.
-module_cmds=$lt_module_cmds_F77
-module_expsym_cmds=$lt_module_expsym_cmds_F77
-
-# Whether we are building with GNU ld or not.
-with_gnu_ld=$lt_with_gnu_ld_F77
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_allow_undefined_flag_F77
-
-# Flag that enforces no undefined symbols.
-no_undefined_flag=$lt_no_undefined_flag_F77
-
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist
-hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77
-
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77
-
-# Whether we need a single "-rpath" flag with a separated argument.
-hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77
-
-# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
-# DIR into the resulting binary.
-hardcode_direct=$hardcode_direct_F77
-
-# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
-# DIR into the resulting binary and the resulting library dependency is
-# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
-# library is relocated.
-hardcode_direct_absolute=$hardcode_direct_absolute_F77
-
-# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
-# into the resulting binary.
-hardcode_minus_L=$hardcode_minus_L_F77
-
-# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
-# into the resulting binary.
-hardcode_shlibpath_var=$hardcode_shlibpath_var_F77
-
-# Set to "yes" if building a shared library automatically hardcodes DIR
-# into the library and all subsequent libraries and executables linked
-# against it.
-hardcode_automatic=$hardcode_automatic_F77
-
-# Set to yes if linker adds runtime paths of dependent libraries
-# to runtime path list.
-inherit_rpath=$inherit_rpath_F77
-
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$link_all_deplibs_F77
-
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path_F77
-
-# Set to "yes" if exported symbols are required.
-always_export_symbols=$always_export_symbols_F77
-
-# The commands to list exported symbols.
-export_symbols_cmds=$lt_export_symbols_cmds_F77
-
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms=$lt_exclude_expsyms_F77
-
-# Symbols that must always be exported.
-include_expsyms=$lt_include_expsyms_F77
-
-# Commands necessary for linking programs (against libraries) with templates.
-prelink_cmds=$lt_prelink_cmds_F77
-
-# Specify filename containing input files.
-file_list_spec=$lt_file_list_spec_F77
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action_F77
-
-# The directories searched by this compiler when creating a shared library.
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_F77
-
-# Dependencies to place before and after the objects being linked to
-# create a shared library.
-predep_objects=$lt_predep_objects_F77
-postdep_objects=$lt_postdep_objects_F77
-predeps=$lt_predeps_F77
-postdeps=$lt_postdeps_F77
-
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path_F77
-
-# ### END LIBTOOL TAG CONFIG: F77
-_LT_EOF
-
-
-    cat <<_LT_EOF >> "$ofile"
-
 # ### BEGIN LIBTOOL TAG CONFIG: FC
 
 # The linker used to build libraries.
 LD=$lt_LD_FC
 
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag_FC
+reload_cmds=$lt_reload_cmds_FC
+
 # Commands used to build an old-style archive.
 old_archive_cmds=$lt_old_archive_cmds_FC
 
@@ -25680,12 +21115,12 @@ with_gcc=$GCC_FC
 # Compiler flag to turn off builtin functions.
 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_FC
 
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl_FC
-
 # Additional compiler flags for building library objects.
 pic_flag=$lt_lt_prog_compiler_pic_FC
 
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_FC
+
 # Compiler flag to prevent dynamic linking.
 link_static_flag=$lt_lt_prog_compiler_static_FC
 
@@ -25772,9 +21207,6 @@ inherit_rpath=$inherit_rpath_FC
 # Whether libtool must link a program against all its dependency libraries.
 link_all_deplibs=$link_all_deplibs_FC
 
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path_FC
-
 # Set to "yes" if exported symbols are required.
 always_export_symbols=$always_export_symbols_FC
 
@@ -25790,6 +21222,9 @@ include_expsyms=$lt_include_expsyms_FC
 # Commands necessary for linking programs (against libraries) with templates.
 prelink_cmds=$lt_prelink_cmds_FC
 
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds_FC
+
 # Specify filename containing input files.
 file_list_spec=$lt_file_list_spec_FC
 
@@ -25814,23 +21249,17 @@ compiler_lib_search_path=$lt_compiler_lib_search_path_FC
 _LT_EOF
 
  ;;
-    "gridspec/tools/make_hgrid/run_tests":F) chmod +x gridspec/tools/make_hgrid/run_tests ;;
-    "gridspec/tools/make_vgrid/run_tests":F) chmod +x gridspec/tools/make_vgrid/run_tests ;;
-    "gridspec/tools/make_topog/run_tests":F) chmod +x gridspec/tools/make_topog/run_tests ;;
 
   esac
 done # for ac_tag
 
 
-{ (exit 0); exit 0; }
+as_fn_exit 0
 _ACEOF
-chmod +x $CONFIG_STATUS
 ac_clean_files=$ac_clean_files_save
 
 test $ac_write_fail = 0 ||
-  { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
 
 
 # configure is writing to config.log, and then calls config.status.
@@ -25851,10 +21280,10 @@ if test "$no_create" != yes; then
   exec 5>>config.log
   # Use ||, not &&, to avoid exiting from the if with $? = 1, which
   # would make configure fail if this is the last instruction.
-  $ac_cs_success || { (exit 1); exit 1; }
+  $ac_cs_success || as_fn_exit 1
 fi
 if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
-  { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
diff --git a/configure.ac b/configure.ac
index 0695878..7ca552e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,18 +1,19 @@
 #                                               -*- Autoconf -*-
 ## Process this file with autoconf to produce a configure script.
+## $Id: configure.ac 925 2012-03-23 20:05:26Z pletzer $
 
 # This is part of Unidata's NetCDF CF Library. package. Copyright
 # 2006, see the COPYRIGHT file for more information.
 
-## This puts the cvs ID tag in the output configure script.
-AC_REVISION([$Id: configure.ac,v 1.6 2009/11/16 15:42:12 zhi Exp $])
+## This puts the svn ID tag in the output configure script.
+AC_REVISION([$Id: configure.ac 925 2012-03-23 20:05:26Z pletzer $])
 
 ## Running autoconf on this file will trigger a warning if 
 ## autoconf is not at least the specified version.
 AC_PREREQ([2.59])
 
 ## Initialize with name, version, and support email address. 
-AC_INIT([libcf], [1.0-alpha5], [support at unidata.ucar.edu])
+AC_INIT([libcf], [1.0-beta10], [pletzer at txcorp.com])
 AC_CONFIG_MACRO_DIR([m4])
 
 AC_MSG_NOTICE([libcf AC_PACKAGE_VERSION])
@@ -20,9 +21,9 @@ AC_MSG_NOTICE([libcf AC_PACKAGE_VERSION])
 # Find out about the host we're building on.
 AC_CANONICAL_HOST
 
-# We will output a config.h for the C library, and a fortran inc file,
+# We will output a libcf_config.h for the C library, and a fortran inc file,
 # nfconfig.inc.
-AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_HEADERS([cf_config.h])
 AC_CONFIG_HEADERS([nfconfig.inc:nfconfig.in], 
    [sed '1d;s%^/\* \(.*\) \*/%\1%' nfconfig.inc >conftest.tmp && mv conftest.tmp nfconfig.inc])
 
@@ -34,22 +35,70 @@ AC_CONFIG_SRCDIR([src/nccoord.c])
 
 AC_MSG_NOTICE([checking user options])
 
-# Turn off shared libraries by default
-AM_DISABLE_SHARED
+# test if --enable-shared was selected
+AM_CONDITIONAL(HAVE_SHARED, test x$enable_shared = xyes)
+if test "x$enable_shared" = "xyes"; then
+	AC_SUBST(HAVE_SHARED, [1])
+else
+	AC_SUBST(HAVE_SHARED, [0])
+fi
+#check for apple
+darwin_os=''
+case $host in
+  *-apple-darwin*)
+    darwin_os='yes'
+  ;;
+esac
+AM_CONDITIONAL(HAVE_DARWIN, test x$darwin_os = xyes)
+if test "x$darwin_os" = "xyes"; then
+   AC_SUBST([HAVE_DARWIN], [1])
+else
+   AC_SUBST([HAVE_DARWIN], [0])
+fi
 
-# The autoconf manual suggests the following to set a var if it's not
-# already set: test "${var+set}" = set || var={value}
+# Find the C compiler.
+AC_MSG_NOTICE([finding C compiler])
+AC_PROG_CC
+AM_PROG_CC_C_O
 
 # For backward compatibility, check to see if the user has set FC to
 # null. If so, treat that as the --disable-fortran option to
 # configure.
-
-# Did the user set fc to null?
 AC_MSG_CHECKING([whether FC is set to ''])
 nc_null_fc=no
 test "x${FC+set}" = xset && test "x$FC" = x && nc_null_fc=yes
 AC_MSG_RESULT([$nc_null_fc])
 
+if test "$nc_null_fc" = "no"  || test "$nc_build_f90" = "yes" ; then
+   # Find fortran compiler. If FC isn't set after AC_PROG_FC, we couldn't
+   # find a fortran compiler. If the user requested the fortran API, then
+   # bail out right here.
+   AC_MSG_NOTICE([finding Fortran compiler (required, even if Fortran API is not desired)])
+
+   # We must call AC_PROG_FC here, otherwise the LIBTOOL macro below
+   # will call it, and reset FC to g77.
+   AC_PROG_FC
+
+   # To determine fortran subroutine name mangling (C gridspec needs 
+   # Fortran lapack/blas)
+   AC_FC_WRAPPERS
+   AC_FC_LIBRARY_LDFLAGS
+   LIBS="$LIBS $FCLIBS"
+
+   if test "x$nc_build_f90" = xyes; then
+      AC_MSG_NOTICE([configuring fortran])
+      # Some f90 compilers change the case of the mod file names. Others
+      # require special flags to be set to deal with .f90 files. Find out
+      # about this compiler.
+      AC_LANG_PUSH(Fortran)
+      AC_FC_SRCEXT(f90)
+      AC_SEARCH_LIBS([nf90_open], [netcdf])
+      AC_LANG_POP(Fortran)
+      AX_F90_MODULE_FLAG
+      AC_SUBST(MOD_FLAG, ${ax_cv_f90_modflag})
+   fi
+fi
+
 # Does the user want to build documentation?
 AC_MSG_CHECKING([whether documentation is to be built])
 AC_ARG_ENABLE([docs],
@@ -60,15 +109,6 @@ test "x$enable_docs" = xyes || enable_docs=no
 AC_MSG_RESULT($enable_docs)
 AM_CONDITIONAL(BUILD_DOCS, [test x$enable_docs = xyes])
 
-# Does the user want to build gridspec tools?
-AC_MSG_CHECKING([whether gridspec tools are to be built])
-AC_ARG_ENABLE([gridspec],
-              [AS_HELP_STRING([--enable-gridspec],
-                              [build the gridspec tools])])
-test "x$enable_gridspec" = xyes || enable_gridspec=no
-AC_MSG_RESULT($enable_gridspec)
-AM_CONDITIONAL(BUILD_GRIDSPEC, [test x$enable_gridspec = xyes])
-
 # Does the user want to fetch test data and run extra gridspec tests?
 AC_MSG_CHECKING([whether gridspec test data should be fetched from Unidata FTP site])
 AC_ARG_ENABLE([gridspec-file-tests],
@@ -78,15 +118,6 @@ test "x$enable_gridspec_file_tests" = xyes || enable_gridspec_file_tests=no
 AC_MSG_RESULT($enable_gridspec_file_tests)
 AM_CONDITIONAL(BUILD_GRIDSPEC_FILE_TESTS, [test x$enable_gridspec_file_tests = xyes])
 
-# Does the user want to build cfcheck?
-AC_MSG_CHECKING([whether cfcheck is to be built])
-AC_ARG_ENABLE([cfcheck],
-              [AS_HELP_STRING([--enable-cfcheck],
-                              [still in development - not working yet])])
-test "x$enable_cfcheck" = xyes || enable_cfcheck=no
-AC_MSG_RESULT($enable_cfcheck)
-AM_CONDITIONAL(BUILD_CFCHECK, [test x$enable_cfcheck = xyes])
-
 # Does the user want to enable logging?
 AC_MSG_CHECKING([whether logging is enabled (useful to CF developers, mainly])
 AC_ARG_ENABLE([logging],
@@ -99,27 +130,27 @@ if test "x$enable_logging" = xyes; then
    AC_DEFINE([LOGGING], 1, [if true, turn on logging])
 fi
 
-# Does the user want to use netcdf-4?
-AC_MSG_CHECKING([whether netCDF-4 is to be used])
-AC_ARG_ENABLE([netcdf-4],
-              [AS_HELP_STRING([--enable-netcdf-4],
-                              [build with netcdf-4 (HDF5 is required)])])
-
-# If hdf5 dir is set, turn on enable-netcdf-4.
-if test "x$with_hdf5" != x; then
-   enable_netcdf_4=yes
-else
-   test "x$enable_netcdf_4" = xyes || enable_netcdf_4=no
+# Does the user want parallel processing?
+AC_MSG_CHECKING([whether parallel processing is enabled (CC should be set to mpicc or equivalent])
+AC_ARG_ENABLE([parallel],
+              [AS_HELP_STRING([--enable-parallel],
+                              [enable parallel processing in GRIDSPEC code.])])
+test "x$enable_parallel" = "xyes" || enable_parallel=no
+AC_MSG_RESULT([$enable_parallel])
+if test "x$enable_parallel" = xyes; then
+   AC_DEFINE([USE_PARALLEL], 1, [if true, turn on parallel processing])
 fi
-AC_MSG_RESULT($enable_netcdf_4)
-AM_CONDITIONAL(USE_NETCDF4, [test x$enable_netcdf_4 = xyes])
-if test "x$enable_netcdf_4" = xyes; then
-   AC_DEFINE([USE_NETCDF4], 1, [if true, use netCDF-4])
-fi
-
-# Does the user want to turn on HDF4 read ability?
-AC_ARG_ENABLE([hdf4], [AS_HELP_STRING([--enable-hdf4],
-              [build netcdf-4 with HDF4 read capability (HDF4, HDF5 and zlib required)])])
+AM_CONDITIONAL(BUILD_PARALLEL, [test x$enable_parallel = xyes])
+
+# Does the user want to run extra parallel tests?
+AC_MSG_CHECKING([whether parallel tests should be run])
+AC_ARG_ENABLE([parallel-tests],
+              [AS_HELP_STRING([--enable-parallel-tests],
+                              [Run extra parallel tests. Ignored if \
+                               parallel processing is not enabled.])])
+test "x$enable_parallel_tests" = xyes || enable_parallel_tests=no
+AC_MSG_RESULT($enable_parallel_tests)
+AM_CONDITIONAL(TEST_PARALLEL, [test "x$enable_parallel" = xyes -a "x$enable_parallel_tests" = xyes])
 
 # Does the user want extra tests on CF sample files?
 AC_MSG_CHECKING([whether extra tests on sample data should be performed])
@@ -132,64 +163,21 @@ test "x$enable_extra_data_tests" = xyes || enable_extra_data_tests=no
 AC_MSG_RESULT($enable_extra_data_tests)
 AM_CONDITIONAL(EXTRA_DATA_TESTS, [test x$enable_extra_data_tests = xyes])
 
-# Did the user specify a location for the HDF5 library?
-AC_MSG_CHECKING([whether a location for the HDF5 library was specified])
-AC_ARG_WITH([hdf5],
-              [AS_HELP_STRING([--with-hdf5=<directory>],
-                              [Specify location of HDF5 library. Configure will expect \
-			      to find subdirs include and lib.])],
-            [HDF5DIR=$with_hdf5])
-AC_MSG_RESULT([$HDF5DIR])
-AM_CONDITIONAL(USE_HDF5_DIR, [test ! "x$HDF5DIR" = x])
-AC_SUBST(HDF5DIR, [$HDF5DIR])
-if test ! "x$HDF5DIR" = x; then
-   LDFLAGS="${LDFLAGS} -L$HDF5DIR/lib"
+libcf_build_regrid=no
+AC_MSG_CHECKING([whether regridding API is desired])
+AC_ARG_ENABLE([regrid], 
+			[AS_HELP_STRING([--disable-regrid],
+			["don't try to build regrid API"])])
+if test "x$enable_regrid" != "xno"; then 
+   libcf_build_regrid=yes
 fi
 
-# Did the user specify a location for the HDF4 library?
-AC_MSG_CHECKING([whether a location for the HDF4 library was specified])
-AC_ARG_WITH([hdf4],
-              [AS_HELP_STRING([--with-hdf4=<directory>],
-                              [Specify location of HDF4 library. Configure will \
-			      expect to find subdirs include and lib.])],
-            [HDF4DIR=$with_hdf4])
-AC_MSG_RESULT([$HDF4DIR])
-AM_CONDITIONAL(USE_HDF4_DIR, [test ! "x$HDF4DIR" = x])
-AC_SUBST(HDF4DIR, [$HDF4DIR])
-AM_CONDITIONAL(USE_HDF4, [test x$enable_hdf4 = xyes])
-
-# Did the user specify a location for the ZLIB library?
-AC_MSG_CHECKING([whether a location for the ZLIB library was specified])
-AC_ARG_WITH([zlib],
-              [AS_HELP_STRING([--with-zlib=<directory>],
-                              [Specify location of ZLIB library. ZLIB is required \
-			      for netCDF-4. Configure will expect to find subdirs \
-			      include and lib.])],
-            [ZLIBDIR=$with_zlib])
-AC_MSG_RESULT([$ZLIBDIR])
-AC_SUBST(ZLIBDIR, [$ZLIBDIR])
-
-# Did the user specify a location for the SZLIB library?
-AC_MSG_CHECKING([whether a location for the SZLIB library was specified])
-AC_ARG_WITH([szlib],
-              [AS_HELP_STRING([--with-szlib=<directory>],
-                              [Specify location of SZLIB library. SZLIB is not \
-			      required for netCDF-4, but you must specify its location \
-			      if HDF5 was built with SZLIB. Configure will expect to \
-			      find subdirs include and lib.])],
-            [SZLIBDIR=$with_szlib])
-AC_MSG_RESULT([$SZLIBDIR])
-AC_SUBST(SZLIBDIR, [$SZLIBDIR])
-
-AM_CONDITIONAL(USE_ZLIB_DIR, [test ! "x$ZLIBDIR" = x])
-AM_CONDITIONAL(USE_SZLIB_DIR, [test ! "x$SZLIBDIR" = x])
-
 # Do we want to build the fortran API? Check for --disable-f90
-nc_build_f90=yes
+nc_build_f90=no
 AC_MSG_CHECKING([whether Fortran 90 API is desired])
 AC_ARG_ENABLE([f90],
               [AS_HELP_STRING([--disable-f90],
-                              [don't try to build Fortran 90 API])])
+                              ["don't try to build Fortran 90 API"])])
 test "x$enable_f90" = "xno" && nc_build_f90=no
 test "x$nc_null_fc" = xyes && nc_build_f90=no
 AC_MSG_RESULT([$nc_build_f90])
@@ -207,44 +195,40 @@ if test ! x$with_netcdf = xno; then
    AC_SUBST(NETCDFDIR, [$with_netcdf])
    AC_SUBST(NCDUMPDIR, [$with_netcdf/bin])
    LDFLAGS="${LDFLAGS} -L$NETCDFDIR/lib"
+   AC_PATH_PROG([NCDUMP], [ncdump], [ncdump], [$with_netcdf/bin$PATH_SEPARATOR$PATH])
 else
    AC_SUBST(NCDUMPDIR, [../../../../ncdump])
+   AC_PATH_PROG([NCDUMP], [ncdump], [ncdump])
 fi
 
-# According to the autoconf mailing list gurus, we must test for
-# compilers unconditionally. That is, we can't skip looking for the
-# fortran compilers, just because the user doesn't want fortran. This
-# is due to a limitation in autoconf.
-
-# Find the C compiler.
-AC_MSG_NOTICE([finding C compiler])
-AC_PROG_CC(mpcc_r xlc cc c89 acc gcc)
-AM_PROG_CC_C_O
-
-# Find fortran compiler. If FC isn't set after AC_PROG_FC, we couldn't
-# find a fortran compiler. If the user requested the fortran API, then
-# bail out right here.
-AC_MSG_NOTICE([finding Fortran compiler (required, even if Fortran API is not desired)])
-
-# We must call AC_PROG_F77 here, otherwise the LIBTOOL macro below
-# will call it, and reset F77 to g77.
-AC_PROG_F77([mpxlf_r xlf fort xlf95 ifort ifc efc pgf95 lf95 g95 gfortran f95 frt pgf77 f77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 g77])
-if test "${F77+set}" = set && test "x$F77" = x && test "x$nc_build_fortran" = xyes; then
-   AC_MSG_ERROR([Can't find F77 compiler, and compiler recovery disabled.])
-fi
-AC_PROG_FC([mpxlf_r xlf90 fort xlf95 ifort ifc efc pgf95 lf95 g95 gfortran f95 frt pgf77 f77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 g77])
-
-if test "x$nc_build_f90" = xyes; then
-   AC_MSG_NOTICE([configuring fortran])
-   # Some f90 compilers change the case of the mod file names. Others
-   # require special flags to be set to deal with .f90 files. Find out
-   # about this compiler.
-   AC_LANG_PUSH(Fortran)
-   AC_FC_SRCEXT(f90)
-   AC_LANG_POP(Fortran)
-   AX_F90_MODULE_FLAG
-   AC_SUBST(MOD_FLAG, ${ax_cv_f90_modflag})
-fi
+lapacklibdir_l=""
+AC_ARG_WITH([lapack-libdir], 
+   [AS_HELP_STRING([--with-lapack-libdir=<directory>],
+        [Specify location of LAPACK library, required for interpolation and regridding.])],
+   [lapacklibdir_l="-L$withval"])
+LDFLAGS="$lapacklibdir_l $LDFLAGS"
+
+blaslib=""
+AC_ARG_WITH([blas-lib],
+   [AS_HELP_STRING([--with-blas-lib=<path>],
+       [Specify path to blas library, required for interpolation and regridding.])],
+   [blaslib="$withval"])
+LIBS="$blaslib $LIBS"
+
+lapacklib=""
+AC_ARG_WITH([lapack-lib],
+   [AS_HELP_STRING([--with-lapack-lib=<path>],
+       [Specify path to lapack library, required for interpolation and regridding.])],
+   [lapacklib="$withval"])
+LIBS="$lapacklib $LIBS"
+
+# check if compiler supports MPI directives
+AC_CHECK_HEADERS([mpi.h])
+AC_SEARCH_LIBS([MPI_Init], [mpi mpich pmpi])
+AM_CONDITIONAL([HAVE_MPI], [test "$ac_cv_header_mpi_h" = "yes" -a test "$ac_cv_lib_MPI_Init" != "no"])
+
+# Can we find the nccmp utility?
+#AC_PATH_PROG([NCCMP], [nccmp])
 
 AC_MSG_NOTICE([finding other utilities])
 
@@ -252,11 +236,13 @@ AC_PROG_INSTALL
 
 AC_MSG_NOTICE([setting up libtool])
 
-# Produce a windows DLL. This macro must be before AM_PROG_LIBTOOL.
-AC_LIBTOOL_WIN32_DLL
-
 # Use libtool.
-AC_PROG_LIBTOOL
+LT_INIT
+
+# must set ranlib when compiling on Darwin
+if test "x$darwin_os" = "xyes"; then
+   RANLIB="ranlib -c"
+fi
 
 AC_MSG_NOTICE([checking for large file support])
 
@@ -286,30 +272,139 @@ AC_CHECK_SIZEOF(double)
 AC_CHECK_SIZEOF(off_t)
 #AC_CHECK_SIZEOF(size_t)
 
+AC_SEARCH_LIBS([deflate], [z])
+AC_SEARCH_LIBS([ceil], [m])
+AC_SEARCH_LIBS([Curl_cfree], [curl])
+AC_SEARCH_LIBS([nc_open], [netcdf])
+
+# These tests are written in such a way that a fortran compiler is not 
+# necessary. Therefore not using AC_FC_FUNC to determine the number of
+# underscores
+have_blas="no"
+have_blas_underscore="no"
+have_lapack="no"
+have_lapack_underscore="no"
+if test "$libcf_build_regrid" != "no"; then
+possible_blas_library_names="sci_quadcore_mp nag essl mkl f77blas blas"
+AC_SEARCH_LIBS([dcopy], [$possible_blas_library_names],
+   [have_blas="yes"], 
+        [AC_SEARCH_LIBS([dcopy_], [$possible_blas_library_names],
+	  [have_blas_underscore="yes"]
+	 )]
+)
+possible_lapack_library_names="sci_quadcore_mp nag essl mkl lapack"
+AC_SEARCH_LIBS([dgetrf], [$possible_lapack_library_names], 
+   [have_lapack="yes"],
+      AC_SEARCH_LIBS([dgetrf_], [$possible_lapack_library_names],
+        [have_lapack_underscore="yes"]
+      )
+)
+fi
+AC_SUBST([HAVE_LAPACK_NO_UNDERSCORE], [0])
+AC_SUBST([HAVE_LAPACK_UNDERSCORE], [0])
+AC_SUBST([HAVE_LAPACK_LIB], [0])
+if test "$have_lapack" = "yes"; then
+   AC_MSG_NOTICE([lapack and blas were found, symbols have no underscore])
+   AC_DEFINE([HAVE_LAPACK_NO_UNDERSCORE], [1], [lapack symbols have no underscore])
+   AC_DEFINE([HAVE_LAPACK_LIB], [1], [code with lapack calls compiles])
+   AC_SUBST([HAVE_LAPACK_NO_UNDERSCORE], [1])
+   AC_SUBST([HAVE_LAPACK_LIB], [1])
+fi
+if test "$have_lapack_underscore" = "yes"; then
+   AC_MSG_NOTICE([lapack and blas were found, symbols have underscore])
+   AC_DEFINE([HAVE_LAPACK_UNDERSCORE], [1], [lapack symbols have underscore])
+   AC_DEFINE([HAVE_LAPACK_LIB], [1], [code with lapack calls compiles])
+   AC_SUBST([HAVE_LAPACK_UNDERSCORE], [1])
+   AC_SUBST([HAVE_LAPACK_LIB], [1])
+fi
+
+AC_CHECK_HEADERS( [netcdf.h], [], [AC_MSG_ERROR([Header netcdf.h could
+	not be found. Please set CPPFLAGS.])])
+
+# some parts rely on uuid, if not found we will fall back on own code to 
+# generate unique identifiers
+HAVE_UUID_H="no"
+AC_LANG_PUSH(C)
+AC_LINK_IFELSE(
+	[AC_LANG_PROGRAM([#include <uuid/uuid.h>], 
+                        [uuid_t x; uuid_clear(x);])], 
+	[uuid_clear_compiles=yes], 
+   	[uuid_clear_compiles=no])
+AC_LANG_POP(C)
+libuuid=""
+if test "$uuid_clear_compiles" = "no"; then
+   # on some platforms (e.g. linux), need to link against -luuid
+   AC_CHECK_LIB([uuid], [uuid_generate], [libuuid="-luuid"])
+   if test "x$libuuid" != "x"; then
+      LIBS="$LIBS $libuuid"
+      uuid_clear_compiles=yes
+   fi
+fi
+AC_MSG_NOTICE([Successfully compiling code containing uuid? $uuid_clear_compiles])
+if test "$uuid_clear_compiles" = "yes"; then
+   HAVE_UUID_H="yes"
+   AC_DEFINE([HAVE_UUID_H], [1], [Define if uuid is found])
+fi
+AM_CONDITIONAL([HAVE_UUID], [test "x$HAVE_UUID_H" = "xyes"])
+if test "x$HAVE_UUID_H" = "xyes"; then
+   AC_SUBST([HAVE_UUID], [1])
+else
+   AC_SUBST([HAVE_UUID], [0])
+fi
+
+# test if the fortran compiler supports some Fortran 2003 features
+FORTRAN_2003="no"
+AC_LANG_PUSH([Fortran])
+AC_COMPILE_IFELSE(
+   [AC_LANG_PROGRAM([],[
+       contains      
+       subroutine foo(x, y)
+         use iso_c_binding
+         integer, value :: x
+         type(c_ptr) :: y, z
+    	 integer, pointer :: fpy
+		 call c_f_pointer(y, fpy)
+         z = c_loc(fpy)
+       end subroutine
+])],
+      [fortran_2003=yes],
+      [fortran_2003=no])
+AC_LANG_POP([Fortran])
+if test "$fortran_2003" = "yes"; then
+    AC_SUBST([HAVE_FORTRAN_2003], [1])
+	AC_MSG_NOTICE([Fortran compiler supports 2003 features])
+else
+    AC_SUBST([HAVE_FORTRAN_2003], [0])
+    AC_MSG_WARN([Fortran compiler does not support 2003 features])
+fi
+AM_CONDITIONAL([HAVE_FORTRAN_2003], [test x$fortran_2003 = xyes])
+
+# Python (not required but nice to have)
+PYTHON=""
+AC_CHECK_PROGS([PYTHON],[python python2])
+AM_CONDITIONAL(HAVE_PYTHON, test "x$PYTHON" != "x")
+
 AC_MSG_NOTICE([generating header files and makefiles])
 
-AC_CONFIG_FILES([gridspec/tools/make_hgrid/run_tests], 
-	           [chmod +x gridspec/tools/make_hgrid/run_tests])
-AC_CONFIG_FILES([gridspec/tools/make_vgrid/run_tests], 
-	           [chmod +x gridspec/tools/make_vgrid/run_tests])
-AC_CONFIG_FILES([gridspec/tools/make_topog/run_tests], 
-	           [chmod +x gridspec/tools/make_topog/run_tests])
+dnl AC_CONFIG_FILES([gridspec/tools/run_hgrid_tests], 
+dnl 	           [chmod +x gridspec/tools/run_hgrid_tests])
 
 AC_CONFIG_FILES([Makefile
-                 doc/Makefile
-                 cfcheck/Makefile
+		 pycf/Makefile
+		 pycf/__init__.py
                  src/Makefile
-		 gridspec/Makefile
-		 gridspec/shared/Makefile
-		 gridspec/shared/mosaic/Makefile
-		 gridspec/tools/Makefile
-		 gridspec/tools/shared/Makefile
-		 gridspec/tools/make_hgrid/Makefile
-		 gridspec/tools/make_mosaic/Makefile
-		 gridspec/tools/make_coupler_mosaic/Makefile
-		 gridspec/tools/fregrid/Makefile
-		 gridspec/tools/make_topog/Makefile
-		 gridspec/tools/make_vgrid/Makefile])
-
+                 include/Makefile
+	         gridspec_api/Makefile
+                 gridspec_api/global/Makefile
+                 gridspec_api/axis/Makefile
+                 gridspec_api/coord/Makefile
+                 gridspec_api/grid/Makefile
+                 gridspec_api/data/Makefile
+                 gridspec_api/regrid/Makefile
+                 gridspec_api/mosaic/Makefile
+                 gridspec_api/host/Makefile
+		 examples/Makefile
+		 setup.py],
+		 [])
 AC_OUTPUT()
 
diff --git a/doc/Makefile.am b/doc/Makefile.am
deleted file mode 100644
index bb2444e..0000000
--- a/doc/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-## This is a automake file, part of Unidata's NetCDF CF Library package.
-# Copyright 2006, see the COPYRIGHT file for more information.
-
-# This is the automake file for the NetCDF CF Library documentation.
-
-# $Id: Makefile.am,v 1.3 2009/11/11 11:27:33 ed Exp $
-
-info_TEXINFOS = libcf.texi
-
-# Get texi2dvi to shut the hell up!
-TEXI2DVI = texi2dvi -s
-
-# Get lists of the coresponding ps, info, and pdf files.
-html_docs = ${info_TEXINFOS:.texi=.html} 
-ps_docs = ${info_TEXINFOS:.texi=.ps} 
-pdf_docs = ${info_TEXINFOS:.texi=.pdf}
-info_docs= ${info_TEXINFOS:.texi=.info}
-
-EXTRA_DIST = defines.texi
-
-# Distributes the ps, info, and pdf files with the distribution.
-dist_pkgdata_DATA = $(ps_docs) $(info_docs) $(pdf_docs) 
-
-# Automake seems to be broken with respect to generating html
-# output. Also it steals the *.html targets, no matter what I do. So
-# this cheesy phoney target does the html builds.
-libcf_html:
-	$(MAKEINFO) --html $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I$(srcdir) libcf.texi
-	$(MAKEINFO) --no-split --html $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I$(srcdir) libcf.texi
-
-# This isn't made by all, but tars up everything needed for the website
-web-tarball: all libcf_html
-	tar cf libcf_info.tar *.info*
-	gzip -f libcf_info.tar
-	zip libcf_info *.info &> /dev/null
-	tar cf libcf_pdf.tar *.pdf 
-	gzip -f libcf_pdf.tar
-	zip libcf_pdf *.pdf &> /dev/null
-	tar cf libcf_html.tar libcf libcf.html
-	gzip -f libcf_html.tar
-	zip libcf_html *.pdf &> /dev/null
-	tar cf libcf_docs.tar $(nmans) *.pdf *.html *.tar.gz *.zip libcf
-	gzip -f libcf_docs.tar
diff --git a/doc/Makefile.in b/doc/Makefile.in
deleted file mode 100644
index a7c674b..0000000
--- a/doc/Makefile.in
+++ /dev/null
@@ -1,722 +0,0 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-
-# Copyright 2006, see the COPYRIGHT file for more information.
-
-# This is the automake file for the NetCDF CF Library documentation.
-
-# $Id: Makefile.am,v 1.3 2009/11/11 11:27:33 ed Exp $
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = doc
-DIST_COMMON = $(dist_pkgdata_DATA) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in $(srcdir)/stamp-vti \
-	$(srcdir)/version.texi mdate-sh texinfo.tex
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-SOURCES =
-DIST_SOURCES =
-INFO_DEPS = $(srcdir)/libcf.info
-am__TEXINFO_TEX_DIR = $(srcdir)
-DVIS = libcf.dvi
-PDFS = libcf.pdf
-PSS = libcf.ps
-HTMLS = libcf.html
-TEXINFOS = libcf.texi
-TEXI2PDF = $(TEXI2DVI) --pdf --batch
-MAKEINFOHTML = $(MAKEINFO) --html
-AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
-DVIPS = dvips
-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__installdirs = "$(DESTDIR)$(pkgdatadir)"
-DATA = $(dist_pkgdata_DATA)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
-AMTAR = @AMTAR@
-AR = @AR@
-AS = @AS@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-F77 = @F77@
-FC = @FC@
-FCFLAGS = @FCFLAGS@
-FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
-FGREP = @FGREP@
-GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-MOD_FLAG = @MOD_FLAG@
-NCDUMPDIR = @NCDUMPDIR@
-NETCDFDIR = @NETCDFDIR@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
-VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
-ac_ct_FC = @ac_ct_FC@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-info_TEXINFOS = libcf.texi
-
-# Get texi2dvi to shut the hell up!
-TEXI2DVI = texi2dvi -s
-
-# Get lists of the coresponding ps, info, and pdf files.
-html_docs = ${info_TEXINFOS:.texi=.html} 
-ps_docs = ${info_TEXINFOS:.texi=.ps} 
-pdf_docs = ${info_TEXINFOS:.texi=.pdf}
-info_docs = ${info_TEXINFOS:.texi=.info}
-EXTRA_DIST = defines.texi
-
-# Distributes the ps, info, and pdf files with the distribution.
-dist_pkgdata_DATA = $(ps_docs) $(info_docs) $(pdf_docs) 
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .dvi .html .info .pdf .ps .texi
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-	        && { if test -f $@; then exit 0; else break; fi; }; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
-	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign doc/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-
-.texi.info:
-	restore=: && backupdir="$(am__leading_dot)am$$$$" && \
-	am__cwd=`pwd` && $(am__cd) $(srcdir) && \
-	rm -rf $$backupdir && mkdir $$backupdir && \
-	if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
-	  for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
-	    if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
-	  done; \
-	else :; fi && \
-	cd "$$am__cwd"; \
-	if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
-	 -o $@ $<; \
-	then \
-	  rc=0; \
-	  $(am__cd) $(srcdir); \
-	else \
-	  rc=$$?; \
-	  $(am__cd) $(srcdir) && \
-	  $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
-	fi; \
-	rm -rf $$backupdir; exit $$rc
-
-.texi.dvi:
-	TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
-	MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
-	$(TEXI2DVI) $<
-
-.texi.pdf:
-	TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
-	MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
-	$(TEXI2PDF) $<
-
-.texi.html:
-	rm -rf $(@:.html=.htp)
-	if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
-	 -o $(@:.html=.htp) $<; \
-	then \
-	  rm -rf $@; \
-	  if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
-	    mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \
-	else \
-	  if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
-	    rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
-	  exit 1; \
-	fi
-$(srcdir)/libcf.info: libcf.texi $(srcdir)/version.texi
-libcf.dvi: libcf.texi $(srcdir)/version.texi
-libcf.pdf: libcf.texi $(srcdir)/version.texi
-libcf.html: libcf.texi $(srcdir)/version.texi
-$(srcdir)/version.texi:  $(srcdir)/stamp-vti
-$(srcdir)/stamp-vti: libcf.texi $(top_srcdir)/configure
-	@(dir=.; test -f ./libcf.texi || dir=$(srcdir); \
-	set `$(SHELL) $(srcdir)/mdate-sh $$dir/libcf.texi`; \
-	echo "@set UPDATED $$1 $$2 $$3"; \
-	echo "@set UPDATED-MONTH $$2 $$3"; \
-	echo "@set EDITION $(VERSION)"; \
-	echo "@set VERSION $(VERSION)") > vti.tmp
-	@cmp -s vti.tmp $(srcdir)/version.texi \
-	  || (echo "Updating $(srcdir)/version.texi"; \
-	      cp vti.tmp $(srcdir)/version.texi)
-	- at rm -f vti.tmp
-	@cp $(srcdir)/version.texi $@
-
-mostlyclean-vti:
-	-rm -f vti.tmp
-
-maintainer-clean-vti:
-	-rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi
-.dvi.ps:
-	TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
-	$(DVIPS) -o $@ $<
-
-uninstall-dvi-am:
-	@$(NORMAL_UNINSTALL)
-	@list='$(DVIS)'; test -n "$(dvidir)" || list=; \
-	for p in $$list; do \
-	  $(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(dvidir)/$$f"; \
-	done
-
-uninstall-html-am:
-	@$(NORMAL_UNINSTALL)
-	@list='$(HTMLS)'; test -n "$(htmldir)" || list=; \
-	for p in $$list; do \
-	  $(am__strip_dir) \
-	  echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \
-	  rm -rf "$(DESTDIR)$(htmldir)/$$f"; \
-	done
-
-uninstall-info-am:
-	@$(PRE_UNINSTALL)
-	@if test -d '$(DESTDIR)$(infodir)' && \
-	    (install-info --version && \
-	     install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
-	  list='$(INFO_DEPS)'; \
-	  for file in $$list; do \
-	    relfile=`echo "$$file" | sed 's|^.*/||'`; \
-	    echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \
-	    if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
-	    then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \
-	  done; \
-	else :; fi
-	@$(NORMAL_UNINSTALL)
-	@list='$(INFO_DEPS)'; \
-	for file in $$list; do \
-	  relfile=`echo "$$file" | sed 's|^.*/||'`; \
-	  relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
-	  (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \
-	     echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \
-	     rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
-	   else :; fi); \
-	done
-
-uninstall-pdf-am:
-	@$(NORMAL_UNINSTALL)
-	@list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
-	for p in $$list; do \
-	  $(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(pdfdir)/$$f"; \
-	done
-
-uninstall-ps-am:
-	@$(NORMAL_UNINSTALL)
-	@list='$(PSS)'; test -n "$(psdir)" || list=; \
-	for p in $$list; do \
-	  $(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(psdir)/$$f"; \
-	done
-
-dist-info: $(INFO_DEPS)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	list='$(INFO_DEPS)'; \
-	for base in $$list; do \
-	  case $$base in \
-	    $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
-	  esac; \
-	  if test -f $$base; then d=.; else d=$(srcdir); fi; \
-	  base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \
-	  for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \
-	    if test -f $$file; then \
-	      relfile=`expr "$$file" : "$$d/\(.*\)"`; \
-	      test -f "$(distdir)/$$relfile" || \
-		cp -p $$file "$(distdir)/$$relfile"; \
-	    else :; fi; \
-	  done; \
-	done
-
-mostlyclean-aminfo:
-	-rm -rf libcf.aux libcf.cp libcf.cps libcf.fn libcf.ky libcf.kys libcf.log \
-	  libcf.pg libcf.pgs libcf.tmp libcf.toc libcf.tp libcf.tps \
-	  libcf.vr
-
-clean-aminfo:
-	-test -z "libcf.dvi libcf.pdf libcf.ps libcf.html" \
-	|| rm -rf libcf.dvi libcf.pdf libcf.ps libcf.html
-
-maintainer-clean-aminfo:
-	@list='$(INFO_DEPS)'; for i in $$list; do \
-	  i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
-	  echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
-	  rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
-	done
-install-dist_pkgdataDATA: $(dist_pkgdata_DATA)
-	@$(NORMAL_INSTALL)
-	test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
-	@list='$(dist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
-	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)$(pkgdatadir)'"; \
-	  $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \
-	done
-
-uninstall-dist_pkgdataDATA:
-	@$(NORMAL_UNINSTALL)
-	@list='$(dist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
-	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	test -n "$$files" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(pkgdatadir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(pkgdatadir)" && rm -f $$files
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d "$(distdir)/$$file"; then \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-	  else \
-	    test -f "$(distdir)/$$file" \
-	    || cp -p $$d/$$file "$(distdir)/$$file" \
-	    || exit 1; \
-	  fi; \
-	done
-	$(MAKE) $(AM_MAKEFLAGS) \
-	  top_distdir="$(top_distdir)" distdir="$(distdir)" \
-	  dist-info
-check-am: all-am
-check: check-am
-all-am: Makefile $(DATA)
-installdirs:
-	for dir in "$(DESTDIR)$(pkgdatadir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-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)
-
-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-aminfo clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
-	-rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am: $(DVIS)
-
-html: html-am
-
-html-am: $(HTMLS)
-
-info: info-am
-
-info-am: $(INFO_DEPS)
-
-install-data-am: install-dist_pkgdataDATA
-
-install-dvi: install-dvi-am
-
-install-dvi-am: $(DVIS)
-	@$(NORMAL_INSTALL)
-	test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)"
-	@list='$(DVIS)'; test -n "$(dvidir)" || list=; \
-	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)$(dvidir)'"; \
-	  $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \
-	done
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am: $(HTMLS)
-	@$(NORMAL_INSTALL)
-	test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)"
-	@list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \
-	for p in $$list; do \
-	  if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  $(am__strip_dir) \
-	  if test -d "$$d$$p"; then \
-	    echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \
-	    $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
-	    echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
-	    $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
-	  else \
-	    list2="$$list2 $$d$$p"; \
-	  fi; \
-	done; \
-	test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \
-	while read files; do \
-	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \
-	  $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \
-	done; }
-install-info: install-info-am
-
-install-info-am: $(INFO_DEPS)
-	@$(NORMAL_INSTALL)
-	test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)"
-	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-	list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
-	for file in $$list; do \
-	  case $$file in \
-	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-	  esac; \
-	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
-	  file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
-	  for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
-	               $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
-	    if test -f $$ifile; then \
-	      echo "$$ifile"; \
-	    else : ; fi; \
-	  done; \
-	done | $(am__base_list) | \
-	while read files; do \
-	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \
-	  $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done
-	@$(POST_INSTALL)
-	@if (install-info --version && \
-	     install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
-	  list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
-	  for file in $$list; do \
-	    relfile=`echo "$$file" | sed 's|^.*/||'`; \
-	    echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\
-	    install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\
-	  done; \
-	else : ; fi
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am: $(PDFS)
-	@$(NORMAL_INSTALL)
-	test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)"
-	@list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
-	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)$(pdfdir)'"; \
-	  $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done
-install-ps: install-ps-am
-
-install-ps-am: $(PSS)
-	@$(NORMAL_INSTALL)
-	test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)"
-	@list='$(PSS)'; test -n "$(psdir)" || list=; \
-	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)$(psdir)'"; \
-	  $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-aminfo \
-	maintainer-clean-generic maintainer-clean-vti
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-aminfo mostlyclean-generic \
-	mostlyclean-libtool mostlyclean-vti
-
-pdf: pdf-am
-
-pdf-am: $(PDFS)
-
-ps: ps-am
-
-ps-am: $(PSS)
-
-uninstall-am: uninstall-dist_pkgdataDATA uninstall-dvi-am \
-	uninstall-html-am uninstall-info-am uninstall-pdf-am \
-	uninstall-ps-am
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-am clean clean-aminfo clean-generic \
-	clean-libtool dist-info distclean distclean-generic \
-	distclean-libtool distdir dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am \
-	install-dist_pkgdataDATA 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-aminfo maintainer-clean-generic \
-	maintainer-clean-vti mostlyclean mostlyclean-aminfo \
-	mostlyclean-generic mostlyclean-libtool mostlyclean-vti pdf \
-	pdf-am ps ps-am uninstall uninstall-am \
-	uninstall-dist_pkgdataDATA uninstall-dvi-am uninstall-html-am \
-	uninstall-info-am uninstall-pdf-am uninstall-ps-am
-
-
-# Automake seems to be broken with respect to generating html
-# output. Also it steals the *.html targets, no matter what I do. So
-# this cheesy phoney target does the html builds.
-libcf_html:
-	$(MAKEINFO) --html $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I$(srcdir) libcf.texi
-	$(MAKEINFO) --no-split --html $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I$(srcdir) libcf.texi
-
-# This isn't made by all, but tars up everything needed for the website
-web-tarball: all libcf_html
-	tar cf libcf_info.tar *.info*
-	gzip -f libcf_info.tar
-	zip libcf_info *.info &> /dev/null
-	tar cf libcf_pdf.tar *.pdf 
-	gzip -f libcf_pdf.tar
-	zip libcf_pdf *.pdf &> /dev/null
-	tar cf libcf_html.tar libcf libcf.html
-	gzip -f libcf_html.tar
-	zip libcf_html *.pdf &> /dev/null
-	tar cf libcf_docs.tar $(nmans) *.pdf *.html *.tar.gz *.zip libcf
-	gzip -f libcf_docs.tar
-
-# 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.
-.NOEXPORT:
diff --git a/doc/defines.texi b/doc/defines.texi
deleted file mode 100644
index 9e7caad..0000000
--- a/doc/defines.texi
+++ /dev/null
@@ -1,62 +0,0 @@
- at c This is part of the libcf documentation. See COPYRIGHT file
- at c for terms of use.
-
- at c This file is included by the texi file, and contains
- at c common definitions.
-
- at c $Id: defines.texi,v 1.3 2009/09/15 17:39:45 ed Exp $
-
- at set libcf-man The NetCDF CF Library Users Guide and Reference
-
- at set libcf-support-email support-libcf@@unidata.ucar.edu
-
- at c URLs for CF stuff.
- at set cf-url http://www.cgd.ucar.edu/cms/eaton/cf-metadata/CF-1.0.html
- at set gridspec-url http://www.gfdl.noaa.gov/~vb/gridstd/gridstd.html
-
- at c home pages for netcdf, netcdf-4, netcdf java, hdf5, Unidata
- at set hdf5-url http://hdf.ncsa.uiuc.edu/HDF5
- at set unidata-url http://www.unidata.ucar.edu
- at set netcdf-url @value{unidata-url}/software/netcdf
- at set netcdf-4-url @value{netcdf-url}/netcdf-4
- at set netcdf-java-url @value{unidata-url}/software/netcdf-java
- at set ucar-url http://www.ucar.edu
- at set udunits-url http://www.unidata.ucar.edu/software/udunits/
-
- at c urls for netcdf documents
- at set docs-url @value{netcdf-url}/docs
-
- at c urls to search on-line stuff
- at set libcf-support-search-url @value{unidata-url}/mailsearchform.php?archive=libcf&archivename=LibCF
- at set libcf-list-search-url @value{unidata-url}/mailsearchform.php?archive=libcfgroup-list&archivename=LibCF_Group
-
- at c places to get downloads
- at set ftp-site ftp://ftp.unidata.ucar.edu/pub/libcf
-
- at setchapternewpage odd
- at finalout
- at copying 
-Copyright @copyright{} 2006 University Corporation for
-Atmospheric Research
-
- at sp 2
-Permission is granted to make and distribute verbatim copies of this
-manual provided that the copyright notice and these paragraphs are
-preserved on all copies.  The software and any accompanying written 
-materials are provided ``as is'' without warranty of any kind.  UCAR 
-expressly disclaims all warranties of any kind, either expressed or 
-implied, including but not limited to the implied warranties of 
-merchantability and fitness for a particular purpose.  
-
-The Unidata Program Center is managed by the University 
-Corporation for Atmospheric Research and sponsored by the National 
-Science Foundation.  Any opinions, findings, conclusions, or 
-recommendations expressed in this publication are those of the 
-author(s) and do not necessarily reflect the views of the National 
-Science Foundation.
-
-Mention of any commercial company or product in this document 
-does not constitute an endorsement by the Unidata Program Center.  
-Unidata does not authorize any use of information from this 
-publication for advertising or publicity purposes.
- at end copying
diff --git a/doc/libcf.info b/doc/libcf.info
deleted file mode 100644
index bd1283c..0000000
--- a/doc/libcf.info
+++ /dev/null
@@ -1,3232 +0,0 @@
-This is libcf.info, produced by makeinfo version 4.12 from
-/machine/libcf/lb_new1/doc//defines.texi.
-
-Copyright (C) 2006 University Corporation for Atmospheric Research
-
-
-
-   Permission is granted to make and distribute verbatim copies of this
-manual provided that the copyright notice and these paragraphs are
-preserved on all copies.  The software and any accompanying written
-materials are provided "as is" without warranty of any kind.  UCAR
-expressly disclaims all warranties of any kind, either expressed or
-implied, including but not limited to the implied warranties of
-merchantability and fitness for a particular purpose.
-
-   The Unidata Program Center is managed by the University Corporation
-for Atmospheric Research and sponsored by the National Science
-Foundation.  Any opinions, findings, conclusions, or recommendations
-expressed in this publication are those of the author(s) and do not
-necessarily reflect the views of the National Science Foundation.
-
-   Mention of any commercial company or product in this document does
-not constitute an endorsement by the Unidata Program Center.  Unidata
-does not authorize any use of information from this publication for
-advertising or publicity purposes.
-
-INFO-DIR-SECTION netCDF CF Library
-START-INFO-DIR-ENTRY
-* libcf: (libcf).         The NetCDF CF Library Users Guide and Reference
-END-INFO-DIR-ENTRY
-
-
-File: libcf.info,  Node: Top,  Next: Summary,  Prev: (dir),  Up: (dir)
-
-The NetCDF CF Library Users Guide and Reference
-***********************************************
-
-This guide describes libcf, the netCDF CF Library. This document
-applies to libcf version 1.0-alpha5, and was last updated on 15
-September 2009.
-
-* Menu:
-
-* Summary::
-* Installation::
-* Files::
-* Variables::
-* Coordinates::
-* GRIDSPEC::
-* Combined Index::
-
-
-File: libcf.info,  Node: Summary,  Next: Installation,  Prev: Top,  Up: Top
-
-Summary
-*******
-
-The CF conventions for climate and forecast metadata are designed to
-promote the processing and sharing of files created with the netCDF API.
-
-   This library, libcf, makes it easier to create and work with data
-files which conform to the CF conventions.
-
-   The functions of the CF library are intended to be interspersed with
-netCDF library calls. That is, the programmer will open or create a
-netCDF file with the netCDF API, and then add or read metadata with
-libcf library functions, then continue to working with the netCDF API
-to read and write data.
-
-   By using libcf, a data producer can produce files that conform to the
-CF standards, without having to write netCDF code to create and decode
-all the attributes that the CF convention uses to store meta-data. A
-data consumer can use libcf to read any file which conforms to the CF
-conventions; the file does not need to be created with libcf to be read
-by libcf.
-
-   Fortran-77 wrapper functions provide a Fortran 77 API, just as is
-done with netCDF itself. A Fortran 90 API is planned, but not yet begun.
-
-   For more information about the CF Conventions, see the CF Metadata
-web site at `http://www.cgd.ucar.edu/cms/eaton/cf-metadata/CF-1.0.html'.
-
-
-File: libcf.info,  Node: Installation,  Next: Files,  Prev: Summary,  Up: Top
-
-Downloading and Installing libcf
-********************************
-
-Currently, and for some time to come, libcf is in alpha release. The
-code is tested, but not extensively. The API may be extended, and
-possibly changed, in each release.
-
-   You must have either netCDF-3 (or netCDF-4) installed. And reasonably
-recent version of netCDF should work. libcf is tested with netCDF
-3.6.2-beta4.
-
-   Get the latest version of the libcf tarball at the libcf ftp site:
-ftp://ftp.unidata.ucar.edu/pub/libcf
-
-   Unpack the tarball, and run:
-
-     ./configure --with-netcdf=/my/netcdf --prefix=/my/libcf && make check install > output.txt
-
-   Where /my/netcdf is the root install directory of the netCDF library
-you want to use, and /my/libcf is the root directory where you want
-libcf installed. (They may be the same directory.)
-
-   If you wish to use netCDF-4, you must also have HDF5 and libz, the
-compression library, installed. In this case, configure libcf like this:
-
-     ./configure --with-netcdf=/s/n4_new1/install --enable-netcdf-4 --with-hdf5=/home/ed/local/s && make check install > output.txt
-
-   If the build does not work for you, please email libcf support:
-support-libcf at unidata.ucar.edu. Please send the *complete* output of the
-configure and build output, in ASCII (the output.txt file produced by
-the above build commands), and the file config.log, which is generated
-by the configure script.
-
-
-File: libcf.info,  Node: Files,  Next: Variables,  Prev: Installation,  Up: Top
-
-1 Files
-*******
-
-* Menu:
-
-* nccf_def_convention::
-* nccf_inq_convention::
-* nccf_def_file::
-* nccf_inq_file::
-* nccf_add_history::
-
-
-File: libcf.info,  Node: nccf_def_convention,  Next: nccf_inq_convention,  Prev: Files,  Up: Files
-
-1.1 Mark a File as Conforming to CF Conventions
-===============================================
-
-Mark the file as following CF-1.0 conventions.
-
-   This functions is called automatically by nccf_def_file, so need not
-be called by the user if nccf_def_file is being called.
-
-Usage
-=====
-
-        int nccf_def_convention(int ncid);
-
-`ncid'
-     The ncid of the file.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_convention,  Next: nccf_def_file,  Prev: nccf_def_convention,  Up: Files
-
-1.2 Determine if a File Claims to Conform to CF Conventions
-===========================================================
-
-Determine if the file claims to follow CF-1.0 conventions. This
-function only checks the global "Conventions" attribute. It does not
-look at file metadata to ensure that this is a well-formed CF file. It
-only tells whether the file claims to be a CF file.
-
-Usage
-=====
-
-        int nccf_inq_convention(int ncid, int *cf_convention);
-
-`ncid'
-     The ncid of the file.
-
-`cf_conventions'
-     If this pointer to an int is provided, a 1 is written there if this
-     file claims to follow CF 1.0 conventions, a 0 otherwise.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_file,  Next: nccf_inq_file,  Prev: nccf_inq_convention,  Up: Files
-
-1.3 Add description to the data with nccf_def_file
-==================================================
-
-Add some or all of the CF recommended text attributes to a file. Any
-parameters which are set to NULL will be ignored.
-
-Usage
-=====
-
-     int nccf_def_file(int ncid, char *title, char *history, char *institution,
-                       char *source, char *comment, char *references);
-
-`ncid'
-     The ncid of the file.
-
-`title'
-     If non-NULL, this text string will be written as the CF-recommended
-     "title" attribute.
-
-`history'
-     If non-NULL, this text string will be written as the CF-recommended
-     "history" attribute.
-
-`institution'
-     If non-NULL, this text string will be written as the CF-recommended
-     "institution" attribute.
-
-`source'
-     If non-NULL, this text string will be written as the CF-recommended
-     "source" attribute.
-
-`comment'
-     If non-NULL, this text string will be written as the CF-recommended
-     "comment" attribute.
-
-`references'
-     If non-NULL, this text string will be written as the CF-recommended
-     "references" attribute.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_file,  Next: nccf_add_history,  Prev: nccf_def_file,  Up: Files
-
-1.4 Read the description of the data with nccf_inq_file
-=======================================================
-
-Read any existing CF recommended text attributes from the file.
-
-   Recall that in C, strlens do not include the null terminator. To get
-the lengths before the strings (in order to allocated) pass NULL for
-any or all strings and the lengths will be returned. Then call the
-function again after allocating memory.
-
-   The CF version is guaranteed to be less than NC_MAX_NAME.
-
-   Any of these pointer arguments may be NULL, in which case it will be
-ignored.
-
-Usage
-=====
-
-     int nccf_inq_file(int ncid, size_t *title_lenp, char *title,
-                       size_t *history_lenp, char *history,
-                       size_t *institution_lenp, char *institution,
-                       size_t *source_lenp, char *source,
-                       size_t *comment_lenp, char *comment,
-                       size_t *references_lenp, char *references);
-
-`ncid'
-     The ncid of the file.
-
-`title_lenp'
-     Pointer to size_t which, if not NULL, will get the length of the
-     title attribute.
-
-`title'
-     Pointer to char array which, if not NULL, will get the title
-     string. Memory must be allocated before this function is called.
-     Call this function with a NULL for this parameter to get the size
-     first.
-
-`history_lenp'
-     Pointer to size_t which, if not NULL, will get the length of the
-     history attribute.
-
-`history'
-     Pointer to char array which, if not NULL, will get the history
-     string. Memory must be allocated before this function is called.
-     Call this function with a NULL for this parameter to get the size
-     first.
-
-`institution_lenp'
-     Pointer to size_t which, if not NULL, will get the length of the
-     institution attribute.
-
-`institution'
-     Pointer to char array which, if not NULL, will get the institution
-     string. Memory must be allocated before this function is called.
-     Call this function with a NULL for this parameter to get the size
-     first.
-
-`source_lenp'
-     Pointer to size_t which, if not NULL, will get the length of the
-     source attribute.
-
-`source'
-     Pointer to char array which, if not NULL, will get the source
-     string. Memory must be allocated before this function is called.
-     Call this function with a NULL for this parameter to get the size
-     first.
-
-`comment_lenp'
-     Pointer to size_t which, if not NULL, will get the length of the
-     comment attribute.
-
-`comment'
-     Pointer to char array which, if not NULL, will get the comment
-     string. Memory must be allocated before this function is called.
-     Call this function with a NULL for this parameter to get the size
-     first.
-
-`references_lenp'
-     Pointer to size_t which, if not NULL, will get the length of the
-     references attribute.
-
-`references'
-     Pointer to char array which, if not NULL, will get the references
-     string. Memory must be allocated before this function is called.
-     Call this function with a NULL for this parameter to get the size
-     first.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_add_history,  Prev: nccf_inq_file,  Up: Files
-
-1.5 Append to a History Attribute
-=================================
-
-This function appends a time-stamped history string to the history
-attribute, creating the attribute if it doesn't already exist.
-
-Usage
-=====
-
-     int nccf_add_history(int ncid, const char *history);
-
-`ncid'
-     The ncid of the file.
-
-`history'
-     The string to append to the history attribute.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: Variables,  Next: Coordinates,  Prev: Files,  Up: Top
-
-2 Variables
-***********
-
-* Menu:
-
-* nccf_def_var::
-* nccf_inq_var::
-* nccf_def_var_missing::
-* nccf_inq_var_missing::
-* nccf_def_notes::
-* nccf_inq_notes::
-* nccf_def_latitude::
-* nccf_inq_latitude::
-* nccf_def_longitude::
-* nccf_inq_longitude::
-* nccf_def_lvl::
-* nccf_inq_lvl::
-* nccf_def_lvl_vert::
-* nccf_inq_lvl_vert::
-* nccf_def_time::
-* nccf_inq_time::
-* nccf_def_ft_sigma::
-* nccf_inq_lvl_sigma::
-* nccf_def_ft_hybrid_sigma::
-* nccf_inq_lvl_hybrid_sigma::
-* nccf_def_ft_hybrid_height::
-* nccf_inq_lvl_hybrid_height::
-* nccf_def_ft_sleve::
-* nccf_inq_lvl_sleve::
-* nccf_def_ft_ocean_sigma::
-* nccf_inq_lvl_ocean_sigma::
-* nccf_def_ft_ocean_s::
-* nccf_inq_lvl_ocean_s::
-* nccf_def_ft_ocean_sigma_z::
-* nccf_inq_lvl_ocean_sigma_z::
-* nccf_def_ft_ocean_dbl_sigma::
-* nccf_inq_lvl_ocean_dbl_sigma::
-* nccf_get_vara::
-
-
-File: libcf.info,  Node: nccf_def_var,  Next: nccf_inq_var,  Prev: Variables,  Up: Variables
-
-2.1 Add description to a variable with nccf_def_var
-===================================================
-
-Usage
-=====
-
-     int nccf_def_var(int ncid, int varid, const char *units,
-                         const char *long_name, const char *standard_name,
-                         int ncoord_vars, int *coord_varids);
-
-`ncid'
-     The ncid of the file.
-
-`varid'
-     The varid of the netCDF variable being described.
-
-`units'
-     If non-NULL, this text string will be written as the CF-recommended
-     "units" attribute.
-
-`long_name'
-     If non-NULL, this text string will be written as the CF-recommended
-     "long_name" attribute.
-
-`standard_name'
-     If non-NULL, this text string will be written as the CF-recommended
-     "standard_name" attribute.
-
-`ncoord_vars'
-     Number of coordinate variables for this variable.
-
-`coord_varids'
-     The variable IDs of the coordinate variables for this variable.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_var,  Next: nccf_def_var_missing,  Prev: nccf_def_var,  Up: Variables
-
-2.2 Read variable description with nccf_inq_var
-===============================================
-
-Read any existing CF recommended text attributes from a variable.
-
-Usage
-=====
-
-     int nccf_inq_var(int ncid, int varid, size_t *units_lenp, char *units,
-                      size_t *long_name_lenp, char *long_name,
-                      size_t *standard_name_lenp, char *standard_name,
-                      int *ncoord_vars, int *coord_varids);
-
-`ncid'
-     The ncid of the file.
-
-`varid'
-     The varid of the netCDF variable.
-
-`units_lenp'
-     Pointer to size_t which, if not NULL, will get the length of the
-     units attribute.
-
-`units'
-     Pointer to char array which, if not NULL, will get the long_name
-     string. Memory must be allocated before this function is called.
-     Call this function with a NULL for this parameter to get the size
-     first.
-
-`long_name_lenp'
-     Pointer to size_t which, if not NULL, will get the length of the
-     long_name attribute.
-
-`long_name'
-     Pointer to char array which, if not NULL, will get the long_name
-     string. Memory must be allocated before this function is called.
-     Call this function with a NULL for this parameter to get the size
-     first.
-
-`standard_name_lenp'
-     Pointer to size_t which, if not NULL, will get the length of the
-     standard_name attribute.
-
-`standard_name'
-     Pointer to char array which, if not NULL, will get the
-     standard_name string. Memory must be allocated before this
-     function is called. Call this function with a NULL for this
-     parameter to get the size first.
-
-`ncoord_vars'
-     Pointer to an integer, which, if non-NULL, will get the number of
-     coordinate variables identified in the "coordinates" attribute.
-
-`coord_varids'
-     Pointer to an array of integer, which, if non-NULL, will be filled
-     with the variable IDs of the variables listed int he "coordinates"
-     attribute.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_var_missing,  Next: nccf_inq_var_missing,  Prev: nccf_inq_var,  Up: Variables
-
-2.3 Define missing data values for a variable with nccf_def_var_missing
-=======================================================================
-
-nccf_def_notes
-
-   This function sets the "fill_value", "valid_min", and "valid_max"
-attributes.
-
-Usage
-=====
-
-     int nccf_def_var_missing(int ncid, int varid, const void *fill_valuep,
-                                 const void *valid_minp, const void *valid_maxp);
-
-`ncid'
-     The ncid of the file.
-
-`varid'
-     The varid of the netCDF variable being described.
-
-`fill_valuep'
-     If non-NULL, this will point to a value of the same type as this
-     varid, which will be used as the fill_value for the data.
-
-`valid_minp'
-     If non-NULL, this will point to a value of the same type as this
-     varid, which will be written as the "valid_min" attribute. If this
-     parameter is non-NULL, valid_max must also be provided.
-
-`valid_maxp'
-     If non-NULL, this will point to a value of the same type as this
-     varid, which will be written as the "valid_max" attribute. If this
-     parameter is non-NULL, valid_min must also be provided.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_var_missing,  Next: nccf_def_notes,  Prev: nccf_def_var_missing,  Up: Variables
-
-2.4 Learn about missing data settings with nccf_inq_var_missing
-===============================================================
-
-Get attributes which define missing data information. If the attributes
-are not there, then provide the valid data anyway, based on netCDF
-defaults.
-
-Usage
-=====
-
-     int nccf_inq_var_missing(int ncid, int varid, void *fill_valuep,
-                                 void *valid_minp, void *valid_maxp);
-
-`ncid'
-     The ncid of the file.
-
-`varid'
-     The varid of the netCDF variable.
-
-`fill_valuep'
-     If this is not NULL, the fill value of the variable will be
-     written at this address by nccf_inq_var_missing. If the fill value
-     was not defined for the variable, the netCDF default value will be
-     used.
-
-`valid_minp'
-     If this is not NULL, the valid_min value of the variable will be
-     written at this address by nccf_inq_var_missing. If the valid_min
-     was not defined for the variable, the netCDF default value will be
-     used.
-
-`valid_maxp'
-     If this is not NULL, the valid_max value of the variable will be
-     written at this address by nccf_inq_var_missing. If the valid_max
-     value was not defined for the variable, the netCDF default value
-     will be used.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_notes,  Next: nccf_inq_notes,  Prev: nccf_inq_var_missing,  Up: Variables
-
-2.5 Add CF-Recommended Metadata to a File or Variable with
-==========================================================
-
-nccf_def_notes
-
-   This functions writes up to four text attributes for either a
-variable, or an entire file. These text attributes, "institution,"
-"source," "comment," and "references" are recommended by the CF
-Metadata Convention.
-
-Usage
-=====
-
-     int nccf_def_notes(int ncid, int varid, char *units, char *long_name,
-                        char *standard_name, char *institution,
-                        char *source, char *comment, char *references);
-
-`ncid'
-     The ncid of the file.
-
-`varid'
-     The varid of the netCDF variable being described. Use NC_GLOBAL if
-     you wish these attributes to apply to the entire file.
-
-`institution'
-     If non-NULL, this text string will be written as the CF-recommended
-     "institution" attribute.
-
-`source'
-     If non-NULL, this text string will be written as the CF-recommended
-     "source" attribute.
-
-`comment'
-     If non-NULL, this text string will be written as the CF-recommended
-     "comment" attribute.
-
-`references'
-     If non-NULL, this text string will be written as the CF-recommended
-     "references" attribute.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_notes,  Next: nccf_def_latitude,  Prev: nccf_def_notes,  Up: Variables
-
-2.6 Read variable description with nccf_inq_notes
-=================================================
-
-Read any existing CF recommended text attributes from a variable.
-
-Usage
-=====
-
-     int nccf_inq_notes(int ncid, int varid,
-                        size_t *institution_lenp, char *institution,
-                        size_t *source_lenp, char *source,
-                        size_t *comment_lenp, char *comment,
-                        size_t *references_lenp, char *references);
-
-`ncid'
-     The ncid of the file.
-
-`varid'
-     The varid of the netCDF variable.
-
-`institution_lenp'
-     Pointer to size_t which, if not NULL, will get the length of the
-     institution attribute.
-
-`institution'
-     Pointer to char array which, if not NULL, will get the institution
-     string. Memory must be allocated before this function is called.
-     Call this function with a NULL for this parameter to get the size
-     first.
-
-`source_lenp'
-     Pointer to size_t which, if not NULL, will get the length of the
-     source attribute.
-
-`source'
-     Pointer to char array which, if not NULL, will get the source
-     string. Memory must be allocated before this function is called.
-     Call this function with a NULL for this parameter to get the size
-     first.
-
-`comment_lenp'
-     Pointer to size_t which, if not NULL, will get the length of the
-     comment attribute.
-
-`comment'
-     Pointer to char array which, if not NULL, will get the comment
-     string. Memory must be allocated before this function is called.
-     Call this function with a NULL for this parameter to get the size
-     first.
-
-`references_lenp'
-     Pointer to size_t which, if not NULL, will get the length of the
-     references attribute.
-
-`references'
-     Pointer to char array which, if not NULL, will get the references
-     string. Memory must be allocated before this function is called.
-     Call this function with a NULL for this parameter to get the size
-     first.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_latitude,  Next: nccf_inq_latitude,  Prev: nccf_inq_notes,  Up: Variables
-
-2.7 Define a coordinate variable and dimension for latitude with nccf_def_latitude
-==================================================================================
-
-Define a coordinate variable and dimension with all the CF recommended
-attribute accessories for latitude.
-
-Usage
-=====
-
-     int nccf_def_latitude(int ncid, size_t len, nc_type xtype,
-                              const char *formula_terms, int *lat_dimidp,
-                              int *lat_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`len'
-     The length of this coordinate dimension.
-
-`xtype'
-     The type of this coordinate variable.
-
-`formula_terms'
-     If non-NULL, a string which will be written as the "formula_terms"
-     attribute on the coordinate variable.
-
-`lat_dimidp'
-     If non-NULL, nccf_def_latitude will write the dimension ID of the
-     netCDF dimension for the latitude here.
-
-`lat_varidp'
-     If non-NULL, nccf_def_latitude will write the variable ID of the
-     netCDF coordinate variable for the latitude here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_latitude,  Next: nccf_def_longitude,  Prev: nccf_def_latitude,  Up: Variables
-
-2.8 Learn about a latitude coordinate variable and dimension with
-=================================================================
-
-nccf_inq_latitude
-
-   Inquire about a latitude dimension and coordinate variable.
-
-Usage
-=====
-
-     int nccf_inq_latitude(int ncid, size_t *lenp, nc_type *xtypep,
-                              size_t *ft_lenp, char *formula_terms,
-                              int *lat_dimidp, int *lat_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`lenp'
-     If non-NULL, the length of the latitude dimension will be written
-     here by nccf_inq_latitude.
-
-`xtypep'
-     If non-NULL, the type of the coordinate variable will be written
-     here.
-
-`ft_lenp'
-     If non-NULL, the length of the value of the "formula_terms"
-     attribute will be written here by ft_lenp. If there is no
-     "formula_terms" attribute, zero will be written.
-
-`lat_dimidp'
-     If non-NULL, the dimid of the latitude dimension will be written
-     here.
-
-`lat_varidp'
-     If non-NULL, the varid of the latitude coordinate variable will be
-     written here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_longitude,  Next: nccf_inq_longitude,  Prev: nccf_inq_latitude,  Up: Variables
-
-2.9 Define a coordinate variable and dimension for longitude with nccf_def_longitude
-====================================================================================
-
-Define a coordinate variable and dimension with all the CF recommended
-attribute accessories for longitude.
-
-Usage
-=====
-
-     int nccf_def_longitude(int ncid, size_t len, nc_type xtype,
-                              const char *formula_terms, int *lon_dimidp,
-                              int *lon_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`len'
-     The length of this coordinate dimension.
-
-`xtype'
-     The type of this coordinate variable.
-
-`formula_terms'
-     If non-NULL, a string which will be written as the "formula_terms"
-     attribute on the coordinate variable.
-
-`lon_dimidp'
-     If non-NULL, nccf_def_longitude will write the dimension ID of the
-     netCDF dimension for the longitude here.
-
-`lon_varidp'
-     If non-NULL, nccf_def_longitude will write the variable ID of the
-     netCDF coordinate variable for the longitude here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_longitude,  Next: nccf_def_lvl,  Prev: nccf_def_longitude,  Up: Variables
-
-2.10 Learn about a longitude coordinate variable and dimension with
-===================================================================
-
-nccf_inq_longitude
-
-   Inquire about a longitude dimension and coordinate variable.
-
-Usage
-=====
-
-     int nccf_inq_longitude(int ncid, size_t *lenp, nc_type *xtypep,
-                              size_t *ft_lenp, char *formula_terms,
-                              int *lon_dimidp, int *lon_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`lenp'
-     If non-NULL, the length of the longitude dimension will be written
-     here by nccf_inq_longitude.
-
-`xtypep'
-     If non-NULL, the type of the coordinate variable will be written
-     here.
-
-`ft_lenp'
-     If non-NULL, the length of the value of the "formula_terms"
-     attribute will be written here by ft_lenp. If there is no
-     "formula_terms" attribute, zero will be written.
-
-`lon_dimidp'
-     If non-NULL, the dimid of the longitude dimension will be written
-     here.
-
-`lon_varidp'
-     If non-NULL, the varid of the longitude coordinate variable will be
-     written here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_lvl,  Next: nccf_inq_lvl,  Prev: nccf_inq_longitude,  Up: Variables
-
-2.11 Define a coordinate variable and dimension for level with nccf_def_lvl
-===========================================================================
-
-Define a coordinate variable and dimension with all the CF recommended
-attribute accessories for a vertical level.
-
-Usage
-=====
-
-     int nccf_def_lvl(int ncid, const char *name, size_t len, nc_type xtype,
-                      const char *units, int positive_up, const char *standard_name,
-                      const char *long_name, const char *formula_terms,
-                      int *lvl_dimidp, int *lvl_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`name'
-     The name of the coordinate dimension and variable.
-
-`len'
-     The length of this coordinate dimension and variable.
-
-`xtype'
-     The type of this coordinate variable.
-
-`units'
-     If non-NULL, a string which will be written as the "units"
-     attribute on the coordinate variable.
-
-`positive_up'
-     Set to 0 and the attribute "positive" to "down". Set to any other
-     value to get "up".
-
-`standard_name'
-     If non-NULL, a string which will be written as the "standard_name"
-     attribute on the coordinate variable.
-
-`long_name'
-     If non-NULL, a string which will be written as the "long_name"
-     attribute on the coordinate variable.
-
-`lon_dimidp'
-     If non-NULL, nccf_def_lvl will write the dimension ID of the
-     netCDF dimension for the level here.
-
-`lon_varidp'
-     If non-NULL, nccf_def_lvl will write the variable ID of the netCDF
-     coordinate variable for the level here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_lvl,  Next: nccf_def_lvl_vert,  Prev: nccf_def_lvl,  Up: Variables
-
-2.12 Learn about a level coordinate variable and dimension with
-===============================================================
-
-nccf_inq_lvl
-
-   Inquire about a level dimension and coordinate variable.
-
-Usage
-=====
-
-     int nccf_inq_lvl(int ncid, char *name, size_t *lenp, nc_type *xtypep,
-                      size_t *ft_lenp, char *formula_terms, int *positive_upp,
-                      int *lvl_dimidp, int *lvl_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`name'
-     If non-NULL, the name of this vertical level dimension (and
-     variable) will be written here.
-
-`lenp'
-     If non-NULL, the length of the level dimension will be written
-     here by nccf_inq_lvl.
-
-`xtypep'
-     If non-NULL, the type of the coordinate variable will be written
-     here.
-
-`ft_lenp'
-     If non-NULL, the length of the value of the "formula_terms"
-     attribute will be written here by ft_lenp. If there is no
-     "formula_terms" attribute, zero will be written.
-
-`positive_upp'
-     If non-NULL, a one will be written here if the "positive" attribute
-     of this coordinate variable is "up", a zero will be written if it
-     is "down".
-
-`lvl_dimidp'
-     If non-NULL, the dimid of the level dimension will be written here.
-
-`lvl_varidp'
-     If non-NULL, the varid of the level coordinate variable will be
-     written here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_lvl_vert,  Next: nccf_inq_lvl_vert,  Prev: nccf_inq_lvl,  Up: Variables
-
-2.13 Define a coordinate variable and dimension for level with nccf_def_lvl
-===========================================================================
-
-Define a unitless vertical coordinate variable and dimension from
-Apendix D of the CF Convention, with all the CF recommended attribute
-accessories for a vertical level.
-
-Usage
-=====
-
-     int nccf_def_lvl_vert(int ncid, int lvl_type, const char *name, nc_type xtype,
-                           size_t len, int *lvl_dimidp, int *lvl_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`lvl_type'
-     One of: CF_VERT_ATM_LN, CF_VERT_SIGMA, CF_VERT_HYBRID_SIGMA,
-     CF_VERT_HYBRID_HEIGHT, CF_VERT_SLEVE, CF_VERT_OCEAN_SIGMA,
-     CF_VERT_OCEAN_S, CF_VERT_OCEAN_SIGMA_Z, CF_VERT_OCEAN_DBL_SIGMA.
-
-`name'
-     The name of the coordinate dimension and variable.
-
-`xtype'
-     The type of this coordinate variable.
-
-`len'
-     The length of this coordinate dimension and variable.
-
-`lvl_dimidp'
-     If non-NULL, the function will write the dimension ID of the
-     netCDF dimension for the level here.
-
-`llvl_varidp'
-     If non-NULL, the function will write the variable ID of the netCDF
-     coordinate variable for the level here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_lvl_vert,  Next: nccf_def_time,  Prev: nccf_def_lvl_vert,  Up: Variables
-
-2.14 Learn about a level coordinate variable and dimension with
-===============================================================
-
-nccf_inq_lvl
-
-   Inquire about a level dimension and coordinate variable.
-
-Usage
-=====
-
-     int nccf_inq_lvl_vert(int ncid, char *name, nc_type *xtypep, size_t *lenp,
-                           int *lvl_typep, int *lvl_dimidp, int *lvl_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`name'
-     If non-NULL, the name of this vertical level dimension (and
-     variable) will be written here.
-
-`xtypep'
-     If non-NULL, the type of the coordinate variable will be written
-     here.
-
-`lenp'
-     If non-NULL, the length of the level dimension will be written
-     here.
-
-`lvl_typep'
-     If non-NULL, the type of vertical dimension will be written here,
-     one of CF_VERT_ATM_LN, CF_VERT_SIGMA, CF_VERT_HYBRID_SIGMA,
-     CF_VERT_HYBRID_HEIGHT, CF_VERT_SLEVE, CF_VERT_OCEAN_SIGMA,
-     CF_VERT_OCEAN_S, CF_VERT_OCEAN_SIGMA_Z, CF_VERT_OCEAN_DBL_SIGMA.
-
-`lvl_dimidp'
-     If non-NULL, the dimid of the level dimension will be written here.
-
-`lvl_varidp'
-     If non-NULL, the varid of the level coordinate variable will be
-     written here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_time,  Next: nccf_inq_time,  Prev: nccf_inq_lvl_vert,  Up: Variables
-
-2.15 Define a coordinate variable and dimension for time with nccf_def_time
-===========================================================================
-
-Define a coordinate variable and dimension with all the CF recommended
-attribute accessories for time.
-
-Usage
-=====
-
-     int nccf_def_time(int ncid, const char *name, size_t len, nc_type xtype,
-                          const char *units, const char *standard_name, const char *long_name,
-                          const char *formula_terms, int *time_dimidp, int *time_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`len'
-     The length of this coordinate dimension.
-
-`xtype'
-     The type of this coordinate variable.
-
-`formula_terms'
-     If non-NULL, a string which will be written as the "formula_terms"
-     attribute on the coordinate variable.
-
-`lon_dimidp'
-     If non-NULL, nccf_def_time will write the dimension ID of the
-     netCDF dimension for the time here.
-
-`lon_varidp'
-     If non-NULL, nccf_def_time will write the variable ID of the
-     netCDF coordinate variable for the time here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_time,  Next: nccf_def_ft_sigma,  Prev: nccf_def_time,  Up: Variables
-
-2.16 Learn about a time coordinate variable and dimension with
-==============================================================
-
-nccf_inq_time
-
-   Inquire about a time dimension and coordinate variable.
-
-Usage
-=====
-
-     int nccf_inq_time(int ncid, size_t *lenp, nc_type *xtypep, size_t *ft_lenp,
-                          char *formula_terms, int *time_dimidp, int *time_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`lenp'
-     If non-NULL, the length of the time dimension will be written here
-     by nccf_inq_time.
-
-`xtypep'
-     If non-NULL, the type of the coordinate variable will be written
-     here.
-
-`ft_lenp'
-     If non-NULL, the length of the value of the "formula_terms"
-     attribute will be written here by ft_lenp. If there is no
-     "formula_terms" attribute, zero will be written.
-
-`formula_terms'
-     If non-NULL the value of the "formula_terms" attribute, if any,
-     will be copied here.
-
-`time_dimidp'
-     If non-NULL, the dimid of the time dimension will be written here.
-
-`time_varidp'
-     If non-NULL, the varid of the time coordinate variable will be
-     written here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_ft_sigma,  Next: nccf_inq_lvl_sigma,  Prev: nccf_inq_time,  Up: Variables
-
-2.17 Define atmosphere sigma coordinate.
-========================================
-
-Define formula terms attribute for atmosphere sigma coordinate variable.
-
-Usage
-=====
-
-     int nccf_def_ft_sigma(int ncid, int varid, int ps_varid, int ptop_varid);
-
-`ncid'
-     The ncid of the file.
-
-`varid'
-     The varid of the vertical coordinate variable.
-
-`ps_varid'
-     The variable ID of the ps variable.
-
-`ptop_varid'
-     The variable ID of the ptop variable.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_lvl_sigma,  Next: nccf_def_ft_hybrid_sigma,  Prev: nccf_def_ft_sigma,  Up: Variables
-
-2.18 Inquire about atmosphere sigma coordinate.
-===============================================
-
-nccf_inq_time
-
-   Inquire about atmosphere sigma coordinate.
-
-Usage
-=====
-
-     int nccf_inq_lvl_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp,
-                            int *ps_varidp, int *ptop_varidp, int *lvl_dimidp,
-                            int *lvl_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`name'
-     If non-NULL, this pointer gets the name of the coordinate variable
-     and dimension.
-
-`xtypep'
-     If non-NULL, the type of the coordinate variable will be written
-     here.
-
-`lenp'
-     If non-NULL, the length of the coordinate dimension will be written
-     here.
-
-`ps_varidp'
-     If non-NULL, the variable ID of the ps variable will be written
-     here.
-
-`ptop_varidp'
-     If non-NULL, the variable ID of the ptop variable will be written
-     here.
-
-`lvl_dimidp'
-     If non-NULL, the dimid of the coordinate dimension will be written
-     here.
-
-`lvl_varidp'
-     If non-NULL, the varid of the coordinate variable will be written
-     here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_ft_hybrid_sigma,  Next: nccf_inq_lvl_hybrid_sigma,  Prev: nccf_inq_lvl_sigma,  Up: Variables
-
-2.19 Define atmosphere sigma coordinate.
-========================================
-
-Define formula terms attribute for atmosphere hybrid sigma coordinate
-variable.
-
-Usage
-=====
-
-     int nccf_def_ft_hybrid_sigma(int ncid, int varid, int a_varid, int b_varid,
-                                  int ps_varid, int p0_varid);
-
-`ncid'
-     The ncid of the file.
-
-`varid'
-     The varid of the vertical coordinate variable.
-
-`a_varid'
-     The variable ID of the a variable.
-
-`b_varid'
-     The variable ID of the b variable.
-
-`ps_varid'
-     The variable ID of the ps variable.
-
-`ptop_varid'
-     The variable ID of the ptop variable.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_lvl_hybrid_sigma,  Next: nccf_def_ft_hybrid_height,  Prev: nccf_def_ft_hybrid_sigma,  Up: Variables
-
-2.20 Inquire about atmosphere sigma coordinate.
-===============================================
-
-Inquire about atmosphere hybrid sigma coordinate.
-
-Usage
-=====
-
-     int nccf_inq_lvl_hybrid_sigma(int ncid, char *name, nc_type *xtypep,
-                                   size_t *lenp, int *a_varidp, int *b_varidp,
-                                   int *ps_varidp, int *p0_varidp, int *lvl_dimidp,
-                                   int *lvl_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`name'
-     If non-NULL, this pointer gets the name of the coordinate variable
-     and dimension.
-
-`xtypep'
-     If non-NULL, the type of the coordinate variable will be written
-     here.
-
-`lenp'
-     If non-NULL, the length of the coordinate dimension will be written
-     here.
-
-`a_varidp'
-     If non-NULL, the variable ID of the a variable will be written
-     here.
-
-`b_varidp'
-     If non-NULL, the variable ID of the b variable will be written
-     here.
-
-`ps_varidp'
-     If non-NULL, the variable ID of the ps variable will be written
-     here.
-
-`ptop_varidp'
-     If non-NULL, the variable ID of the ptop variable will be written
-     here.
-
-`lvl_dimidp'
-     If non-NULL, the dimid of the coordinate dimension will be written
-     here.
-
-`lvl_varidp'
-     If non-NULL, the varid of the coordinate variable will be written
-     here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_ft_hybrid_height,  Next: nccf_inq_lvl_hybrid_height,  Prev: nccf_inq_lvl_hybrid_sigma,  Up: Variables
-
-2.21 The formula_terms attribute for atmosphere hybrid height
-=============================================================
-
-Define formula terms attribute for atmosphere hybrid height coordinate
-variable
-
-Usage
-=====
-
-     int nccf_def_ft_hybrid_height(int ncid, int varid, int a_varid, int b_varid,
-                                   int orog_varid);
-
-`ncid'
-     The ncid of the file.
-
-`varid'
-     The varid of the vertical coordinate variable.
-
-`a_varid'
-     The variable ID of the a variable.
-
-`b_varid'
-     The variable ID of the b variable.
-
-`orog_varid'
-     The variable ID of the orog variable.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_lvl_hybrid_height,  Next: nccf_def_ft_sleve,  Prev: nccf_def_ft_hybrid_height,  Up: Variables
-
-2.22 Inquire about hybrid height coordinate.
-============================================
-
-Inquire about the hybrid height coordinate.
-
-Usage
-=====
-
-     int nccf_inq_lvl_hybrid_height(int ncid, char *name, nc_type *xtypep, size_t *lenp,
-                                    int *a_varidp, int *b_varidp, int *orog_varidp,
-                                    int *lvl_dimidp, int *lvl_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`name'
-     If non-NULL, this pointer gets the name of the coordinate variable
-     and dimension.
-
-`xtypep'
-     If non-NULL, the type of the coordinate variable will be written
-     here.
-
-`lenp'
-     If non-NULL, the length of the coordinate dimension will be written
-     here.
-
-`a_varidp'
-     If non-NULL, the variable ID of the a variable will be written
-     here.
-
-`b_varidp'
-     If non-NULL, the variable ID of the b variable will be written
-     here.
-
-`orog_varidp'
-     If non-NULL, the variable ID of the orog variable will be written
-     here.
-
-`lvl_dimidp'
-     If non-NULL, the dimid of the coordinate dimension will be written
-     here.
-
-`lvl_varidp'
-     If non-NULL, the varid of the coordinate variable will be written
-     here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_ft_sleve,  Next: nccf_inq_lvl_sleve,  Prev: nccf_inq_lvl_hybrid_height,  Up: Variables
-
-2.23 Define atmosphere sleve coordinate.
-========================================
-
-Define formula terms attribute for the atmosphere sleve coordinate
-variable.
-
-Usage
-=====
-
-     int nccf_def_ft_sleve(int ncid, int varid, int a_varid, int b1_varid,
-                           int b2_varid, int ztop_varid, int zsurf1_varid,
-                           int zsurf2_varid);
-
-`ncid'
-     The ncid of the file.
-
-`varid'
-     The varid of the vertical coordinate variable.
-
-`a_varid'
-     The variable ID of the a variable.
-
-`b1_varid'
-     The variable ID of the b1 variable.
-
-`b2_varid'
-     The variable ID of the b2 variable.
-
-`ztop_varid'
-     The variable ID of the ztop variable.
-
-`zsurf1_varid'
-     The variable ID of the zsurf1 variable.
-
-`zsurf2_varid'
-     The variable ID of the zsurf2 variable.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_lvl_sleve,  Next: nccf_def_ft_ocean_sigma,  Prev: nccf_def_ft_sleve,  Up: Variables
-
-2.24 Inquire About Sleve Coordinate.
-====================================
-
-Inquire about the sleve coordinate.
-
-Usage
-=====
-
-     int nccf_inq_lvl_sleve(int ncid, char *name, nc_type *xtypep, size_t *lenp,
-                            int *a_varidp, int *b1_varidp, int *b2_varidp, int *ztop_varidp,
-                            int *zsurf1_varidp, int *zsurf2_varidp, int *lvl_dimidp,
-                            int *lvl_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`name'
-     If non-NULL, this pointer gets the name of the coordinate variable
-     and dimension.
-
-`xtypep'
-     If non-NULL, the type of the coordinate variable will be written
-     here.
-
-`lenp'
-     If non-NULL, the length of the coordinate dimension will be written
-     here.
-
-`a_varidp'
-     If non-NULL, the variable ID of the a variable will be written
-     here.
-
-`b1_varidp'
-     If non-NULL, the variable ID of the b1 variable will be written
-     here.
-
-`b2_varidp'
-     If non-NULL, the variable ID of the b2 variable will be written
-     here.
-
-`ztop_varidp'
-     If non-NULL, the variable ID of the ztop variable will be written
-     here.
-
-`zsurf1_varidp'
-     If non-NULL, the variable ID of the zsurf1 variable will be written
-     here.
-
-`zsurf2_varidp'
-     If non-NULL, the variable ID of the zsurf2 variable will be written
-     here.
-
-`lvl_dimidp'
-     If non-NULL, the dimid of the coordinate dimension will be written
-     here.
-
-`lvl_varidp'
-     If non-NULL, the varid of the coordinate variable will be written
-     here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_ft_ocean_sigma,  Next: nccf_inq_lvl_ocean_sigma,  Prev: nccf_inq_lvl_sleve,  Up: Variables
-
-2.25 Define Ocean Sigma Coordinate.
-===================================
-
-Define the formula terms attribute for the ocean sigma coordinate
-variable.
-
-Usage
-=====
-
-     int nccf_def_ft_ocean_sigma(int ncid, int varid, int eta_varid, int depth_varid);
-
-`ncid'
-     The ncid of the file.
-
-`varid'
-     The varid of the vertical coordinate variable.
-
-`eta_varid'
-     The variable ID of the eta variable.
-
-`depth_varid'
-     The variable ID of the depth variable.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_lvl_ocean_sigma,  Next: nccf_def_ft_ocean_s,  Prev: nccf_def_ft_ocean_sigma,  Up: Variables
-
-2.26 Inquire About Ocean Sigma Coordinate.
-==========================================
-
-Inquire about the ocean sigma coordinate.
-
-Usage
-=====
-
-     int nccf_inq_lvl_ocean_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp,
-                                  int *eta_varidp, int *depth_varidp, int *lvl_dimidp,
-                                  int *lvl_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`name'
-     If non-NULL, this pointer gets the name of the coordinate variable
-     and dimension.
-
-`xtypep'
-     If non-NULL, the type of the coordinate variable will be written
-     here.
-
-`lenp'
-     If non-NULL, the length of the coordinate dimension will be written
-     here.
-
-`eta_varidp'
-     If non-NULL, the variable ID of the eta variable will be written
-     here.
-
-`lvl_dimidp'
-     If non-NULL, the dimid of the coordinate dimension will be written
-     here.
-
-`lvl_varidp'
-     If non-NULL, the varid of the coordinate variable will be written
-     here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_ft_ocean_s,  Next: nccf_inq_lvl_ocean_s,  Prev: nccf_inq_lvl_ocean_sigma,  Up: Variables
-
-2.27 Define Ocean S Coordinate.
-===============================
-
-Define ocean s coordinate.
-
-Usage
-=====
-
-     int nccf_def_ft_ocean_s(int ncid, const char *name, nc_type xtype, size_t len,
-                              int eta_varid, int depth_varid, int a_varid, int b_varid,
-                              int depth_c_varid, int *lvl_dimidp, int *lvl_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`varid'
-     The varid of the vertical coordinate variable.
-
-`xtype'
-     The type of this coordinate variable.
-
-`len'
-     The length of this coordinate dimension.
-
-`eta_varid'
-     The variable ID of the eta variable.
-
-`depth_varid'
-     The variable ID of the depth variable.
-
-`a_varid'
-     The variable ID of the a variable.
-
-`b_varid'
-     The variable ID of the b variable.
-
-`depth_c_varid'
-     The variable ID of the depth_c variable.
-
-`lvl_dimidp'
-     If non-NULL, the dimension ID of the netCDF coordinate dimension
-     will be written here.
-
-`lvl_varidp'
-     If non-NULL, the variable ID of the netCDF coordinate variable
-     will be written here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_lvl_ocean_s,  Next: nccf_def_ft_ocean_sigma_z,  Prev: nccf_def_ft_ocean_s,  Up: Variables
-
-2.28 Inquire About Ocean S Coordinate.
-======================================
-
-nccf_inq_time
-
-   Inquire about the ocean s coordinate.
-
-Usage
-=====
-
-     int nccf_inq_lvl_ocean_s(int ncid, char *name, nc_type *xtypep, size_t *lenp,
-                              int *eta_varidp, int *depth_varidp, int *a_varidp, int *b_varidp,
-                              int *depth_c_varidp, int *lvl_dimidp, int *lvl_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`name'
-     If non-NULL, this pointer gets the name of the coordinate variable
-     and dimension.
-
-`xtypep'
-     If non-NULL, the type of the coordinate variable will be written
-     here.
-
-`lenp'
-     If non-NULL, the length of the coordinate dimension will be written
-     here.
-
-`eta_varidp'
-     If non-NULL, the variable ID of the eta variable will be written
-     here.
-
-`depth_varidp'
-     If non-NULL, the variable ID of the depth variable will be written
-     here.
-
-`a_varidp'
-     If non-NULL, the variable ID of the a variable will be written
-     here.
-
-`b_varidp'
-     If non-NULL, the variable ID of the b variable will be written
-     here.
-
-`depth_c_varidp'
-     If non-NULL, the variable ID of the depth_c variable will be
-     written here.
-
-`lvl_dimidp'
-     If non-NULL, the dimid of the coordinate dimension will be written
-     here.
-
-`lvl_varidp'
-     If non-NULL, the varid of the coordinate variable will be written
-     here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_ft_ocean_sigma_z,  Next: nccf_inq_lvl_ocean_sigma_z,  Prev: nccf_inq_lvl_ocean_s,  Up: Variables
-
-2.29 Define Ocean Sigma Z Coordinate.
-=====================================
-
-Define ocean sigma z coordinate.
-
-Usage
-=====
-
-     int nccf_def_ft_ocean_sigma_z(int ncid, const char *name, nc_type xtype,
-                                    size_t len, int eta_varid, int depth_varid,
-                                    int depth_c_varid, int nsigma_varid,
-                                    int zlev_varid, int *lvl_dimidp, int *lvl_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`varid'
-     The varid of the vertical coordinate variable.
-
-`xtype'
-     The type of this coordinate variable.
-
-`len'
-     The length of this coordinate dimension.
-
-`eta_varid'
-     The variable ID of the eta variable.
-
-`depth_varid'
-     The variable ID of the depth variable.
-
-`depth_c_varid'
-     The variable ID of the depth_c variable.
-
-`nsigma_varid'
-     The variable ID of the nsigma variable.
-
-`zlev_varid'
-     The variable ID of the zlev variable.
-
-`lvl_dimidp'
-     If non-NULL, the dimension ID of the netCDF coordinate dimension
-     will be written here.
-
-`lvl_varidp'
-     If non-NULL, the variable ID of the netCDF coordinate variable
-     will be written here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_lvl_ocean_sigma_z,  Next: nccf_def_ft_ocean_dbl_sigma,  Prev: nccf_def_ft_ocean_sigma_z,  Up: Variables
-
-2.30 Inquire About Ocean Sigma Z Coordinate.
-============================================
-
-Inquire about the ocean sigma z coordinate.
-
-Usage
-=====
-
-     int nccf_inq_lvl_ocean_sigma_z(int ncid, char *name, nc_type *xtypep, size_t *lenp,
-                                    int *eta_varidp, int *depth_varidp, int *depth_c_varidp,
-                                    int *nsigma_varidp, int *zlev_varidp, int *lvl_dimidp,
-                                    int *lvl_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`name'
-     If non-NULL, this pointer gets the name of the coordinate variable
-     and dimension.
-
-`xtypep'
-     If non-NULL, the type of the coordinate variable will be written
-     here.
-
-`lenp'
-     If non-NULL, the length of the coordinate dimension will be written
-     here.
-
-`eta_varidp'
-     If non-NULL, the variable ID of the eta variable will be written
-     here.
-
-`depth_varidp'
-     If non-NULL, the variable ID of the depth variable will be written
-     here.
-
-`depth_c_varidp'
-     If non-NULL, the variable ID of the depth_c variable will be
-     written here.
-
-`nsigma_varidp'
-     If non-NULL, the variable ID of the nsigma variable will be written
-     here.
-
-`zlev_varidp'
-     If non-NULL, the variable ID of the zlev variable will be written
-     here.
-
-`lvl_dimidp'
-     If non-NULL, the dimid of the coordinate dimension will be written
-     here.
-
-`lvl_varidp'
-     If non-NULL, the varid of the coordinate variable will be written
-     here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_def_ft_ocean_dbl_sigma,  Next: nccf_inq_lvl_ocean_dbl_sigma,  Prev: nccf_inq_lvl_ocean_sigma_z,  Up: Variables
-
-2.31 Define Ocean Double Sigma Coordinate.
-==========================================
-
-Define ocean double sigma coordinate.
-
-Usage
-=====
-
-     int nccf_def_ft_ocean_dbl_sigma(int ncid, const char *name, nc_type xtype, size_t len,
-                                      int depth_varid, int z1_varid, int z2_varid, int a_varid,
-                                      int href_varid, int k_c_varid, int *lvl_dimidp,
-                                      int *lvl_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`varid'
-     The varid of the vertical coordinate variable.
-
-`xtype'
-     The type of this coordinate variable.
-
-`len'
-     The length of this coordinate dimension.
-
-`depth_varid'
-     The variable ID of the depth variable.
-
-`z1_varid'
-     The variable ID of the z1 variable.
-
-`z2_varid'
-     The variable ID of the z2 variable.
-
-`a_varid'
-     The variable ID of the a variable.
-
-`href_varid'
-     The variable ID of the href variable.
-
-`k_c_varid'
-     The variable ID of the k_c variable.
-
-`lvl_dimidp'
-     If non-NULL, the dimension ID of the netCDF coordinate dimension
-     will be written here.
-
-`lvl_varidp'
-     If non-NULL, the variable ID of the netCDF coordinate variable
-     will be written here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_inq_lvl_ocean_dbl_sigma,  Next: nccf_get_vara,  Prev: nccf_def_ft_ocean_dbl_sigma,  Up: Variables
-
-2.32 Inquire About Ocean Double Sigma Coordinate.
-=================================================
-
-Inquire about the ocean double sigma coordinate.
-
-Usage
-=====
-
-     int nccf_inq_lvl_ocean_dbl_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp,
-                                      int *depth_varidp, int *z1_varidp, int *z2_varidp,
-                                      int *a_varidp, int *href_varidp, int *k_c_varidp,
-                                      int *lvl_dimidp, int *lvl_varidp);
-
-`ncid'
-     The ncid of the file.
-
-`name'
-     If non-NULL, this pointer gets the name of the coordinate variable
-     and dimension.
-
-`xtypep'
-     If non-NULL, the type of the coordinate variable will be written
-     here.
-
-`lenp'
-     If non-NULL, the length of the coordinate dimension will be written
-     here.
-
-`depth_varidp'
-     If non-NULL, the variable ID of the depth variable will be written
-     here.
-
-`z1_varidp'
-     If non-NULL, the variable ID of the z1 variable will be written
-     here.
-
-`z2_varidp'
-     If non-NULL, the variable ID of the z2 variable will be written
-     here.
-
-`a_varidp'
-     If non-NULL, the variable ID of the a variable will be written
-     here.
-
-`href_varidp'
-     If non-NULL, the variable ID of the href variable will be written
-     here.
-
-`k_c_varidp'
-     If non-NULL, the variable ID of the k_c variable will be written
-     here.
-
-`lvl_dimidp'
-     If non-NULL, the dimid of the coordinate dimension will be written
-     here.
-
-`lvl_varidp'
-     If non-NULL, the varid of the coordinate variable will be written
-     here.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf_get_vara,  Prev: nccf_inq_lvl_ocean_dbl_sigma,  Up: Variables
-
-2.33 Get a geographic subset of the data.
-=========================================
-
-Get a geographic subset of the data.
-
-Usage
-=====
-
-        int nccf_get_vara(int ncid, int varid, float *lat_bounds, int *nlat, float *lon_bounds,
-     		     int *nlon, int *lvl_index, int *nlvl, int rec, void *data);
-
-`ncid'
-     The ncid of the file.
-
-`varid'
-     The varid of the data variable from which the subset will be taken.
-
-`lat_bounds'
-     A length two array, this holds the latitude start and stop values
-     for the range of interest.
-
-`nlat'
-     A pointer to an integer which will get the number of latitude
-     values which fall within the range.
-
-`lon_bounds'
-     A length two array, this holds the longitude start and stop values
-     for the range of interest. (Wrapping around the dateline is not
-     allowed!)
-
-`nlon'
-     A pointer to an integer which will get the number of longitude
-     values which fall within the range.
-
-`lvl_index'
-     A zero-based index number for the verticle level of interest to the
-     subsetter. (Ignored if data has no vertical axis).
-
-`timestep'
-     A zero-based index number for the timestep of interest to the
-     subsetter. (Ignored if data has no time axis).
-
-`data'
-     A pointer to which the data subset will be written. Memory must be
-     allocated (and deallocated) by the user.
-
-
-Return Codes
-============
-
-This function returns zero for success, or an error code for failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: Coordinates,  Next: GRIDSPEC,  Prev: Variables,  Up: Top
-
-3 Coordinate Systems
-********************
-
-* Menu:
-
-* nccf-def-axis-type::
-* nccf-inq-axis-type::
-* nccf-def-coord-system::
-* nccf-inq-coord-system::
-* nccf-assign-coord-system::
-* nccf-def-transform::
-* nccf-inq-transform::
-* nccf-assign-transform::
-
-
-File: libcf.info,  Node: nccf-def-axis-type,  Next: nccf-inq-axis-type,  Prev: Coordinates,  Up: Coordinates
-
-3.1 Label the axis type of a coordinate var with nccf_def_axis_type
-===================================================================
-
-Usage
-=====
-
-     int
-     nccf_def_axis_type(int ncid, int varid, int axis_type);
-
-`ncid'
-     The ncid of the file.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf-inq-axis-type,  Next: nccf-def-coord-system,  Prev: nccf-def-axis-type,  Up: Coordinates
-
-3.2 Find out the axis type of a coordinate var with nccf_inq_axis_type
-======================================================================
-
-Usage
-=====
-
-     int
-     nccf_inq_axis_type(int ncid, int varid, int *axis_type);
-
-`ncid'
-     The ncid of the file.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf-def-coord-system,  Next: nccf-inq-coord-system,  Prev: nccf-inq-axis-type,  Up: Coordinates
-
-3.3 Define a coordinate system with nccf_def_coord_system
-=========================================================
-
-Usage
-=====
-
-     int
-     nccf_def_coord_system(int ncid, const char *name, int naxes, int *axis_varids,
-                         int *system_varid);
-
-   Define a coordinate system consisting of naxes axes, each axis
-represented by a coordinate varid in the axis_varids array. This create
-a new (scalar, NC_CHAR) var, whose varid is returned in system_varid.
-
-`ncid'
-     The ncid of the file.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf-inq-coord-system,  Next: nccf-assign-coord-system,  Prev: nccf-def-coord-system,  Up: Coordinates
-
-3.4 Find out about a coordinate system with nccf_inq_coord_system
-=================================================================
-
-Usage
-=====
-
-     int
-     nccf_inq_coord_system(int ncid, int system_varid, char *name,
-                         int *naxes, int *axis_varids);
-
-   Find out about a coordinate system, it's name, number of axes, and
-the varid of each axis coordinate var.
-
-`ncid'
-     The ncid of the file.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf-assign-coord-system,  Next: nccf-def-transform,  Prev: nccf-inq-coord-system,  Up: Coordinates
-
-3.5 Assign a coordinate system to a var with nccf_assign_coord_system
-=====================================================================
-
-Usage
-=====
-
-     int
-     nccf_assign_coord_system(int ncid, int varid, int system_varid);
-
-   Assign a coordinate system to a var. This adds an attribute to the
-var.
-
-`ncid'
-     The ncid of the file.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf-def-transform,  Next: nccf-inq-transform,  Prev: nccf-assign-coord-system,  Up: Coordinates
-
-3.6 Define a coordinate transform with nccf_def_transform
-=========================================================
-
-Usage
-=====
-
-     int
-     nccf_def_transform(int ncid, const char *name, const char *transform_type,
-                      const char *transform_name, int *transform_varid);
-
-   Define a coordinate transform. This adds a (scalar, NC_CHAR) var,
-which contains some attributes. The varid of this new variable is
-returned in transform_varid.
-
-`ncid'
-     The ncid of the file.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf-inq-transform,  Next: nccf-assign-transform,  Prev: nccf-def-transform,  Up: Coordinates
-
-3.7 Find out about a coordinate transform with nccf_inq_transform
-=================================================================
-
-Usage
-=====
-
-     int
-     nccf_inq_transform(int ncid, int transform_varid, char *name, size_t *type_len,
-                      char *transform_type, size_t *name_len, char *transform_name);
-
-   Find out about a coordinate transform, it's name, and the contents
-of the transform_type and transform_name attributes. Pass NULL for any
-that you're not interested in. Pass NULL for transform_type and
-transform_name to get their lengths with type_len and name_len.
-
-`ncid'
-     The ncid of the file.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: nccf-assign-transform,  Prev: nccf-inq-transform,  Up: Coordinates
-
-3.8 Assign a coordinate transform to a coordinate system with nccf_assign_transform
-===================================================================================
-
-Usage
-=====
-
-     int
-     nccf_assign_transform(int ncid, int system_varid, int transform_varid);
-
-   Assign a coordinate transform to a coordinate system. This adds an
-attribute to the variable that holds the coordinate system attributes.
-
-`ncid'
-     The ncid of the file.
-
-
-Return Codes
-============
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
-Example
-=======
-
-
-
-File: libcf.info,  Node: GRIDSPEC,  Next: Combined Index,  Prev: Coordinates,  Up: Top
-
-4 GRIDSPEC - A standard for the description of grids used in Earth System models
-********************************************************************************
-
-The GRIDSPEC is a proposed CF standard. It is not yet part of the
-Climate and Forecast Conventions. Support for GRIDSPEC in libcf is
-provided as a service to the CF community, allowing for the evaluation
-of the proposed GRIDSPEC standard.
-
-   Each of the GRIDSPEC tools listed below may be call
-programmatically, or with a command line utility.
-
-   For more information about GRIDSPEC see
-`http://www.gfdl.noaa.gov/~vb/gridstd/gridstd.html'.
-
-* Menu:
-
-* gs_make_hgrid::
-* gs_fregrid::
-* gs_make_solo_mosaic::
-* gs_river_regrid::
-* gs_transfer_to_mosaic::
-* gs_make_vgrid::
-* gs_make_coupler_mosaic::
-* gs_make_topog::
-
-
-File: libcf.info,  Node: gs_make_hgrid,  Next: gs_fregrid,  Prev: GRIDSPEC,  Up: GRIDSPEC
-
-4.1 Make a Horizontal Grid
-==========================
-
-This function can generate different types of horizontal grids. The
-output data is on supergrid ( model grid size x refinement(=2) ).  For
-'cubic_grid', six grid files which contain the grid information for each
-tile will be generated, otherwise one file will be generated.
-
-   Specify the grid type through grid_type parameter. The value of
-grid_type can be 'from_file', 'spectral_grid', 'spherical_grid',
-'conformal_cubic_grid', 'gnomonic_ed' or 'simple_cartesian_grid', with
-default value 'spherical_grid'.
-
-   The nlon and nlat parameters must be specified to indicate supergrid
-size (for cubic_grid, nlat is not needed because nlat has the same
-value as nlon).
-
-     int
-     gs_make_hgrid(char *grid_type, int *nlat, int *nlon,
-     	      int nxbnds0, int nybnds0, int nxbnds1, int nybnds1,
-     	      int nxbnds2, int nybnds2, double lat_join, int nratio,
-     	      double simple_dx, double simple_dy, int ntilex, int ntiley,
-                   char *gridname, char *center, char *history, double *xbnds,
-     	      double *ybnds)
-
-   The following grid types are available:
-
-`from_file'
-     my_grid_file must be specified. The grid " specified in
-     my_grid_file should be super grid vertex.
-
-`spectral_grid'
-     no other optional or required arguments.
-
-`regular_lonlat_grid'
-     nxbnds, nybnds xbnds, ybnds, must be specified to define the grid
-     bounds.
-
-`tripolar_grid'
-     nxbnds, nybnds, xbnds, ybnds, must be specified to define the grid
-     bounds. lat_join is optional with default value 65.
-
-`conformal_cubic_grid'
-     nratio is optional argument.
-
-`gnomonic_ed'
-     equal distance gnomonic cubic grid.
-
-`simple_cartesian_grid'
-     xbnds, ybnds must be specified to define
-         the grid bounds location and grid size. number
-                   of bounds must be 2 in both and x and
-                    y-direction. simple_dx and simple_dy must b
-                           specified to specify uniform cell length.
-
-
-`grid_type'
-     specify type of topography (see table above).
-
-`my_grid_file'
-     when this flag is present, the program will read grid information
-     from 'my_grid_file'. The file format can be ascii file or netcdf
-     file. Multiple file entry are allowed but the number should be
-     less than MAXBOUNDS.
-
-`nxbnds'
-     Specify number of zonal regions for varying resolution.
-
-`nybnds'
-     Specify number of meridinal regions for varying resolution.
-
-`xbnds'
-     Specify boundaries for defining zonal regions of varying
-     resolution. When tripolar is present, x also defines the longitude
-     of the two new poles nxbnds must be 2 and lon_start = x(1),
-     lon_end = x(nxbnds) are longitude of the two new poles.
-
-`ybnds'
-     Specify boundaries for defining meridional regions of varying
-     resolution
-
-`nlon'
-     Number of model grid points(supergrid) for each zonal regions of
-     varying resolution.
-
-`nlat'
-     Number of model grid points(supergid) for each meridinal regions of
-     varying resolution.
-
-`lat_join'
-     Specify latitude for joining spherical and rotate bipolar grid.
-     Default value is 65 degree.
-
-`nratio'
-     Speicify the refinement ratio when calculating cell length and
-     area of supergrid.
-
-`simple_dx'
-     Specify the uniform cell length in x-direction fo simple cartesian
-     grid.
-
-`simple_dy'
-     Specify the uniform cell length in y-direction fo simple cartesian
-     grid.
-
-`ndivx'
-     Specify number division in x-direction for each face, default
-     value is 1.
-
-`ndivy'
-     Specify number division in y-direction for each face, default
-     value is 1.
-
-`grid_name'
-     Specify the grid name. The output grid file name will be
-     grid_name.nc if there is one tile and grid_name.tile#.nc if there
-     is more than one tile The default value will be horizontal_grid.
-
-`center'
-     Specify the center location of grid. The valid entry will be
-     'none', 't_cell' or 'c_cell' with default value 'none'. The grid
-     refinement is assumed to be 2 in x and y-direction when center is
-     not 'none'. 'c_cell' should be used for the gr used in MOM4.
-
-
-
-File: libcf.info,  Node: gs_fregrid,  Next: gs_make_solo_mosaic,  Prev: gs_make_hgrid,  Up: GRIDSPEC
-
-4.2 Remap data from Input Mosaic to Output Mosaic
-=================================================
-
-This function remaps data (scalar or vector) from input_mosaic onto
-output_mosaic.
-
-   The target grid also could be specified through lonBegin, lonEnd,
-latBegin, latEnd, nlon and nlat.
-
-   Currently only T-cell scalar regridding and AGRID vector regridding
-(only bilinear interpolation is implemented for cubic grid vector
-interpolation). The interpolation algorithm used is controlled by
-interp_method with default 'conserve_order1'.
-
-   Currently only 'conserve_order1', 'conserve_order2' and 'bilinear'
-remapping scheme are implemented. 'bilinear' is only used to remap data
-from cubic grid to latlon grid. We will add more scheme in the future if
-needed. fregrid expects NetCDF format input. scalar_field and/or
-u_field/v_field must be specified. u_fld and v_fld must be paired
-together.
-
-     int
-     gs_fregrid(char *history, char *mosaic_in, char *mosaic_out, char *dir_in,
-                char *dir_out, char **input_file, int nfiles, char **output_file,
-                int nfiles_out, char *remap_file, char **scalar_name, int nscalar,
-                char **u_name, int nvector, char **v_name, int nvector2,
-                char *interp_method, char *test_case, double test_param,
-                unsigned int opcode, int grid_type, unsigned int finer_step,
-                int fill_missing, int nlon, int nlat, int check_conserve,
-                int y_at_center, double lonbegin, double lonend, double latbegin,
-                double latend, int kbegin, int kend, int lbegin, int lend)
-
-`innput_mosaic'
-     Specify the input mosaic information. This file contains list of
-     tile files which specify the grid information for each tile.
-
-`input_file'
-     specify the input file name. The suffix '.nc' can be omitted. The
-     suffix 'tile#' should not present for multiple-tile files. The
-     number of files must be 1 for scalar regridding and can be 1 or 2
-     for vector regridding. File path should not be includes.
-
-`scalar_field'
-     specify the scalar field name to be regridded. The multiple entry
-     field names are seperated by comma.
-
-`u_field'
-     specify the vector field u-componentname to be regridded. The
-     multiple entry field names are seperated by comma. u_field must be
-     paired together with v_field.
-
-`v_field'
-     specify the vector field v-componentname to be regridded. The
-     multiple entry field names are seperated by comma. v_field must be
-     paired together with u_field.
-
-`output_mosaic'
-     specify the output mosaic information. This file contains list of
-     tile files which specify the grid information for each tile. If
-     output_mosaic is not specified, nlon and nlat must be specified.
-
-`lonBegin  #'
-     specify the starting longitude(in degree) of the geographical
-     region of the target grid on which the output is desired. The
-     default value is 0.
-
-`lonEnd'
-     specify the ending longitude(in degree) of the geographical region
-     of the target grid on which the output is desired. The default
-     value is 360.
-
-`latBegin'
-     specify the starting latitude(in degree) of the geographical
-     region of the target grid on which the output is desired. The
-     default value is -90.
-
-`latEnd'
-     specify the ending latitude(in degree) of the geographical region
-     of the target grid on which the output is desired. The default
-     value is 90.
-
-`nlon'
-     specify number of grid box cells in x-direction for a regular
-     lat-lon grid.
-
-`nlat'
-     specify number of grid box cells in y-direction for a regular
-     lat-lon grid.
-
-`KlevelBegin'
-     specify begin index of the k-level (depth axis) that to be
-     regridded.
-
-`KlevelEnd'
-     specify end index of the k-level (depth axis) that to be regridded.
-
-`LstepBegin'
-     specify the begin index of L-step (time axis) that to be regridded.
-
-`LstepEnd'
-     specify the end index of L-step (time axis) that to be regridded.
-
-`output_file'
-     specify the output file name. If not presented, output_file will
-     take the value of input_file. The suffix '.nc' can be omitted. The
-     suffix 'tile#' should not present for multiple-tile files. The
-     number of files must be 1 for scalar regridding and can be 1 or 2
-     for vector regridding. File path should not be includes
-
-`input_dir'
-     specify the path that stores input_file. If not presented, the
-     input file is assumed to be stored in current diretory.
-
-`output_dir'
-     specify the path that will store output file. If not presented, the
-     output file will be stored in current diretory.
-
-`remap_file'
-     specify the file name that saves remapping information.  If
-     remap_file is specified and the file does not exist, remapping
-     information will be calculated ans stored in remap_file. If
-     remap_file is specified and the file exists, remapping information
-     will be read from remap_file.
-
-`interp_method'
-     specify the remapping algorithm to be used. Default is
-     'conserve_order1'. Currently only 'conserve_order1',
-     'conserve_order2' and 'bilinear' remapping scheme are implemented
-     in this tool. The bilinear scheme can only be used to remap data
-     from cubic grid to regular latlon grid. When interp_method is
-     'bilinear', nlon and nlat must be specified and the output data in
-     y-direction will be located at the center of cell or bound of the
-     cell depending on the setting of y_center.
-
-`test_case'
-     specify the test function to be used for testing.
-
-`grid_type'
-     specify the vector field grid location. default is AGRID and only
-     AGRID is implemented yet.
-
-`symmetry'
-     the grid is symmetry or not.
-
-`target_grid'
-     input cell area instead of calculating based on exchange grid
-     area. default is off.
-
-`-finer_step'
-     This is used only for bilinear interpolation. Set finer_step to a
-     positive integer to reduce noise in interpolation and get a
-     relatively smooth output. The default value is 0. When finer_step
-     is greater than 0, fregrid will first remap data from source grid
-     onto a finer grid with resolution that is power of 2 of
-     destination grid resolution using bilinear interpolation, then
-     using volume averaging to remap data from finer grid onto
-     destination grid.
-
-`center_y'
-     output latitude will locate at cell center, i.e., the starting
-     latitude will be -89 when nlat = 90. when center_y is not set,
-     starting latitude will be -90. for bilinear interpolation. For
-     conservative interpolation, center_y is assumed.
-
-`check_conserve'
-     check the conservation of conservative interpolation.  The area
-     sum will be printed out for input and output mosaic.
-
-
-
-File: libcf.info,  Node: gs_make_solo_mosaic,  Next: gs_river_regrid,  Prev: gs_fregrid,  Up: GRIDSPEC
-
-4.3 Generate Mosaic Information Between Tiles
-=============================================
-
-This function generates Mosaic information between tiles. The mosaic
-information includes: list of tile files, list of contact region
-specified by index, contact type.
-
-     int
-     gs_make_solo_mosaic(char *history, int ntiles, char *mosaic_name, char *grid_descriptor,
-                         char **tilefile, double periodx, double periody, char *dir)
-
-`num_tiles'
-     Number of tiles in the mosaic.
-
-`dir'
-     The directory that contains all the tile grid file.
-
-`mosaic_name'
-     mosaic name. The output file will be mosaic_name.nc.  default is
-     'mosaic'.
-
-`tile_file'
-     Grid file name of all tiles in the mosaic. The file name should be
-     relative file name ( exclude the absolute file path). The absolute
-     file path will be dir/tile_file.  If this option is not specified,
-     the tile_file will be 'horizontal_grid.tile#.nc'
-
-`periodx'
-     Specify the period in x-direction of mosaic. Default
-              value is 0 (not periodic).
-
-`periody'
-     Specify the period in y-direction of mosaic. Default value is 0
-     (not periodic).
-
-
-
-File: libcf.info,  Node: gs_river_regrid,  Next: gs_transfer_to_mosaic,  Prev: gs_make_solo_mosaic,  Up: GRIDSPEC
-
-4.4 Remap River Network Data
-============================
-
-river_regrid will remap river network data from global regular lat-lon
-grid onto any Other grid (includes regular lat-lon grid and cubic grid
-), which is specified through option mosaic. The river network source
-data is specified through option river_src.
-
-     int
-     gs_river_regrid(char *history, char *mosaic_file, char *river_src_file,
-        char *output_file)
-
-`mosaic'
-     specify the mosaic file of destination grid. This mosaic file
-     should be a coupler mosaic file, which contains link to land solo
-     mosaic and the exchange grid file.
-
-`river_src'
-     specify the river network source data file. The data is assumed on
-     regular lat-lon grid and the longitude is assumed from 0 to 360
-     degree and latitude is assumed from -90 to 90 degree.
-
-`output'
-     specify the output file base name. the suffix '.nc' should not be
-     included in the output_file. The default value is river_output.
-     For one tile mosaic, the actual result will be $output_file.nc.
-     For multiple tile mosaic, the result will be $output.tile#.nc.
-
-
-
-File: libcf.info,  Node: gs_transfer_to_mosaic,  Next: gs_make_vgrid,  Prev: gs_river_regrid,  Up: GRIDSPEC
-
-4.5 Transfer to Mosaic
-======================
-
-     int
-     gs_transfer_to_mosaic(char *old_file, char *mosaic_dir)
-
-`old_file'
-     The old file.
-
-`mosaic_dir'
-     The mosaic directory.
-
-
-
-File: libcf.info,  Node: gs_make_vgrid,  Next: gs_make_coupler_mosaic,  Prev: gs_transfer_to_mosaic,  Up: GRIDSPEC
-
-4.6 Make a Vertical Grid
-========================
-
-This program call be used to make vertical grid for FMS model.  It uses
-cubic-spline algorithm to calculate the grid cell location.  The output
-netcdf will contains information on supergrid with grid size equal
-model grid size multipling refinement ( always 2 ).  make_vgrid takes
-the following flags
-
-     int
-     gs_make_vgrid(char *history, int nbnds, int *bnds, int n1,
-     	      int n2, int *nz, char *gridname, char *center)
-
-`nbnds'
-     Specify number of vertical regions for varying resolution.
-
-`bnds'
-     Specify boundaries for defining vertical regions of varying
-     resolution.
-
-`nz'
-     Number of model grid points for each vertical regions of varying
-     resolution.
-
-`grid_name'
-     Specify the grid name. The output grid file name will be
-     grid_name.nc. The default value is vertical_grid.
-
-`center'
-     Specify the center location of grid. The valid entry will be
-     'none', 't_cell' or 'c_cell' with default value 'none'. The grid
-     refinement is assumed to be 2 in x and y-direction when center is
-     not 'none'. 'c_cell' should be used for the grid used in MOM4.
-
-
-
-File: libcf.info,  Node: gs_make_coupler_mosaic,  Next: gs_make_topog,  Prev: gs_make_vgrid,  Up: GRIDSPEC
-
-4.7 Generate Three Exchange Grids for FMS Coupler
-=================================================
-
-make_coupler_mosaic generates three exchange grids for the FMS coupler.
-The output file includes exchange grid files for fluxes between
-atmosphere and surface (sea ice and land), exchange grid files for
-runoff between land and sea ice. There might be more than one exchange
-grid files between two model solo mosaic because there might be multiple
-tiles in a solo mosaic. All the exchange grid information are between
-model grid, not between supergrid. We assume the refinement ratio
-between model grid and supergrid is 2. Currently we only output the
-exchange grid on T-cell.  Besides generate the exchange grid files,
-make_coupler_mosaic also generate the coupler mosaic file (the file name
-will be mosaic_name.nc) which contains the atmos, land and ocean mosaic
-path, ocean mosaic topog path and exchange grid file path.
-make_coupler_mosaic expects NetCDF format input.
-
-     int
-     gs_make_coupler_mosaic(char *history, char *amosaic, char *lmosaic,
-     		       char *omosaic, char *otopog, int interp_order,
-     		       double sea_level, char *mosaic_name, int check)
-
-`atmos_mosaic'
-     specify the atmosphere mosaic information. This file contains list
-     of tile files which specify the grid information for each tile.
-     Each grid is required to be regular lon/lat grid. The file name
-     can not be 'mosaic.nc'
-
-`ocean_mosaic'
-     specify the ocean mosaic information. This file contains list of
-     tile files which specify the grid information for each tile. The
-     file name can not be 'mosaic.nc'
-
-`ocean_topog'
-     specify the topography information for ocean mosaic.  The field
-     name of the topography is depth_tile# or depth when ntiles = 1,
-     The topography data is positive down.
-
-`land_mosaic'
-     specify the land mosaic information. This file contains list of
-     tile files which specify the grid information for each tile. Each
-     grid is required to be regular lon/lat grid. When land_mosaic is
-     not specified, atmosphere mosaic will be used to specify land
-     mosaic.  The file name can not be 'mosaic.nc'.
-
-`interp_order'
-     specify the order of conservative interplation. Its value can be 1
-     ( linear order ) or 2 ( second order ) with default value 2.
-
-`sea_level #'
-     specify the sea level ( in meters ) and its value will be used to
-     determine land/sea mask. When topography of a grid cell is less
-     than sea level, this grid cell will be land, otherwise it will be
-     ocean. Default value is 0
-
-`mosaic_name'
-     coupler mosaic name. The output coupler mosaic file will be
-     mosaic_name.nc. default value is 'mosaic'.
-
-`check'
-     check the tiling error.
-
-
-
-File: libcf.info,  Node: gs_make_topog,  Prev: gs_make_coupler_mosaic,  Up: GRIDSPEC
-
-4.8 Generate Topography for Any Mosaic
-======================================
-
-make_topog can generate topography for any Mosaic. The output file will
-contains the topography for each tile in the Mosaic. The field name in
-the output topography file will be depth_tile# and it is positive down.
-The topography data will be defined on model grid, the model grid size
-will be supergrid grid size divided by refinement (x_refine, y_refine,
-default is 2).  mosaic is a required option and all other options are
-optional, but some options are required depending on the choice of
-topog_type.
-
-     int
-     gs_make_topog(char *history, char *mosaic_file, char *topog_type,
-                   int x_refine, int y_refine,
-                   double basin_depth, char *topog_file, double bottom_depth,
-                   double min_depth, double scale_factor, int num_filter_pass,
-                   double gauss_amp, double gauss_scale, double slope_x,
-                   double slope_y, double bowl_south, double bowl_north,
-                   double bowl_west, double bowl_east, int fill_first_row,
-                   int filter_topog, int round_shallow, int fill_shallow,
-                   int deepen_shallow, int smooth_topo_allow_deepening,
-                   char *output_file)
-
-`mosaic'
-     Specify the mosaic file where topography data located.
-
-`topog_type'
-     Specify type of topography. Its value can be 'realistic',
-     'rectangular_basin', 'gaussian', 'bowl' or 'idealized'. The default
-     value is 'realistic'.
-
-`x_refine #'
-     the refinement ratio of model grid vs supergrid ins x-directin.
-     default value 2.
-
-`y_refine #'
-     the refinement ratio of model grid vs supergrid ins y-directin.
-     default value 2.
-
-`basin_depth #'
-     the basin depth when topog_type is 'rectangular_basin'. Default
-     value is 5000 meter.
-
-`topog_file'
-     Specify name of topograhy file (e.g. scripps, navy_topo, ...)
-
-`topog_field'
-     Specify name of topography field name in topog_file.
-
-`bottom_depth #'
-     maximum depth (or bottom depth) of ocean.  default value is 5000
-     meter.
-
-`min_depth #'
-     minimum depth of ocean.  default value is 10 meter.
-
-`scale_factor #'
-     scaling factor for topography data (e.g. -1 to flip sign or 0.01 to
-     convert from centimeters).  default value is 1.
-
-`num_filter_pass #'
-     number of passes of spatial filter default value is 1.
-
-`gauss_amp #'
-     height of gaussian bump as percentage of ocean depth. default
-     value is 0.5.
-
-`gauss_scale #'
-     width of gaussian bump as percentag e of basin width. Default
-     value is 0.25.
-
-`slope_x #'
-     rise of the ocean floor to the east for the gaussian bump. Default
-     value is 0.
-
-`slope_y #'
-     rise of the ocean floor to the north for the gaussian bump. Default
-     value is 0.
-
-`bowl_south #'
-     southern boundary of Winton bowl.  Default value is 60.
-
-`bowl_north #'
-     northern boundary of Winton bowl.  Default value is 70.
-
-`bowl_west #'
-     western boundary of Winton bowl.  Default value is 0.
-
-`bowl_east #'
-     eastern boundary of Winton bowl.  Default value is 20.
-
-`fill_first_row'
-     when true, make first row of ocean model all land points for ice
-     model.
-
-`filter_topog'
-     when true, apply filter to topography.
-
-`round_shallow'
-     when true, Make cells land if depth is less than 1/2 mimumim depth,
-     otherwise make ocean.
-
-`fill_shallow'
-     when specified, Make cells less than minimum depth land.
-
-`deepen_shallow'
-     when specified, Make cells less than minimum depth equal to
-     minimum depth.
-
-`smooth_topo_allow_deepening'
-     when specified, allow filter to deepen cells.
-
-`output'
-     The created netcdf file that contains mosaic topography. Default
-     value is 'topog.nc'
-
-
-
-File: libcf.info,  Node: Combined Index,  Prev: GRIDSPEC,  Up: Top
-
-Index
-*****
-
- [index ]
-* Menu:
-
-* API, C:                                Summary.               (line 6)
-* API, F90:                              Summary.               (line 6)
-* API, Fortran:                          Summary.               (line 6)
-* supported programming languages:       Summary.               (line 6)
-
-
-
-Tag Table:
-Node: Top1365
-Node: Summary1793
-Node: Installation3101
-Node: Files4587
-Node: nccf_def_convention4802
-Node: nccf_inq_convention5393
-Node: nccf_def_file6269
-Node: nccf_inq_file7587
-Node: nccf_add_history10878
-Node: Variables11450
-Node: nccf_def_var12353
-Node: nccf_inq_var13486
-Node: nccf_def_var_missing15632
-Node: nccf_inq_var_missing16960
-Node: nccf_def_notes18427
-Node: nccf_inq_notes19867
-Node: nccf_def_latitude22057
-Node: nccf_inq_latitude23301
-Node: nccf_def_longitude24594
-Node: nccf_inq_longitude25853
-Node: nccf_def_lvl27153
-Node: nccf_inq_lvl28901
-Node: nccf_def_lvl_vert30448
-Node: nccf_inq_lvl_vert31853
-Node: nccf_def_time33251
-Node: nccf_inq_time34533
-Node: nccf_def_ft_sigma35860
-Node: nccf_inq_lvl_sigma36544
-Node: nccf_def_ft_hybrid_sigma37863
-Node: nccf_inq_lvl_hybrid_sigma38740
-Node: nccf_def_ft_hybrid_height40329
-Node: nccf_inq_lvl_hybrid_height41194
-Node: nccf_def_ft_sleve42626
-Node: nccf_inq_lvl_sleve43670
-Node: nccf_def_ft_ocean_sigma45426
-Node: nccf_inq_lvl_ocean_sigma46132
-Node: nccf_def_ft_ocean_s47354
-Node: nccf_inq_lvl_ocean_s48660
-Node: nccf_def_ft_ocean_sigma_z50309
-Node: nccf_inq_lvl_ocean_sigma_z51719
-Node: nccf_def_ft_ocean_dbl_sigma53460
-Node: nccf_inq_lvl_ocean_dbl_sigma54940
-Node: nccf_get_vara56773
-Node: Coordinates58326
-Node: nccf-def-axis-type58663
-Node: nccf-inq-axis-type59154
-Node: nccf-def-coord-system59662
-Node: nccf-inq-coord-system60423
-Node: nccf-assign-coord-system61101
-Node: nccf-def-transform61697
-Node: nccf-inq-transform62438
-Node: nccf-assign-transform63314
-Node: GRIDSPEC63978
-Node: gs_make_hgrid64850
-Node: gs_fregrid69080
-Node: gs_make_solo_mosaic75927
-Node: gs_river_regrid77192
-Node: gs_transfer_to_mosaic78428
-Node: gs_make_vgrid78730
-Node: gs_make_coupler_mosaic80006
-Node: gs_make_topog82862
-Node: Combined Index86705
-
-End Tag Table
diff --git a/doc/libcf.pdf b/doc/libcf.pdf
deleted file mode 100644
index 2302e78..0000000
Binary files a/doc/libcf.pdf and /dev/null differ
diff --git a/doc/libcf.ps b/doc/libcf.ps
deleted file mode 100644
index 312d345..0000000
--- a/doc/libcf.ps
+++ /dev/null
@@ -1,4275 +0,0 @@
-%!PS-Adobe-2.0
-%%Creator: dvips(k) 5.96.1 Copyright 2007 Radical Eye Software
-%%Title: libcf.dvi
-%%CreationDate: Mon Nov 23 07:23:17 2009
-%%Pages: 52
-%%PageOrder: Ascend
-%%BoundingBox: 0 0 595 842
-%%DocumentFonts: CMBX12 CMR10 CMSY10 CMMI12 CMMI10 CMTT10 CMR9 CMMI9
-%%DocumentPaperSizes: a4
-%%EndComments
-%DVIPSWebPage: (www.radicaleye.com)
-%DVIPSCommandLine: dvips -o libcf.ps libcf.dvi
-%DVIPSParameters: dpi=600
-%DVIPSSource:  TeX output 2009.11.23:0723
-%%BeginProcSet: tex.pro 0 0
-%!
-/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
-N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72
-mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0
-0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{
-landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize
-mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[
-matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round
-exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{
-statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0]
-N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin
-/FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array
-/BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2
-array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N
-df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A
-definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get
-}B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub}
-B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr
-1 add N}if}B/CharBuilder{save 3 1 roll S A/base get 2 index get S
-/BitMaps get S get/Cd X pop/ctr 0 N Cdx 0 Cx Cy Ch sub Cx Cw add Cy
-setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx sub Cy .1 sub]{Ci}imagemask
-restore}B/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn
-/BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put
-}if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{
-bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A
-mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{
-SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{
-userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X
-1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4
-index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N
-/p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{
-/Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT)
-(LaserWriter 16/600)]{A length product length le{A length product exch 0
-exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse
-end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask
-grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot}
-imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round
-exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto
-fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p
-delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M}
-B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{
-p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S
-rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end
-
-%%EndProcSet
-%%BeginProcSet: texps.pro 0 0
-%!
-TeXDict begin/rf{findfont dup length 1 add dict begin{1 index/FID ne 2
-index/UniqueID ne and{def}{pop pop}ifelse}forall[1 index 0 6 -1 roll
-exec 0 exch 5 -1 roll VResolution Resolution div mul neg 0 0]FontType 0
-ne{/Metrics exch def dict begin Encoding{exch dup type/integertype ne{
-pop pop 1 sub dup 0 le{pop}{[}ifelse}{FontMatrix 0 get div Metrics 0 get
-div def}ifelse}forall Metrics/Metrics currentdict end def}{{1 index type
-/nametype eq{exit}if exch pop}loop}ifelse[2 index currentdict end
-definefont 3 -1 roll makefont/setfont cvx]cvx def}def/ObliqueSlant{dup
-sin S cos div neg}B/SlantFont{4 index mul add}def/ExtendFont{3 -1 roll
-mul exch}def/ReEncodeFont{CharStrings rcheck{/Encoding false def dup[
-exch{dup CharStrings exch known not{pop/.notdef/Encoding true def}if}
-forall Encoding{]exch pop}{cleartomark}ifelse}if/Encoding exch def}def
-end
-
-%%EndProcSet
-%%BeginFont: CMMI9
-%!PS-AdobeFont-1.1: CMMI9 1.100
-%%CreationDate: 1996 Jul 23 07:53:55
-% Copyright (C) 1997 American Mathematical Society. All Rights Reserved.
-11 dict begin
-/FontInfo 7 dict dup begin
-/version (1.100) readonly def
-/Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def
-/FullName (CMMI9) readonly def
-/FamilyName (Computer Modern) readonly def
-/Weight (Medium) readonly def
-/ItalicAngle -14.04 def
-/isFixedPitch false def
-end readonly def
-/FontName /CMMI9 def
-/PaintType 0 def
-/FontType 1 def
-/FontMatrix [0.001 0 0 0.001 0 0] readonly def
-/Encoding 256 array
-0 1 255 {1 index exch /.notdef put} for
-dup 58 /period put
-readonly def
-/FontBBox{-29 -250 1075 750}readonly def
-currentdict end
-currentfile eexec
-D9D66F633B846A97B686A97E45A3D0AA0529731C99A784CCBE85B4993B2EEBDE
-3B12D472B7CF54651EF21185116A69AB1096ED4BAD2F646635E019B6417CC77B
-532F85D811C70D1429A19A5307EF63EB5C5E02C89FC6C20F6D9D89E7D91FE470
-B72BEFDA23F5DF76BE05AF4CE93137A219ED8A04A9D7D6FDF37E6B7FCDE0D90B
-986423E5960A5D9FBB4C956556E8DF90CBFAEC476FA36FD9A5C8175C9AF513FE
-D919C2DDD26BDC0D99398B9F4D03D5993DFC0930297866E1CD0A319B6B1FD958
-9E394A533A081C36D6F5CA5FED4F9AC9ADE41E04F9FC52E758C9F45A92BED935
-86F9CFDB57732045913A6422AD4206418610C81D882EE493DE9523CC1BFE1505
-DD1390B19BC1947A01B93BC668BE9B2A0E69A968554239B88C00AF9FBDF09CCD
-67D3B2094C11A04762FE8CC1E91D020A28B3C122D24BEAACF82313F4604F2FEF
-6E176D730A879BE45DD0D4996EF0247AEB1CA0AB08FF374D99F06D47B36F9554
-FAD9A2D3CE451B7791C3709D8A1DDDEFBD840C1B42AB824D5A0DFF0E0F15B0B7
-22AEEB877FF489581DA6FA8DA64944555101EB16F7AB0B717E148B7B98D8DBFD
-730C52937E226545CF8DC3E07C5BA30739BAFCD0F2B44275A6D503F582C0FB4F
-449963D0AD2FAFDE33BA3D77BCA9D1DF878DDAFCA2E22CC4BACD542B282164C7
-97C2BDE318AF9D501CA21F6E662E7AAB75A5F24D2C182E598D175D44E88AB19A
-E7CD59584F95B389183EE21B525BF52A3F23C0FE5383A5565A19361D716F508C
-AAB78411CA5A4D27552CC1C435760D5A89D535B71C593E755C616661363308DA
-A683F54ED0C23FB2C225A008392B0B719F66F11A946A090B7C00B662A3C69599
-B4ECB0CC70C85C4BBBF207E0026F6C7A19F2ACFB7A60804FC98A4BFFD7BFFF2B
-9529E6D9D4238002BBC255BC62959D6F3381FE06E0621B879D5FE5B541D45A1E
-759A6E7DC32B1D1632368D09A97039DF255B6492B1B2B7E2C1434E8306ECA7D3
-5A79B6D614B4979F10988BC76ED53A5F45315CD7DA216221F842FD0F3E050DD2
-BAC23C984D506D8F7D614BCB6B244F5F41321549BB0BD041FBF3053307168680
-3435E9C9445A59A7C666418C4F2512C32058B1CE1EA46C7839C6E372F6CC60AE
-2CF46DD2F130B532DE8ECD42D9204500E413799E298CF6426F28D23BB7216BEA
-1A618B3ECC61B44DDEF0BB22D640B47C09AC0DF378CE68FC9CD88BDAE9ED89CB
-431A5CF9C3E9528FEE7A9936C2B1CF7B38DD2B95773F0EA0051607BE1B0B3588
-A8B907A5EF011B4622C5093A7B107DD1EED6FEE9536DECF1CC96E65373D0F433
-30AE3C094654ABF4698C07F8C74E71D023DFD242EE83B1306786124DD8C6BFA7
-801E66CB944BE7EBCB3FE803EC97067AF7AFC8A4E9AC9D11
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-cleartomark
-%%EndFont 
-%%BeginFont: CMR9
-%!PS-AdobeFont-1.1: CMR9 1.0
-%%CreationDate: 1991 Aug 20 16:39:59
-% Copyright (C) 1997 American Mathematical Society. All Rights Reserved.
-11 dict begin
-/FontInfo 7 dict dup begin
-/version (1.0) readonly def
-/Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def
-/FullName (CMR9) readonly def
-/FamilyName (Computer Modern) readonly def
-/Weight (Medium) readonly def
-/ItalicAngle 0 def
-/isFixedPitch false def
-end readonly def
-/FontName /CMR9 def
-/PaintType 0 def
-/FontType 1 def
-/FontMatrix [0.001 0 0 0.001 0 0] readonly def
-/Encoding 256 array
-0 1 255 {1 index exch /.notdef put} for
-dup 44 /comma put
-dup 48 /zero put
-dup 49 /one put
-dup 57 /nine put
-dup 65 /A put
-dup 67 /C put
-dup 70 /F put
-dup 73 /I put
-dup 80 /P put
-dup 97 /a put
-dup 100 /d put
-dup 101 /e put
-dup 103 /g put
-dup 105 /i put
-dup 108 /l put
-dup 109 /m put
-dup 110 /n put
-dup 111 /o put
-dup 112 /p put
-dup 114 /r put
-dup 115 /s put
-dup 116 /t put
-dup 117 /u put
-readonly def
-/FontBBox{-39 -250 1036 750}readonly def
-currentdict end
-currentfile eexec
-D9D66F633B846A97B686A97E45A3D0AA052A014267B7904EB3C0D3BD0B83D891
-016CA6CA4B712ADEB258FAAB9A130EE605E61F77FC1B738ABC7C51CD46EF8171
-9098D5FEE67660E69A7AB91B58F29A4D79E57022F783EB0FBBB6D4F4EC35014F
-D2DECBA99459A4C59DF0C6EBA150284454E707DC2100C15B76B4C19B84363758
-469A6C558785B226332152109871A9883487DD7710949204DDCF837E6A8708B8
-2BDBF16FBC7512FAA308A093FE5CF7158F1163BC1F3352E22A1452E73FECA8A4
-87100FB1FFC4C8AF409B2067537220E605DA0852CA49839E1386AF9D7A1A455F
-D1F017CE45884D76EF2CB9BC5821FD25365DDEA6E45F332B5F68A44AD8A530F0
-92A36FADB679CF58BAFDD3E51DFDD314B91A605515D729EE20C42505FD4E0835
-3C9D365B14C003BC6DD352F0228A8C161F172D2551CD1C67CD0B1B21DED53203
-046FAFF9B1129167921DD82C5964F9DDDFE0D2686875BD075FC81831A941F20E
-C5CD90040A092E559F6D1D3B0E9BB71733595AE0EA6093F986377A96060BF12A
-A1B525CD9FA741FE051DD54A32BECD55A868DD63119A4370F8322CCBEC889BC2
-A723CB4015FC4AA90AE873EA14DE13382CA9CF0D8DFB65F0ABEDFD9A64BB3F4D
-731E2E1C9A1789228FF44116230A70C339C9819676022AB31B5C9C589AE9094B
-09882051AD4637C1710D93E8DD117B4E7B478493B91EA6306FDB3FA6D738AAB1
-49FBB21A00AC2A999C21445DE3177F21D8B6AAB33869C882613EA6B5EC56476B
-5634181ECBF03BFEDB57F079EACE3B334F6F384BDF9D70AEBD592C8ECF21378B
-54A8B5DBF7CB9282E16AA517E14843909339B5E7C55B038BF3BB493F3B884A1C
-C25F9E8FB912CBE23199AD9D2C3E573727701BA301526C66C3617B9514D6F11F
-11930B1D97C17816C85B1BFD9B973A191B33CC3B391815AD14F1CBE935942AEC
-D4004E6BEF379066FD72209DC88D2E634E79BCC2B98C766CBD92C561F2703F8A
-109E6C6CEC7B866F2FC7ADF646BF492E520319F3B949AB5D84AE990B33344A40
-3971F58DFDF8D8D67FA0B8F2A0D884F8C09A5A721319B911DBA0A35903877343
-C37BC36C5EB32353272D1E6ED5FCA611BE319A7E1E842CB7576E7CCE29C1136C
-9B6311F452C368D335645E3F96DA7860EBBE80E932664C89515439473598CAFA
-870C56732A9C9ED76CC421B79A04E784CD2C11FF0E2ACE282D27D994330A1698
-923F5E81E38D6D57DAC50F4447E0E0550741867562616B0BEA3D13509C37B5AF
-E346798C9997651A866DB11F272BC20EA24A03137261E7A588D42FEE9786CDCE
-EED97AD7820F66219E23A25CBA10980E836DB7BF6B4A14FE78F5D73D7E4218BB
-22AEB254D86857E59DE82612AB3A520E13ADF219E6C0E3D9A24A3FA233247C76
-943E6E6765C0DBC85563B95EA6C5660BA7965D55C8E65BF1954473C9BD02C919
-82CD4293B4C67E6DF0F5C373FC135010CA9C302F5D60639B6E94E67DABDD1FF2
-292F0CE59AC4EFCBC882E94D353D9243F00A0359CC32809F931F64D35A6834F5
-7719E74037B9A791B95EDDE64BD981D8E8545CDB0F8380280100CD511DF4D9A4
-CAE390977F1F975D394D2E30447959780B8FEA839C699399AB1A269A5119E1E7
-4D9D95DF633D0EFC92473A14F90EC599910DCB8F8AB6355A692279E3F761E5D7
-51752923A5A0FC4A44F975CC3575AECC5721D1CC55C4FAFAC509D91FD81F6871
-01236C9CF4CBD17861AE0321AAE9BDC84A7B0F7865228B4CAB1B07FD1B823539
-72C71758A352AFCDEBDDA4E037B7104071CD79F569B0ECB2845E305D1367FAC7
-803F1B19FB9940AB50112ACA7DC70A86136EE62887D0844F64A20CCF45D602A7
-FD62790E004F37D759CB6F185422C5E5966323810F2B410AF967AD1A9D08ED0C
-478344D670DA60539C040C5DA62770D5B4075A3B6EFF0743C1876F103425B516
-ECA422FCDD538E4FBF4809A4F01A8A9618773B320ACAC824258A432F55AB4F61
-428A7A8555A4BBF9B9D9FC5C3A5EDFD760AD773E9C7DD54327DEEF4AAE675C62
-F58BA1D87EDCD84D3354EDDE797950E128DEE5EDDA6B0B20D812E47C00CAA72A
-C06BCCCF1B92E0BCD54C9D96CB7593BC6AE730B01ADEBECFD7BB3243A8C4FD61
-A726FBFB21E000E56D7A693BF65516C04C927F92FAA5D346B2D08E83629CF93E
-1FDA9F18875A9906818345F7713BF82AD92B36A6DCF8BB60B10CD971DD577754
-B15FBC9B18B66A0B569C96C4531C93DBF76E17EE1742419FDBA72329401CC4CA
-B5F683BBD0BF5055B93753DE807723AA8CFB534556B756CD3CA959A4717F8B72
-C399B60F9AF13A88E43AFB9AE8A2C786EEFB02817AB79D89B39415EE3F1E5FE1
-F8CEC8C58DC0C4E75936F19E0779363C820E59E16BCCC47C98A385385D240963
-DFED6DD9DC7FC43607F1E0C26E4C732534B01584BDD9B6FAA798DC8D1916C05D
-DD706B469F7A67881873C6B2F8B71A2CA48106D5E0DFADF1531CD1B74A4F4764
-B822F8942983D992E0E0E0973746DAA67F621AF66E7A2DDC9086750B19863261
-64D451635ABEB78065858D07E3D68355E1C8593E99D5C77102FAE32B0A1E5B52
-B2BF48E95001BD2F8E0E48F98C9D2D642386F26387F13B90921038C8C3FAAB1A
-278C97BA5A030B8483336C21C9D99CDB5C0A5C0CF24DB170264CF165F2C3544D
-32091A54CA96FF5EDB028B894515AA1F364E3FA14F5C126E91AE19AA65657DA3
-919B13422344DF7398EED00C204ED6B7F7FBF1354DA6D5511FB43163ED2FC148
-688139DBD26222C44FA541F559DEEB22A15D03604598CE6C36EC613FB205B8C8
-A831564BC21D0C5936E7B05D4CF0A0CDA82EBE81342E84F27C4DFAD48459AB90
-48EF9E2F1DA165A3FC74435B66089500A8CADE7FD953F806C7AAF4A3B59364B6
-4516F955238F4D541EA2585956A28B0365397A38A221C18C5B09829EAE7C22A1
-89CBEE163C10207F85000B706C8C037053722903460B18DABCECA11334643784
-1B7D412124DB3D31E72F3C60CA40DF86DC3965CC6490318ED3554DA28613588E
-4C329BCF4CCD209A511CC08575343BE51F9B71863B0D0AF717D326173FE85A6C
-1307C6FC6211DF29C288C5D2947C850D556ADEC0FEC8024B6FE3834F82269543
-CE4ACA88885A6CB96F82992AECEE34EDD8353B5276148DD70F9A892FA601D40E
-F9391F025531EF2BBC85D791AB7E7EC263D2D7B7B3B295AEA18C9DDD7DEEDAD3
-CD35CAE2A7CECFDCDCB100AFDF3FB1A5603E11862C0A2AB5E89C8BE60897917C
-29E56B027A8116FC3AE0BB8961AC88CE125B4C775F17F665D50D83A801B5C191
-4349F80CE9C6B4D9A1DAC60B5CEE711DE70817769C5D57489382D0C80B136846
-07852385BB15837C271407A1D251E54972A339C4B07C47EE9438196017D9E1BE
-8814A64AB6FC3F8B734D2E8BEBAA25A81661EF251F346917894252BC661F1F36
-2F79FE774CFF9783AE48D8B5B16597946F424ECDD29F7B61CF7D2BDA867E247A
-0811148747319C7BF5D917CBED59EC3F7A7DE5065D703C5779C530D273842BE6
-B4BE55D3BBE9E496C6D9D688CE455635FA8DF065D39C9EFC6B53624EC692ECF3
-FD9CD936001DBC8904B5CA9E07C48F07ED2B90271827BBBF349093F7945A8411
-9F6F94A6DA10D973C8921ECF58ADEEE4871253CC3D3269B56AC7F45D0E78DA07
-D13CBAB3C70F315479A941BD3487DEA2AA6FE8C8DF8DFD98837084C63B25DF12
-46F0FEE99D9413736665188AACE680804FBE3300D921A2799F2708838E07FEA6
-1DCCF84251C7B7A17CD0B211E0EF3893A0490FEBE8B4D42FCB65F92BF725FF20
-F3D9BB8803A806DCD62FA82BAE32D20A09A6970EBA1E1FDB406B35A6F0F5ED0E
-6914A7C9CF346B8761E92E6E14699057A50354D1A09007403CC5ECE50B7A0B5B
-652203F630395CB6C2108127EEA55E45901DB6187227F605AEC38CF1C90BF20E
-C53CB606C58D6D8A614B76655A7CBC5062EEF1F176E88975C20CB26DD77C2CDF
-2A57C6A97BFF573B463891D3D3A1C2C9365A625AF603442DDA20749523348E97
-74D4DAABEC96F0FC6843F7AA2EB655536DFC037C9FD87D4425AC530C93695CBC
-2CAE7743A8B5D5785B0A8DB841C0CA07C533FA97A36EA139CCF9798127B21D4E
-0AF2D6AF926A087E0F777913C1D310B86CDCB99EE8F80026950F1B148E997224
-F07DB07652D9DC338989FB5D3FAE78BA23C95899B61D5CC938A007F8773A716C
-97152E14C5B13B0131DA15C3C5E757506536CACF7E6714868DCCCBC23DFE67EA
-24B44E991467FEE2ECDBFA11169F65D977BE98D628085BD0B0C15B0994203722
-4E6F16D70F056D62AE17AAE036CE9CAE6CC90A7B3BEE0428E4A0BCFAE59EEBC5
-F1C608A527272FF5ED18218704F66DD9150EF9BE38123BC9CDC941D49D845CFA
-3557B109D080306D1DF89702F6FC99F4F172E0AC719C36DDD4DA60075929E77E
-2D9EB7CE42D8CFB7B88D54E5AEBF05A41DB655BE58299906E05FC1D4BA73F5A5
-9A356701D66051B6C50A1C58617779F659879C224D71CCE1F06B6C816AE5972F
-AEFFA78D9807D876771424D9E713F6F152FA8B874E50719CAF9A82026D6D92B2
-C5693164DEC775B32077858953A233C4DCCDD3A7A8247FC8DE0BA3E33CCD0353
-1B9FDF1061EFC94E2AA62660667E259A60FD5EF666B8874474E6BFF492541790
-05ABE6BB6162CEECB97F03DA3D90341473454755D95EC5830731941136069B83
-408EF639F0F8C69B6DA8377D232578FEF00EA8085595569B81B4F16C6A5F6DE7
-310D5A25ED1A59B2418813D5FBD398FE7E1AF850542FD22AA0A67FEB1FFB0522
-7EC6830BBA6DF7624F2FE54FE1EA45A6AB7C71B7E75BA77E073560B4E6AC0840
-D81F45FE04AE3CAF185CF0588553BE234ED01649FB6858353833132337C1C54A
-1CF117D4ABF3E81A7B85C653412CFDFABD033668B6640F5734C2AAF4B0850C61
-02DA99652B5717D5AF86A967AE9E2C31FE5B57118D5A6157ED1FE00EC35C96D6
-EB944E5BB4E06B8F673F6B51A6525D24007E919A2087F076C0F32DD527F96C4C
-94AC1BDA9797CE5E3E10EEE5A9BBF590155CCDAC886636188E333AB930B2F85C
-457545E24D6270D6EBC8723056D9438738F33929BAD4E50A7EE5B367E2EE4BB3
-B3FBA4128FABAC9A5476AE50DE5C341C7941EC72F18F30A94B40601D698391EF
-FD9C9ED71D113502A8EEA819CB0E89300E009AC7CBD12EABE70AECC943D5B2A6
-56A5818FA87F3612BE86F837942A1D9BDC06923140E438B47730E4A1C2BDAA2A
-9E620D1678E2B47B5CAAE8B68286A5B53648F6D81A09A8A9AA360EFFAF6D0D8B
-4167504EDAA4BCFED47B478069D2071CA3F014C6DE285FB44367982917EFD0D0
-790464444E38DBC8140E06B2585962C0E42C7ABA14ADDA7137E8BEC048BFFDAA
-305DF2A36EDCAD99E65A59FA4A04A36788291A3F01FB6B570EAA6926FB1B803B
-DBCEB039E6DDA600CF06B915AD97E6159489BD7D435A75B69174E800D73837E8
-641DB831F29234DB4E062BEF698EB3A8DCA650CF098DDB7727A2BD25EEC74359
-BC412027E62DB072B06EA440A2A5B3DEA44A09A6F3A0A9C53B4684B6218713DF
-4AA614D92F62E79B8E3C7452B4D85F69417ECE59B858AF3351485393DC37E2F2
-2D473159483078C91FD7AA503C792FFB7EBC004433C8690D4C9F7AE28217FAF6
-B7EA8C4BE755973454E9EB461D3B47AD55BFE90BCBA18A88FD16D122DBE327EE
-ABF23A45EECCF120DD8893B5868AAF9CFFF7B2A240B8D093A8B9F809D0BC9306
-5575AAC042BB9CF989E28CD390AC386D1BFC1E6A6D33F66EECB9FD49C460D560
-E6C282588555D41D7C1CE4C16E36BFB036AE947A23021065FFC381C4389E1BC9
-FC9EF2D3A9CEF4A283F25C83BA0BEB564FAEB23DD8C473285FB6683CC99FE43A
-6888099F895C111D25FDADEDDAF4116CBC6A2445FC0AE10F4838B3C6FBF29770
-905D5C390265911E6E69A8188D08E690BF6E8E5677F9DD5FE222C932FE1B8D8D
-0E1D587E27C4EA35023A4D5D074EA51A02E0A808E05A515C00846259576C456A
-D652C4EA6C09F3107B4570EF22C9E9E7A316FE26C1ACEA03724B483BA18BA248
-9AEC05E99502482F1FFA2CA3F25FC193307C6D07022FA9F9C7738BCB468E304E
-8FC35C43B14746FDD8B2EAE77F473FB938D9EC2B2F2D9E395E9A920796376866
-BA8B4AA98C523F4BD6A278D326650B6387EB41E019C818E9DD96166F76BB25E4
-5F411BF2388705D2E07CE1D72F03669571261F06BAC919611473922472EAB206
-10410EB228A32599FAC918CBBCF9B1EB3CD863D3675C66BA81
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-cleartomark
-%%EndFont 
-%%BeginFont: CMTT10
-%!PS-AdobeFont-1.1: CMTT10 1.00B
-%%CreationDate: 1992 Apr 26 10:42:42
-% Copyright (C) 1997 American Mathematical Society. All Rights Reserved.
-11 dict begin
-/FontInfo 7 dict dup begin
-/version (1.00B) readonly def
-/Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def
-/FullName (CMTT10) readonly def
-/FamilyName (Computer Modern) readonly def
-/Weight (Medium) readonly def
-/ItalicAngle 0 def
-/isFixedPitch true def
-end readonly def
-/FontName /CMTT10 def
-/PaintType 0 def
-/FontType 1 def
-/FontMatrix [0.001 0 0 0.001 0 0] readonly def
-/Encoding 256 array
-0 1 255 {1 index exch /.notdef put} for
-dup 34 /quotedbl put
-dup 35 /numbersign put
-dup 38 /ampersand put
-dup 40 /parenleft put
-dup 41 /parenright put
-dup 42 /asterisk put
-dup 44 /comma put
-dup 45 /hyphen put
-dup 46 /period put
-dup 47 /slash put
-dup 48 /zero put
-dup 49 /one put
-dup 50 /two put
-dup 52 /four put
-dup 53 /five put
-dup 58 /colon put
-dup 59 /semicolon put
-dup 61 /equal put
-dup 62 /greater put
-dup 64 /at put
-dup 66 /B put
-dup 67 /C put
-dup 69 /E put
-dup 70 /F put
-dup 75 /K put
-dup 76 /L put
-dup 95 /underscore put
-dup 97 /a put
-dup 98 /b put
-dup 99 /c put
-dup 100 /d put
-dup 101 /e put
-dup 102 /f put
-dup 103 /g put
-dup 104 /h put
-dup 105 /i put
-dup 106 /j put
-dup 107 /k put
-dup 108 /l put
-dup 109 /m put
-dup 110 /n put
-dup 111 /o put
-dup 112 /p put
-dup 113 /q put
-dup 114 /r put
-dup 115 /s put
-dup 116 /t put
-dup 117 /u put
-dup 118 /v put
-dup 119 /w put
-dup 120 /x put
-dup 121 /y put
-dup 122 /z put
-dup 126 /asciitilde put
-readonly def
-/FontBBox{-4 -235 731 800}readonly def
-currentdict end
-currentfile eexec
-D9D66F633B846A97B686A97E45A3D0AA052A014267B7904EB3C0D3BD0B83D891
-016CA6CA4B712ADEB258FAAB9A130EE605E61F77FC1B738ABC7C51CD46EF8171
-9098D5FEE67660E69A7AB91B58F29A4D79E57022F783EB0FBBB6D4F4EC35014F
-D2DECBA99459A4C59DF0C6EBA150284454E707DC2100C15B76B4C19B84363758
-469A6C558785B226332152109871A9883487DD7710949204DDCF837E6A8708B8
-2BDBF16FBC7512FAA308A093FE5F00F963068B8232429ED8B7CF6A3D879A2D19
-38DD5C4467F9DD8C5D1A2000B3A6BF2F25629BAEC199AE8BD4BA6ED9BBF7DABF
-D0E153BAB1C17900D4FCE209622ACD19E7C74C2807D0397357ED07AB460D5204
-EB3A45B7AC4D106B7303AD8348853032A745F417943F9B4FED652B835AA49727
-A8B4117AFF1D4BCE831EB510B6851796D0BE6982B76620CB3CE0C22CACDD4593
-F244C14EEC0E5A7C4AC42392F81C01BC4257FE12AF33F4BFEA9108FF11CF9714
-4DD6EC70A2C4C1E4F328A1EB25E43525FB1E16C07E28CC359DF61F426B7D41EA
-6A0C84DD63275395A503AAE908E1C82D389FD12A21E86999799E7F24A994472E
-A10EAE77096709BE0D11AAD24A30D96E15A51D720AFB3B10D2E0AC8DC1A1204B
-E8725E00D7E3A96F9978BC19377034D93D080C4391E579C34FF9FC2379CB119F
-1E5BBEA91AE20F343C6420BE1E2BD0636B04FCCC0BEE0DC2D56D66F06DB22438
-452822CBEAF03EE9EAA8398F276EC0D92A7FB978C17805DB2F4A7DFBA56FD6AF
-8670EB364F01DE8FCAFBAF657D68C3A03112915736CEABAA8BA5C0AC25288369
-5D49BD891FABEFE8699A0AE3ED85B48ACB22229E15623399C93DE7D935734ADA
-DA7A1462C111D44AD53EA35B57E5D0B5FC0B481820E43222DB8EFCD5D30E15F9
-BA304FA879392EE0BCC0E1A61E74B3A1FC3A3D170218D7244580C7AA0DC65D19
-741FA5FE6F8CBF60250ACC27454BBF0897CA4B909C83A56672958752ED4B5E79
-E18660764F155E86F09EFA9F7685F2F5027EC85A775287B30E2069DE4E4D5712
-E7D033481A53A2702BA7542C71062173039030CF28D8B9C63B5596A9B42B33E7
-D922944A38713383D3648A4AF160A3B0C8F3379BA4372BE2E7EA49AABA75AEEE
-C5DDE1D8BF68483C3D21271280ABB91D54CC819680322EAB72E1250A760BC8DC
-FF798F2ABFC4F3539392985C4CB324B0007229586D1E0321559F67C057FD7902
-194490A4C133DA7E04E7895F3C8786BEB6B449472C32E3AE702291DAF51407EA
-86DB7DA1EDFC73D7697FD45E3A2928746BE164AFCBF8F5E8058815645D2180D8
-C19938D79834F4D677BDE57E3231402808137187C94E45B679BD59294184EF54
-172447AC57A8B69B4DAAC8F618ABFE8E6F085C4FA6A856A3B0FAE27B20E1DF3B
-8213D67BA98090F1EE3BB63CA41A8B2F5C95B5E45EE23DFD8BB91FEBE4787113
-4B34BEBB4632F4D7E71CA6C730938309EAF06D1C16F13AEE13ADF9E99D615FE0
-E2B39A653382AFE1AA5F758B8C7EB02722DA8D89474ED625056509BC9BDE9DEE
-1E8951142A28319378A1DDA52BBF99D226F5829D9A7C2E01FC260CE9AA2786EF
-5DCD2F48F1F3BB0DD53BEF770B4CC4E174F49ED8ABCB237A6028EFA12F452039
-6F7F52B7D55F17ED0B5F69C63BF01D7E51056405C824D8A2F4D3AE277DF1DCAE
-3DB461880D70CE0B38151243D996CDEAE424506B3BC2632449BCE8CECA12AB3E
-B24FB1414C4BA56E3479F7C3DAA25499EA5A9CBA58CCAB4CFC3910C426F6F863
-3383A516692C1B5EE6E8C8CA0EA25CC33EAD2EE47C0DBA105148A031F42CD465
-E53466FDEF6E4A396F508CD1F02B5F03BB54DDE85782816D910572D8F95D0352
-B7A1573D6D860CCCFA596ECC929383BE85A2222214FAEE6EDA909FD997220B67
-9E5235A1D701FE82EC8AE7F837CF8B451675B8F0DDF4F3A6AC86377A8D34ECF4
-9DF8F393C550D0EC1208413CD30054C9DED3D823842A44832623960E4352F70B
-E77E5C63A68D3762EC2FDF20D5677496F77A3A621B0FE06284B88FCBEB0923BF
-14625BC7212D0C80B4D20BDA765CB637EF73E341FE6D1777B16FDB2BDD04A5A8
-801BBF34D10B16221090D92C2CAE2F8B0F85D9A92789A5CCDD806705B07A0FAC
-CCF584BB7FF25E58AD84CCFADDF8727B7F6C4F0A7697B390816EB24032F3439A
-BE93C3F183F92277B32B4863BDE0BBC256D3429287EFC9CE02C72825A705667D
-22A42B91AE0F122B4EAA16E2C2C2A3C16AE87DB08B2ACD37436B1137E8B976E5
-16BF2FAAF5B4BF8898DD2A42AAB1E8DC6467FF9FD4432CCC1DBCB2D4831118CB
-7962B9FF5A9055B3AFA23A57C517941902B19037B66EFB34C1C34E2F867E25FB
-501C4D56A1D29EF53A38917895D2A0B267E41E785CCCE4F010A30DF375E6D28C
-60D5FDC534E114B86192C34BE3866F756009F2E0E348D37C8E9EC65E8F8FDC8A
-76E6A2E0CEF1B504330AA0D626C122D415C8C5B25F4168BA383F2DEA0A3DA019
-456AACAE5BD00D237ECCCD84BB3E3653C6C33CE6E3657BCB4C9F7C6DC45D3753
-2C138C4BE7E73108A528A870D5C958099AE72CF6B1FE11FB2E8DE00DFC98FF43
-4E7F14DEC20389AEA428EFCFD592EEEA23121C8C34A2114FBBFED591DC087632
-086FA71131C9C3C2DC55FA60ED844080F7D5E41B70EBC0F8959D79CDCB507443
-2FEFE0A92A8703FD2BFFD13E8BD9572D12EF0A37B1E08E144C9A7618EA660FC6
-ED43A643558C3F7D9CA27AF5CB08F07D02F9624097C65413912B18F3264FF143
-1A3F4D1CC765AF491CDB2E2D151C128CB8687F387D4C8DD1633C31560355B3FB
-66E7D0E499BA3A7A4D99DD6FEA80AC68DD43C197E0980EAB6F1339FAC5FD4B47
-00C86D3CDB9783179252852F0CF4B6C4C1EAEE4E15FEE111D4F63575AC9DC123
-D50E5BD184BE3FAD9DDCF7C5F124AE4E72B62B90B4EB99130E7FAE23871DE075
-35DF81CF648ABD6C2A6B07FA27DADED93737674704EF2F01A4CED638A096F24B
-359BE698E374EE05CA2215788B38F1BBA7F3A27E513EF9C3D4C57100B441DF7E
-E74F5A1C024D4EC8B52815EAAA81E8EC57BCDDC1075DEF2178CA3267E39384B5
-07B5372A4E0D4B38F43EF06B54A9AB10FDA480620545486495D3A8B317AE0BB2
-B0AD892E815B90C31BF42BECDE9D8E679F7C8201CAF04E39094EA2BEEB586955
-5D35D2FB3967B5A733726196A84E51A8E89DAD46D97ABCB8ED6FC4371382BB9E
-D69E0D56B7F1D94A2BAE462005EEDCE64EC679F6A6A226E1A1EAB98FA5C62CD6
-731120402FC2F6AD84FBB298367E39892A4010AFBD26222B96053F1A37872960
-D41AC25E7DA313B80374A3581B911662980D23E3FD570C52894229EEF1571A35
-515A33B1CB25C22E399ED39A83484764FBF7A21F922BF5AEAC5E68EC3A615E4E
-87D5FBFE3D1D804F6982C0E08BABFE4DD9DBC07FC85ACE53B704C42F4885DB5D
-21002582C80AF571E43580C9ED5A85A1554F21CD0F48DB9E554DCD20CB2FAD15
-22DBE48286980ABDF10E2327FEEF3DA4D9DCFA9E5068248312CAB66445E4B143
-8D7785AD66E20BF7B18A02A0564900A42B4261E656B0899CE7ED0B986B8F9334
-8D9968FF8A2EB54A9FA281942C9E29928C3EA80EE6AEAC840A35138DB440F2E2
-450A64FED4FFD5BC9710F1D12BB659D17EE5AD9234CD8B666E3FE80E5E6F0C5A
-385934731F90771E3F45636B017525E972DD5AC3DEDB9D5048D459434ECD105C
-23B84EA784F96D9C21C026F91F92344196FFD79B3D7F3E4AB209F93BC29C2FA1
-DF25DE96A8CAC597EBF113397094452D3C4BB282DCA058CB7A79D82048D69113
-94D7CE7D8E674083D27E4EA02AF4A2902EC074B51706BF81B870901DF050BD93
-2CA06BFC4320DEA140F54802D4FC2055AAE3E658B9C99B8ADB81BC98D2CCD6A2
-D17D8916BECA6B7E9F31B58F35D27B55FC95FA9E4C3420A943964B98CAA9E208
-C6D560BF198CEB3BA0E4FCF6C995D572FF48D3B002A492D206E9BC18CD5875CD
-62FED8B571CCD88FDA0988A8F478A2D59E0FC7278F904FAACBDAFD8A167361E3
-2C7187CC6363B819DE03F4A4BC7783DD804726CFE3DCFFF15E77B39A0995DCC1
-DE541BEE08551FF12DD55D3CAAAA979CAFFFFCF9435A3C9D3E6E9300C1AA8CF1
-CF5C32932768413DE1D765EABE73DCE3748B52B69C90BECA8AE3F388B3474AB8
-C262CEBCB0985CF5F1BEEFE9B20DAF8A4D532B510FD085F328A14922CC48FF7B
-72AF643E1AFD209B90F2524E434A12125DDB8D64642A8FD41BECAFB1984ABF54
-EC48D754D6D9D3D5506344D4C9FCE34EDAB0E00F301EB108090F58503E994676
-2917D0D65061DBE9D5623F37466BC0E117C88A50CD3C57EF442F285AA10944C6
-3FEF56BA9AD9F6AC23B4A79DE18F55F656CCEF8A18BD9C104DDF106D41B5DD30
-045C2CCD23F7E061CBBF97358ED0E78E18B24FB65EA5F38C9801AF69BC19A827
-44D962D35B17CDA09D7E4E2EC63AF446CB82CB051B4D69B961E84796FBBC72E0
-7597D30013B5FB25924532E15124B1BD8A81755644CD080C2F8360EB08D5E7D1
-732D41468E2B064117641D640FFC31AFC2BCD6073A5C5BB7946D035CC8DA37FC
-4A049BF5CCD2E664E0C5F68215815E97BA6151E84819837C43369E959E32C711
-8100CFDD953EE9C63C5D449787E0DDC64E783F6002B0FFDB73C52EFF94A6A37D
-43F1E382E79D7C76AC8AA148E31DB60DC98E430A479C2827650D6513A9E1734A
-F13DAA66B10E7B9A345476620DFBEE3C9BE5BC0E78C17BC402789A9CF4DD6732
-B6E51A9D58A2FCC0D12C6692A08BD3B543CC593BF32804F0739384D917A4ABCA
-8F3AB59B1E192299D9961AEC80C6015A2AF48CFFE129AC7C5850CE98726CEFC2
-1F99D5DE498B12560BBF91EC750A626A62B83E67F475720C9145ECD18E7748C5
-0BB686EC7A1CEB398240687B836FE4445E5DE5E424A0BC3219E466BD2BC7906E
-89CAA6B0CDB09908EB51C7A557880BC31EDACAB54F40980DB61E58D73EFABD47
-18D254CA780BA19FBABDBF0474B344F74FC0854825D88499DBC5CD7C716CC3C0
-08BFA450FB9A683635ABA53FEF2CE78FA5DAA01EFA91BAD15E6B44C6238F87C5
-692A78447946BDE85F5C55264E94779A9897D1266282CBEC8EF54FE4ACCCCA6E
-430204838FB6071288203E94DFB09E48B94B3D3B8D3C3D9530DC4924699F26FD
-F194FCBB61420AC87DD5EF509D32A1661E7135B3FE500424ADEEF33A37FAE0B0
-32164841F68DFCF0D185692C278A692D075EC47C83C5B19EC0D93BDD99184916
-8D108B7C94133C6770D671CA045B073E5AEE987E2FEDA5FF7097C24FDB91C1E9
-02CE8E6394C6058A3367B7CF782FB29C4DCA39149FA6468D80F51AF1B8402306
-2914ABFCDE678889A24216905F974D71E32E8C0ECBC19856A44379741003D398
-5D2BD1EE909EF60CBC4AEBBF2BC19D9EAAC70CC096A4927C78896EDCC7B2DBC2
-E1542D5A7C3FF8A2220BBAB2BC18C606FADF7ECD1F6D389C0F5BE958C7DD6E36
-DD4E08948635ABF25ADEA0E8D66221F87AF37D14F320107837677005E26F58E6
-5945316205D92750099E79C8A6DBDD134C1D2B615A10911698B6F9D5B4DCD224
-B1D4F3C3734FCC2FB8A03B4D5871E3D034449C3924DF7B78D6C9BD47A361764D
-B5045267D81C2E5100E9FD83EA91CDB140E52CCDE57F5A2DB778D6B79FB5B0BB
-05993630997DD86EABCFDBF7DB2DCC235A7BEB0B7CB9D09BDCA000CC7B367D14
-E69D3CAA12A511CF36351863DFFB8E194200C932F4B5CD771DDD7029846FAE7E
-B64590AC5B8FDD50F9D5F15EAD57B556E77EF4138AAA39230A423CC592CA7831
-CD9F5777CDBEB2003A8DAAF5273A14A99E5584C1A6C61611EF94D9877FD98907
-3E63DEEE89AB712FB5C09C67501A25ACDDD58325B6DB966DBC55517769B5C069
-A379F5651A7B14E3E858856CD827D8F139A317680D02E955F9FFF760F1096F3C
-888BBDB40357293855DF6FDD6238235FF0E156F1F39416D83588FF56E04F0BF7
-ABBF6C49056758D198EC0CBDF6BFCAD918F64B22B12793BF2AA48936AE82BA13
-9FFBCC86ED8266AAFD51C512792AEB5F655C517D191EAC9AC4A1976207E1E61A
-90588449D9326DA0C69745E403317008567F6DE3EA8A78A312E9AD6263ABBCD6
-FD81F8937CA9DC064A6E1DAD521B97782838C20B02C95F422D0B37BA2777CD32
-54EB780791391735C91205A9E23419031174A25C300964AD6252309699AC7CF5
-E9BD1084D2908E39721619F9A93ABDDAF2B65471CB84861A9B0D11721CA7C0E1
-94030BD9849060F24CA0FDF851EE4D2B2F04CE962F5E687A0CB193EE75037F6F
-191909589C6D5039FA54B5AA11E89A5F2CFD1F59DC32C0A95BF0CEFC089A1CA0
-D5534917BF7E133B36F9EEB372E10DF85AD8D316F84D0CA3FDB5911A325D4E7F
-6F1EF9868DDD67B704518377BB726512DD3DD313C3580EED4C2A3ECF0FD27A27
-60DC53405DF0414B02CD56D15CD771D423696F2239F5C9924827351694A97663
-9A5780D60E10199F75A40D8D62FC099A4719CF33D9647476CF97F677A93754FD
-2AA49E07377DAECD76830BEC3234C605E7CA3F8D6B9ED181B311CD4E936B8DC9
-749D3B474638C4F180248F4372176C85A4611EEDE061BB6B2F202256A8A98C6C
-53F9D7221FF16D2E3A51272FE99CA683BC14D98E79B1098A35F6B9DDEE7C49F5
-48289726F454DE8B5D93CAF1A21EA1DEC11B61B2E5CEF614250A3E91587F559E
-115A228BF92B37C7BF808F8EBCD65A362C6380DE3E9B6256F22E67355C5C462C
-405B89BB0EF60F24D7BCE8F3047617D80FC3F38AE5BDACE63D86BF1CB8E6B023
-8D6B2588A75B584D80A1314C562D8778EADA93F4C759ECDA7A155E8706A0CEF8
-97F676C14C22C9A88663344733547CFAE879A9FD8A5C20D73503698039A224B6
-49EFFE18C51FD20BC5C3C9DAFA761DA75F08BDD7826B3B5951133E4B117504B5
-AD9DD9230CD5DE1F6FA35C2315F24F391EDC7DBE8D894901540B28A77F4F0600
-9461B40B3A52012A36B3D9D61DB4DE94C578A73CBE65B3B0BB72C36F7C48658C
-887AB02AFC75EC4ECBF3F6EBF4E04D9F2851EE09C6D3BBE56900187CA9E7F318
-29A95D5C26C854FA6DF3F5EBAB027471F7D6998474427FF3CAA83D3EA6199D59
-DA21BD2FC69541133CB3FF615782BF6E77B3C4E5C3F51FBAC16E059E83B9C0C5
-50E2E44C1022EB8CC87B986410D379E2D8598214F7204D848BE3C9EC88478625
-4FD9894102EBCF9CC9D38036D99C5BB4861B68DE8C2E6E90D2B963E05E6807D4
-6F6EC4174BC71D0F4BE4CB94BFCAD836811A742559AACF4568ECA058980BBA58
-48B0C0B99DDCE3489F92A8A512ADC802E4CF6B4FF02DE4ACF385F3D9399E30DE
-058F7368BA4AC36AE20DA20022A398B899EFA3C8C5672D7AE69603EB77CACEB3
-10A1CD1D691063662C73CA0213AC5D3BF7D4E5649A103DEE4F5A5AEC925F455C
-ADF028617505F11913115FF2F9C79950C62E6EC7057138365705859D51FDD193
-4B05A655963EB7A179B9D96AF6A1045EA6D2DB27F838911E9C8BADF79425AB2B
-EC62788868A680914097E89B09F4C4DF5BD57C1F48BF9A4505B19DAE914E1C58
-03D3DB90715167E11B5A32DF41719EB42728C67784E1A354244C98CB0DE1712B
-E1D8E7293E941234B450486743D053D3D5A445F909AD1461248755E49A198B96
-481ACE9E2F4747762DE1098F4C425A15C6F9F62555EBC479C313A2944788F25D
-9799A1D9B109A3A1EC31266F90A337181AE2DAA53D0222BCF9BDE511AC6B98DE
-9875C87F13E376B9B646266E66433AA571BD167C521524A7C4A1C6C8CB231057
-1A348FDF2577373256287311574AC45A2F82ED5B6C3F64223B5956634E0AFB0D
-99D8588D808689F3794A4E17F9F63CEE9B00B8A415FFBD7967AF6D59758B8B59
-3B2B15F91AA40082748DE8DB8B0ECCA17DF2B651AEFAEFACF57D742C0AEA321B
-61C63C4C1AB34494F25B8D4CA77301D5AF6B2232AEE464B21C78CFA7090CB4F6
-B44A51756C0E78CD5E7586E3E22096B773EFFB42606AE8756D90FFBE908E92F6
-7FAB9597E3F7D8EC5FDA47BE43324B3C3C5594DE0FD930B7AF545E524AF05BC6
-CA08863C3FA007C5B3D943A485EF7BF9BEFD8747040BE8BA67BDAB29C2426CF9
-349D56C6BE1E14F16376DF26E0706576C8FB2E8A4CD0EC07201A875D0EC78455
-BF9BC3E6FB6011AFED7DA6E022038979BFDB2C51FAE0A9ED956F0CF9B64DAC7D
-D46DF7BE0A4B5D76EC2BC92E8998B96D2F83FBB7D8DBDEACBDFC563AB8C4BE9B
-1DA3DB06E8E2A5A011118F9466A2D49CED60CD4F018B0CD6AEE48DD304D87AFE
-179A1E98819E7AF6615B32674E07201660311C6651D39B60FFA172ADC1827CC3
-70CAF8BB4CD70676BC1C36EC63B6CDBF1A772A40D346FD55E8EC56ADD6B8776C
-39C7E9ABAE4BB39E5004FEE8F1D1A2C4253D6F52744DB83AEF98348418528F5B
-4CB5C5B9002D28AACE942E665A9B194F70B9D43246BB5A90F6D83A0A86CBE286
-43FCAF6347B13EA1BC0A7B0617482A8DAA48927A4458F3F7356C066805421FDF
-D9BC28CBAE97F6D1495B98FC7E7DB5BF771B7BE8BFDD73455B6E6DEACE5C2B64
-A9753EED9B53162D56ED63BD81970F01909DCBF03A321F7FDB7775AC5FB1483F
-8AFCEC84FA54FECC0943D208DD70BFED8422DF974FC2395A7ED73C59893F27F3
-AE131B2CA79CCC672EC0889BEB9B92D7ABF0BE800E99926DCCB9A91614F8C82C
-8027C8536757F0CFF01CC545DC7512E9FB1744C2488DBDAB118A374932E93F04
-F8FEABD06239EA605A608996A3768770642787F2C684E6CB0748C64B87A39644
-39B5CEA6252DCDBF6C68F60DB4E6085FE2E8EBAFAFD2E8A6CB7A05E984677DC3
-19999AAE299F1D2992CFB35AB346D5A4A38AF9533E31D3A7B38A4CECCD7765FF
-6260D1008D128BD1C6C5F893567BB9A7FE1C0A215C0C39A8EA0599533A7A53E5
-E8796570A4B04A0B14807ED5CB744979D828AE2CFB624D1883A92ED74EAA5965
-6B776CF01C0A201366378BE236D73BF5AE74C2C686FB6D0D8A33AACBA19A907F
-39801051B3C3EB31D8D7345AF80870BE76A7F8C027A10BCFA10BAF075BF40619
-507C2BF54751C9F89909A639EBDA554A25B3B6B321496052EB27F33251F01760
-1950AC4300D0F2E616BD816271C078D61B72675CB5F09055A0F8B67827B81126
-063D14BC8C0885F63D47A13E5378436812939DA210D73EEDEAC1AB3CD4D51BA3
-3497798ED810A1AC9D9EFB8D26565E9E2EED11028FEDDA34057928EDE3E6B48E
-7826BCAE8EF5FAA4476167730F020F0A74AA9634F87AD41EB444F3A373454239
-4E2AAA1F00129D1C349E9552346FFA5CC260DB3C2E79E7CB51D407A9902C1421
-C442997D66CBA8111BB9A3AA4158F51AA715CED066C5CDACA28D4CA5EC6B3695
-728FD1E8CE6144E02AB8C129C184BE59D8969D9388C59FCD285E412BE54EA43E
-DA2E9D7C8E63BBCA0B32FFA8EDE9DCE029ACD633D7F2FE5E48382A8541B7A5E4
-8446622D467812359BAC9D4852082E663F2FEAF0E64EB4FF0C8DFBC90EE07C8B
-AFADEBA85B2F025FDC243149B1DCFE7F739CFF5CC6F77E8B0D0E80FCBCDE762D
-F173913A76BEFC853D1C45FF938645A61FD727762EC5DE953B4BE59D970DCA16
-521422A466C82B155212072DA38F79ACD7EA650F984D557E233CB4649F3EE7B4
-0FB31F5426AC187831FECFA360BCF71668FA5191943F68459CA7141D5913E1D9
-56E141CB7CB2BD9699950A9D60078C87BA7A3A02709AB9524BFAB7E50B5FD79B
-C003CE62E6D9498601B9E79CC885CB7176971A3C17A64B6EA7DFA8867BB578A8
-3079F189A839EB33F48C1EB8F87340BA2C61C4F4A17C517B97975339306A9F59
-FB864429AA2DFD52060760A617EAAB656E57D4C68B0CA0F2C80F44B6A1199EE8
-5ED5F83D3397F0E80A3344048E34ABC3B936E1F9F8B99CF24D40EDE6E08ACA0A
-D64E7AFE6208EC809B6C5D263249E6797CDCCD46C443257C3E5C2E1382A5A7F0
-5ABA38CFBF585BE2492C0EED5B043F6BD253816C39F6275869EB89B4C38417F1
-21E651EE6CDCC900BAD50D6EBC426ABF25F35BDA22D83F594C92191CE4FF00FC
-F13588AF5780029A8BDA5AE7E3E2E68D44CFE00B864FCD3E3EC40D1396DD467F
-5C04B826DE9F47660793E75DA6CFB5508D57C00CC26E23A1EE8E99CD9AAE9DB6
-19216CCE67FCA16D576B7C1709B0C263C919FAD9C6ACDC1704E4305ECF5E5B62
-8229736CF78BFD917FA00962BD96491EFF3F502E8462988E2E6B85C3665F491D
-B17AF9B2563F1FBDE421F7525C73F7DAF4660E79D158BD86B3DD049AC269DE35
-D92E44D9BE90486EB58A2E0D58BC6EC60E1805839B02C89A84C0A839C970002A
-A3AF60F15F35C3D919E91164CA16D8E9F573757D197D17D85B83C2F779FC2C2B
-C1E5B4E920EBB8895C63F146AF7444079A436FEA8C9DDDDD94ACA4EAFC294538
-EDC94E28307F09A1FB45183F1693117242E927CA67C1CF43682DEC39C25DEC85
-531A8B4F22364772E424B26600AF11914D90BBAB22EF0ABF631198A37116A668
-CE7A69039F0AB40C77741398F7D3A2ED6DBF361CE3F78868B4450E2FCE8F6D81
-7E655BE6B0FD1763C098C07DA0A590448380407A5C1509DFC19D5A48A48906B8
-77F9AE1BBA721AC9AFD9289EC9728EBFC8B7A8A7005EDA605A34436F9E187443
-EA14A72D05ED1CA6EDC6BD75DAF3BB933080C2E498B913D320A727A635061679
-CD2ED9A3CE500DA144245396EEDEFA0AF04C35E7EFD96808D9F9F2B31785B482
-84699594420CA0A39DA528F24E8AE117019740CF0D44180A7491E19A78701E61
-087AC1A47814160B48673B6D5239B701822B6C8EC893241A5A80BBEB23E205BB
-8BD4CF2D514BAAD704598C2FFF22065A58CA9F72B7A4CA631568483D1449E877
-EC419CC02C359F53D0F3A07470CA098096C8B7F8B13310AA06A27420DC5D5248
-D91F4F93F56C5CA489546D9C8B6D035A7353694280B9D5F0E3D2FCF6A5F518FC
-C718CCA64B1E1170D28E670485EE02538A3F85C3352CF6B9BCBA00250DA30728
-FBC18DA95A8C77404B6E44EF40A2C83A2DD12CF5A0468A4CDB9564CC0E5C50FB
-BBA1E80B15E65D99590395AA93B5DE142C781A723461EB3668EDD96F2F7917AD
-24490882C94A8D56C2F64EC3BFFCAE749A669C1B71FA97C0E50A681BB131457D
-515C1249E38A9FF8EFC71CDE5905CC00AE17AAF78DC49B5B90DC870D800BD1C9
-DA810059DCFA6E8D559C87958793D6DE7FEE5DA3E13929969EE1D79DF8DC8D33
-3854ED7CA2B4DB363D3A68A5EF13DE8EB290DF7E85C0182B371D6F07F9373F0D
-18418F7D52DF7771E7F28A8773FCB60E0BA988D13E60D2BAD7E3D53A45F4A622
-28906C55FB9875A0E888F949509B0435B0E1279B006059A74DEDD20B1162563C
-EF8D45AAC2B233EEAE934F8EEA58D8F23EFD8EA50AECD873CDCFFBB6D7E5645D
-1394E8443E81E9DE70545EE991EE9E8F1F5ED820429AF9A71FF9770972A8E583
-1386AB70A3ECAFB60B74E596593A4087D6E8AC81DCDBFB3E1FA8E969ED03F4EB
-53E818066F3DB521D995DBC51A71E011D0885D7D1D394D1C79AB22376AF02C10
-78B11F77FAE3BB6FFADC42C08599458B6BBC4C27E40B41B1727E97501C9B29CF
-ED7929196DF393C22AD31ABD933A744AF29E834B94C87F085EF5DE983BDB77E6
-84C45F56D66F070E1409B8A65FD3CCF7590250E91CE1EB1EB54B1D03FD480DBF
-568EED437875D9D75655F3B117569C8D33677B8AA5678B7CC5A5D1091BED07FE
-CADF0F26F8160A1EB2E8F2F3634E989A369CDD8FD4859D43617D689907B3F1B5
-CC1BAD1C580DA1018E38C74AFFC0BB5D746736A2961F73A85360605E752A8C81
-EAE92DF6D1486A19F5F3F79F9807A6358DCF75B13B6EAF95C7846EAB8807CEA9
-9C327ECE5E7274CDD9116CDB7829CE248F83F3932AFCAD231628137182E8F34C
-69539D201A7B877B7559EFBAB3808E268A0F6C10F179A7618876E0F4451C1B5E
-C30BA19676FD43035931D0D5977A2637C8E87364959B716BBE8633E33E40BEC2
-741D9C6820CCE47CFD19596C6ACA1E05FD86D1AD9EF67E0F6A592DDCEC6BDFB8
-63EFC5D0FA8045690C15B4BE2819A9D846D3C373BDDDE97D895AFB1F1DC60C74
-B157762B839E8BE12BE5B1E6B1C98FCA351D2F1144BA7FD9CB25C8E2C995595F
-0148445BDBF3DEAB517541E97A4C6E130A5EA74B5BB0A9D2D40876674BFE1FDA
-DA22E43FCAAF6FA028DF8B58923A66DA1B3F138EEFB936A8896CC35CD571FF8C
-43896CFA08C0BA382799053538F68693D22796A27F6F849F0CBFFD2F6F4E1B17
-C7D665E1420CBACF177A28A07C84AF696CD7EA4ABA509D9095ACB79777A671EC
-6582B1403113D29C38479CE22DFABA806751C17914A5C3559B9FA12803FFC75F
-EF20D87AAC04A1211C9926280860A9FBB1B067F0875BBBDF6E2D5952EF38DC25
-6D0EC803BF3000D31112FE826AF6C376FC86A544DB1DE284E5F631549CB46DDD
-1F5EA6F7AB970618CEA850E7C28FC6BC9D0269CE7161AB55F58010089A89BA54
-528B529A64815B315FBF9705A1698EE07D338B2667DF75943E5FD11BBE1462C1
-4D23A53F7F2C2D9E4C53E77840D82BEB8A7AABA7F0F539605C676FA0F2B5CFBB
-DCC720A7D5A8AB674F1AE1D956E14C634C3ACCE4C54DAC7CE7189062F2FFD86B
-3C204B468589CC3E40E16D706B1B48A670C7A82B7E3B4A530ED4C1C26E1CD6CA
-A22677CE63138071D10420F739F9BC8607F6E0AF079F1ED57F3E86BF2B603568
-41B478BBBFE4E27E03E1A5733208553FF62698C4AECEB4888A32FF1C09ED556A
-8448ECA3044302923584733D38431563B1CE6E12C549650DF3C09EDA7331F9C6
-482761DE1664676D899BFB7A435B77811C610A3667D1FCAECBF10AF749202D9C
-0059D1010A86313807CE9FD293B7F8D9DA2DD54822F937526D12C44360DF254B
-C94D834FD4E8D2675415D83F875ED92A36293323E365F2216EF6C4AF652C4308
-AD28CB5F5483A34EBF5BDDAC12553F2E5657B578E6E864A5BAFCB49E39BC70F5
-0517175B27C54A984FE7F731C85D4FB9AE80B1BF693B8CA0E7C7F27927C9545F
-E7AD81D47319F6A735B473C060633A9B8E7208321C5C2A1C6E7D9C7086120CA4
-1F36DF24E88522928D6D59DF7B94682A1C13F4D26551F73A00AFDEF73F553B61
-DECB364525CC5DABAC6E
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-cleartomark
-%%EndFont 
-%%BeginFont: CMMI10
-%!PS-AdobeFont-1.1: CMMI10 1.100
-%%CreationDate: 1996 Jul 23 07:53:57
-% Copyright (C) 1997 American Mathematical Society. All Rights Reserved.
-11 dict begin
-/FontInfo 7 dict dup begin
-/version (1.100) readonly def
-/Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def
-/FullName (CMMI10) readonly def
-/FamilyName (Computer Modern) readonly def
-/Weight (Medium) readonly def
-/ItalicAngle -14.04 def
-/isFixedPitch false def
-end readonly def
-/FontName /CMMI10 def
-/PaintType 0 def
-/FontType 1 def
-/FontMatrix [0.001 0 0 0.001 0 0] readonly def
-/Encoding 256 array
-0 1 255 {1 index exch /.notdef put} for
-dup 58 /period put
-readonly def
-/FontBBox{-32 -250 1048 750}readonly def
-currentdict end
-currentfile eexec
-D9D66F633B846A97B686A97E45A3D0AA0529731C99A784CCBE85B4993B2EEBDE
-3B12D472B7CF54651EF21185116A69AB1096ED4BAD2F646635E019B6417CC77B
-532F85D811C70D1429A19A5307EF63EB5C5E02C89FC6C20F6D9D89E7D91FE470
-B72BEFDA23F5DF76BE05AF4CE93137A219ED8A04A9D7D6FDF37E6B7FCDE0D90B
-986423E5960A5D9FBB4C956556E8DF90CBFAEC476FA36FD9A5C8175C9AF513FE
-D919C2DDD26BDC0D99398B9F4D03D5993DFC0930297866E1CD0A319B6B1FD958
-9E394A533A081C36D456A09920001A3D2199583EB9B84B4DEE08E3D12939E321
-990CD249827D9648574955F61BAAA11263A91B6C3D47A5190165B0C25ABF6D3E
-6EC187E4B05182126BB0D0323D943170B795255260F9FD25F2248D04F45DFBFB
-DEF7FF8B19BFEF637B210018AE02572B389B3F76282BEB29CC301905D388C721
-59616893E774413F48DE0B408BC66DCE3FE17CB9F84D205839D58014D6A88823
-D9320AE93AF96D97A02C4D5A2BB2B8C7925C4578003959C46E3CE1A2F0EAC4BF
-8B9B325E46435BDE60BC54D72BC8ACB5C0A34413AC87045DC7B84646A324B808
-6FD8E34217213E131C3B1510415CE45420688ED9C1D27890EC68BD7C1235FAF9
-1DAB3A369DD2FC3BE5CF9655C7B7EDA7361D7E05E5831B6B8E2EEC542A7B38EE
-03BE4BAC6079D038ACB3C7C916279764547C2D51976BABA94BA9866D79F13909
-95AA39B0F03103A07CBDF441B8C5669F729020AF284B7FF52A29C6255FCAACF1
-74109050FBA2602E72593FBCBFC26E726EE4AEF97B7632BC4F5F353B5C67FED2
-3EA752A4A57B8F7FEFF1D7341D895F0A3A0BE1D8E3391970457A967EFF84F6D8
-47750B1145B8CC5BD96EE7AA99DDC9E06939E383BDA41175233D58AD263EBF19
-AFC0E2F840512D321166547B306C592B8A01E1FA2564B9A26DAC14256414E4C8
-42616728D918C74D13C349F4186EC7B9708B86467425A6FDB3A396562F7EE4D8
-40B43621744CF8A23A6E532649B66C2A0002DD04F8F39618E4F572819DD34837
-B5A08E643FDCA1505AF6A1FA3DDFD1FA758013CAED8ACDDBBB334D664DFF5B53
-9560176676ABB71BBD0EE56B4CC492C0652750227CEC6CBEEE374709231B00CD
-0DE83AFDE295B314F6C8B1FFD32251C1925D96A64D739FF1DA4926460B28B3DE
-E949AA0BA3DDB16534FBA30C32092D5F712B5E8C8D5142F35AF2906E6C219D2C
-7FD9A368C193E0EB9C7E25FF03C546B6ED993F964CEDB1B8537C617170787F37
-88D6F2AD02384B01067FE3F98257BAB958BB3BCD1001090A4502DA0638080EC6
-DB784CC8AC37CDC01B29BC481D6A05ADC6188785262358C1BF1D694BBF31C1F1
-AF117C1ACED44AAC6EB4B9A2511A6762DDE8FCCBA5
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-cleartomark
-%%EndFont 
-%%BeginFont: CMMI12
-%!PS-AdobeFont-1.1: CMMI12 1.100
-%%CreationDate: 1996 Jul 27 08:57:55
-% Copyright (C) 1997 American Mathematical Society. All Rights Reserved.
-11 dict begin
-/FontInfo 7 dict dup begin
-/version (1.100) readonly def
-/Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def
-/FullName (CMMI12) readonly def
-/FamilyName (Computer Modern) readonly def
-/Weight (Medium) readonly def
-/ItalicAngle -14.04 def
-/isFixedPitch false def
-end readonly def
-/FontName /CMMI12 def
-/PaintType 0 def
-/FontType 1 def
-/FontMatrix [0.001 0 0 0.001 0 0] readonly def
-/Encoding 256 array
-0 1 255 {1 index exch /.notdef put} for
-dup 58 /period put
-readonly def
-/FontBBox{-30 -250 1026 750}readonly def
-currentdict end
-currentfile eexec
-D9D66F633B846A97B686A97E45A3D0AA0529731C99A784CCBE85B4993B2EEBDE
-3B12D472B7CF54651EF21185116A69AB1096ED4BAD2F646635E019B6417CC77B
-532F85D811C70D1429A19A5307EF63EB5C5E02C89FC6C20F6D9D89E7D91FE470
-B72BEFDA23F5DF76BE05AF4CE93137A219ED8A04A9D7D6FDF37E6B7FCDE0D90B
-986423E5960A5D9FBB4C956556E8DF90CBFAEC476FA36FD9A5C8175C9AF513FE
-D919C2DDD26BDC0D99398B9F4D03D6A8F05B47AF95EF28A9C561DBDC98C47CF5
-5250011D19E9366EB6FD153D3A100CAA6212E3D5D93990737F8D326D347B7EDC
-4391C9DF440285B8FC159D0E98D4258FC57892DCC57F7903449E07914FBE9E67
-3C15C2153C061EB541F66C11E7EE77D5D77C0B11E1AC55101DA976CCACAB6993
-EED1406FBB7FF30EAC9E90B90B2AF4EC7C273CA32F11A5C1426FF641B4A2FB2F
-4E68635C93DB835737567FAF8471CBC05078DCD4E40E25A2F4E5AF46C234CF59
-2A1CE8F39E1BA1B2A594355637E474167EAD4D97D51AF0A899B44387E1FD933A
-323AFDA6BA740534A510B4705C0A15647AFBF3E53A82BF320DD96753639BE49C
-2F79A1988863EF977B800C9DB5B42039C23EB86953713F730E03EA22FF7BB2C1
-D97D33FD77B1BDCC2A60B12CF7805CFC90C5B914C0F30A673DF9587F93E47CEA
-5932DD1930560C4F0D97547BCD805D6D854455B13A4D7382A22F562D7C55041F
-0FD294BDAA1834820F894265A667E5C97D95FF152531EF97258F56374502865D
-A1E7C0C5FB7C6FB7D3C43FEB3431095A59FBF6F61CEC6D6DEE09F4EB0FD70D77
-2A8B0A4984C6120293F6B947944BE23259F6EB64303D627353163B6505FC8A60
-00681F7A3968B6CBB49E0420A691258F5E7B07B417157803FCBE9B9FB1F80FD8
-CA0DA1186446DD565542BCCC7D339A1EB34C7F49246E8D72E987EB477C6DB757
-99AF86CEBCD7605C487A00CD2CD093098182DC57B20D78ECE0BECF3A0BF88EBA
-C866DB19F34BBBED6634AFC0F08D2AFB2A92578A6F8B4ADCD6594737FF6EED7D
-5B536DA9E3E2CADB40DB7C600EA4D100D33C3B92B1CF857E012C4EB370BA8295
-55B50047CC8911C98FE1A7BA6CDEA82D34476286E710776823690AD333DD3A49
-335002F4680DBE1C21174BF016B0DF799B01EB9D6988479A8334BBA2F8DC7146
-BC0DAE9DE3A6453B181808E68A89E0C02DAC6264D002B422EBC1CF14F65D9888
-15EE6D514D3457F7F3C6A3D17EE1DA076F73ECC392D349174DA9E4680F29CE10
-0157E42CA35F5DBFF56BFC3AA07E61A78DBE882C5AB388220C19750D3643E7C8
-23D6673027CE568A4ACCE1D12B1D9E5A43507F4AF9BC873237F65A6B95078DD2
-378007CF0F0DE7CCEF760E19D6D1D7B412EC5D4972
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-cleartomark
-%%EndFont 
-%%BeginFont: CMBX12
-%!PS-AdobeFont-1.1: CMBX12 1.0
-%%CreationDate: 1991 Aug 20 16:34:54
-% Copyright (C) 1997 American Mathematical Society. All Rights Reserved.
-11 dict begin
-/FontInfo 7 dict dup begin
-/version (1.0) readonly def
-/Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def
-/FullName (CMBX12) readonly def
-/FamilyName (Computer Modern) readonly def
-/Weight (Bold) readonly def
-/ItalicAngle 0 def
-/isFixedPitch false def
-end readonly def
-/FontName /CMBX12 def
-/PaintType 0 def
-/FontType 1 def
-/FontMatrix [0.001 0 0 0.001 0 0] readonly def
-/Encoding 256 array
-0 1 255 {1 index exch /.notdef put} for
-dup 12 /fi put
-dup 45 /hyphen put
-dup 46 /period put
-dup 48 /zero put
-dup 49 /one put
-dup 50 /two put
-dup 51 /three put
-dup 52 /four put
-dup 53 /five put
-dup 54 /six put
-dup 55 /seven put
-dup 56 /eight put
-dup 57 /nine put
-dup 65 /A put
-dup 66 /B put
-dup 67 /C put
-dup 68 /D put
-dup 69 /E put
-dup 70 /F put
-dup 71 /G put
-dup 72 /H put
-dup 73 /I put
-dup 76 /L put
-dup 77 /M put
-dup 78 /N put
-dup 79 /O put
-dup 80 /P put
-dup 82 /R put
-dup 83 /S put
-dup 84 /T put
-dup 85 /U put
-dup 86 /V put
-dup 90 /Z put
-dup 97 /a put
-dup 98 /b put
-dup 99 /c put
-dup 100 /d put
-dup 101 /e put
-dup 102 /f put
-dup 103 /g put
-dup 104 /h put
-dup 105 /i put
-dup 107 /k put
-dup 108 /l put
-dup 109 /m put
-dup 110 /n put
-dup 111 /o put
-dup 112 /p put
-dup 113 /q put
-dup 114 /r put
-dup 115 /s put
-dup 116 /t put
-dup 117 /u put
-dup 118 /v put
-dup 119 /w put
-dup 120 /x put
-dup 121 /y put
-dup 122 /z put
-readonly def
-/FontBBox{-53 -251 1139 750}readonly def
-currentdict end
-currentfile eexec
-D9D66F633B846A97B686A97E45A3D0AA052A014267B7904EB3C0D3BD0B83D891
-016CA6CA4B712ADEB258FAAB9A130EE605E61F77FC1B738ABC7C51CD46EF8171
-9098D5FEE67660E69A7AB91B58F29A4D79E57022F783EB0FBBB6D4F4EC35014F
-D2DECBA99459A4C59DF0C6EBA150284454E707DC2100C15B76B4C19B84363758
-469A6C558785B226332152109871A9883487DD7710949204DDCF837E6A8708B8
-2BDBF16FBC7512FAA308A093FE5F0364CD5660F74BEE96790DE35AFA90CCF712
-B1805DA88AE375A04D99598EADFC625BDC1F9C315B6CF28C9BD427F32C745C99
-AEBE70DAAED49EA45AF94F081934AA47894A370D698ABABDA4215500B190AF26
-7FCFB7DDA2BC68605A4EF61ECCA3D61C684B47FFB5887A3BEDE0B4D30E8EBABF
-20980C23312618EB0EAF289B2924FF4A334B85D98FD68545FDADB47F991E7390
-B10EE86A46A5AF8866C010225024D5E5862D49DEB5D8ECCB95D94283C50A363D
-68A49071445610F03CE3600945118A6BC0B3AA4593104E727261C68C4A47F809
-D77E4CF27B3681F6B6F3AC498E45361BF9E01FAF5527F5E3CC790D3084674B3E
-26296F3E03321B5C555D2458578A89E72D3166A3C5D740B3ABB127CF420C316D
-F957873DA04CF0DB25A73574A4DE2E4F2D5D4E8E0B430654CF7F341A1BDB3E26
-77C194764EAD58C585F49EF10843FE020F9FDFD9008D660DE50B9BD7A2A87299
-BC319E66D781101BB956E30643A19B93C8967E1AE4719F300BFE5866F0D6DA5E
-C55E171A24D3B707EFA325D47F473764E99BC8B1108D815CF2ACADFA6C4663E8
-30855D673CE98AB78F5F829F7FA226AB57F07B3E7D4E7CE30ED3B7EB0D3035C5
-148DA8D9FA34483414FDA8E3DC9E6C479E3EEE9A11A0547FC9085FA4631AD19C
-E936E0598E3197207FA7BB6E55CFD5EF72AEC12D9A9675241C7A71316B2E148D
-E2A1732B3627109EA446CB320EBBE2E78281CDF0890E2E72B6711335857F1E23
-337C75E729701E93D5BEC0630CDC7F4E957233EC09F917E5CA703C7E93841598
-0E73843FC6619DE017C8473A6D1B2BE5142DEBA285B98FA1CC5E64D2ADB981E6
-472971848451A245DDF6AA3B8225E9AC8E4630B0FF32D679EC27ACAD85C6394E
-A6F71023B660EE883D8B676837E9EBA4E42BA8F365433A900F1DC3A9F0E88A26
-331508EB5EA0129B0812E2B888CDC3CF50E799B35D0997A9D3EC69D785AD6C35
-BB0583EDB5FE7C28C30C34A905F11DEC9DB163C9B7BABAB718B7A8E7B0553DE1
-AF58738452D8733E5FB18A11CD4D57984F7E8B7EAA0845DA090C1A0F16EAE609
-CDD36788CD8EE8705DC743566FF343117647A7E83EFAC76F8AE39330AF1E8FF8
-A1AE6672B17DFF1B292E36990B96BF85B304D3298CF4AA460D574EBEEEA4FB0A
-EFBBA3F2F3818146B79ED15B2107B0043FC4B7C70284B905A53EB2839F552B99
-AEB32C52B1EB253538FBB9CF36F6027A4957016BD54DDAAE87FE899B6BA145C3
-8B644B84F15E84EC63AC9BA05909673CB2506CF61B3FE6FA59A75D98FEF28E49
-9312882C8178DD2D25201E10289B410122D815ADF500A9CB2B64F91FD1FCFEAC
-067358FEBA4CDE3E7D2AA6C055FE9C61A09CDA39A89031FCB02658B542ADE7DC
-D72A92D69AB9B6BB54FD76B1FC4588CA65EBF1A7D22A8E50337AAD4F1536681B
-151D6AEBF8C37F10FCC5C0A1CB1347D705E3A6E1084DB853E52979AFF0B2940B
-E5023565B44A990D82028FE506E4DDD6D0083894E6A83683961B53454504569D
-457C416123BFCFDBA9C29F1F383F41CFA8168892BA75C4F76157E0D777A7E543
-820458884EBC03A3527310C7966792AD248AE4F837BE54C117571D7114899B05
-5A5631CB5BB4D8616ADA849FF629433BC7FF9491913C475B41239541EA88529E
-96E9CF03AA174DA5F26272B1B81FFB9280657992806891F052F943ABC0A28CC3
-67B4D322596B0BF3DEEA82DF844C6B23743300C37012CEAC9749FC278C768F91
-4CECF64BE2C5D36BE78FF9FB534CC53E948A8C7191C6B185FD8B7F60654775E2
-77B98D26B27648CC84C88D375ACF0539FBE640A316651C26E090385A6BD8A7D9
-378B45D7B9F5FDBED80F307E957B98246DD6B59B402AB6FCBD3EDC423179D494
-F0A2878FACC2631A13E3E3577649038782F650C7C71893E16D1543AA5758BBAC
-18A0EF1531B441814C63341AE77C2764170779F6B5079CB37B5CEF93D8BC912C
-6D0AF13DDC1B89929C2E04071C5F23B4C80C39FB1CA568F1933A26A9B37A43F0
-91BABBD85432783909230C7E764A74C83B0DC9827EECB591254918F5147DBF1C
-5F8035C016722D36BAE202405339748FD247476A877E7D28EA9E9AD5A1A3A6C8
-4A268703D68DE934FF8EFFC264E55113EDE195E48D6046659D54D582E42E3E6F
-31C5B6DFACE214F2468624486B7C1311E7EE8CAE02265F40021E79CC7233F6E4
-2B61455654FBC8171DC35DC48E0184DE334F54D116AC6A84BD5CB993A6A3653B
-175430DD42034058465C8735E13319E5D8CE9EC9F8A527F6C4C3D6F85702F79E
-59E1EF197A921DB95C27464B3F2A08D0E880F30E3C88DE4E8E690A0EB1528A98
-F5936A07816B37ADFC44D0E81A6D06239F22B34A284E102054AA86533BDE68BB
-B0104F0FA81EF25CD427654850D42DAF4062EE75CC74D6662DE7E85FA96807E3
-571EDF162C017F9E8E403DA8B1F68F7629F54A59313104A17A9DB2466A03A36D
-318C1F1EBE532A56FE1B16BD08735CCF98C2FDF179F5164FB598F0AF8E120433
-9AD5BDBE4F03FFAD457D63A0606D5C65F1D7BFE7F27F2AD8B33B33F926B0F734
-7F464F8978EB6331A344CF076B12ED4167914C1E3DEDDA81DCA7CCFB3FC8B221
-5A5BCDA699B4792E8EAFF32F1521A8E4CCE84729B3C03882515680D1B4043D55
-2DC31C7BD4252A6449D9D1B1CC70BF69B14395AC49C2B233844A8A9FDA1E0F22
-85B4B2E490A67CA7E2FFFFC30A2B9F7813A430A9106F258D3BE59AB1E0D22D39
-F5A4503B8CDF418D2D4F25B5544D92557EF9C3D5D8D88E40927E5FE1C121F5F8
-6BFAD87C38EED25BEEA229DDA2E9893164D6C0AB3B7E513DFD93E8D4C67A1FA5
-C22BE730D035F0AFA9DF7E32A07180EC9D66B061C291FDA89DBF50F6796D9933
-C945B0D822E1079518850D54814EB047E64AB6C92626548185F0A20153056C55
-764974A54CB7B798D3B571AFEE438FF73F4D398A72526E9E08C468172D8B0F73
-DA0F2F2E07F900E45966726822097F6991D5365CA7052D144CF9EC7506CD3A66
-8B0C935D5F748135A70EF3D7FD900BB9C0C9D355A3066B77659B7E938F519DF3
-D11331283960D21F426B289B1425F3BEF5EA53DB9CEC31A376490473AB3E70EE
-1C80D3309BF09ECF910F4FFC766E1E8D335F8E0136ADF71DFA990700411469F4
-4FA674A051DFC9DD69DBF015C4854B1EE881F086505AA7DF696440A43BE2E4DE
-73CDF5D7584C8B239F754CF57F3B3F070AF9F1400B378BD4AE5E894DD0766248
-31666BD29D655F84689C96540A97002E25539B8DC5916F57CE3F662D0B141CB0
-CBF93E5570C206BDEF2521C7E80EF6D143C7A031CC721C22B51AEA6A99898CEC
-E81807148AEC9A9BB27F139307C17BC265EF674E1F5D0A314A3D82D0EE516635
-453A53520DFB87292AF8CD39ACB718C9EBBE32658B2E78A1FCB2BAB05CCCFDF5
-0F1021F19519640EDD4879F3F1BFEAF96F049D6A29656CBAC7D73F5BCD48BE61
-E3126E566F662756839A28A12AA35F918F1BD42802CADFF08880C457A4204E84
-39B74E7699C2B52681D4BBC0464B668ABAD126DFDF9620D3A3DC2579EDBEDBAD
-7EFB4B18D044B6C44C09426D926FC144BF54B0A99AF9940BAA96EC9A4E67BD51
-DCC9B8BA6F374B4051F88439A5418D2BF7A76F35A515C2D4479E07B531482650
-21177DA0BF946CEF21F5FD9C6DE01A75B6BB369AEFAFD26B0D24C496BE3772C1
-8D035AAFE18FE8773C0B045971652AA3DA7F4CE9A98A35FA2898DD0453AEAD0F
-B8D49BB9A9BF154A443B26EF6312FBEDB0581AFF33FF3E0623A06C0D37D2175D
-4A39E94FEEE5A49601760518251BC1053386BF2A2CA2519FBE304537CE1B10F0
-5A49BF52BCFF3E5E9899DA5D343BBCB6121AB2B2EEBFB2F5C8D75143B9C46371
-11863239F41ADABF9C5DF1F56F3B6F58EA027261DA2989E69D4C85864A9E2ABD
-C06219875A2EAB7FBA31EF8A419963F56A1794C7AA76E08505F4F69ABB1C8F2E
-7DDC84B60924369FB02276255C06592C3CBC39234B809F1E98164F579E33BF72
-9BFE3167E35D34F294849A5EC8B8D85E9CBE4B855792978B699A14D00B8C4E5E
-8243F3F253DAB290A0C31F0F61B1814016A51A6478EC75071FFDFA8DE171EE55
-558F65EC06BE4C61EFC10235CF8A67729FC8539B54E24149F40F156150A0E3D5
-ACEDB6317C663FB4D19351D1FB66283E31158C68F559AEA59CBFBEC8EA532A0B
-3E90AE9F7BD9FC88367B1BA34DF3FA6322EFDBCF1C9EBDA04EFA09AD50BEA044
-9D40863676648BA884D2BCE295CF78C484E1190CCC075E20036AF0DEBA4F3146
-25230B84531D3472109F52A7985614FD2A4BC7BA60CFF2B40BDA929F655CF041
-427B9DB5EE3423136F99BDF25AA587342C2A3D4259F9AB301E4950C77FC22A82
-3F14FEB80C1409F769F59A57DF18CB9891CD781114F67C91192870597D2AAF25
-C7409745E69C51E4ACFC57E17C062EFD124570D0DC03167589B3E0A479659D9A
-458F1FC8DEAB9BDD8AAEF79E683442F387EF855DA848FB2011B380236D34CEA1
-3989C37BFD2CDA7E554DB0CF2173622732E006055B93E680CF302DAE3F099A1E
-3CFFEA42266D1539E502BF51BFEE5BDAC2BD89BC2FFBF2370FA8D42550C97122
-2381B61CA5A18AB1F9DF2465F771F1941DA7DC4ABFB56A74F6CF5B599C17D303
-CEEF0DECA46C6026E6B450930A55C6D22FB585563A664368E9DAC2DC8A89FFC7
-339BED3672C4673518F06A3E11E82CA6A09AD9EFC62A8317FC48BB42FCE7629F
-58F23E4B0F2FE4B51996F3472FC776CF7AE9AA575790B091A195ED09B7CC79D0
-C6E9210688EB1FE4002C049B8019A2B6BEF58F8E4BD6C417E15615F8ABCDA902
-B3BF7DEF24505F7A343B4DD2CDED0B0F3FAA8AC566E02F746D8ABBDD50D5184F
-CE04468013BEA580EAFE461DFE50B4EA9442C92136C035B6F6CBED44B74EF6AD
-E80B1804E5108AE194967BDF98DD594F652D2DD51FA089D68B1E4B0C11D0662F
-708FDFC2D42C58A11E07494FE0187122EB052FAD53B747BA27FA78470A400C57
-A1299756081025F330FB88B2177E885191C3E89D97E3ED9742F93D9A67CC53B7
-6C65AA92DB402F2F4AD16CB273906FEF6E5FF1E70B5BF7E2B6B09D0AF93BFEAB
-B39D35788EFC09B2D1CD3043CC2BCCBB94D831C0E2318D56C0CEA05D3B3F8358
-9C52804BA1EF1AE81D4F7FEF8B92DEFBC93FEE62BC54578AE37D217A23CC11DD
-443DBC496EA4907C896660D15ACEAB1B71529B73E95B72E57A8150667D482473
-1B49E95DE290D1890DC6A2A4FF8B45BC2586C8EBC837DCA20238CC3D0798B69C
-48E2AAEE91B44C03091A07514079D3492BD927CD86DA61E0D144C13D0FB04B55
-55B267D27D6B4322CA8054EAD1B08E6CC6CAB901FE0F3133341C27FB84F3B11A
-FB79F277ACB50D951CE1DFAFC85A1FC0220CAB8E388814B5A3A0F4C357250723
-15FB784B01ECA0A6C01824695A8D1419AF48E4A10999B47E5431DA0FE16192BA
-4EBDD5F421D392C29E4807DE38DA7B95EBCECA19D08F1B18EDABF3EA50F893AC
-788817D0529A1B7965C0EDCBE31686412248D91B445E794A1D147D302D2F536D
-A6F1369C3E38327F793FEC3FBE23DA622B4BBA30A371503B63FA7E0005C7C085
-FE74FA0782F33976BCF1A787726A749928B07857E1141E2F9F3B5409B79F3B10
-7FCD1297F9C354A19BFBE7FC4531F2A943B63C1888808002E2915D1F7BCD940D
-C070AE31A3BCC518780262E3B57B4BEB9ABDFD86874F275FADD8ED869EC06ABA
-575980D28310CEBDDA56CAB85C7EC19E84A7130648C08A47807207DD47B9B048
-44CA4FED53ED41AADE6AED80E3F5CA649285D6F1EC77E4ADB45374E8404AE74F
-D43A290F32BCC677A734E8818BFB9E648CF52A81184E7A9BF559235D9CDAEDC6
-F9CF50A6510865216E67EFC78CB000D973964A5CF5F429E83CEEE3FDB3998546
-23A2E1B20C14E44E197B94408658A6EEB362C3D4BF6306E1485A8D735B556F04
-DFB7848B5CFDE0A03247179FE97B7D93E20E637A3E1F0905B7298509EC9EE81C
-5CB9DFBB248B73A91A470C31B79ADA893D409DE4812F878DD067DB645EACB250
-A25259C6B0B87081EF70DC70B7217A46B31892850317EBDA2637EE3E5923EB81
-F09AEF1DF421ABAF1966A336CC9DF75AF2AD05E0F95F34C84466BC4A09C670C9
-5A3AEEDBFF99CCB05A974A41F82B2787C65B7BE8B7A85EA906614D87B3D78AEB
-1694B1D927FC5BC9F156F7AF721DA1BAF76E90D3CA0891948B04DB4ACDBFB1A9
-E860EFB9B643F461C4BF1B07A1D55FB9AC069DE0C2C79FF04449C1993334175D
-103DC7FE13658233C0ADC2ECCA6A40E832076B834CE5DCA9FB6B690BFF2D46B7
-82DB5ECFAC9471F06277B8AF5A8CF54A00BC1D63C828D2EB41EF8A9C30D4844B
-EAD13739A615400C4027486DFB643910BE9E39084C6C4C836BABE5902B61A2B5
-0AD3AFA3BF4B1DE1C24C35C36DC4C6A454715ECD86EAE58BA245622B099BC4C0
-5BAF04B2343BC5806F6A7627BB4B58038840C8C990679EB066A89EFDDEC09158
-AFE52E8176AED1CDA31C874ED0E623EA798B18A3F277C7BA6C80CBA2AAE9282D
-4132FA086A32323932DFB61B48CA9828D10428EC06ABD1EEAACDA3CC6BCCA9EB
-13D866A227A56B1502728779EEB75C06309843D4E473DC41B6DA0E8D6D2B6EBC
-F9B9DC28AEF402833D035A8915CBA05F6E87313C51128353B04F0AAC6BFE93FE
-56C0328D0B41123EAFF4E994F8D9E688BFAD002773E78BE21548AE4FC5FA0325
-E3F7F4FFA96FD4DC29A82D335A3512CD4FCF892085A524C9818F814377779B3D
-FD395D6CB467A80F55D5931AC54DF8FAC8D685ADD195D7AA57CCA5E84195F716
-E6F5D3B9EEDF03905D4E453BC4D6CD16E80A889BBCE8E929FF0776F00E052015
-D2144C0ED590901CC11045EC712728EFE0B179C2CACEEF04F37373485AFCDEFF
-C8FE723B4BB2B5F3BA91010F392DC1CF49AADBBF529A61A38549B063F8A85CA5
-66254A6036E67DDAC251112FFBB051D32C3E52CE7A47052AB8B3EEB5FA7B85D3
-DED00EE565AB2F5D92AA8105A22020BB3638F0D3C3E311F236B87CF3294FEF18
-04FA0F914DD858D8E1B50D9F0B628E27551DBF530FAFEBA012F743D233E65453
-2D06D761BAAB99E946FE8758D5F078AEF38BC0E987401DCDF594FC582C88A80F
-068ACBB7B0D8B5CC55C3F81BE1F804C878B2A88507F014CAB17319EA6D1E7815
-1BF80DC5EDA82A8BE74F9B3892ED6ECF91972BA1C5323B6FE30AEA497A8BD6D6
-101A2B5D3C1C135DF4A2C5EFE8EB00B5A39878E983DFB0CFB65BF349068AE607
-E4A8746367508B3DB8E434487C7E0DD59D21E73B82FAF635C9C944BF96180692
-9145BDCBB9474AD2CF0445CE75089AFB3AAF1F382261CF9768C9E72DDB94134F
-D51B6CAB113A7321BB19237D87DB741D709D30C02CC12F0B1FE154051DE5D335
-53EC80BA069277C69E64293BA17F696C6B6A8E1A49E0AF9C80295B404FDF61D5
-15915D63DF1070ED77F6C8A72798FAF7A9E8CA06FF7C34058E1DF6DF2F78BD0A
-60A001B4DE939643A00782E335F2B650DADCA0D472E372D7EB69D7CC33A209BD
-DABDF28F5A6B57050D9AEB71400C6804A83D6042CFA1BBF3E4DDB135843B87FD
-8B3A90BBD26FE135751DDA74D3A58A190EC0D65BACF64D3847CBC6468563B847
-1375D0B46738B8A5E993E656EAF70C2B845D92621EA7D299EC0472709689BD8C
-CD0C914E4282E6F7081895E0CD61973B070E548BB9D644703D1CCEF37EE55690
-2A199C847FBA2CAF763858C7EFC1B1AB81DFC8D7EC384669A2359B8979DA0C57
-20B3696449B4F314F5C735DD48045877F014A66C9140567FB2C5E32D85A65F0F
-79F38E573D17C161E9934178E9EB9BDEC96901048E4581800A15B851F5EEC233
-F4CBCFDE5FCC516477531BAF235738DBF76490DE4775FD6DAA27873814B4E55C
-E9A18B3CFFB7C955D226556E82930FD5CE22EED90F82658E1CCA205C16E431D1
-78F6ADC91853BED7F08D5A0EE63624F5B3B7CF3D84E9051172215828CA11AF8B
-9A7E0529B0F765CFA39CBDFAF4E2BDE8B42F862A5B6EB81D17D11520F2EC5963
-8BF5FEAAF989E2F788FD06223E33889CAACDB6583A5DE8E6C4687279DD26C6D9
-6ACE03EF6F4DCA45B6D706564A9D3C4FD980DD736B6731CD04EBD360A977E3D8
-268B0C8C17771A4BAA1E57ECDD1753F6B2CC616A5E987A3602512F1EEF2F6687
-05C78C0D6FB8F3FC97718B5EE2F3EB70417C542EB55471660E1D5BD19593D057
-DDC6E3DFB28A730B3A5A5E8807DF0FE12741AFEF64B768135028849458C982A5
-7FD84DEBBA672C6802A0660B9D1C0CAF05F5945C82CD68696073C7FA1E69DA49
-1C96523AAAD110AE1FDAC90BD3B1B806955DBB4E6B39F1BF095A835C684340C0
-24FD0DFE275F112E29FF78CA1F5AA1DA666A375EBB2314E88CE92E5A0E332742
-4E3A47A9B18C5B22E3435649CA1E146BC429D791ADB58AEACEB9F0B5CF72C039
-A18859BD622529A5878F8C3830B59677B4B3E530EE07DA4A04E3FC9EF4F69E28
-818B3C86AF5439E955689A3D5EB4614945A39D43299118FA4A6A0495A0878FF7
-D88A5739AEA11D11EF0BC09DF14341EE973E7BCF73CC0B6B3DB6CEDA9955DD2B
-66602196FD3FE44EC36C85E8975583468DB9789CDBFEF07FE6C7DA6E27530C04
-AF64435DE75665E3B452B87E7EBC6CCB6504DD509EBFA07A94EE40826906C88D
-97BB26957268217A535AE2FEDE196D728929DB901A7513CDC0BD31722931EAF2
-C6EFEED4F60C56E558595E204310AB5F8EF645055D4FFBB209132E8063711F7D
-94C97AE8C2A06C9D3A7B1B4254344672239CEB439BCC2F961C62E29DE9B4A304
-B486F37BBDB4CC837423B62546B792FC3C238223160CFA32BC9756BCEB179739
-31DCD955C42AFA139A0FFE44180BC8BC0FC79F78768776AC122DE97D10ED094F
-2096015F91FC2E045C817F8F5F5CC466661361EC2DA988D6D57304D30FD86692
-A659EF3814CDCD55FC0857EA0500339C6C80902389E55CA97A46DCB44CB12EFB
-38705CC1937C0C5BFE77D03901965BD4700B88E9FB3BD9791986B5966B0A3C62
-41592C2A34DBDB5CFEA0ECA77F18B30E082B133E9D08CB7FEE8966AFC3918DB1
-65DD71E3A6D5899CD1C8DE132439FAB79D1C8EF20E2B88B5907522A9D3A7DF6F
-A2A0EE613D3E3DD7E8A548BBF05DAB69D9D9F2CB4FACA594D4385DB40AB44C73
-C7CE2A36547E97B90F8E98A3E86DC6ED97967CFB7E438011D05714067528B547
-ACD35F2A643653F6B2FDE2A216953C2A5FF6B78CA47655218771272F81E9D78D
-B09AF5F6DE4CE302C0D23D2BA7DF2280DB586D2667E112981F2D10DA7936B0D6
-4924AAB6A2179F213D0DBCF8DC3E291621601D84BB5F26B7B74E88B63DA807AC
-4AC0830655065A5C14B718CA5561FF0ADAF7FCDF38B817FA6056DD6414675BB9
-54585EB05B8F725C9C9A2F5093A86F442445229ABF287EDF9532DEF5C8AB2B5F
-34EAE1A3DEBEB0E9BEA8D14CB774F1BA8E4A5C1C2BF2161977CF61E798F81CF0
-9EFB6B1A013F1E6BFA2E49FDFC45F733C9E163C363967F1606C6BE26B0831678
-6BB6B4AA463CF6A819E1C98EE0647102A4275E7AE74EC151E047A4ECDF8CA056
-C2F223FBE22F6708FC0AA5C43544F77AD87A1EA607E33DCA06E78B0B090572DF
-2F893B8B8B6D303A2EED30B4183937F7FD13BBFC9DCFE62BC7FBD9E6991B3CCA
-AEB41AD2355DBFE6B928FA6E6DDCCEAF7C1BE7AC447C933B9D760C2D0556A64C
-7FD25BFACA2907AC992D73281262E49A2AB177C827F113886D1F986E477ACCC8
-006346098A34069D942A89B7F4FAE640A0816D9D499A02C3DF30740E0BDCC75B
-770698E9C1B791D4A9D12867FC985C2480C9324A88663D8D51E97D1003FE3DDC
-3016B5379EC43313F5725A0A88D91BC77C8B6049706AE1668490C4BFC8AE2529
-18720CD3AF6D788B2F818CB30CAE9B36BFC9BF4635B8F445CD4DBA4A5E604339
-833D438D0174FCEF5B7B6F2B049A423DE65E284BBE72EB264587FDDC319B7A4C
-44BBBE8CD81BF545FE9A65C526A2D9336A888B8B06AC7A337D2280787CEEDDDB
-4357FEE5D21AA170B16B0AC6E8F1E629C00871799E15F36C7AC39A6C034B3F80
-C84BAC46E3B13D05F9D5845B459EA3ADBDD5AA5206ED6F94C9240A6F1EC1670A
-C5462B6A19658C3BBE2512B6F30804EDC975D998596CD938F66B13A87EC19A8D
-7CCA35789448580ED7808B171915999D6A801F1ABF14685AA7DC1C35C5F82E4A
-18E4429A5D332086DC37E0B5278F7C3E80D538CF76287F208FA9716EB97C4D27
-30893C09302275D18CA65EF626319DDB88FB2EB4D6F6FDAF96EAAB9E35598FF7
-590996885F24EA89296EE222675B5E7ADBFA240F41D893354234A9100865CA8A
-BD00B9332C841510D4430E9F1B5C0BC473DC8D352A6D051F1E012A7330238977
-7D424523D83805D8C2CE26EF4496ECC42D0CDD55CF87FC27CB1AB4BBB5A78BFA
-FD6C153F80A7136FE52144F0C6AB9E090D1687FDB44E9C5CEAE503829E917573
-EDCFB285CE9DE6C0021B98DE596012EE82520819767A60CCFBD373F96EBA9F6A
-D2EAFE944232FCAEAD2373C62AAE00D5C4AD3B8D22BE1941159530ED3296E4E7
-AE46FE268ECD347E7D66E9369108E73535363C7CAB03B15B95C3F22149AE7B57
-EE820744B53213F89EE0FF3FAC8355FE1072A7D8E90CBF8FFCBA5F424E42D689
-B04E3307CA6599C698A02E2DAA37A828498E8B9D2381A5B93D165E1D72EC127A
-C9DD180AB549C6E79D276B64D035962824F07AFC592261C6A9808180F2CFAEA7
-02C05F181E51BB3FC95D0337C0DD162D0134001247A62DB9D1BB35F91474442D
-8281951862FFC133F315DCE51C384FAB089F0AB28DBCF3EB0FD9A6DEB89CE61E
-09912B68461D62030CFFBD449032A3BCBB54C62C7FB70AA5CC33A012586978FF
-2B91477AB295DE59B1A97498FD9FC938D6816CC23CBFABE552970CEC3ED38AEE
-64BF35FD5BBA70F081061B7183D413E51725C19A8DE85D7219FFAAEF2F796D70
-53976808EF20828531F6C46ADE650EEA890326501FCBD70AF1196B04F907A0D7
-3B466A638033EF953D77EF24F423F250BF6EF4B86253E25128D8FE1AE551F696
-0879D4067CFB13C47E3EBD997CFC6519A06DAF67BAA223E251919E9F135E0A94
-4C348BF05666A067EE58E86E72839A33C2CD3C9C1EC1C696CC42440AF467A1C3
-ACFCC7DC39204ACFF23B5C4004965C9C5847B7F0DA0B1E6ED1483BE9F880A57E
-6565FAE827B498C4ADB4523C6DD91499FDA732FC2C84E33136064061DF4EA7A4
-A55C1503223641B5FD03E45829D64BBEB4AD6BCD1B8EB2A2081A11E9A926A71A
-7C157A46CD0CC4A39CE32E086A92F4B28F251E6E3A91FB6258F6E81BA3C48503
-59BD96E26392D1F1F245CD5FB4B5CF7D1D581A68EF7C3B58C1703EE9451AD863
-662CED26AFE62EFECC93B1DF2DAF611EDC1A133E3C1E1723B4C378E9544A82A2
-2CF9856708862603431CC87F313EEBB83D1AEF2AEA31A6A4BDBDC640978EAFBC
-48CAE3010E3B33832307D6F94C58546AB68AFBEF9A4B2C51449AEC04BB457321
-469BA70A2914F14BA70153287818E12331A0F1CE7D18296088469BAC169564B0
-B2774EBFF627E0AF0260AAD06AAA09764A1C2C1F80F76E65948D8BF8D0BC01C4
-D738F99BCD84611783D6A543D4CA1924482A596EBBB112272CE218872A56C6F1
-69893F40B36BE39CE9F7BA3B5ADF4365D909E60A4B630F3007547830E483165A
-7B3DE584BA674BE0FF06F8A555FFE7D7AFFA5F67939F34728CA11B0428469A17
-2857889C8A472EB5055918704CD48DED7E90BA1DD19499F5464A0C661432EC9C
-9A9372D3F1A89F631BA843D5F0ED8C85C4AD0D961B716AA4237E509B2A2A25B0
-8A9A77E737E5032E9664F11C3F0B2ED6D5A67F5513ACD3EAA6643F365694CBBB
-EB660793B95D97E4054E614460837F77DD696CB003F01C04F84A675E31A68CD8
-9F5F48BDA2CA2FA3289DC5A50E33F05C946CA4BCFBAB13F72D50067F74E88540
-9F8A037553776B8DB57A38C87EE715B29F41CA3870C17DC55470B76DF779A567
-BA8A6C59F3FF628E29EADF817CFEF29FA953CF457C700F01402A4F21BB2AD515
-8A11787F888F7C7ED07DF72CD2462F86999D1E89A47A5BEB94EDA3D49F923E3E
-F13963C7368915CB2CAA6C4E8E523BEAF44FF92B39799030BDA82D842913067D
-3E8DE13B9E476ED30FAB3F63401BA0603F76F4E61923B2B34279E04F1997061C
-159888323AAD58893B33F89FAFB9FBD721EBDC66064B6C549048DF3A570CFE04
-BAE3673EAC21EBB65B55064799CEE8CD492BD5CF52F6438D271D3E3DCE96565D
-710EC4F76FD51261E7A3EA2549C50ACE245DBF93200D33959FA31961FA969D12
-74418C4E4BAD1B4970F528C6B61D7135CBEFEF02893FF168282194B83953B3B8
-A6B195D8C92EAE838EF255C561D27364F3324863607CCC0D07E0030490A0B8EC
-E098237E6CCA354332E66B892978C2F7B4851F784032E08D8F6DD2965BAE6CE3
-D6825EAE1B98F0C9C6B7EE021FEF2676DDA02439C42AE6736E32C7BA50DBF04A
-038AF23552B506D9C68A0F364ADD891077C8B36B285DCA3216C3B3BEE11D6FB0
-7871B2A3D9A7E70877B68E717C988877C4D8F669D3C7FE65A648592824B1A4B5
-02FE3134F48F5F526CB4EBE42F7D3464C340B229C49B322E1644E6A6E9FBF031
-E3E5978671B495BE9CF768A6BA67F0D394B794016B0A2CF9D4A191A996D66D67
-B6A89A2EA7EFA0D14F7A9951C01A767781F162D06ABA6D743FE824C3219075FD
-598614E04B2F94EA17ACDAAF2CC3EFF911BAC11D9A2F58AAE01D1037CE098105
-0B12AF8CB203125D9020D7CB524C1E1E52761D4C6FF230D19EF47E1C02AADB50
-08E91D97241A85CD94E4BE6F25694952224A4210ADFCAA1B0D5332365448022F
-BBCBA69DC8D3257D040096B6140420492920D02DB1D6C489197A03276283C10F
-AE103C7B1A6CEFB58908EFBB897913EF6AA5655FBE9E2205A53A696D4A57AAE9
-832698BA4346FC9F1DCE24C405E59D44CBB1CCD9D6B9E263D3A9E842910D4D58
-452816E85F482B28C824192372B782C188D8F0413A27FE97C5C7681BB59214E5
-1DF8FDFDFEC46B8149C6576F839D49D02C09001DBBDCE252DC0F74563D4F98FB
-647E7CA188058205F75339DBF12F5A2879B8D3A4917778CCEA0009F92C1A091C
-B332907C1DB5A52AA32CDB62D2949D93F11954786D76B02C44F5EB5DDDD1E09B
-2E5F317DF8C8717CC6EBB614659E4879C1BA25E3D5E32C5250C20A2E8B662953
-516C1556BD15D85EE2BEBFD4502ECD297F0C457B288152F67543A376BA1D71D6
-FE4F6A82AADAB1BB45FD2CB58F3E118BEE47873DA1
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-cleartomark
-%%EndFont 
-%%BeginFont: CMSY10
-%!PS-AdobeFont-1.1: CMSY10 1.0
-%%CreationDate: 1991 Aug 15 07:20:57
-% Copyright (C) 1997 American Mathematical Society. All Rights Reserved.
-11 dict begin
-/FontInfo 7 dict dup begin
-/version (1.0) readonly def
-/Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def
-/FullName (CMSY10) readonly def
-/FamilyName (Computer Modern) readonly def
-/Weight (Medium) readonly def
-/ItalicAngle -14.035 def
-/isFixedPitch false def
-end readonly def
-/FontName /CMSY10 def
-/PaintType 0 def
-/FontType 1 def
-/FontMatrix [0.001 0 0 0.001 0 0] readonly def
-/Encoding 256 array
-0 1 255 {1 index exch /.notdef put} for
-dup 13 /circlecopyrt put
-readonly def
-/FontBBox{-29 -960 1116 775}readonly def
-currentdict end
-currentfile eexec
-D9D66F633B846A97B686A97E45A3D0AA052F09F9C8ADE9D907C058B87E9B6964
-7D53359E51216774A4EAA1E2B58EC3176BD1184A633B951372B4198D4E8C5EF4
-A213ACB58AA0A658908035BF2ED8531779838A960DFE2B27EA49C37156989C85
-E21B3ABF72E39A89232CD9F4237FC80C9E64E8425AA3BEF7DED60B122A52922A
-221A37D9A807DD01161779DDE7D31FF2B87F97C73D63EECDDA4C49501773468A
-27D1663E0B62F461F6E40A5D6676D1D12B51E641C1D4E8E2771864FC104F8CBF
-5B78EC1D88228725F1C453A678F58A7E1B7BD7CA700717D288EB8DA1F57C4F09
-0ABF1D42C5DDD0C384C7E22F8F8047BE1D4C1CC8E33368FB1AC82B4E96146730
-DE3302B2E6B819CB6AE455B1AF3187FFE8071AA57EF8A6616B9CB7941D44EC7A
-71A7BB3DF755178D7D2E4BB69859EFA4BBC30BD6BB1531133FD4D9438FF99F09
-4ECC068A324D75B5F696B8688EEB2F17E5ED34CCD6D047A4E3806D000C199D7C
-515DB70A8D4F6146FE068DC1E5DE8BC5703711DA090312BA3FC00A08C453C609
-C627A8BFEF75B4DEFAF34B44B356A516B765AFCDD3F5475B1F928731D09D2170
-B97E40F12CCEDF4F6BB3756C4734F6E98D74B7E942A954B1BAAB83D4AD727FF6
-DF6DC50B2223BCB5568A73A112E4860AD490554E64E780073FF3399CB4688D33
-9E8829667CD6EAEF25E0C7D2D44F2BBFA40E999325F9561514844221B50BC8FC
-4C7AD68CA7220D69125C2AF06849A3E068D18733276F0C0A6A2936D3C2C87CDE
-59CD1AF148C44F85784A5DAD569F5FF53C061056C067CE29AEF1E3BD1FD8B0B8
-71A0A638CDAC6AEEDBD5337D4683C084BB60B1859E600F59CB4E19C5FC5C6327
-EC544A68134496A9BD0B87D83AF6FDA3CB62FBF0B54FACE1F0E6A2D84B467AFF
-0F62DB
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-cleartomark
-%%EndFont 
-%%BeginFont: CMR10
-%!PS-AdobeFont-1.1: CMR10 1.00B
-%%CreationDate: 1992 Feb 19 19:54:52
-% Copyright (C) 1997 American Mathematical Society. All Rights Reserved.
-11 dict begin
-/FontInfo 7 dict dup begin
-/version (1.00B) readonly def
-/Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def
-/FullName (CMR10) readonly def
-/FamilyName (Computer Modern) readonly def
-/Weight (Medium) readonly def
-/ItalicAngle 0 def
-/isFixedPitch false def
-end readonly def
-/FontName /CMR10 def
-/PaintType 0 def
-/FontType 1 def
-/FontMatrix [0.001 0 0 0.001 0 0] readonly def
-/Encoding 256 array
-0 1 255 {1 index exch /.notdef put} for
-dup 11 /ff put
-dup 12 /fi put
-dup 13 /fl put
-dup 14 /ffi put
-dup 33 /exclam put
-dup 34 /quotedblright put
-dup 35 /numbersign put
-dup 36 /dollar put
-dup 39 /quoteright put
-dup 40 /parenleft put
-dup 41 /parenright put
-dup 42 /asterisk put
-dup 44 /comma put
-dup 45 /hyphen put
-dup 46 /period put
-dup 47 /slash put
-dup 48 /zero put
-dup 49 /one put
-dup 50 /two put
-dup 51 /three put
-dup 52 /four put
-dup 53 /five put
-dup 54 /six put
-dup 55 /seven put
-dup 56 /eight put
-dup 57 /nine put
-dup 58 /colon put
-dup 59 /semicolon put
-dup 61 /equal put
-dup 65 /A put
-dup 66 /B put
-dup 67 /C put
-dup 68 /D put
-dup 69 /E put
-dup 70 /F put
-dup 71 /G put
-dup 72 /H put
-dup 73 /I put
-dup 76 /L put
-dup 77 /M put
-dup 78 /N put
-dup 79 /O put
-dup 80 /P put
-dup 82 /R put
-dup 83 /S put
-dup 84 /T put
-dup 85 /U put
-dup 86 /V put
-dup 87 /W put
-dup 88 /X put
-dup 89 /Y put
-dup 90 /Z put
-dup 92 /quotedblleft put
-dup 97 /a put
-dup 98 /b put
-dup 99 /c put
-dup 100 /d put
-dup 101 /e put
-dup 102 /f put
-dup 103 /g put
-dup 104 /h put
-dup 105 /i put
-dup 106 /j put
-dup 107 /k put
-dup 108 /l put
-dup 109 /m put
-dup 110 /n put
-dup 111 /o put
-dup 112 /p put
-dup 113 /q put
-dup 114 /r put
-dup 115 /s put
-dup 116 /t put
-dup 117 /u put
-dup 118 /v put
-dup 119 /w put
-dup 120 /x put
-dup 121 /y put
-dup 122 /z put
-readonly def
-/FontBBox{-251 -250 1009 969}readonly def
-currentdict end
-currentfile eexec
-D9D66F633B846A97B686A97E45A3D0AA052A014267B7904EB3C0D3BD0B83D891
-016CA6CA4B712ADEB258FAAB9A130EE605E61F77FC1B738ABC7C51CD46EF8171
-9098D5FEE67660E69A7AB91B58F29A4D79E57022F783EB0FBBB6D4F4EC35014F
-D2DECBA99459A4C59DF0C6EBA150284454E707DC2100C15B76B4C19B84363758
-469A6C558785B226332152109871A9883487DD7710949204DDCF837E6A8708B8
-2BDBF16FBC7512FAA308A093FE5CF7158F1163BC1F3352E22A1452E73FECA8A4
-87100FB1FFC4C8AF409B2067537220E605DA0852CA49839E1386AF9D7A1A455F
-D1F017CE45884D76EF2CB9BC5821FD25365DDEA6E45F332B5F68A44AD8A530F0
-92A36FAC8D27F9087AFEEA2096F839A2BC4B937F24E080EF7C0F9374A18D565C
-295A05210DB96A23175AC59A9BD0147A310EF49C551A417E0A22703F94FF7B75
-409A5D417DA6730A69E310FA6A4229FC7E4F620B0FC4C63C50E99E179EB51E4C
-4BC45217722F1E8E40F1E1428E792EAFE05C5A50D38C52114DFCD24D54027CBF
-2512DD116F0463DE4052A7AD53B641A27E81E481947884CE35661B49153FA19E
-0A2A860C7B61558671303DE6AE06A80E4E450E17067676E6BBB42A9A24ACBC3E
-B0CA7B7A3BFEA84FED39CCFB6D545BB2BCC49E5E16976407AB9D94556CD4F008
-24EF579B6800B6DC3AAF840B3FC6822872368E3B4274DD06CA36AF8F6346C11B
-43C772CC242F3B212C4BD7018D71A1A74C9A94ED0093A5FB6557F4E0751047AF
-D72098ECA301B8AE68110F983796E581F106144951DF5B750432A230FDA3B575
-5A38B5E7972AABC12306A01A99FCF8189D71B8DBF49550BAEA9CF1B97CBFC7CC
-96498ECC938B1A1710B670657DE923A659DB8757147B140A48067328E7E3F9C3
-7D1888B284904301450CE0BC15EEEA00E48CCD6388F3FC3BEFD8D9C400015B65
-0F2F536D035626B1FF0A69D732C7A1836D635C30C06BED4327737029E5BA5830
-B9E88A4024C3326AD2F34F47B54739B48825AD6699F7D117EA4C4AEC4440BF6D
-AA0099DEFD326235965C63647921828BF269ECC87A2B1C8CAD6C78B6E561B007
-97BE2BC7CA32B4534075F6491BE959D1F635463E71679E527F4F456F774B2AF8
-FEF3D8C63B2F8B99FE0F73BA44B3CF15A613471EA3C7A1CD783D3EB41F4ACEE5
-20759B6A4C4466E2D80EF7C7866BAD06E5DF0434D2C607FC82C9EBD4D8902EE4
-0A7617C3AEACCB7CCE00319D0677AA6DB7E0250B51908F966977BD8C8D07FDBD
-F4D058444E7D7D91788DEA997CBE0545902E67194B7BA3CD0BF454FCA60B9A20
-3E6BB526D2D5B5321EE18DD2A0B15E53BCB8E3E01067B30ED2DD2CB9B06D3122
-A737435305D42DE9C6B614926BFD44DF10D14402EBEDFF0B144B1C9BD22D7379
-5262FEEAFE31C8A721C2D46AA00C10681BA9970D09F1EA4FA77428025D4059BA
-2988AC2E3D7246BAAAFB89745F0E38580546045527C8779A254DB08DCC6FB9B9
-0E172209FBE3857AF495A7F2B34BC893D942C145C2204CFCD6A5C69FEFC25B60
-E412CB2BEAE7F7FAD03AF46344F6A7D483BBB1E896BF16B0F4C363799DF23CE2
-E8127996DE841B6F9D8A9E56BD799B6A938582988AF87151BB8D3AEA85C49857
-DD862B5E10D9F33D57795D656FB616BC9B8397B3612131A2B0F472656700958F
-739A548F7C3A348698AF9F6F9821D7A9FD4131781ACBF7EAB885A3AC254DBF94
-02FA697941A0F97F048861788BEACC20DE829764413CA58F9D045A6B38BCD6E6
-E4827247EDF1171F64E3B041A69B244308DC07F66643FCD7D5FD37F36EC4CB5F
-957D4ADAF91850A3B1A765E0E580EDC77556593D1B2E1C22685268469298688A
-45C474C9D0472D019CE1E83F25182D084AD85A49C502E8D679C227DA8E32045F
-8055D1622C478F8FDA342685F858DE3F53F1CEA0D70BF3FE09037D981E9E7FFB
-BC3F896535D0DCF53F4C85A1DA5D0B632484D1F25460E3EB38E251D2AA17817E
-F3B25A2A49C0AEDE0B89E277F52CBF744EF0243C409FD71FB0C574640CF11599
-117A4F42F27D8D282D34485AD116F7E753A8DEBFDF7C552A1179C02B7A37782B
-743D0DF85C15A333BE9EE82C13DBC9CB007DEB5900954AD9309902E08B3D5BB4
-E8414211B971CE8B9F05A61C15F400D9297745F606C6419E8A8A9ADCBDC39243
-617EFABFDCF9F836D14411BD72EE19D0BDE89234BF7D52E7A68ECC952FB74FE3
-33E1A87DA39AEEE9E90406E2B1CF3799C63E9BA858D54F38918B814C0DF0B696
-839C820C26FB473ACC5C08E2056457A74123A398806EECDB427BB183F5458105
-2B66D7E1FC3529025D3243A045625E9DD9417FA089B3C7C394D2B65C0367FF73
-79F17ADEC6B5D27A5D3D3E244A0839E38267ACF07B2D994C2B4E7F30A416EEE2
-D1688F167D1641A72A795B1F4DA3350F75AD6D546AA118B5F8A5085F5794E6E5
-28256CD31D250D8328C9620B8ACAB03E4A33DB4595E959F4D0FB1C8CE85A710E
-22F1940067C036A7DCED7EA48F1EB81AC4735FB26A249A32AC2E3E7636B32D31
-7D76FBEBA106D6C67C94A3BD4256B786B71C6EF8D191CA90CAD8D2EEAD42C6DD
-8BB4BEA7DAD4ECB6E002F3B71C2955A5A401E34D55F755BED68178C270109BAB
-FA0AD848347EB977325530B27180661A59447D7DB55A62D65309DE24B6638986
-1D3A539BD37E74C2C00DFED3336B5C6B28D915AB7188FFBCE3ADB3CB903944DF
-1BA5923A1C053D4682BB8616F44E81E18DB2B58298F4B1A6289CA993DF3E7C73
-B00DEA3A9B747FEEBC4A11E5B9B8B05CA2709B8AA935A42159D3DE399544F5AF
-AC1CC00F6CB94AB69856078C9A2EB2046BB9055CDD6A0622112F7D3710143F1C
-20CD8DAB4109CD47BC00EBCB88314081C1D6C43132412F261CE0262FA28DB7A3
-C7D8534BCBE1A60488EA230DC558B73C72AE87539A9D7E28C2BE05FC05F58DDD
-871178D227ADB9F0D01F5780F7CD67B369538A7F77631F1A5EBCF380A19F3B5F
-A0C08A2F6E094F6BF1B3B3673641FD5089157EA980D98F7CA8A682B21EB5E13C
-1EC7873AAC8D88A41F01F1F56085641C5EAC5E66C73D2C85D6B31F09CA745EC0
-2D5AC148BADAB62B8053F6E2AD05E7101E7B35612A446BDE809A3BFB56E169ED
-33EBAD52FF4B3A863FCC27B6D193A5B4580D151D0491A1381DE2DA4F197C83FC
-183CC96D14BCD9FAE955C046E46373357D60B19432EF18EECDFD0640C87B5C24
-D718DAACE05BEAFC1C808E89A0BE2FC02BE2E1E69CD8C076F849CF440C12FED4
-C1A34D86FACE8EBEA18C1A2BF48A71BAF2DA115D81BD2ABC1D58C7F968FA7A6C
-350D0C7FF5565373E3637E0DB09F0C474313C3DA0B6D4584C46E2F4B333BCC7C
-63D9544AC0E30D501AE00DA839DAA2DD95282A722429C34DEAB63955C7C43704
-603B37357181C382ADEFB472ECC13D467C4552FBF9551851A48E85B1CB4764B1
-7A412657C55CF481A5F17E3A67639E34BE681A8D2F446D8076AA01B3ED00D0C1
-8D3B3AF37D2F9F56ABE454700BA4C6C4960CC31F86CA523EE65CE030FAD935D0
-18251B13475E80DBB92F08D83B79ADF9A566F6DCEE4E6EAD7549B3B1ED91979E
-77A9DD6E53DE81327EA06789966D35DC7D03F181E13EC95910A8E592CACE806A
-363B820DF18007F4211215F86C2CE30392602469A4CCD6EFB00FD3C85C2F4253
-379684A7F07251986A5BB208E6A871C9ACC961326EA1E8E8A212493E0139BB8D
-A93B1033841DA18F1A56480B6FB748BC19FBAC315A9DC482928B37B5447F7980
-455E436160BAC682EB30A40238068C1ADE45ACA6FA2B123E4C3E14E4F5224855
-FF76580FA4A80A3184FFAD8327CA49F9202BD16C5AE5EA4A0E0A82B34D78B0B1
-8ED4474694B50F359462E4CFFEDEAB25B3166D60962147400FD8CA01E3B261ED
-3B2DF397760138F4943ACCEE160CDFF63B6205865883FB95C3ADB1770560AED6
-B44B2D0942CC01F263C997D47D9E74673C8A350F85408469A64CBE269C7D9F13
-B3E6289B5085DD156FAF740B94A000FA8F912A79C0FD2D56F708B71D59FACB3E
-119CA8AFB8E85F724E44C0EA1679DBE5E5A1C4925D5859106C57B6395C5FDB67
-F1F1054EFDE0895BCA5894A2D4B1FE7361564B5974C4A3B8B6D638295A732DF6
-904592D1243DB7ECF0226EC87B3795E864C5B08C27961EC717F39FDC6C4925E2
-FA7DF372393E3938D2F4FA72D4F722161EF22F765A58114ADCA08074FA169617
-78DD15195A58602BD24C5F30436E85FD043CF159E6A1E92C91D536B2FD10A478
-AF3D246B5653A3D8CB253843C187D37CB6FE632D55013849B6FC359088E3E81B
-947B7B745D672A0280AA870733185D0AD014E74432523AC384ABE071C5FD4F1B
-124B3C602F8E83C8CAFDAA573E9A415E03C7D58449F6FFF06B014574511B78C6
-DE06B5A28B76EDD85C198B451DBA22FD6309A9742AA692EC43D255573434C690
-20FB3FC3CC0379FC96EF6AFBF755D2F45EFE564F6F72F85E539EC7E7277EFF41
-0381531FFE1FD45103D598BF73B2A21E5645E9D5FC2AC33857D14FCC41CF683D
-E81C4B216BA786F3544DA46B10EE6C3E37E33CB79F33D1B4E046FF2C9B4667B8
-9C7BFFF93FF6F546FA59276C94F28058A7E3132DD94311B4A9ADEB256CD4EC32
-E2A4123DD236C43CD015C1CABE2791B6F62C5944E457FDFA034B8B420F558F77
-570C5202BC8B049B61116BE8BA1CDCE418BD02F09DE193E792B15549DEF456D8
-B9E52B4CDCC771A6B92749241C81A90152521773DBB7A813B6DE3AE001E2A1FE
-5A8020E58202271CCE4D404861C178E2F450D5F0DDA449230C2400BFAF5AEA06
-C7C92B256E4D98D96C147E4AB6CA32FD86302DC0EF22F8DC6CDFA8CA9E675B05
-A55FF3B9DA1322B9618CC9F010AC2E06C40592F3C16C704153C3DBE01D2699D3
-64D617BCA60AEF0E9C6D03EABEBE29AB76840E556A8F1D022153981953C2E7F1
-5BB364F9926ED6EF8AB2EA9CCC1079174FD101207017A985DE8ED9BA31952B70
-92B9562855D5649872EFCED6C3A01E2F01C045F04686FA69AF8C98996A17A5A0
-4A204AF0FCB6E470716598A9D3F6307ABE34B9CDEC0F2565CB03E130D9F3565E
-C268C6A62B9F600422DF3ECCC2E24CE89AE86CFDA0CFD5CD22B248406626B546
-CE8ADF997B463DAB26CCB72A31302157B9AAD5A697D0988D16A43EFE65435393
-FCE51CB134F63BA0F4D094066185BDD9043BFC2AD0C946F8ACE2C9F5B9D1D692
-FADBAA7785D256ABEDFC04B4B0485F63B431D5691E68B257843175C07478ABA3
-818A51A26603E8A1D94711932963B6379785CD78194F1CCE3425CF49653C22ED
-3EE08461B6399B9D12BE9E62402B246DADA240E1862F9A662F5E01979437F7A1
-291A728D3AFE5D2859845E81822C6C7EBDED1F27C677C2B6F2288C667443C019
-D78B6E9FE4D2779278779F1D52649E47E76E3BDF5D48AF6B145CCC2A95A6977F
-38FD58C8296187FC2916F0AB24EFC091A0B107C34A3F44BF13C8AA1779AA80DD
-11124BA47FA6299682A61895AAB75D4D6E34AA6DC4D4DF914D08C55FBE57A80B
-FD27777CA222B46BAB48E427FC70A28FA12E9FE9BFA0AF875A8E07B1CCF47134
-97D175D1843D6A6F9AAA0E49F13AD79847FBB1F570D7CCECA543A79678069002
-F953116B3A2FD3BE340C8940CF46285791E4D1FBE1E9EDFFD489EF95ACA75AAC
-83AC2818BFA2DD0DD9C13E162B202992856863B1160B952630A0CECA31C55F7C
-48ABA185420371148F103A12F909F8C67C29A6B2229DB1005A37D894D7CC95CE
-2AEB5B43D8F23ADD452DF622C30DCE537387181269396B0F124D8BA9A94C0543
-6263DDCB9F5CF1DE0DF305180DA43B5D5037AC83D20954E8BB1584BEBEA05D8A
-1B48A4FC8931D09B1F0E389E9A43CB211E64156DCD1F3BE8B1F5628792488858
-D51F5C336374FC3E157994DB66F0BE38124295CB70679FC637B073EA3295F577
-50A75E4BC19F8EE0037293A20F4E22FA15253C46024D792A0B774E25295EC570
-4B7280446D189245D7F96E6466CA032FE81F114A8849C168D7F97520EF1C9350
-DBB732B48494589105CAF7EB23F6294FF87DAC6E1930F72C5BE7F50952F526D5
-085105934426B347CDD55E5D774B0864FE03E04DCFC520A4E5EBDFCB5A5E9313
-7A38CF22A3F14CF55691C4FCA796E2DBCDA4095C6B879A619F82107F2B561711
-94C33B62FEFC049F86B5DEC80E812F467D654932323DFF4D390B7C89B0005F4E
-5873BA345BC6009E0CF6E962CA3A8F9DF158E66E334EE49D7DC27E94AFB014FD
-75EDE6D3B21F23A1C80AE04CCAF589E4920B442A3BF9FFA7BA35E1F20D138BE4
-03E31278B158EDEFEA76A8B9561938776AA2290468710CF6EF47AFD4844F70A0
-A07CEB3AC13344CC08B6619361C0B7E720ADD995640255302D98C4499D6BDEB7
-9A2719FD445AC77C5D7D09507362160C28D1FA5D30A42D6DBC1B8A8291C52079
-66E2EF53C7B758944DE0CDE69424267E67E2E4052768508B861BF4B3A4D27A09
-6706BCA5194AB5C4A3C379130273B5D3AFDEA51E99138025CB03ABDE2CC8106A
-BD96BD7F9B3A150CF8F9173DF337FDF2C6AB59CED890B45F23045E0F6AF7A9B2
-725620EB9F30693CB4B69414CF0D0B1F0D71AF1F67D23DA7A4B52B101309B2B1
-5A373717FE811F5020DB01179E2CAA5D955FBE7C56715AB6621E55CB3AF06F06
-CC56FCE9421384E3B0A77FD457E60DCF37DFA243CE3072E02CF35F664A01779A
-A48D097B5B2B88192E15090F1ADB2D0A8D1C0CCC10B26AC287BBC61D3DB3A915
-D538FF9B89A792E4C6D75D3C44A083EC5724780D7FF8A960345B92BCC044E4B3
-889155D70672833157F0FDD31C49A738C9B7A2F0D4997BA0A303AA5D91DDADBD
-1EDAFE42D233E25D31E7B97815D8C530D63AF26D68FDF0393C417FF44051B240
-35CF7A0645391B38D0003E9BAA3CE561AC4730B3489AFA5F18F970E9E43E48EF
-5EF8893DCFDE3F1704AA97CE8585C772C6E96FD35355B2D3D907C36373C4E85C
-8E273200B26B239360C9EBC63F99B71898A4F3EB2ED2EDC19F852423399EB21A
-F2F2303C7182501E6AA760711411C277CF890714B126A5F680A07639A97ED524
-C509842D518E3E0FAC5EF88839094A1119BD7AED21F021D38C4147886C6AACB3
-A72BE3A0D79F0971C3412C1DB447162C286DE215423D4541AF08F1BFDDFB7945
-1A838CFECD54B99A06C5DDD9854B20A449FD0B4E19DE2BB40715414E63421DFB
-74D056E01E52D989D47F56E9F34218EBF056632AE57BE5D19132B2AC1FBEB1CF
-A869A899BFAC374000D264E300541A91BB940F9346F9EE4194C485822BC2DEBE
-801EDA925CD0B2CF7A1BD83316B2AC4DBF07C2610642EFBDA725E6A887908944
-354DEEF3A022BB083FD939CB68EC789DEA7BF5BFAB5B6B91F587EA1FE94B6045
-9894094CC03407ADD66FFD0A8EDF5B48D534F31A6D5B0187BE860FC270EF5D66
-FBCBC1B64EB374D7FFB9D1EBE9171A349D12A8A9DDE868D4AF79E183BDF67DF5
-A8A7E87A81BBD7758CD3467F9C9EC3FF1519D7896415B7C26BDA22AB8F5078C2
-A35CD83EBDC8B1A11781A15108D390FA5B2262D2F210EBE5F7C8BD1AA8084913
-F54675B183151B878B60F441C74A40288C0ABF98C14374D8B5DA36D8C78EF697
-EB56F23C38F91CD639429A6DB60E8581326A00B7E074F2A20D64F14356BDE398
-052073B435986EA8612EB52D5CB8BD85F7199705FAE81BEAB5740D62C1F1C133
-F03E3A499CB6BBBE237DBB17FCABF44F4B9FD4F4F9E56C6E993E76D42F2FE7E4
-9ADA4B391772A859D49CBC09E543D2A51D5B9FFB7864780FCE4A15055E983026
-D699471767E93ACD164329986B0BB3BE331A90EBD4D835642F3B7D6AD830468E
-680D57C14ECB2EF77F650E6279CEDEB4E8AB8A4EA2F077E8FC717FDB988A9B8F
-ECA5110535B56BC5E5E861B7651C5513DA2A6068DBE2FCD17E85C4A9EC61C20A
-388722763F30261399BE69B465BF8E2135658A5638C70069CFCC4EBB086B903D
-668B0786ACD82DF2DFE5E78BC99286D4C22A71F2666CFDE9AD43D736EC3927A4
-3CBA975CD6E491C01262928D84A7B2E496A6C97B71B7FD31B2FEFC5A5306F961
-CB3F81AE3196ECFD280B70DEC319ADB53C1DF12D15BBFC015C7AFEB2AE5112FC
-E0B85110C6635ECE5B2AED74DD14AF064644A6199CFA1C605C1EDCE6CCEE3C58
-9B6D0E49BBADBFED049267ABCC7DE4BDE0A0CC8B3B6008DA16F94F8A9A1BBCFF
-A23B234829F60373D466CF2D09B26CFAF35AE72251EA084A07385C26926B172E
-CA468D3E0EF390C898488EB47566862A322A73B5952554B545A7B998C3DC2CAB
-F2F891F8DD6E14428350C46CA79B6A57A10BFA2721F348723A2AB59EC0C8DF7B
-F379AB402517FF87D9FCB51CFE75C78787E81C28A8692448744B8DEC74B12F0B
-2324B3A21676598568F01381375E39FB9A2A45547D83BB65A57228EAA6380055
-04179EA6A35FA22206B17FDDCDB51041563EFD9F23675069ED21403C1738BCBA
-55DEE0EA1BC8F73BC44CE309141058AD36D4917324D97BD08C43D7FFC645146B
-B2841F478BDCA45E22E35AC0AC13EAF0A2661580D73334775735BC14A4011AD6
-93021390234A1BB9F18076677DE513F0F52C775A0485F4C8EFD047A6A21A827D
-83BC8AFA6925878AE724A4E84640791875FAAC480CC4CCF6E5D107DE1C11810E
-B3216FCA3DEB4D040CB873E44E55EC27F8B427A8D77A8C689D7FC3F579103EB5
-FE7D21DB0013EF79BB73D50A9AD49CAA466C8F2641D277F84FDBB3AE6259060F
-ACD2978B75D32FE4AC6F3934EFEDB2E33382E55A6EFEF8B4AE759CA3CF65AA88
-B19F716A14AE905462FB85986C9B2BB7572253C166FFAAB0CBB64A052D8AE0F6
-6F1E9F8E0C4E87F3DA74852A31DBC7BB4C7F1EDF199B8B7B7B5967AED68500CB
-792A1DEAE616D080A93E0A3B1DA58C06FA27F46137495EAC1886F7B4A5118E8C
-C4D477DF342430153CA5CBBBFD0D29BA54356036CABA91F157B82F96B6D925E5
-84FA56DBA603D2C504CBDE4DD04E4FC6DD668237E7D4C60F71CA3F8049C07807
-D761D19B4836FAEA51BC11AECCCF5B32BCE46A089A5DB45424F76B10F1B6441D
-97EB8813787650DBB7ACD2291BC1A1F25A80464B3E71175D92FA1424C83FF058
-4A128AE5C90E288FC847D716A9C5FDC82FA0ABD338A9ED418172AAB8640820AE
-C3953B4634AD4787CD537B8F908A6CA73EE6E639EA334717FD29C1D1ABDC4FA5
-E4DCE1671EFADF9DD532563F87B93A5EA254E729A90B9B69B91B633ACA5A46A7
-140D1BD7F14BF09F92F065391C83562EBB0BAF2B761136FA3DF03BCE2B6CE469
-EDC044BAB9E7FB19E102E1DD4ED60135F7B7B49290D7428F7F553E034EF2BE2C
-22FB689B829A4566AB52F9A4FC54617F8AC56EDF72D507002DCDE6EC7E661109
-03E6D6C3F034DD93F5E285EA40A88C4F967D48FF4F66B996152D8A3EA847DC3D
-3EE12B349F4A32A1C77FEC78B50425326482C2DB095AA90CC7050AC6790E3491
-F7B6992B849FC408F2338B3FE5F10EA350137FFE1F8E18B6B17C960831D1CCB5
-75F631FA5A2E2FAE4D483F0C77938D566ABD0A4B424A4D50AB35E770DBBCFB53
-031FB89E14C8B5AFB16953550BA26FE94DB3DA75C0FCC2DA3BBEBA5A4004A684
-00FA8C97E33532A53AC8B3756D1822C0BCE2F61F860B04075CCFA67A6B09C258
-E6C0DA4A3FA951A9933270518AF0BB4BFFD88188FC29C39DB34B942AEC387B07
-6FE20C0332F2F1E8FB183FF40FA8653FFA722A832B080F57C4B1BCD9B4FC6257
-FC17C037896A417F029D227D57868260F68338ED4F5D5D8A553F1BC18BFE211C
-D0F3DAFE3FD052ED9F42DB9FEFE7089F054DD3D50E3D2ED0408F9C80D46356AF
-452FE1370A78031FA37A730944B41AF4C8BFB4A7FA4F38AAE6B5B6C419EC35EE
-18A0BCA5E4D009BA37B54493906D70916E5FBD4142B870138B0D8288087B5339
-61B391A24EEF4C4BC75975C5F131A48788725B04EE87B0DB80A449A78AF17A28
-B68A145C1B464C35241FF5E7C7CFBCF812FAB1F4D8C3B353FDEE0A530023A7F7
-3F80923D31BA3179858911374736417C5CAFA1F0AAA41275F4E9A138289D5EF9
-4925BE4106A31068C4F25A9847E76753A38CC3C1424C6BD55B1B13FCE6638E07
-7876592849B167E9708E9D6BAF878D8E0F4C836B7C7D1B4BDD1E05364FEA2C81
-25358C2B0A5BB9410096713147D476BBD92D4B4BB338E8D8B52686154CB23A13
-CAC8E673A1E48C67A5A56EE7719633A60D41BD0506967A78040356A413C7BCE4
-52468D1AE9B16959A481E23E96D2867338BA416B8494843B4F8A7508CAE67EFA
-8E09A393DD806879E6F88B6B37A75435E3C20BCE250F6DACA15CDF4E01A911BC
-BE923B7754F590E8244FCDEB1154281091DA21BEEA15E6237668D55AEEBD38CC
-C9F4CB9F71FA0E4391780B8729F843F46E506A40397EF2180FD1C53434A8703D
-FD349FE0207D016CC06A21241D280A0044C3DB9DB9ED28694A362CE60DE926C4
-8D24E653F0677A87F173650830DB2ADD2502FC77A37E311390E08EB3E3621D4E
-11493B9A068EEA534357BEDEE27EEB5670ED2BE6EA1FBFF255CCA6D54717932C
-33698C63C693455E865069753938FE260CFFFB0779C360E89A057D32501B9CE5
-E47E79302AFF3B6E61E09C201734A3D576DB66FF902E6762C894A597DAA81F88
-D02F081ED1443E85F46EC9B278EB0F02BD1F44120AB64B7C4471F216DCACBFD4
-858C67EC1BF6DD69A6FE39C828081A7FCB92E91F2161A73CC411BA593FEE9C87
-EFA92C6E3DEC5A71E953078475F1BF9D4EC5A578C1F9B78A8B3AC47A1A5D19ED
-01424D5636FB6D0DEA89DE935AC571BE3161E7A513528C93FCBE12BA9ABD4119
-E3584815CE47A7B906E6DAEF937D4A7DD1A02D1B278A8180C5FD3B2087CA64D7
-BCD5ED09E184D196372C3D077E78F2AA135D029AD6C826D10646E24EBD74718B
-5CD98BF6DDA180ABB4C98137DA64BA5EE5EF78F193B3B87C35ACF11C91F7EAB8
-8BCA389F532AE0281249E6C1E8C89220268716B475B1D5A1FB4E7C36ACE1885C
-106C8218AF8BB1DCA51AFE2FD21D5AE6C3505722B813E1A410B5E4DB911A1992
-A8E12C03479B0A700A49D6CE695CCADA1BE6C7A91B5949731953756C4538D3E7
-DD626756A7AAA8546EC41BB3CF3BD06BBC21AE420E0FF3DA27F5AE2C11B1DDDA
-198121EE4B2970A0E9CD506A7ABBC4A33851C30D1B5DAE551B9825289F28F872
-700E90DCEAE487CD9C3C0425040213D0E879D350334EC636B5EC2F4F783E484B
-926376C0CC1E5867A82935D2BD8CD6775B96B5D49A15FF3F623B84EE6FFFCC6C
-6E0DAF9BC0E89281077B19701E980DDA8F3B7101758AF5D27C961F791F7306E6
-4EEFB3715D444E7506A1E446F430A917848F252E65BDD2F04741537ADD1C7691
-3264150AC3166E5C1CD8A2EB7F54B6717B52A3E4C78942016EB3A98DBA6CC7F1
-0A81EE196C46D813E3E53D1E4F4A7EC580A53FC072042156AF669B8131CD9E6F
-E3FB758B7F60E5296B1F0C9A9E792DC052635658165E3976FED17DC7955BD2F4
-0399BF29EAF40C41B3434AA250C2C8F351718DF80601C835A83B0339D2E2E1EC
-AE01930EFAEFB7D8C31AD28C934B908D04BAE58BFE032934C80E168CA057A2FD
-069BCDF978078997E8369A6299018FBC8A397E685A1A7BE9FD7E2A3296C2196C
-14573328AF8FBCD1E7D78585E40004652A408AB4F60D061E2CCA1A242C2B3BF3
-9C7B997188D93075F2DCD56018FB19A795DAF806F35C37A3AAD93EC137786B14
-6A3F1E1EEFE61B3C97743FF7BEFEA9B404015838A9D444B049A4D3D0644BB1B8
-9364C088CDF5B6DF44D09FA64ADD16CBA31ECA7073B6051D1F75EA85070EE14B
-DCECAE41D89C362D31350463E68E6639A7E4C08208CF839186BEDAF797A12527
-B3D781A91E620460F5DDB4A399E3CD644DD39239CFCF57963E016EF503AB6558
-E54CA8C78A0BCB4C703A9A55DFB0C271B40446F82447361478E455590E803DC1
-6276A2F278E929C5ED162E7B6690C6806B6664A8FE705EC73CA4B384EFA394F9
-851D8610AB1159D16895FF4D419B2BDA1646F38B257AD5A3FC9CB5892A1B1C84
-EAC5A30EE5C67F4F91C425474E56916B70BEAA6FEA4833B423CDF13315243E22
-160A62D4427DF21099B8EF7DEA370A1D5F9FEAC8BEAB0F3C85A9F0A99E637139
-629FAF020B4E8C74402BB428FAEC8C2085D3F09E6AE8E52783B8FFB8310561F1
-636B1C092240F3B1FEC2F57842997F01DA2BEBA6EFA0DF79E014855C6A97F03B
-CB6644FA86C328D8D922F64D1C93ECBAE876CEFAD1A7A2D0EAAEEB13B2F7D6E6
-6EA60F46B3231A2863D86C33244B83CB5BE460555A8DB7C424AD98060B284779
-109FF0826A6D7EDCC5F253E6899556B7C0E71F7A7EB7493C838A40005A4F84D4
-64B33489F5CEEEB9A89A7314440285124CD7B08231DDCA054567074B991DD6F5
-3741E3EE315DA77C84320D88699637C86D6B47FE8FB3CF7F4AA5DB1B58972F6E
-87476F2D465A059F7AD1B366BEC64192243E8F85865DAE1C1BBB5415CE417939
-629EE39F56581202326BB4399E66BE91AC38121757599C3A187CEBD71E45795C
-EE51B717419B8B2FC6DC69361C8A106CAE1709F433D2F4948F76FB1CEB403787
-4B04E4AB6AB31B32992AC0E55EE997A9AF354090DDA249F45DAF6EDD4D1EE35A
-6C12F3CBEC9CD39608115BA838FF06A2AE6F552D92684E2C69226F5426501213
-B43FBCAEEFA2DEACC5E46A056F1940A60912094EBAFDB8354A765BC4A888E3BF
-FDA2D25E14231AB9AE0124E785B11C011887C8AA6B5799ECA670D805795AC031
-F194F0EB97D015DD26DD0B979AA4F0CD959100774ED80D2ACFE21102C0F13879
-60A38271D413012D89296E0EF4D695F24756A810BFFE4CCA4C84E92164598819
-8C8C388C645C2CB97B410AF2D1510D275550664A10C698CF4F0A5A48349B1319
-D543C34F12945EC9CC0C0C3E9F335873F6BD34A2852051FD5DA12A6254AD32D0
-6C6952F7509615E6F74ADBCCAD0FA5399A3A95D53A96EFD7EE02E72C4C381FDC
-081EA3AD1B28018723B6D2FD631674254527F33D249CA13D083C90C993F942D2
-99CD0F449417EFF72C386D980E270639ECD6FC2A8AC8F5EBF162BFC3896C48A7
-1116E2E4E85C5BF7823AEA88ABE42BDD66DC60CB122AA3E14D474680EE209CCC
-5866CBE83AD88E35B11490965A3E0F6ECECA9DE6B8D19C369BD376DC8F913B9F
-0D87A0EB72291C5BD198AD1953EE451BB9CBB5582E35517E0DCA3E3436B1C9F6
-BEF192AC209C1D4FF3637D396F363109A7B76C71FC93A939BED902484ACB9A29
-27074F659B9D9EA2F673725215622516F17BB9297E85B85AAA2AA83EB5028A91
-28685193157BFB81EEB2F4B2CB91517AFA50496B73608421337F127D1321F019
-F8138E0E3C4A5D84AF7DF648D363D356E158B8D29385D4FF5A2FE2C271CEB664
-B796DFD930D65C9947903184810B3A2D9291CDB4157934BC20BEC1B9ADFEAC27
-9468C3B58E97C57256DA43673F2A34B0A9C8BBC298965948370C9E4F193EBACC
-5D11F8FB1141274D43AD95A336F12629B79B910629D4BB88C65A390F243A0B93
-F551F51037CB0D86CF0B9D921B263AC7EAFF5432C0D3167FF11203B42DD573CE
-C100408FCE92604826D553E7BC48CBBE22C19294F4901369B7CB03427599E140
-195D4D363F78A33E20281740EAD7DE13CD99114D2AE48C4AC3CC2252E1BA62CE
-ECC7995B612F1617E64165F41DBAC99A837B888F0F02AB727BD9ABF1611BFB64
-83BC35D8ECF94DB817CB9E23CAF96963CB0D5B3F70CC10E1ED87895C8936A3EC
-4F73F66A4D8C78FC6D74662DDE70204A9114FEBD9E5196127E47A14E083C5B57
-A68B8AAFDD03A222E50F9E9DEA4B35AF713B14C6C3CB23B366CEEC5C721CB3EC
-0D38B5176CE6C7AB74FA8A4AD04A94E3452774F2CC43A30C9FD6C0FD06E71C7D
-97BF1CB932C2C7D5B1A566B3845EDD2FB7F4EBCF0581011C5B9BBB21A6E9C8E9
-1531217E38F91AD630EE7D332A99A99449166BFA91039811500171582D4A31B2
-8045BCD1D925DF2ABBE952D28C7580CFE212472D0A97D69D02E02DA9DDAA9701
-45A3470B6B69527AEC857E2BCF0BB1A186C150A304BC26F7D7C82403FDC5DA59
-EB706F7F6ED716025700D6A22F0DE056F74774BC304D8E6C8BE89843C85C5962
-81B5C4AF670DCB9F5BCF0AC4387937B24D12EF3531309A0A29FCF0072A74C831
-A90DD5318AD23E9F88C2D7F849DB6DF090D17FC57C4855E817E08997D0B1385C
-009323EFCEB6D68E557FDD7DD7D94674E41D0BE4A5C444C5F02074992BB16878
-485001F13C832AE4DBDD7F432709268170FFC068189AEE149DE6530CF92CAF11
-3E9464725692E1B516242E72BDC4F4084A1578F15C3B79D85C2668539E76322E
-31ACB8890079FA7ED36390D879C8B29C9984EDCC204D8070865A3FD738D3E693
-25CF751745DDC75AC6AB6699CCD07D9FDF8EF31937CA71001282410D943B093F
-4470C1F8ED8488ABF6A0D88D2F693558D8CA5B9E8EEC759D0A596C53A8794345
-7FD1B377198FB59C5ECDB227648E18836F497129BBD8E1892AD3E3187ACFC55C
-B325D93C07DC326AFB76B84B84FC783C797C8661FA18EA6C3DC2C0CE87F03B49
-823623AA75B4C2023C57C1A6A4012CEA83FE87799A233D156652CC05C7E0824D
-6A18C903D5805F8432882743DF736E538B1DF041B1668C6257ECF43EC5D693B8
-CC3B3D95C52D5F3B88B77419835357DF2AC26E66FE6B5E90EE6F212D56EC01DB
-A3F5EE670DBE55535762EDADABF645E2D5020FB344923AE7A9195AFB842A9EF9
-DA70D624DDB865AC36FCE7B4C8BBC06C78B29A776B42B15B28D61C6FCB64E036
-82B121E0AA49D06A096769599C139FEC7F74894D261DEDD6251DB2AD15D43038
-7709CAF7290EC8D8DDD7AE238C0A95B25E700C5D3D69DB1D9694AC366D37564E
-DEEF1CDA013E0C54952B24B2DCCFAAFEEE0E8A8EE43E9B539FB6E8A74618DBCE
-50C67ECB7CA88F9E9C5001999F8DA12066B73DEA420AD8883F22D5317ABBBB74
-9B9B8E8AD26E1456D476089D0389CE93D15F9692B4603ECA14F01A8254074690
-1CEAEC579B9ED835E70032A63777182A7AD54D6D8D1CA05072341CC1BCFD8737
-22AD61E367D38AB998F121EF7DC09B50548ABB47865EFF555EFB87E996CC9F0F
-4B16BE0B6F609734CF8B7232208D1DC291D90879F0EEEBC94293D25DC790B555
-5C3EE30D6358143D001A2E1F776A4D5927F24081F6C379F96EC79CCA88FBBE5F
-3F6DC2AA68A093A8E658A4EE82C3A3E7870CE4FF4EB0863986361E80CC0CBE77
-5542D2DB93E47DE011CDF6F1A8D2C54B8CD74AF17B3122B4199B9F81637BF436
-99D66C4F9E37487E73454CB2D6BE12B72B415DF501346697720951E1306A90D5
-3F6D4D16A0BFF81228148DFBADA170231A34293C0C84C2B98A8A2954ECEB38A1
-2BBCD63D4993D59B11F0C53612C98D1043E84566C5E91F959CFD50ADF275AF45
-67FA33C7DB5FD0447E5CF66367C8F2535C721400D48082975FB983A1A18FB2E5
-2B1C151A25DBE535B210BA0E0C77321A7A827EB81507C21FE16D9C085824668D
-394D5EF5DDB8568AB5AB34E38192FE5840226625409F1A51F2C8F1D20720D3DD
-2A4A7A73B47D03F131E1C302D8A0FE27259EAC476D2DA5D068228009A8B98670
-587ED171F852906A47E05D4A5B706EFDEDB0407926B1A7C7FC36B7DBCD5F677C
-26BEFC9B484BF1E77F778D8274D13BD119610F6B6B21B93FA2F85E20722C95F5
-4265DF8777F23974A9EE8DFA1BF6C95364F2F800D390DE71886D1365FE657D7E
-8FB0CF9BCB2B0D49380036EC40D6D84C4381081428E19AAAEBDF130CD6279EC2
-7F3FEA89AED7FD46A3DE9B7D7975E421E6B8E0D546640C0DBC82FAEDDFE41972
-63B8C32A85C9C3DE8F8E5DC20BA45EC8BEBCE7FDA0DFE984473B8B7E63C8FB97
-C8B55E8FB3943F28920B315CCB5B5EA6B0CF8592B9E85605F5910102981A3E8F
-430046B31C83F7A7178371AF53CD8D67BF0FFF983E9DAD05028624C7A3BC85A9
-CB08CDB500C1ED0C75FC6D158EBE8468CEB05B3CDD849434AAAED7CA951B1EF7
-9F1132304B44F599E3EECFFD0A7C933D043426D4ECE4C2DB5F86AAF263F462A8
-6B3C1096FB277EB543D3572E55D06113852736ED8FF87A82242B202B23ED1D8B
-A22DF7F705F9591E47C3A3DBEA0316AD36DB9685A1970054605C988392358E3E
-C6C3D774D1ECDEBEBD69BD58070E4A2F09530B110E48F1C5096B19127823A2DF
-019A4CA132F4CF45549791917D9CE15466975070EC9AA35EDCD006162AAA4B43
-9B8443EB5C0C8387900130760CB4C9D39086FB6A0529C6556B9B5A5964129E97
-F7BCC762417350605EF01B958CF64DAF4F6B206D540D09C8426B640A4683417F
-10A1E6FF66B5380ED995D1EB96ED88511D4E881A4AC59F5780C430067706D874
-CE5970B0A9BDCF810340AFB4A47B5BC5DAD7A6640F9EFBECCA45960B821DCBA9
-37E59A565C55096D2969C22408727BA8479B4F5686DE0B11DD3B4DE08CA9404F
-32545C8A4466E5FFC1F8087513CC0E4739A99A69B6069D89C6A1C18E5D66B66C
-71DF638483722689F703F6141AF2F397A226F10EE6D20F1539A8BC0DB1C0981F
-9873769658167D25BC92CA668A74C9222FC10CE06020239FB2AAFC991652D83F
-31F99338D34E37601D6B87E67AF0CE17204ED329FBF9AE05E5B5D0B06C24A504
-CA25D59789642E29DC5A22BA8F2E5CE7F97E69217091306D1914CEDEC400B0AD
-3CB9514BA8D44F4256B988EA65D7F1BFF3EC382C7C6F253C2EE1A8F40E046C07
-FAA4B1877BB26DD2F5427D39E4C144163B0070A99BA736ECAC3321D5DBC70029
-8BBBB883062910D05DCE6B0E9B560E635BCE7037BDD5580D64FF8E8AE1E40D72
-FC3D42D0B9BF60FFB8B2BC0DBF5FD36048CD52DF98B3C143A03A9A23D1613C9C
-DBE72FAA9FFE6F91F39B972394E922F2885A1FD4FD7C10F6FA0F33A089D414F3
-9DEEA619F236EC4212B12575BA4337312D76BBADFE2DF13F5B3E5E9E73792172
-0C3DBBBE0CE74C6DD49566D50C24B6672EEA6067DA23C428AD4D54C471D473D4
-19EE8A164BD75B182BBF2B608B698991905DA0326DC981B5E4A7BBFC9822258D
-80B8DB0D5C9A5E182392FCBD809599F7978EAC35493862589651DAE21C64412C
-B04AFA28341EEAB61799FC175400376FBD0A997AABE59861C6FC7F221863081B
-459809F602FABECE52A76777B99043D6FB322B7DB5755D20EC65E868CC3B83D8
-4F0622B90ADBE3B32F3A80CACC6562BFCF0FFB321CC8D4F6140866586130EC47
-E920D9C3AC6975E50060804EBD1EA64426C359C40C3B619C79877393E6026F27
-030B3B8837197F9A9D44A9761141C6986A7DD861677511964C707BA450683E0C
-FCA566824010C7D98C5664F84EEDAE3446F0369D3AB48DD0E27BB1C64B7F9B6E
-5990D53A40425930E6765D693A6A94D280B2FD0934BFED81C06ED7EAEB580D82
-A53B3D328478319E08100642347771D3CBA2C9AC18F23073F8B5416716705702
-D1B7ABACCDD257DDA3D2F7AC6C710F1382EB1B3DA1CF67AE1AEF2C3DBEBF6702
-E5C88B7724F0B1F978CD3228BC5FBCA2EA74EBA69866BB8B9C2529740355D53D
-ACE962F124D0AB995E871BB105398DDA8090DFB85F025E4B91AF3E99AB399612
-0B252E51525A04A699A1B7BD2A568E81CEB89CE4C78C349B68143CD0DA323F83
-EEC93C3E77D2CCE0A0296A1BBCA4C656A74BB2A2496943ED612CD433492B634A
-E4E905381154FA47CF28FB359170EC65B0A431E0B842CE3A9A8DB8C837D6AF8A
-5BB6834E130A04CF904B882E1AC9FC524BA46BA0BBA547128C1F8D7141B0E287
-DFBBAE01EDE86F553AFDF9ED71BDD7C1765C2CC90AD937DBDF0DEFCDCB831FEC
-74BDABA9D83E7EDB72A69C7B07D8332B23E862B92EE403606961EEF6368E34E9
-590E4D9424A22791E7F4FD5BE18100734264C8F739FC2E61FDBFE335F4F17D22
-BABBF8ADFFF1035404F12A795FB8EBA2257CCA57961AB45C136FF3710E9B86ED
-94B2806138C01D980763AE985B370C5DAD2D6F9B017774763CD48B11D007FC57
-5B03F42E6C8584CD967ED115DFAAA6521304D5CBCEA1C865A844919D6AAC2216
-0E0F8B5D867B8FBF0665015FF7A738B07B6FE3B24448FD35590BA742B154A653
-E14C272D4B841C6971CAC43492775B4A49DA477A7230D344896DA6CA9A561A06
-8CC9524BBA715CB6AD1C78E5367EEA0C004948CB2E268A648775F5F96192F6A9
-CCEADA57E9C3296552F7A2442DC225F6847EF5DF4739A32FAE5D42C120C03088
-26BD4A515852DB83F80798F2F2EFD82812C104816F10745758A9F2B7D3919F87
-3B0644193150DE1FE2517A74C3DFF71FD48AB15C17519DB564773FCB7E8A4562
-E353385A81857E27FB5FE31AB6CA05B1413564583D244B4B47146E11C5F617DB
-BE737348100F85E528BE5F02538E3C97C77B0106F51C485978308A1EA557BDF2
-F88BD86CBC9FC4764486752A38AEB77CD6E9357FE3EAD27531495CE0F9F5DAB6
-1C90E6B2660036997828611D6764BD3DBA81DD2CFF48B264CFAFD1FF0FE2A346
-6AB6D5D08BD672276354C864E9DAA4AA94F5AEEE374C6734B92B8A4253BCA770
-2D8513FA3823851F26EE7BD9FFCD5DE91E113352237EB68CE1EEF5CF5CB0384C
-7552F257E6ECC484FE7F7FEF0172DE689B3703374F9360F881068FCF2C95FA71
-A0031C100FDB0898E5B15832DEF7AA12B359B2C2B343F57CFE1679824B6F2D95
-6A611DB5718576D739EFCC6C4542C6CB63B195553FDE03F3EC8241DF3E4BDD95
-BFFF95A987B00B0323D282AC6BD6B13A995587D6C7F156BAE359EB897CB19333
-8E0194B4423F780495D23EDA74DC255953903F484ACF3834C3962F03BDC8EF7A
-187C077312DC1773A482C10643E16021385463715F60FCA5CDDB392736F6D803
-40BE48C2946B496612B0E6E10D49E3CE4A5FA0F13BB02F2C162BE59EB652EAFF
-66050FB12372292331AEC2988C0446F83DC57FF3C596ECE76DB48344204EDE43
-8986C8906CF4FB3CC248351B86A3AC618EBE8AC31C35B32961A1663EFA5C5B1E
-E3164993F3706AEA5C3F76BB2132C7D28D7C547A16BF70C195CD18A3C15E20AD
-2E6DA5C4872B5115BF537592D023C1B3A235279683139A8471C0B0D394096FAB
-059DCE80A01A923E66D8EAC760E69305E5AFDD8CE1D099BE91B6DF6455AB2690
-C6ED99AC1A984C6F1A9E9A4568B6D0F52453F7407694AA83F932593CC360532C
-7D00C682FB7C10FD0A0441F98FFEA848EF65A5FD0F6C554A33E2B6A105490756
-660155A9ED4E1C6521EBB6CEF53319971568FFC59DAC3301CA367E40D239DCBB
-249AA6D12F6AE88EA80F67D002AE06025AFE39B0FB2D0FD85306E60F970C75D5
-BCCD07134FE734D03EF10A18443B02D83975BFCCC0882B0E2050D45A0131B0C3
-2C681666EC60FAD9F825E9CF921BEA1355DB3807C6A09ACA10AF55B6A32D0594
-66D29B3FD1D45E491218AC54F3D9460AF1BA336283BC0954E1C76CFD3A60B769
-6C66EBA0A05066D6342E6FB4C497699F97281E98DA87ADA09DB2A2D28026DD27
-4069AE0A9FF21A0FAF70EF67EF8EFF4A50709FA553D20998D0C02F529663EC0A
-9F73792CC2B6EF23247DE434FBA13B898601FDF64D9CC78D7860BDDEC6645903
-6581368690AE6D3B35A25FF851E3D6474E26F29C081FD5769BE29A9C4D7255E4
-656563368E55BC8452729F35F6A072D42BE6B30CC8FC542FD44DF1F07EC147D0
-A757F41E4A858196D3B91933AD6A4AD5260B63EDE47FE96727BFDB40C4E0FCC4
-8EB056B0BF0FB7F63D8BB17A5DE4574C6FE2395048544B57342A049CF62B54B9
-7148B273D085F02AD5EE2A287F4784B69BA55D7D35EEC73BD9F2D9D5BA03E6C8
-A86E2363A4FEC3154C37F8C00D858B929075455444463B9BEAEAEFF6D0898F12
-E19BF799BB18BB73E6518A94CE26889EF2D7AFE9F21BF54FB7E22A93A9EC089B
-8208E562E1294F911D2DCA8124637019D3DAD6930C05DAF6D386B138613479D9
-F63A38514A8256E3844DEC7E803830D34B3D1A8D61D1B11FBF507788B388FEBB
-34958C7D41185E2EB6120DBB337026385A5EB785F96082F75B19A84753AF13AC
-72329CF81024C27ADD17763470E929BA85D3E84A34765ED28EC64A70C3A7FBDF
-25772D07B6B77CDE0CE08B5C373160A9A0F6960FF0F26D7004D51EF386204B43
-AFFAB475223B917A77419C6D213906E23E3865CE367DDB05D602F9D2D70968F7
-473FEC4A7A751833D026E64F6E41C3D55858411AD3B2F096195FC0AC70C8B267
-09F89FC57D36B1264E642E42552DBEEFAFD5495F9DD1EC53362B1716B47B5D35
-AA27AC9AA210BFA8A14398D480FFCDAC06FB6C2ADF9A9E873C087B506FE133CB
-FC2945E2585B111B2FE7B423F4EB538AADD632EFF87E6CF546DA2DFB06691130
-0AE91C2BE96AB3BBB3215946A235F1D318110ECD62D34FE5F8F3D24A2B2B9C48
-1B91F95523ECE45033259142562166BDA4EACDC1424937E2BBFD06CF8048442F
-39E979E4986FA612A25B2660341E9A88C2B639F24A6850C8645353219951F47A
-9BC914CE439561459172DDA8382744C0029FEC3A0FE73B8DD96E9D5B81855A26
-316600784DACEDDA45E93A266B8D4397A3888E9A75C3197DBFC75B3CA7069FF7
-9244A47FF21C6CBA7E0626ABC71A5FC4E48CB90A2A1A3CA0C53B59770D5F2D1C
-C5500C42EB126AF56F3217152E68BDC11F96F8CAA19C77D1FF70A63332322326
-3597981124702B13235BB6B90B8F48344200A5244494B02D3C0C12F1511BCC6E
-6E38D736A97F770F5C32DA03D8200CA3CA79F509CC3450AA1D00E60D920108EF
-CA502DA667373FD3491203343E85A22BA57486AB7D8E9B1AD9127B28D59D1D41
-A444E64306704FB7D7ACBF416B26844FDB1CCC35ABDB0344D91123AF0D13FAEF
-25537D5CF4ADA15C54B75F8B9587D27806FC7340C47D42AC40B4AF5D40C5F02F
-F7ADA2FEDD781EF69C7FF650BD414EE4F89ABC85353F3FAA01995B54053E8AFA
-3378BFABBE3454A5CACF2571BF97B0593949F4956DDB70187CC4AB31F33CBC0A
-7807B8398F86C6144CE4DBF96D3615BAC1165D97269475DAA32DECC9787AD215
-647A5DC23F0F58B6E6C94CE1CE63FCE4C7F852F27BAC12E0CCF464F5E7C5C022
-68EE0C016107EDBC2F214D50DD0D54F3C2565310ADC4D191262DFBFC934023F3
-193391C399E4047CA53150163435D71BEBFD6A07AD2175BDE21D4C28CD333CDA
-0394CB0931CDF3C6F8718434C6D87343944229B1035AFB77E74C90137B74FC5B
-5A0F710197E2A14A70F81DD6E295848F15C248F3FEE78E12C6968FDB60E131C2
-5A98D5D8E7FFCEC49ADD57524AB50A02D378
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-0000000000000000000000000000000000000000000000000000000000000000
-cleartomark
-%%EndFont 
-TeXDict begin 39139632 55387786 1000 600 600 (libcf.dvi)
- at start /Fa 197[21 58[{}1 74.7198 /CMMI9 rf /Fb 138[43
-30 30 30 1[43 38 43 64 21 2[21 1[38 1[34 43 2[38 16[52
-6[28 2[50 2[55 1[58 7[38 7[38 38 3[21 44[{}23 74.7198
-/CMR9 rf /Fc 129[48 3[48 48 48 48 48 48 48 48 48 48 48
-48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 1[48 18[48
-48 4[48 48 1[48 48 1[48 1[48 48 1[48 48 4[48 48 1[48
-48 48 48 48 48 48 1[48 48 48 1[48 2[48 48 34[{}54 90.9091
-/CMTT10 rf /Fd 197[25 58[{}1 90.9091 /CMMI10 rf /Fe 197[33
-58[{}1 119.552 /CMMI12 rf /Ff 134[85 85 117 1[90 63 64
-66 1[90 81 90 134 45 2[45 90 81 49 74 90 72 90 78 10[122
-1[112 90 120 1[110 6[60 1[127 101 106 124 117 1[122 12[81
-81 81 81 3[54 45[{}38 143.462 /CMBX12 rf /Fg 242[91 13[{}1
-90.9091 /CMSY10 rf /Fh 133[60 71 71 97 71 75 52 53 55
-71 75 67 75 112 37 71 1[37 75 67 41 61 75 60 75 65 6[82
-3[102 103 94 75 100 1[92 101 105 128 81 2[50 105 106
-85 88 103 97 96 102 7[67 67 67 67 67 67 67 67 67 67 1[37
-45 32[75 12[{}58 119.552 /CMBX12 rf /Fi 133[40 48 48
-66 48 51 35 36 36 48 51 45 51 76 25 48 28 25 51 45 28
-40 51 40 51 45 4[45 1[56 68 68 93 68 68 66 51 67 1[62
-71 68 83 57 2[33 68 71 59 62 69 66 64 68 3[71 1[25 25
-45 45 45 45 45 45 45 45 45 45 45 25 30 25 1[45 35 35
-25 2[45 76 45 25 18[76 51 51 53 11[{}79 90.9091 /CMR10
-rf /Fj 134[102 3[108 75 76 79 3[108 4[54 108 1[59 88
-108 86 108 94 11[149 135 1[144 3[151 1[116 4[152 122
-1[148 140 67[{}23 172.154 /CMBX12 rf end
-%%EndProlog
-%%BeginSetup
-%%Feature: *Resolution 600dpi
-TeXDict begin
-%%PaperSize: A4
- end
-%%EndSetup
-%%Page: 1 1
-TeXDict begin 1 0 bop 150 1318 a Fj(The)64 b(NetCDF)i(CF)e(Library)h
-(Users)h(Guide)e(and)g(Reference)p 150 1418 3600 34 v
-3017 1515 a Fi(V)-8 b(ersion)31 b(1.0-alpha5)3118 1623
-y(Septem)m(b)s(er)f(2009)150 4935 y Fh(Ed)45 b(Hartnett)150
-5068 y(Unidata)h(Program)g(Cen)l(ter)p 150 5141 3600
-17 v eop end
-%%Page: 2 2
-TeXDict begin 2 1 bop 150 3713 a Fi(Cop)m(yrigh)m(t)602
-3710 y(c)577 3713 y Fg(\015)30 b Fi(2006)i(Univ)m(ersit)m(y)g(Corp)s
-(oration)e(for)g(A)m(tmospheric)h(Researc)m(h)150 4067
-y(P)m(ermission)e(is)g(gran)m(ted)h(to)g(mak)m(e)g(and)f(distribute)f
-(v)m(erbatim)i(copies)g(of)f(this)g(man)m(ual)h(pro)m(vided)e(that)150
-4177 y(the)c(cop)m(yrigh)m(t)i(notice)g(and)d(these)i(paragraphs)f(are)
-h(preserv)m(ed)e(on)i(all)g(copies.)39 b(The)24 b(soft)m(w)m(are)i(and)
-e(an)m(y)150 4286 y(accompan)m(ying)29 b(written)f(materials)h(are)f
-(pro)m(vided)f(\\as)i(is")f(without)g(w)m(arran)m(t)m(y)g(of)g(an)m(y)g
-(kind.)39 b(UCAR)150 4396 y(expressly)25 b(disclaims)g(all)h(w)m(arran)
-m(ties)g(of)f(an)m(y)g(kind,)g(either)h(expressed)e(or)h(implied,)h
-(including)f(but)f(not)150 4505 y(limited)31 b(to)g(the)g(implied)f(w)m
-(arran)m(ties)h(of)g(merc)m(han)m(tabilit)m(y)i(and)c(\014tness)h(for)g
-(a)h(particular)g(purp)s(ose.)150 4640 y(The)j(Unidata)h(Program)f(Cen)
-m(ter)g(is)h(managed)f(b)m(y)g(the)h(Univ)m(ersit)m(y)g(Corp)s(oration)
-f(for)g(A)m(tmospheric)150 4749 y(Researc)m(h)f(and)e(sp)s(onsored)f(b)
-m(y)i(the)g(National)h(Science)g(F)-8 b(oundation.)46
-b(An)m(y)31 b(opinions,)h(\014ndings,)f(con-)150 4859
-y(clusions,)k(or)e(recommendations)h(expressed)f(in)h(this)f
-(publication)h(are)g(those)g(of)g(the)g(author\(s\))g(and)150
-4969 y(do)c(not)h(necessarily)g(re\015ect)g(the)g(views)f(of)h(the)f
-(National)i(Science)g(F)-8 b(oundation.)150 5103 y(Men)m(tion)36
-b(of)f(an)m(y)h(commercial)g(compan)m(y)g(or)f(pro)s(duct)e(in)i(this)g
-(do)s(cumen)m(t)g(do)s(es)f(not)i(constitute)g(an)150
-5213 y(endorsemen)m(t)46 b(b)m(y)f(the)h(Unidata)g(Program)g(Cen)m
-(ter.)86 b(Unidata)46 b(do)s(es)g(not)f(authorize)i(an)m(y)f(use)f(of)
-150 5322 y(information)31 b(from)f(this)g(publication)h(for)f(adv)m
-(ertising)h(or)g(publicit)m(y)f(purp)s(oses.)p eop end
-%%Page: -1 3
-TeXDict begin -1 2 bop 3725 -116 a Fi(i)150 299 y Ff(T)-13
-b(able)53 b(of)h(Con)l(ten)l(ts)150 641 y Fh(Summary)18
-b Fe(:)h(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)
-f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h
-(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)62 b Fh(1)150
-911 y(Do)l(wnloading)46 b(and)f(Installing)h(lib)t(cf)24
-b Fe(:)c(:)g(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)
-f(:)69 b Fh(3)150 1181 y(1)135 b(Files)10 b Fe(:)20 b(:)f(:)h(:)f(:)h
-(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)
-h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f
-(:)h(:)f(:)h(:)f(:)g(:)55 b Fh(5)275 1318 y Fi(1.1)92
-b(Mark)30 b(a)h(File)h(as)e(Conforming)g(to)h(CF)f(Con)m(v)m(en)m
-(tions)11 b Fd(:)17 b(:)e(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h
-(:)f(:)g(:)h(:)f(:)41 b Fi(5)275 1427 y(1.2)92 b(Determine)31
-b(if)f(a)h(File)h(Claims)e(to)h(Conform)f(to)h(CF)f(Con)m(v)m(en)m
-(tions)20 b Fd(:)d(:)f(:)f(:)g(:)h(:)50 b Fi(5)275 1537
-y(1.3)92 b(Add)29 b(description)i(to)g(the)f(data)h(with)f(nccf)p
-1993 1537 28 4 v 40 w(def)p 2152 1537 V 40 w(\014le)10
-b Fd(:)16 b(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h
-(:)f(:)h(:)40 b Fi(5)275 1646 y(1.4)92 b(Read)30 b(the)h(description)f
-(of)h(the)f(data)h(with)f(nccf)p 2176 1646 V 40 w(inq)p
-2340 1646 V 40 w(\014le)17 b Fd(:)f(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h
-(:)f(:)g(:)h(:)47 b Fi(6)275 1756 y(1.5)92 b(App)s(end)28
-b(to)j(a)g(History)g(A)m(ttribute)24 b Fd(:)16 b(:)f(:)h(:)f(:)g(:)h(:)
-f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f
-(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)54 b Fi(8)150 1998
-y Fh(2)135 b(V)-11 b(ariables)35 b Fe(:)19 b(:)h(:)f(:)h(:)f(:)h(:)f(:)
-g(:)h(:)f(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)h(:)f
-(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)79
-b Fh(9)275 2135 y Fi(2.1)92 b(Add)29 b(description)i(to)g(a)f(v)-5
-b(ariable)32 b(with)e(nccf)p 2047 2135 V 40 w(def)p 2206
-2135 V 39 w(v)-5 b(ar)20 b Fd(:)c(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g
-(:)h(:)f(:)h(:)f(:)g(:)h(:)50 b Fi(9)275 2245 y(2.2)92
-b(Read)30 b(v)-5 b(ariable)31 b(description)g(with)f(nccf)p
-1894 2245 V 40 w(inq)p 2058 2245 V 40 w(v)-5 b(ar)13
-b Fd(:)i(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)
-h(:)f(:)g(:)h(:)43 b Fi(9)275 2355 y(2.3)92 b(De\014ne)30
-b(missing)g(data)h(v)-5 b(alues)31 b(for)f(a)h(v)-5 b(ariable)31
-b(with)f(nccf)p 2493 2355 V 40 w(def)p 2652 2355 V 40
-w(v)-5 b(ar)p 2816 2355 V 40 w(missing)478 2464 y Fd(:)15
-b(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f
-(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)
-g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f
-(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)51 b Fi(10)275
-2574 y(2.4)92 b(Learn)30 b(ab)s(out)g(missing)g(data)h(settings)g(with)
-g(nccf)p 2239 2574 V 40 w(inq)p 2403 2574 V 39 w(v)-5
-b(ar)p 2566 2574 V 40 w(missing)15 b Fd(:)g(:)h(:)44
-b Fi(11)275 2683 y(2.5)92 b(Add)29 b(CF-Recommended)i(Metadata)h(to)f
-(a)g(File)h(or)e(V)-8 b(ariable)32 b(with)27 b Fd(:)15
-b(:)g(:)57 b Fi(12)275 2793 y(2.6)92 b(Read)30 b(v)-5
-b(ariable)31 b(description)g(with)f(nccf)p 1894 2793
-V 40 w(inq)p 2058 2793 V 40 w(notes)9 b Fd(:)16 b(:)f(:)h(:)f(:)g(:)h
-(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)39 b Fi(12)275
-2902 y(2.7)92 b(De\014ne)30 b(a)h(co)s(ordinate)g(v)-5
-b(ariable)31 b(and)f(dimension)g(for)g(latitude)h(with)456
-3012 y(nccf)p 621 3012 V 40 w(def)p 780 3012 V 40 w(latitude)12
-b Fd(:)k(:)g(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)
-h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h
-(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)41
-b Fi(13)275 3122 y(2.8)92 b(Learn)30 b(ab)s(out)g(a)h(latitude)g(co)s
-(ordinate)g(v)-5 b(ariable)31 b(and)f(dimension)g(with)478
-3231 y Fd(:)15 b(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)
-f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h
-(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)
-f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)51
-b Fi(14)275 3341 y(2.9)92 b(De\014ne)30 b(a)h(co)s(ordinate)g(v)-5
-b(ariable)31 b(and)f(dimension)g(for)g(longitude)h(with)456
-3450 y(nccf)p 621 3450 V 40 w(def)p 780 3450 V 40 w(longitude)22
-b Fd(:)16 b(:)g(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f
-(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)
-g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)52 b Fi(15)275
-3560 y(2.10)92 b(Learn)30 b(ab)s(out)g(a)h(longitude)g(co)s(ordinate)g
-(v)-5 b(ariable)31 b(and)f(dimension)g(with)478 3670
-y Fd(:)15 b(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)g
-(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)
-h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g
-(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)51 b Fi(15)275
-3779 y(2.11)92 b(De\014ne)31 b(a)f(co)s(ordinate)i(v)-5
-b(ariable)31 b(and)f(dimension)f(for)h(lev)m(el)j(with)456
-3889 y(nccf)p 621 3889 V 40 w(def)p 780 3889 V 40 w(lvl)16
-b Fd(:)g(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)
-f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f
-(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)
-45 b Fi(16)275 3998 y(2.12)92 b(Learn)30 b(ab)s(out)g(a)h(lev)m(el)h
-(co)s(ordinate)f(v)-5 b(ariable)31 b(and)f(dimension)g(with)11
-b Fd(:)16 b(:)f(:)41 b Fi(17)275 4108 y(2.13)92 b(De\014ne)31
-b(a)f(co)s(ordinate)i(v)-5 b(ariable)31 b(and)f(dimension)f(for)h(lev)m
-(el)j(with)456 4218 y(nccf)p 621 4218 V 40 w(def)p 780
-4218 V 40 w(lvl)16 b Fd(:)g(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f
-(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)
-g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f
-(:)h(:)f(:)g(:)h(:)45 b Fi(18)275 4327 y(2.14)92 b(Learn)30
-b(ab)s(out)g(a)h(lev)m(el)h(co)s(ordinate)f(v)-5 b(ariable)31
-b(and)f(dimension)g(with)11 b Fd(:)16 b(:)f(:)41 b Fi(18)275
-4437 y(2.15)92 b(De\014ne)31 b(a)f(co)s(ordinate)i(v)-5
-b(ariable)31 b(and)f(dimension)f(for)h(time)i(with)456
-4546 y(nccf)p 621 4546 V 40 w(def)p 780 4546 V 40 w(time)17
-b Fd(:)f(:)g(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)
-h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g
-(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)46
-b Fi(19)275 4656 y(2.16)92 b(Learn)30 b(ab)s(out)g(a)h(time)g(co)s
-(ordinate)g(v)-5 b(ariable)31 b(and)f(dimension)g(with)11
-b Fd(:)16 b(:)f(:)41 b Fi(20)275 4765 y(2.17)92 b(De\014ne)31
-b(atmosphere)f(sigma)h(co)s(ordinate.)20 b Fd(:)d(:)e(:)h(:)f(:)h(:)f
-(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)
-f(:)50 b Fi(21)275 4875 y(2.18)92 b(Inquire)29 b(ab)s(out)i(atmosphere)
-f(sigma)h(co)s(ordinate.)16 b Fd(:)g(:)g(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)
-f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)45 b Fi(21)275 4985 y(2.19)92
-b(De\014ne)31 b(atmosphere)f(sigma)h(co)s(ordinate.)20
-b Fd(:)d(:)e(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)
-g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)50 b Fi(22)275 5094 y(2.20)92
-b(Inquire)29 b(ab)s(out)i(atmosphere)f(sigma)h(co)s(ordinate.)16
-b Fd(:)g(:)g(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)
-h(:)45 b Fi(22)275 5204 y(2.21)92 b(The)30 b(form)m(ula)p
-1023 5204 V 40 w(terms)g(attribute)i(for)e(atmosphere)g(h)m(ybrid)f
-(heigh)m(t)15 b Fd(:)i(:)f(:)f(:)45 b Fi(23)275 5313
-y(2.22)92 b(Inquire)29 b(ab)s(out)i(h)m(ybrid)e(heigh)m(t)i(co)s
-(ordinate.)26 b Fd(:)15 b(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h
-(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)55 b Fi(23)p eop
-end
-%%Page: -2 4
-TeXDict begin -2 3 bop 150 -116 a Fi(ii)2396 b(The)30
-b(CF)g(Library)g(Users)g(Guide)275 83 y(2.23)92 b(De\014ne)31
-b(atmosphere)f(slev)m(e)i(co)s(ordinate.)20 b Fd(:)d(:)e(:)g(:)h(:)f(:)
-h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g
-(:)h(:)f(:)50 b Fi(24)275 193 y(2.24)92 b(Inquire)29
-b(Ab)s(out)h(Slev)m(e)i(Co)s(ordinate.)25 b Fd(:)15 b(:)h(:)f(:)h(:)f
-(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)
-g(:)h(:)f(:)h(:)f(:)g(:)55 b Fi(25)275 302 y(2.25)92
-b(De\014ne)31 b(Ocean)f(Sigma)h(Co)s(ordinate.)24 b Fd(:)15
-b(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f
-(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)53 b Fi(26)275
-412 y(2.26)92 b(Inquire)29 b(Ab)s(out)h(Ocean)h(Sigma)g(Co)s(ordinate.)
-d Fd(:)15 b(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f
-(:)h(:)f(:)g(:)h(:)57 b Fi(26)275 521 y(2.27)92 b(De\014ne)31
-b(Ocean)f(S)g(Co)s(ordinate.)18 b Fd(:)e(:)g(:)f(:)g(:)h(:)f(:)h(:)f(:)
-g(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g
-(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)48 b Fi(27)275 631 y(2.28)92
-b(Inquire)29 b(Ab)s(out)h(Ocean)h(S)f(Co)s(ordinate.)23
-b Fd(:)15 b(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f
-(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)52 b Fi(27)275
-741 y(2.29)92 b(De\014ne)31 b(Ocean)f(Sigma)h(Z)f(Co)s(ordinate.)21
-b Fd(:)16 b(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h
-(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)50 b Fi(28)275
-850 y(2.30)92 b(Inquire)29 b(Ab)s(out)h(Ocean)h(Sigma)g(Z)f(Co)s
-(ordinate.)25 b Fd(:)15 b(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f
-(:)g(:)h(:)f(:)h(:)f(:)g(:)55 b Fi(29)275 960 y(2.31)92
-b(De\014ne)31 b(Ocean)f(Double)h(Sigma)g(Co)s(ordinate.)9
-b Fd(:)16 b(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h
-(:)f(:)g(:)h(:)f(:)h(:)38 b Fi(30)275 1069 y(2.32)92
-b(Inquire)29 b(Ab)s(out)h(Ocean)h(Double)g(Sigma)g(Co)s(ordinate.)13
-b Fd(:)j(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)43
-b Fi(31)275 1179 y(2.33)92 b(Get)31 b(a)g(geographic)h(subset)e(of)g
-(the)h(data.)9 b Fd(:)17 b(:)e(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f
-(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)39
-b Fi(32)150 1421 y Fh(3)135 b(Co)t(ordinate)46 b(Systems)22
-b Fe(:)e(:)f(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)h(:)
-f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)h(:)f(:)67 b Fh(33)275
-1558 y Fi(3.1)92 b(Lab)s(el)30 b(the)g(axis)h(t)m(yp)s(e)g(of)f(a)h(co)
-s(ordinate)g(v)-5 b(ar)31 b(with)f(nccf)p 2432 1558 28
-4 v 40 w(def)p 2591 1558 V 39 w(axis)p 2784 1558 V 41
-w(t)m(yp)s(e)478 1668 y Fd(:)15 b(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h
-(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)
-f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f
-(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)
-51 b Fi(33)275 1778 y(3.2)92 b(Find)30 b(out)g(the)h(axis)g(t)m(yp)s(e)
-f(of)h(a)f(co)s(ordinate)i(v)-5 b(ar)30 b(with)g(nccf)p
-2558 1778 V 40 w(inq)p 2722 1778 V 40 w(axis)p 2916 1778
-V 40 w(t)m(yp)s(e)478 1887 y Fd(:)15 b(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g
-(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)
-h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h
-(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)
-h(:)51 b Fi(33)275 1997 y(3.3)92 b(De\014ne)30 b(a)h(co)s(ordinate)g
-(system)g(with)f(nccf)p 1960 1997 V 40 w(def)p 2119 1997
-V 40 w(co)s(ord)p 2379 1997 V 39 w(system)19 b Fd(:)d(:)f(:)h(:)f(:)h
-(:)f(:)g(:)49 b Fi(33)275 2106 y(3.4)92 b(Find)30 b(out)g(ab)s(out)g(a)
-h(co)s(ordinate)g(system)g(with)f(nccf)p 2316 2106 V
-40 w(inq)p 2480 2106 V 40 w(co)s(ord)p 2740 2106 V 40
-w(system)478 2216 y Fd(:)15 b(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f
-(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)
-h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g
-(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)51
-b Fi(34)275 2325 y(3.5)92 b(Assign)29 b(a)i(co)s(ordinate)f(system)g
-(to)h(a)f(v)-5 b(ar)30 b(with)f(nccf)p 2306 2325 V 40
-w(assign)p 2584 2325 V 41 w(co)s(ord)p 2845 2325 V 40
-w(system)478 2435 y Fd(:)15 b(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f
-(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)
-h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g
-(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)51
-b Fi(34)275 2545 y(3.6)92 b(De\014ne)30 b(a)h(co)s(ordinate)g
-(transform)f(with)g(nccf)p 2076 2545 V 40 w(def)p 2235
-2545 V 40 w(transform)13 b Fd(:)h(:)h(:)h(:)f(:)h(:)f(:)g(:)h(:)42
-b Fi(34)275 2654 y(3.7)92 b(Find)30 b(out)g(ab)s(out)g(a)h(co)s
-(ordinate)g(transform)f(with)g(nccf)p 2432 2654 V 40
-w(inq)p 2596 2654 V 40 w(transform)478 2764 y Fd(:)15
-b(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f
-(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)
-g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f
-(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)51 b Fi(35)275
-2873 y(3.8)92 b(Assign)30 b(a)h(co)s(ordinate)g(transform)f(to)h(a)g
-(co)s(ordinate)g(system)f(with)456 2983 y(nccf)p 621
-2983 V 40 w(assign)p 899 2983 V 41 w(transform)13 b Fd(:)i(:)g(:)h(:)f
-(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)
-g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f
-(:)h(:)f(:)43 b Fi(35)150 3225 y Fh(4)135 b(GRIDSPEC)45
-b(-)f(A)h(standard)g(for)g(the)g(description)h(of)419
-3358 y(grids)f(used)g(in)g(Earth)g(System)h(mo)t(dels)21
-b Fe(:)f(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)66 b Fh(37)275
-3495 y Fi(4.1)92 b(Mak)m(e)32 b(a)e(Horizon)m(tal)j(Grid)20
-b Fd(:)15 b(:)g(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h
-(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)
-f(:)h(:)f(:)g(:)h(:)49 b Fi(37)275 3605 y(4.2)92 b(Remap)30
-b(data)h(from)f(Input)f(Mosaic)j(to)f(Output)e(Mosaic)20
-b Fd(:)e(:)d(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)50
-b Fi(39)275 3714 y(4.3)92 b(Generate)31 b(Mosaic)h(Information)f(Bet)m
-(w)m(een)h(Tiles)22 b Fd(:)16 b(:)g(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f
-(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)52 b Fi(41)275 3824 y(4.4)92
-b(Remap)30 b(Riv)m(er)h(Net)m(w)m(ork)h(Data)18 b Fd(:)f(:)e(:)h(:)f(:)
-h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g
-(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)48
-b Fi(42)275 3934 y(4.5)92 b(T)-8 b(ransfer)29 b(to)i(Mosaic)19
-b Fd(:)f(:)d(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)
-g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f
-(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)49 b Fi(42)275
-4043 y(4.6)92 b(Mak)m(e)32 b(a)e(V)-8 b(ertical)33 b(Grid)12
-b Fd(:)j(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)
-h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g
-(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)42 b Fi(42)275 4153 y(4.7)92
-b(Generate)31 b(Three)f(Exc)m(hange)i(Grids)d(for)i(FMS)f(Coupler)25
-b Fd(:)15 b(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)55
-b Fi(43)275 4262 y(4.8)92 b(Generate)31 b(T)-8 b(op)s(ograph)m(y)31
-b(for)f(An)m(y)g(Mosaic)c Fd(:)16 b(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g
-(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)54
-b Fi(44)150 4505 y Fh(Index)22 b Fe(:)d(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h
-(:)f(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)
-h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f(:)h(:)f(:)h(:)f(:)h(:)f(:)g(:)h(:)f
-(:)h(:)f(:)67 b Fh(47)p eop end
-%%Page: 1 5
-TeXDict begin 1 4 bop 150 -116 a Fi(Summary)3172 b(1)150
-299 y Ff(Summary)150 533 y Fi(The)36 b(CF)h(con)m(v)m(en)m(tions)i(for)
-d(climate)j(and)d(forecast)i(metadata)h(are)e(designed)f(to)i(promote)f
-(the)g(pro-)150 643 y(cessing)31 b(and)f(sharing)g(of)g(\014les)h
-(created)g(with)f(the)h(netCDF)g(API.)275 777 y(This)h(library)-8
-b(,)34 b(lib)s(cf,)g(mak)m(es)g(it)f(easier)h(to)g(create)h(and)d(w)m
-(ork)i(with)e(data)i(\014les)f(whic)m(h)g(conform)g(to)150
-887 y(the)e(CF)f(con)m(v)m(en)m(tions.)275 1021 y(The)37
-b(functions)g(of)h(the)g(CF)g(library)g(are)g(in)m(tended)f(to)i(b)s(e)
-e(in)m(tersp)s(ersed)g(with)h(netCDF)g(library)150 1131
-y(calls.)59 b(That)36 b(is,)i(the)e(programmer)g(will)g(op)s(en)g(or)g
-(create)i(a)e(netCDF)h(\014le)f(with)g(the)g(netCDF)h(API,)150
-1240 y(and)30 b(then)f(add)h(or)g(read)g(metadata)i(with)e(lib)s(cf)g
-(library)g(functions,)g(then)f(con)m(tin)m(ue)j(to)f(w)m(orking)f(with)
-150 1350 y(the)h(netCDF)g(API)f(to)h(read)f(and)g(write)g(data.)275
-1484 y(By)39 b(using)g(lib)s(cf,)i(a)f(data)g(pro)s(ducer)d(can)j(pro)s
-(duce)e(\014les)h(that)h(conform)f(to)h(the)f(CF)h(standards,)150
-1594 y(without)32 b(ha)m(ving)h(to)g(write)f(netCDF)h(co)s(de)f(to)h
-(create)h(and)d(deco)s(de)i(all)g(the)f(attributes)h(that)g(the)f(CF)
-150 1704 y(con)m(v)m(en)m(tion)k(uses)d(to)h(store)g(meta-data.)51
-b(A)34 b(data)g(consumer)f(can)g(use)h(lib)s(cf)f(to)h(read)f(an)m(y)h
-(\014le)f(whic)m(h)150 1813 y(conforms)e(to)i(the)f(CF)f(con)m(v)m(en)m
-(tions;)k(the)d(\014le)g(do)s(es)f(not)h(need)g(to)g(b)s(e)f(created)i
-(with)e(lib)s(cf)h(to)g(b)s(e)f(read)150 1923 y(b)m(y)f(lib)s(cf.)275
-2057 y(F)-8 b(ortran-77)38 b(wrapp)s(er)d(functions)h(pro)m(vide)g(a)h
-(F)-8 b(ortran)37 b(77)g(API,)g(just)f(as)g(is)h(done)f(with)g(netCDF)
-150 2167 y(itself.)42 b(A)30 b(F)-8 b(ortran)31 b(90)g(API)f(is)h
-(planned,)f(but)f(not)i(y)m(et)g(b)s(egun.)275 2301 y(F)-8
-b(or)44 b(more)g(information)g(ab)s(out)f(the)h(CF)g(Con)m(v)m(en)m
-(tions,)k(see)d(the)e(CF)h(Metadata)i(w)m(eb)e(site)g(at)150
-2411 y Fc(http://www.cgd.ucar.edu/)o(cms/)o(eato)o(n/c)o(f-me)o(tada)o
-(ta/)o(CF-1)o(.0.h)o(tml)o Fi(.)p eop end
-%%Page: 2 6
-TeXDict begin 2 5 bop eop end
-%%Page: 3 7
-TeXDict begin 3 6 bop 150 -116 a Fi(Do)m(wnloading)32
-b(and)d(Installing)j(lib)s(cf)2257 b(3)150 299 y Ff(Do)l(wnloading)51
-b(and)i(Installing)g(lib)t(cf)150 533 y Fi(Curren)m(tly)-8
-b(,)30 b(and)f(for)h(some)g(time)h(to)g(come,)g(lib)s(cf)e(is)h(in)g
-(alpha)g(release.)42 b(The)29 b(co)s(de)h(is)g(tested,)h(but)f(not)150
-643 y(extensiv)m(ely)-8 b(.)43 b(The)30 b(API)g(ma)m(y)h(b)s(e)f
-(extended,)g(and)g(p)s(ossibly)g(c)m(hanged,)h(in)f(eac)m(h)h(release.)
-275 777 y(Y)-8 b(ou)26 b(m)m(ust)h(ha)m(v)m(e)h(either)e(netCDF-3)i
-(\(or)f(netCDF-4\))h(installed.)40 b(And)26 b(reasonably)h(recen)m(t)g
-(v)m(ersion)150 887 y(of)k(netCDF)g(should)e(w)m(ork.)41
-b(lib)s(cf)30 b(is)g(tested)h(with)f(netCDF)h(3.6.2-b)s(eta4.)275
-1021 y(Get)21 b(the)f(latest)i(v)m(ersion)f(of)f(the)h(lib)s(cf)f
-(tarball)h(at)g(the)f(lib)s(cf)g(ftp)g(site:)37 b
-(ftp://ftp.unidata.ucar.edu/pub/lib)s(cf)275 1156 y(Unpac)m(k)30
-b(the)h(tarball,)g(and)f(run:)390 1290 y Fc(./configure)45
-b(--with-netcdf=/my/netcd)o(f)d(--prefix=/my/libcf)h(&&)k(make)g(check)
-f(install)g(>)h(output.txt)275 1425 y Fi(Where)32 b(/m)m(y/netcdf)i(is)
-f(the)f(ro)s(ot)h(install)h(directory)f(of)f(the)h(netCDF)g(library)f
-(y)m(ou)h(w)m(an)m(t)h(to)f(use,)150 1534 y(and)28 b(/m)m(y/lib)s(cf)i
-(is)e(the)h(ro)s(ot)g(directory)h(where)e(y)m(ou)h(w)m(an)m(t)g(lib)s
-(cf)g(installed.)41 b(\(They)28 b(ma)m(y)i(b)s(e)e(the)h(same)150
-1644 y(directory)-8 b(.\))275 1778 y(If)22 b(y)m(ou)i(wish)f(to)h(use)f
-(netCDF-4,)k(y)m(ou)c(m)m(ust)h(also)g(ha)m(v)m(e)h(HDF5)f(and)f(libz,)
-j(the)d(compression)h(library)-8 b(,)150 1888 y(installed.)41
-b(In)30 b(this)g(case,)i(con\014gure)e(lib)s(cf)g(lik)m(e)i(this:)390
-2022 y Fc(./configure)45 b(--with-netcdf=/s/n4_new)o(1/in)o(stal)o(l)d
-(--enable-netcdf-4)h(--with-hdf5=/home/ed/lo)o(cal/)o(s)f(&&)47
-b(make)g(check)f(install)g(>)h(output.txt)275 2157 y
-Fi(If)78 b(the)i(build)e(do)s(es)h(not)h(w)m(ork)f(for)h(y)m(ou,)92
-b(please)80 b(email)g(lib)s(cf)f(supp)s(ort:)137 b(supp)s(ort-)150
-2267 y(lib)s(cf)p Fc(@)p Fi(unidata.ucar.edu.)91 b(Please)48
-b(send)f(the)g(*complete*)j(output)d(of)h(the)f(con\014gure)g(and)g
-(build)150 2376 y(output,)29 b(in)f(ASCI)s(I)g(\(the)h(output.txt)g
-(\014le)g(pro)s(duced)e(b)m(y)i(the)g(ab)s(o)m(v)m(e)h(build)d
-(commands\),)j(and)e(the)h(\014le)150 2486 y(con\014g.log,)j(whic)m(h)e
-(is)h(generated)g(b)m(y)f(the)h(con\014gure)f(script.)p
-eop end
-%%Page: 4 8
-TeXDict begin 4 7 bop eop end
-%%Page: 5 9
-TeXDict begin 5 8 bop 150 -116 a Fi(Chapter)30 b(1:)41
-b(Files)2905 b(5)150 299 y Ff(1)80 b(Files)150 687 y
-Fh(1.1)68 b(Mark)45 b(a)g(File)g(as)h(Conforming)f(to)h(CF)e(Con)l(v)l
-(en)l(tions)150 846 y Fi(Mark)31 b(the)f(\014le)h(as)f(follo)m(wing)i
-(CF-1.0)g(con)m(v)m(en)m(tions.)275 997 y(This)c(functions)h(is)g
-(called)i(automatically)h(b)m(y)d(nccf)p 2081 997 28
-4 v 41 w(def)p 2241 997 V 39 w(\014le,)h(so)g(need)f(not)h(b)s(e)e
-(called)j(b)m(y)e(the)h(user)150 1106 y(if)g(nccf)p 398
-1106 V 40 w(def)p 557 1106 V 40 w(\014le)h(is)f(b)s(eing)g(called.)150
-1363 y Fh(Usage)533 1522 y Fc(int)47 b(nccf_def_convention\(int)42
-b(ncid\);)150 1706 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)
-150 1962 y Fh(Return)45 b(Co)t(des)150 2122 y Fi(This)30
-b(function)g(returns)f(zero)i(for)f(success,)h(or)f(a)h(netCDF)g(error)
-f(co)s(de)h(for)f(failure.)150 2378 y Fh(Example)150
-2628 y(1.2)68 b(Determine)47 b(if)e(a)g(File)g(Claims)i(to)e(Conform)g
-(to)h(CF)389 2761 y(Con)l(v)l(en)l(tions)150 2920 y Fi(Determine)39
-b(if)g(the)f(\014le)h(claims)g(to)g(follo)m(w)h(CF-1.0)g(con)m(v)m(en)m
-(tions.)67 b(This)37 b(function)h(only)h(c)m(hec)m(ks)h(the)150
-3030 y(global)c(\\Con)m(v)m(en)m(tions")h(attribute.)55
-b(It)35 b(do)s(es)g(not)g(lo)s(ok)g(at)h(\014le)f(metadata)i(to)e
-(ensure)f(that)i(this)f(is)g(a)150 3139 y(w)m(ell-formed)c(CF)f
-(\014le.)41 b(It)31 b(only)f(tells)i(whether)d(the)i(\014le)f(claims)i
-(to)f(b)s(e)f(a)g(CF)h(\014le.)150 3396 y Fh(Usage)533
-3555 y Fc(int)47 b(nccf_inq_convention\(int)42 b(ncid,)k(int)h
-(*cf_convention\);)150 3739 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h
-(\014le.)150 3914 y Fc(cf_conventions)630 4024 y Fi(If)36
-b(this)h(p)s(oin)m(ter)g(to)h(an)e(in)m(t)i(is)e(pro)m(vided,)j(a)e(1)g
-(is)g(written)g(there)g(if)g(this)g(\014le)f(claims)i(to)630
-4133 y(follo)m(w)32 b(CF)e(1.0)h(con)m(v)m(en)m(tions,)i(a)e(0)g
-(otherwise.)150 4390 y Fh(Return)45 b(Co)t(des)150 4549
-y Fi(This)30 b(function)g(returns)f(zero)i(for)f(success,)h(or)f(a)h
-(netCDF)g(error)f(co)s(de)h(for)f(failure.)150 4806 y
-Fh(Example)150 5071 y(1.3)68 b(Add)44 b(description)h(to)h(the)f(data)h
-(with)f(nccf)p 2629 5071 41 6 v 58 w(def)p 2864 5071
-V 60 w(\014le)150 5230 y Fi(Add)34 b(some)h(or)f(all)i(of)e(the)h(CF)f
-(recommended)h(text)g(attributes)g(to)h(a)e(\014le.)54
-b(An)m(y)34 b(parameters)h(whic)m(h)150 5340 y(are)c(set)g(to)g(NULL)f
-(will)h(b)s(e)f(ignored.)p eop end
-%%Page: 6 10
-TeXDict begin 6 9 bop 150 -116 a Fi(6)2401 b(The)30 b(CF)g(Library)g
-(Users)g(Guide)150 299 y Fh(Usage)390 458 y Fc(int)47
-b(nccf_def_file\(int)c(ncid,)j(char)h(*title,)f(char)g(*history,)g
-(char)g(*institution,)1249 568 y(char)h(*source,)e(char)i(*comment,)e
-(char)i(*references\);)150 729 y(ncid)288 b Fi(The)30
-b(ncid)g(of)g(the)h(\014le.)150 889 y Fc(title)240 b
-Fi(If)35 b(non-NULL,)g(this)h(text)g(string)g(will)f(b)s(e)g(written)h
-(as)f(the)h(CF-recommended)f(\\title")630 999 y(attribute.)150
-1159 y Fc(history)144 b Fi(If)25 b(non-NULL,)g(this)g(text)h(string)f
-(will)g(b)s(e)f(written)i(as)f(the)g(CF-recommended)g(\\history")630
-1269 y(attribute.)150 1429 y Fc(institution)630 1539
-y Fi(If)j(non-NULL,)g(this)g(text)h(string)f(will)g(b)s(e)f(written)i
-(as)f(the)g(CF-recommended)g(\\institu-)630 1648 y(tion")j(attribute.)
-150 1809 y Fc(source)192 b Fi(If)27 b(non-NULL,)h(this)f(text)i(string)
-e(will)h(b)s(e)f(written)h(as)g(the)f(CF-recommended)h(\\source")630
-1918 y(attribute.)150 2079 y Fc(comment)144 b Fi(If)36
-b(non-NULL,)h(this)g(text)h(string)f(will)g(b)s(e)f(written)h(as)g(the)
-g(CF-recommended)g(\\com-)630 2188 y(men)m(t")31 b(attribute.)150
-2349 y Fc(references)630 2458 y Fi(If)k(non-NULL,)g(this)g(text)h
-(string)f(will)h(b)s(e)e(written)i(as)f(the)g(CF-recommended)g
-(\\refer-)630 2568 y(ences")c(attribute.)150 2802 y Fh(Return)45
-b(Co)t(des)150 2961 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(a)h(netCDF)g(error)f(co)s(de)h(for)f(failure.)150
-3195 y Fh(Example)150 3453 y(1.4)68 b(Read)46 b(the)f(description)g(of)
-g(the)h(data)f(with)h(nccf)p 2902 3453 41 6 v 58 w(inq)p
-3143 3453 V 59 w(\014le)150 3612 y Fi(Read)31 b(an)m(y)f(existing)i(CF)
-e(recommended)g(text)h(attributes)g(from)f(the)h(\014le.)275
-3748 y(Recall)k(that)g(in)f(C,)f(strlens)h(do)g(not)h(include)e(the)i
-(n)m(ull)f(terminator.)52 b(T)-8 b(o)35 b(get)g(the)f(lengths)g(b)s
-(efore)150 3857 y(the)d(strings)f(\(in)h(order)f(to)h(allo)s(cated\))i
-(pass)e(NULL)f(for)g(an)m(y)h(or)g(all)g(strings)g(and)f(the)h(lengths)
-g(will)g(b)s(e)150 3967 y(returned.)40 b(Then)29 b(call)j(the)e
-(function)g(again)i(after)f(allo)s(cating)h(memory)-8
-b(.)275 4102 y(The)29 b(CF)i(v)m(ersion)g(is)f(guaran)m(teed)h(to)g(b)s
-(e)f(less)h(than)f(NC)p 2239 4102 28 4 v 40 w(MAX)p 2498
-4102 V 41 w(NAME.)275 4238 y(An)m(y)g(of)h(these)f(p)s(oin)m(ter)h
-(argumen)m(ts)f(ma)m(y)h(b)s(e)f(NULL,)h(in)f(whic)m(h)g(case)h(it)g
-(will)g(b)s(e)f(ignored.)150 4472 y Fh(Usage)390 4631
-y Fc(int)47 b(nccf_inq_file\(int)c(ncid,)j(size_t)g(*title_lenp,)f
-(char)i(*title,)1249 4741 y(size_t)f(*history_lenp,)e(char)j(*history,)
-1249 4850 y(size_t)f(*institution_lenp,)d(char)k(*institution,)1249
-4960 y(size_t)f(*source_lenp,)e(char)j(*source,)1249
-5070 y(size_t)f(*comment_lenp,)e(char)j(*comment,)1249
-5179 y(size_t)f(*references_lenp,)d(char)k(*references\);)150
-5340 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)p
-eop end
-%%Page: 7 11
-TeXDict begin 7 10 bop 150 -116 a Fi(Chapter)30 b(1:)41
-b(Files)2905 b(7)150 299 y Fc(title_lenp)630 408 y Fi(P)m(oin)m(ter)32
-b(to)f(size)p 1208 408 28 4 v 41 w(t)f(whic)m(h,)h(if)f(not)h(NULL,)f
-(will)h(get)g(the)g(length)g(of)f(the)h(title)h(attribute.)150
-575 y Fc(title)240 b Fi(P)m(oin)m(ter)24 b(to)f(c)m(har)g(arra)m(y)g
-(whic)m(h,)h(if)e(not)h(NULL,)g(will)g(get)g(the)g(title)h(string.)38
-b(Memory)23 b(m)m(ust)630 685 y(b)s(e)31 b(allo)s(cated)j(b)s(efore)d
-(this)h(function)g(is)g(called.)46 b(Call)32 b(this)g(function)g(with)f
-(a)h(NULL)g(for)630 794 y(this)e(parameter)h(to)g(get)h(the)e(size)i
-(\014rst.)150 961 y Fc(history_lenp)630 1071 y Fi(P)m(oin)m(ter)25
-b(to)f(size)p 1194 1071 V 41 w(t)f(whic)m(h,)i(if)e(not)h(NULL,)f(will)
-h(get)g(the)g(length)g(of)f(the)h(history)f(attribute.)150
-1237 y Fc(history)144 b Fi(P)m(oin)m(ter)32 b(to)g(c)m(har)f(arra)m(y)g
-(whic)m(h,)g(if)g(not)g(NULL,)g(will)g(get)h(the)g(history)e(string.)42
-b(Memory)630 1347 y(m)m(ust)25 b(b)s(e)g(allo)s(cated)i(b)s(efore)e
-(this)g(function)f(is)i(called.)40 b(Call)26 b(this)f(function)g(with)f
-(a)i(NULL)630 1456 y(for)k(this)g(parameter)h(to)g(get)h(the)e(size)i
-(\014rst.)150 1623 y Fc(institution_lenp)630 1733 y Fi(P)m(oin)m(ter)45
-b(to)f(size)p 1234 1733 V 41 w(t)g(whic)m(h,)i(if)e(not)f(NULL,)h(will)
-g(get)h(the)e(length)h(of)g(the)f(institution)630 1842
-y(attribute.)150 2009 y Fc(institution)630 2119 y Fi(P)m(oin)m(ter)29
-b(to)f(c)m(har)h(arra)m(y)f(whic)m(h,)g(if)g(not)g(NULL,)f(will)h(get)h
-(the)f(institution)g(string.)40 b(Mem-)630 2228 y(ory)34
-b(m)m(ust)g(b)s(e)g(allo)s(cated)i(b)s(efore)e(this)g(function)g(is)g
-(called.)53 b(Call)35 b(this)f(function)g(with)g(a)630
-2338 y(NULL)c(for)g(this)h(parameter)g(to)g(get)g(the)g(size)g
-(\014rst.)150 2504 y Fc(source_lenp)630 2614 y Fi(P)m(oin)m(ter)c(to)f
-(size)p 1198 2614 V 41 w(t)f(whic)m(h,)i(if)e(not)g(NULL,)h(will)g(get)
-g(the)g(length)f(of)h(the)f(source)h(attribute.)150 2781
-y Fc(source)192 b Fi(P)m(oin)m(ter)34 b(to)f(c)m(har)g(arra)m(y)h(whic)
-m(h,)f(if)g(not)f(NULL,)h(will)g(get)h(the)f(source)g(string.)47
-b(Memory)630 2890 y(m)m(ust)25 b(b)s(e)g(allo)s(cated)i(b)s(efore)e
-(this)g(function)f(is)i(called.)40 b(Call)26 b(this)f(function)g(with)f
-(a)i(NULL)630 3000 y(for)k(this)g(parameter)h(to)g(get)h(the)e(size)i
-(\014rst.)150 3167 y Fc(comment_lenp)630 3276 y Fi(P)m(oin)m(ter)38
-b(to)f(size)p 1220 3276 V 41 w(t)f(whic)m(h,)i(if)f(not)f(NULL,)h(will)
-f(get)i(the)f(length)f(of)h(the)f(commen)m(t)i(at-)630
-3386 y(tribute.)150 3552 y Fc(comment)144 b Fi(P)m(oin)m(ter)25
-b(to)g(c)m(har)f(arra)m(y)h(whic)m(h,)g(if)f(not)g(NULL,)g(will)h(get)g
-(the)f(commen)m(t)h(string.)38 b(Memory)630 3662 y(m)m(ust)25
-b(b)s(e)g(allo)s(cated)i(b)s(efore)e(this)g(function)f(is)i(called.)40
-b(Call)26 b(this)f(function)g(with)f(a)i(NULL)630 3772
-y(for)k(this)g(parameter)h(to)g(get)h(the)e(size)i(\014rst.)150
-3938 y Fc(references_lenp)630 4048 y Fi(P)m(oin)m(ter)47
-b(to)f(size)p 1238 4048 V 41 w(t)g(whic)m(h,)j(if)d(not)f(NULL,)h(will)
-g(get)h(the)e(length)h(of)g(the)g(references)630 4157
-y(attribute.)150 4324 y Fc(references)630 4434 y Fi(P)m(oin)m(ter)23
-b(to)g(c)m(har)f(arra)m(y)g(whic)m(h,)i(if)d(not)h(NULL,)g(will)h(get)g
-(the)f(references)g(string.)37 b(Memory)630 4543 y(m)m(ust)25
-b(b)s(e)g(allo)s(cated)i(b)s(efore)e(this)g(function)f(is)i(called.)40
-b(Call)26 b(this)f(function)g(with)f(a)i(NULL)630 4653
-y(for)k(this)g(parameter)h(to)g(get)h(the)e(size)i(\014rst.)150
-4896 y Fh(Return)45 b(Co)t(des)150 5056 y Fi(This)30
-b(function)g(returns)f(zero)i(for)f(success,)h(or)f(a)h(netCDF)g(error)
-f(co)s(de)h(for)f(failure.)150 5299 y Fh(Example)p eop
-end
-%%Page: 8 12
-TeXDict begin 8 11 bop 150 -116 a Fi(8)2401 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fh(1.5)68 b(App)t(end)43
-b(to)j(a)f(History)h(A)l(ttribute)150 458 y Fi(This)30
-b(function)h(app)s(ends)e(a)i(time-stamp)s(ed)h(history)f(string)g(to)g
-(the)g(history)g(attribute,)h(creating)h(the)150 568
-y(attribute)e(if)f(it)h(do)s(esn't)f(already)h(exist.)150
-800 y Fh(Usage)390 960 y Fc(int)47 b(nccf_add_history\(int)42
-b(ncid,)47 b(const)f(char)h(*history\);)150 1119 y(ncid)288
-b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150 1279 y Fc(history)144
-b Fi(The)30 b(string)g(to)h(app)s(end)e(to)i(the)g(history)f
-(attribute.)150 1511 y Fh(Return)45 b(Co)t(des)150 1670
-y Fi(This)30 b(function)g(returns)f(zero)i(for)f(success,)h(or)f(a)h
-(netCDF)g(error)f(co)s(de)h(for)f(failure.)150 1903 y
-Fh(Example)p eop end
-%%Page: 9 13
-TeXDict begin 9 12 bop 150 -116 a Fi(Chapter)30 b(2:)41
-b(V)-8 b(ariables)2727 b(9)150 299 y Ff(2)80 b(V)-13
-b(ariables)150 631 y Fh(2.1)68 b(Add)44 b(description)h(to)h(a)f(v)-7
-b(ariable)46 b(with)f(nccf)p 2708 631 41 6 v 59 w(def)p
-2944 631 V 59 w(v)-7 b(ar)150 888 y(Usage)390 1048 y
-Fc(int)47 b(nccf_def_var\(int)c(ncid,)k(int)g(varid,)f(const)g(char)h
-(*units,)1345 1157 y(const)f(char)h(*long_name,)d(const)j(char)f
-(*standard_name,)1345 1267 y(int)g(ncoord_vars,)f(int)i
-(*coord_varids\);)150 1426 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h
-(\014le.)150 1586 y Fc(varid)240 b Fi(The)30 b(v)-5 b(arid)30
-b(of)g(the)h(netCDF)g(v)-5 b(ariable)31 b(b)s(eing)f(describ)s(ed.)150
-1745 y Fc(units)240 b Fi(If)32 b(non-NULL,)g(this)g(text)h(string)f
-(will)h(b)s(e)e(written)i(as)f(the)g(CF-recommended)h(\\units")630
-1855 y(attribute.)150 2014 y Fc(long_name)630 2124 y
-Fi(If)64 b(non-NULL,)g(this)g(text)h(string)g(will)f(b)s(e)g(written)g
-(as)h(the)f(CF-recommended)630 2233 y(\\long)p 847 2233
-28 4 v 41 w(name")31 b(attribute.)150 2393 y Fc(standard_name)630
-2502 y Fi(If)36 b(non-NULL,)g(this)g(text)i(string)e(will)h(b)s(e)e
-(written)i(as)f(the)h(CF-recommended)f(\\stan-)630 2612
-y(dard)p 819 2612 V 39 w(name")31 b(attribute.)150 2771
-y Fc(ncoord_vars)630 2881 y Fi(Num)m(b)s(er)e(of)i(co)s(ordinate)g(v)-5
-b(ariables)31 b(for)f(this)g(v)-5 b(ariable.)150 3040
-y Fc(coord_varids)630 3150 y Fi(The)30 b(v)-5 b(ariable)31
-b(IDs)f(of)h(the)g(co)s(ordinate)g(v)-5 b(ariables)31
-b(for)f(this)g(v)-5 b(ariable.)150 3382 y Fh(Return)45
-b(Co)t(des)150 3542 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(a)h(netCDF)g(error)f(co)s(de)h(for)f(failure.)150
-3774 y Fh(Example)150 4032 y(2.2)68 b(Read)46 b(v)-7
-b(ariable)46 b(description)f(with)g(nccf)p 2484 4032
-41 6 v 59 w(inq)p 2726 4032 V 59 w(v)-7 b(ar)150 4191
-y Fi(Read)31 b(an)m(y)f(existing)i(CF)e(recommended)g(text)h
-(attributes)g(from)f(a)h(v)-5 b(ariable.)150 4423 y Fh(Usage)390
-4583 y Fc(int)47 b(nccf_inq_var\(int)c(ncid,)k(int)g(varid,)f(size_t)g
-(*units_lenp,)e(char)j(*units,)1201 4692 y(size_t)f(*long_name_lenp,)e
-(char)i(*long_name,)1201 4802 y(size_t)g(*standard_name_lenp,)d(char)j
-(*standard_name,)1201 4912 y(int)h(*ncoord_vars,)d(int)j
-(*coord_varids\);)150 5181 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h
-(\014le.)150 5340 y Fc(varid)240 b Fi(The)30 b(v)-5 b(arid)30
-b(of)g(the)h(netCDF)g(v)-5 b(ariable.)p eop end
-%%Page: 10 14
-TeXDict begin 10 13 bop 150 -116 a Fi(10)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fc(units_lenp)630
-408 y Fi(P)m(oin)m(ter)g(to)g(size)p 1205 408 28 4 v
-41 w(t)f(whic)m(h,)h(if)f(not)g(NULL,)g(will)g(get)i(the)e(length)g(of)
-g(the)h(units)e(attribute.)150 564 y Fc(units)240 b Fi(P)m(oin)m(ter)29
-b(to)f(c)m(har)f(arra)m(y)h(whic)m(h,)g(if)g(not)f(NULL,)h(will)f(get)i
-(the)e(long)p 2953 564 V 41 w(name)h(string.)39 b(Mem-)630
-674 y(ory)34 b(m)m(ust)g(b)s(e)g(allo)s(cated)i(b)s(efore)e(this)g
-(function)g(is)g(called.)53 b(Call)35 b(this)f(function)g(with)g(a)630
-783 y(NULL)c(for)g(this)h(parameter)g(to)g(get)g(the)g(size)g(\014rst.)
-150 939 y Fc(long_name_lenp)630 1048 y Fi(P)m(oin)m(ter)44
-b(to)g(size)p 1233 1048 V 41 w(t)g(whic)m(h,)i(if)d(not)h(NULL,)f(will)
-g(get)i(the)e(length)h(of)f(the)g(long)p 3503 1048 V
-41 w(name)630 1158 y(attribute.)150 1313 y Fc(long_name)630
-1423 y Fi(P)m(oin)m(ter)29 b(to)f(c)m(har)f(arra)m(y)h(whic)m(h,)g(if)g
-(not)f(NULL,)h(will)f(get)i(the)e(long)p 2953 1423 V
-41 w(name)h(string.)39 b(Mem-)630 1532 y(ory)34 b(m)m(ust)g(b)s(e)g
-(allo)s(cated)i(b)s(efore)e(this)g(function)g(is)g(called.)53
-b(Call)35 b(this)f(function)g(with)g(a)630 1642 y(NULL)c(for)g(this)h
-(parameter)g(to)g(get)g(the)g(size)g(\014rst.)150 1798
-y Fc(standard_name_lenp)630 1907 y Fi(P)m(oin)m(ter)g(to)f(size)p
-1206 1907 V 41 w(t)f(whic)m(h,)h(if)f(not)h(NULL,)f(will)h(get)g(the)g
-(length)g(of)f(the)h(standard)p 3505 1907 V 39 w(name)630
-2017 y(attribute.)150 2172 y Fc(standard_name)630 2282
-y Fi(P)m(oin)m(ter)36 b(to)f(c)m(har)g(arra)m(y)g(whic)m(h,)h(if)e(not)
-h(NULL,)g(will)f(get)i(the)f(standard)p 3217 2282 V 39
-w(name)g(string.)630 2391 y(Memory)25 b(m)m(ust)f(b)s(e)g(allo)s(cated)
-j(b)s(efore)d(this)g(function)g(is)h(called.)40 b(Call)25
-b(this)f(function)g(with)630 2501 y(a)31 b(NULL)f(for)g(this)g
-(parameter)h(to)g(get)h(the)f(size)g(\014rst.)150 2656
-y Fc(ncoord_vars)630 2766 y Fi(P)m(oin)m(ter)36 b(to)g(an)e(in)m
-(teger,)k(whic)m(h,)d(if)g(non-NULL,)g(will)g(get)h(the)f(n)m(um)m(b)s
-(er)e(of)i(co)s(ordinate)630 2876 y(v)-5 b(ariables)31
-b(iden)m(ti\014ed)f(in)h(the)f(\\co)s(ordinates")i(attribute.)150
-3031 y Fc(coord_varids)630 3141 y Fi(P)m(oin)m(ter)46
-b(to)f(an)g(arra)m(y)g(of)g(in)m(teger,)50 b(whic)m(h,)e(if)d
-(non-NULL,)g(will)g(b)s(e)f(\014lled)g(with)h(the)630
-3250 y(v)-5 b(ariable)31 b(IDs)g(of)f(the)h(v)-5 b(ariables)31
-b(listed)g(in)m(t)g(he)f(\\co)s(ordinates")i(attribute.)150
-3479 y Fh(Return)45 b(Co)t(des)150 3638 y Fi(This)30
-b(function)g(returns)f(zero)i(for)f(success,)h(or)f(a)h(netCDF)g(error)
-f(co)s(de)h(for)f(failure.)150 3867 y Fh(Example)150
-4107 y(2.3)68 b(De\014ne)45 b(missing)h(data)f(v)-7 b(alues)46
-b(for)f(a)g(v)-7 b(ariable)46 b(with)389 4240 y(nccf)p
-634 4240 41 6 v 59 w(def)p 870 4240 V 59 w(v)-7 b(ar)p
-1113 4240 V 59 w(missing)150 4399 y Fi(nccf)p 315 4399
-28 4 v 40 w(def)p 474 4399 V 40 w(notes)275 4531 y(This)29
-b(function)h(sets)h(the)g(\\\014ll)p 1325 4531 V 40 w(v)-5
-b(alue",)32 b(\\v)-5 b(alid)p 1905 4531 V 40 w(min",)31
-b(and)f(\\v)-5 b(alid)p 2609 4531 V 41 w(max")30 b(attributes.)150
-4760 y Fh(Usage)390 4919 y Fc(int)47 b(nccf_def_var_missing\(int)41
-b(ncid,)46 b(int)h(varid,)f(const)h(void)f(*fill_valuep,)1726
-5029 y(const)h(void)f(*valid_minp,)f(const)h(void)h(*valid_maxp\);)150
-5184 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-5340 y Fc(varid)240 b Fi(The)30 b(v)-5 b(arid)30 b(of)g(the)h(netCDF)g
-(v)-5 b(ariable)31 b(b)s(eing)f(describ)s(ed.)p eop end
-%%Page: 11 15
-TeXDict begin 11 14 bop 150 -116 a Fi(Chapter)30 b(2:)41
-b(V)-8 b(ariables)2681 b(11)150 299 y Fc(fill_valuep)630
-408 y Fi(If)35 b(non-NULL,)g(this)g(will)g(p)s(oin)m(t)g(to)h(a)g(v)-5
-b(alue)35 b(of)h(the)f(same)g(t)m(yp)s(e)h(as)f(this)g(v)-5
-b(arid,)36 b(whic)m(h)630 518 y(will)31 b(b)s(e)e(used)h(as)h(the)f
-(\014ll)p 1508 518 28 4 v 40 w(v)-5 b(alue)31 b(for)f(the)h(data.)150
-669 y Fc(valid_minp)630 778 y Fi(If)k(non-NULL,)g(this)g(will)g(p)s
-(oin)m(t)g(to)h(a)g(v)-5 b(alue)35 b(of)h(the)f(same)g(t)m(yp)s(e)h(as)
-f(this)g(v)-5 b(arid,)36 b(whic)m(h)630 888 y(will)g(b)s(e)f(written)h
-(as)g(the)g(\\v)-5 b(alid)p 1779 888 V 41 w(min")35 b(attribute.)58
-b(If)35 b(this)h(parameter)g(is)g(non-NULL,)630 998 y(v)-5
-b(alid)p 825 998 V 40 w(max)31 b(m)m(ust)f(also)h(b)s(e)f(pro)m(vided.)
-150 1148 y Fc(valid_maxp)630 1258 y Fi(If)35 b(non-NULL,)g(this)g(will)
-g(p)s(oin)m(t)g(to)h(a)g(v)-5 b(alue)35 b(of)h(the)f(same)g(t)m(yp)s(e)
-h(as)f(this)g(v)-5 b(arid,)36 b(whic)m(h)630 1368 y(will)f(b)s(e)e
-(written)i(as)g(the)f(\\v)-5 b(alid)p 1772 1368 V 41
-w(max")35 b(attribute.)53 b(If)34 b(this)h(parameter)g(is)f(non-NULL,)
-630 1477 y(v)-5 b(alid)p 825 1477 V 40 w(min)30 b(m)m(ust)g(also)i(b)s
-(e)e(pro)m(vided.)150 1701 y Fh(Return)45 b(Co)t(des)150
-1860 y Fi(This)30 b(function)g(returns)f(zero)i(for)f(success,)h(or)f
-(an)h(error)f(co)s(de)g(for)g(failure.)150 2084 y Fh(Example)150
-2322 y(2.4)68 b(Learn)45 b(ab)t(out)g(missing)h(data)f(settings)i(with)
-389 2455 y(nccf)p 634 2455 41 6 v 59 w(inq)p 876 2455
-V 59 w(v)-7 b(ar)p 1119 2455 V 59 w(missing)150 2614
-y Fi(Get)32 b(attributes)f(whic)m(h)f(de\014ne)g(missing)h(data)g
-(information.)42 b(If)31 b(the)g(attributes)g(are)g(not)g(there,)g
-(then)150 2724 y(pro)m(vide)f(the)h(v)-5 b(alid)31 b(data)g(an)m(yw)m
-(a)m(y)-8 b(,)32 b(based)e(on)h(netCDF)g(defaults.)150
-2947 y Fh(Usage)390 3107 y Fc(int)47 b(nccf_inq_var_missing\(int)41
-b(ncid,)46 b(int)h(varid,)f(void)h(*fill_valuep,)1726
-3216 y(void)g(*valid_minp,)d(void)j(*valid_maxp\);)150
-3367 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-3518 y Fc(varid)240 b Fi(The)30 b(v)-5 b(arid)30 b(of)g(the)h(netCDF)g
-(v)-5 b(ariable.)150 3669 y Fc(fill_valuep)630 3778 y
-Fi(If)28 b(this)h(is)f(not)h(NULL,)g(the)g(\014ll)g(v)-5
-b(alue)29 b(of)g(the)g(v)-5 b(ariable)29 b(will)g(b)s(e)f(written)h(at)
-g(this)g(address)630 3888 y(b)m(y)34 b(nccf)p 925 3888
-28 4 v 40 w(inq)p 1089 3888 V 40 w(v)-5 b(ar)p 1253 3888
-V 40 w(missing.)52 b(If)34 b(the)h(\014ll)f(v)-5 b(alue)35
-b(w)m(as)f(not)h(de\014ned)e(for)h(the)g(v)-5 b(ariable,)37
-b(the)630 3998 y(netCDF)31 b(default)g(v)-5 b(alue)30
-b(will)h(b)s(e)f(used.)150 4148 y Fc(valid_minp)630 4258
-y Fi(If)44 b(this)g(is)g(not)h(NULL,)f(the)h(v)-5 b(alid)p
-1892 4258 V 40 w(min)44 b(v)-5 b(alue)45 b(of)f(the)h(v)-5
-b(ariable)45 b(will)f(b)s(e)g(written)g(at)630 4368 y(this)33
-b(address)f(b)m(y)g(nccf)p 1430 4368 V 41 w(inq)p 1595
-4368 V 39 w(v)-5 b(ar)p 1758 4368 V 40 w(missing.)48
-b(If)33 b(the)g(v)-5 b(alid)p 2607 4368 V 40 w(min)32
-b(w)m(as)h(not)h(de\014ned)d(for)i(the)630 4477 y(v)-5
-b(ariable,)31 b(the)g(netCDF)g(default)g(v)-5 b(alue)30
-b(will)h(b)s(e)f(used.)150 4628 y Fc(valid_maxp)630 4738
-y Fi(If)g(this)g(is)h(not)f(NULL,)h(the)f(v)-5 b(alid)p
-1808 4738 V 41 w(max)30 b(v)-5 b(alue)31 b(of)f(the)h(v)-5
-b(ariable)31 b(will)g(b)s(e)f(written)g(at)h(this)630
-4847 y(address)25 b(b)m(y)h(nccf)p 1237 4847 V 40 w(inq)p
-1401 4847 V 40 w(v)-5 b(ar)p 1565 4847 V 40 w(missing.)39
-b(If)26 b(the)g(v)-5 b(alid)p 2391 4847 V 41 w(max)26
-b(v)-5 b(alue)27 b(w)m(as)f(not)h(de\014ned)e(for)h(the)630
-4957 y(v)-5 b(ariable,)31 b(the)g(netCDF)g(default)g(v)-5
-b(alue)30 b(will)h(b)s(e)f(used.)150 5181 y Fh(Return)45
-b(Co)t(des)150 5340 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)p
-eop end
-%%Page: 12 16
-TeXDict begin 12 15 bop 150 -116 a Fi(12)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fh(Example)150
-538 y(2.5)68 b(Add)44 b(CF-Recommended)h(Metadata)h(to)g(a)f(File)g(or)
-g(V)-11 b(ariable)389 671 y(with)150 831 y Fi(nccf)p
-315 831 28 4 v 40 w(def)p 474 831 V 40 w(notes)275 963
-y(This)35 b(functions)h(writes)h(up)e(to)i(four)f(text)h(attributes)g
-(for)g(either)g(a)f(v)-5 b(ariable,)39 b(or)e(an)f(en)m(tire)i(\014le.)
-150 1072 y(These)44 b(text)g(attributes,)k(\\institution,")h
-(\\source,")f(\\commen)m(t,")i(and)43 b(\\references")i(are)f(recom-)
-150 1182 y(mended)29 b(b)m(y)i(the)f(CF)h(Metadata)h(Con)m(v)m(en)m
-(tion.)150 1410 y Fh(Usage)390 1569 y Fc(int)47 b(nccf_def_notes\(int)c
-(ncid,)j(int)h(varid,)f(char)h(*units,)f(char)g(*long_name,)1297
-1679 y(char)g(*standard_name,)e(char)j(*institution,)1297
-1789 y(char)f(*source,)g(char)h(*comment,)e(char)i(*references\);)150
-1943 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-2098 y Fc(varid)240 b Fi(The)36 b(v)-5 b(arid)36 b(of)g(the)h(netCDF)f
-(v)-5 b(ariable)37 b(b)s(eing)f(describ)s(ed.)57 b(Use)37
-b(NC)p 3061 2098 V 40 w(GLOBAL)f(if)h(y)m(ou)630 2208
-y(wish)30 b(these)g(attributes)h(to)g(apply)f(to)i(the)e(en)m(tire)h
-(\014le.)150 2363 y Fc(institution)630 2472 y Fi(If)d(non-NULL,)g(this)
-g(text)h(string)f(will)g(b)s(e)f(written)i(as)f(the)g(CF-recommended)g
-(\\institu-)630 2582 y(tion")j(attribute.)150 2737 y
-Fc(source)192 b Fi(If)27 b(non-NULL,)h(this)f(text)i(string)e(will)h(b)
-s(e)f(written)h(as)g(the)f(CF-recommended)h(\\source")630
-2846 y(attribute.)150 3001 y Fc(comment)144 b Fi(If)36
-b(non-NULL,)h(this)g(text)h(string)f(will)g(b)s(e)f(written)h(as)g(the)
-g(CF-recommended)g(\\com-)630 3111 y(men)m(t")31 b(attribute.)150
-3265 y Fc(references)630 3375 y Fi(If)k(non-NULL,)g(this)g(text)h
-(string)f(will)h(b)s(e)e(written)i(as)f(the)g(CF-recommended)g
-(\\refer-)630 3485 y(ences")c(attribute.)150 3713 y Fh(Return)45
-b(Co)t(des)150 3872 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(a)h(netCDF)g(error)f(co)s(de)h(for)f(failure.)150
-4100 y Fh(Example)150 4355 y(2.6)68 b(Read)46 b(v)-7
-b(ariable)46 b(description)f(with)g(nccf)p 2484 4355
-41 6 v 59 w(inq)p 2726 4355 V 59 w(notes)150 4514 y Fi(Read)31
-b(an)m(y)f(existing)i(CF)e(recommended)g(text)h(attributes)g(from)f(a)h
-(v)-5 b(ariable.)150 4742 y Fh(Usage)390 4902 y Fc(int)47
-b(nccf_inq_notes\(int)c(ncid,)j(int)h(varid,)1297 5011
-y(size_t)f(*institution_lenp,)d(char)j(*institution,)1297
-5121 y(size_t)g(*source_lenp,)e(char)j(*source,)1297
-5230 y(size_t)f(*comment_lenp,)e(char)i(*comment,)1297
-5340 y(size_t)g(*references_lenp,)d(char)k(*references\);)p
-eop end
-%%Page: 13 17
-TeXDict begin 13 16 bop 150 -116 a Fi(Chapter)30 b(2:)41
-b(V)-8 b(ariables)2681 b(13)150 299 y Fc(ncid)288 b Fi(The)30
-b(ncid)g(of)g(the)h(\014le.)150 447 y Fc(varid)240 b
-Fi(The)30 b(v)-5 b(arid)30 b(of)g(the)h(netCDF)g(v)-5
-b(ariable.)150 596 y Fc(institution_lenp)630 706 y Fi(P)m(oin)m(ter)45
-b(to)f(size)p 1234 706 28 4 v 41 w(t)g(whic)m(h,)i(if)e(not)f(NULL,)h
-(will)g(get)h(the)e(length)h(of)g(the)f(institution)630
-815 y(attribute.)150 964 y Fc(institution)630 1073 y
-Fi(P)m(oin)m(ter)29 b(to)f(c)m(har)h(arra)m(y)f(whic)m(h,)g(if)g(not)g
-(NULL,)f(will)h(get)h(the)f(institution)g(string.)40
-b(Mem-)630 1183 y(ory)34 b(m)m(ust)g(b)s(e)g(allo)s(cated)i(b)s(efore)e
-(this)g(function)g(is)g(called.)53 b(Call)35 b(this)f(function)g(with)g
-(a)630 1292 y(NULL)c(for)g(this)h(parameter)g(to)g(get)g(the)g(size)g
-(\014rst.)150 1441 y Fc(source_lenp)630 1551 y Fi(P)m(oin)m(ter)c(to)f
-(size)p 1198 1551 V 41 w(t)f(whic)m(h,)i(if)e(not)g(NULL,)h(will)g(get)
-g(the)g(length)f(of)h(the)f(source)h(attribute.)150 1699
-y Fc(source)192 b Fi(P)m(oin)m(ter)34 b(to)f(c)m(har)g(arra)m(y)h(whic)
-m(h,)f(if)g(not)f(NULL,)h(will)g(get)h(the)f(source)g(string.)47
-b(Memory)630 1809 y(m)m(ust)25 b(b)s(e)g(allo)s(cated)i(b)s(efore)e
-(this)g(function)f(is)i(called.)40 b(Call)26 b(this)f(function)g(with)f
-(a)i(NULL)630 1918 y(for)k(this)g(parameter)h(to)g(get)h(the)e(size)i
-(\014rst.)150 2067 y Fc(comment_lenp)630 2177 y Fi(P)m(oin)m(ter)38
-b(to)f(size)p 1220 2177 V 41 w(t)f(whic)m(h,)i(if)f(not)f(NULL,)h(will)
-f(get)i(the)f(length)f(of)h(the)f(commen)m(t)i(at-)630
-2286 y(tribute.)150 2435 y Fc(comment)144 b Fi(P)m(oin)m(ter)25
-b(to)g(c)m(har)f(arra)m(y)h(whic)m(h,)g(if)f(not)g(NULL,)g(will)h(get)g
-(the)f(commen)m(t)h(string.)38 b(Memory)630 2544 y(m)m(ust)25
-b(b)s(e)g(allo)s(cated)i(b)s(efore)e(this)g(function)f(is)i(called.)40
-b(Call)26 b(this)f(function)g(with)f(a)i(NULL)630 2654
-y(for)k(this)g(parameter)h(to)g(get)h(the)e(size)i(\014rst.)150
-2802 y Fc(references_lenp)630 2912 y Fi(P)m(oin)m(ter)47
-b(to)f(size)p 1238 2912 V 41 w(t)g(whic)m(h,)j(if)d(not)f(NULL,)h(will)
-g(get)h(the)e(length)h(of)g(the)g(references)630 3022
-y(attribute.)150 3170 y Fc(references)630 3280 y Fi(P)m(oin)m(ter)23
-b(to)g(c)m(har)f(arra)m(y)g(whic)m(h,)i(if)d(not)h(NULL,)g(will)h(get)g
-(the)f(references)g(string.)37 b(Memory)630 3389 y(m)m(ust)25
-b(b)s(e)g(allo)s(cated)i(b)s(efore)e(this)g(function)f(is)i(called.)40
-b(Call)26 b(this)f(function)g(with)f(a)i(NULL)630 3499
-y(for)k(this)g(parameter)h(to)g(get)h(the)e(size)i(\014rst.)150
-3720 y Fh(Return)45 b(Co)t(des)150 3880 y Fi(This)30
-b(function)g(returns)f(zero)i(for)f(success,)h(or)f(a)h(netCDF)g(error)
-f(co)s(de)h(for)f(failure.)150 4102 y Fh(Example)150
-4338 y(2.7)68 b(De\014ne)45 b(a)g(co)t(ordinate)h(v)-7
-b(ariable)46 b(and)e(dimension)i(for)f(latitude)389 4471
-y(with)g(nccf)p 940 4471 41 6 v 59 w(def)p 1176 4471
-V 59 w(latitude)150 4630 y Fi(De\014ne)31 b(a)h(co)s(ordinate)g(v)-5
-b(ariable)32 b(and)e(dimension)h(with)g(all)h(the)f(CF)g(recommended)g
-(attribute)h(acces-)150 4740 y(sories)f(for)f(latitude.)150
-4961 y Fh(Usage)390 5121 y Fc(int)47 b(nccf_def_latitude\(int)42
-b(ncid,)k(size_t)g(len,)h(nc_type)f(xtype,)1583 5230
-y(const)h(char)f(*formula_terms,)e(int)j(*lat_dimidp,)1583
-5340 y(int)g(*lat_varidp\);)p eop end
-%%Page: 14 18
-TeXDict begin 14 17 bop 150 -116 a Fi(14)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fc(ncid)288
-b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150 467 y Fc(len)336
-b Fi(The)30 b(length)h(of)f(this)g(co)s(ordinate)i(dimension.)150
-636 y Fc(xtype)240 b Fi(The)30 b(t)m(yp)s(e)g(of)h(this)f(co)s
-(ordinate)h(v)-5 b(ariable.)150 805 y Fc(formula_terms)630
-914 y Fi(If)33 b(non-NULL,)g(a)g(string)g(whic)m(h)g(will)g(b)s(e)f
-(written)i(as)f(the)g(\\form)m(ula)p 3060 914 28 4 v
-41 w(terms")g(attribute)630 1024 y(on)d(the)h(co)s(ordinate)g(v)-5
-b(ariable.)150 1192 y Fc(lat_dimidp)630 1302 y Fi(If)45
-b(non-NULL,)g(nccf)p 1398 1302 V 40 w(def)p 1557 1302
-V 39 w(latitude)h(will)g(write)f(the)g(dimension)g(ID)g(of)g(the)g
-(netCDF)630 1412 y(dimension)30 b(for)g(the)h(latitude)g(here.)150
-1580 y Fc(lat_varidp)630 1690 y Fi(If)f(non-NULL,)h(nccf)p
-1369 1690 V 40 w(def)p 1528 1690 V 40 w(latitude)h(will)f(write)g(the)g
-(v)-5 b(ariable)32 b(ID)f(of)g(the)g(netCDF)g(co)s(or-)630
-1799 y(dinate)g(v)-5 b(ariable)31 b(for)f(the)h(latitude)g(here.)150
-2046 y Fh(Return)45 b(Co)t(des)150 2205 y Fi(This)30
-b(function)g(returns)f(zero)i(for)f(success,)h(or)f(an)h(error)f(co)s
-(de)g(for)g(failure.)150 2451 y Fh(Example)150 2698 y(2.8)68
-b(Learn)45 b(ab)t(out)g(a)g(latitude)i(co)t(ordinate)e(v)-7
-b(ariable)46 b(and)389 2830 y(dimension)g(with)150 2990
-y Fi(nccf)p 315 2990 V 40 w(inq)p 479 2990 V 40 w(latitude)275
-3134 y(Inquire)29 b(ab)s(out)h(a)h(latitude)g(dimension)f(and)g(co)s
-(ordinate)h(v)-5 b(ariable.)150 3380 y Fh(Usage)390 3539
-y Fc(int)47 b(nccf_inq_latitude\(int)42 b(ncid,)k(size_t)g(*lenp,)g
-(nc_type)g(*xtypep,)1583 3649 y(size_t)g(*ft_lenp,)g(char)g
-(*formula_terms,)1583 3758 y(int)h(*lat_dimidp,)e(int)h(*lat_varidp\);)
-150 3931 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-4100 y Fc(lenp)288 b Fi(If)45 b(non-NULL,)g(the)g(length)h(of)f(the)g
-(latitude)h(dimension)f(will)g(b)s(e)g(written)g(here)g(b)m(y)630
-4210 y(nccf)p 795 4210 V 40 w(inq)p 959 4210 V 40 w(latitude.)150
-4378 y Fc(xtypep)192 b Fi(If)30 b(non-NULL,)g(the)h(t)m(yp)s(e)f(of)h
-(the)f(co)s(ordinate)i(v)-5 b(ariable)31 b(will)g(b)s(e)e(written)i
-(here.)150 4547 y Fc(ft_lenp)144 b Fi(If)32 b(non-NULL,)g(the)g(length)
-g(of)h(the)f(v)-5 b(alue)33 b(of)f(the)g(\\form)m(ula)p
-2762 4547 V 41 w(terms")g(attribute)h(will)g(b)s(e)630
-4656 y(written)h(here)f(b)m(y)h(ft)p 1351 4656 V 40 w(lenp.)50
-b(If)34 b(there)f(is)h(no)g(\\form)m(ula)p 2536 4656
-V 40 w(terms")h(attribute,)g(zero)g(will)f(b)s(e)630
-4766 y(written.)150 4935 y Fc(lat_dimidp)630 5044 y Fi(If)c(non-NULL,)g
-(the)h(dimid)e(of)i(the)f(latitude)i(dimension)e(will)g(b)s(e)g
-(written)h(here.)150 5213 y Fc(lat_varidp)630 5322 y
-Fi(If)c(non-NULL,)h(the)g(v)-5 b(arid)27 b(of)h(the)g(latitude)g(co)s
-(ordinate)h(v)-5 b(ariable)28 b(will)g(b)s(e)f(written)h(here.)p
-eop end
-%%Page: 15 19
-TeXDict begin 15 18 bop 150 -116 a Fi(Chapter)30 b(2:)41
-b(V)-8 b(ariables)2681 b(15)150 299 y Fh(Return)45 b(Co)t(des)150
-458 y Fi(This)30 b(function)g(returns)f(zero)i(for)f(success,)h(or)f
-(an)h(error)f(co)s(de)g(for)g(failure.)150 741 y Fh(Example)150
-1000 y(2.9)68 b(De\014ne)45 b(a)g(co)t(ordinate)h(v)-7
-b(ariable)46 b(and)e(dimension)i(for)f(longitude)389
-1133 y(with)g(nccf)p 940 1133 41 6 v 59 w(def)p 1176
-1133 V 59 w(longitude)150 1292 y Fi(De\014ne)31 b(a)h(co)s(ordinate)g
-(v)-5 b(ariable)32 b(and)e(dimension)h(with)g(all)h(the)f(CF)g
-(recommended)g(attribute)h(acces-)150 1402 y(sories)f(for)f(longitude.)
-150 1685 y Fh(Usage)390 1844 y Fc(int)47 b(nccf_def_longitude\(int)42
-b(ncid,)k(size_t)g(len,)h(nc_type)f(xtype,)1583 1954
-y(const)h(char)f(*formula_terms,)e(int)j(*lon_dimidp,)1583
-2063 y(int)g(*lon_varidp\);)150 2273 y(ncid)288 b Fi(The)30
-b(ncid)g(of)g(the)h(\014le.)150 2466 y Fc(len)336 b Fi(The)30
-b(length)h(of)f(this)g(co)s(ordinate)i(dimension.)150
-2659 y Fc(xtype)240 b Fi(The)30 b(t)m(yp)s(e)g(of)h(this)f(co)s
-(ordinate)h(v)-5 b(ariable.)150 2852 y Fc(formula_terms)630
-2962 y Fi(If)33 b(non-NULL,)g(a)g(string)g(whic)m(h)g(will)g(b)s(e)f
-(written)i(as)f(the)g(\\form)m(ula)p 3060 2962 28 4 v
-41 w(terms")g(attribute)630 3071 y(on)d(the)h(co)s(ordinate)g(v)-5
-b(ariable.)150 3264 y Fc(lon_dimidp)630 3374 y Fi(If)39
-b(non-NULL,)f(nccf)p 1385 3374 V 41 w(def)p 1545 3374
-V 39 w(longitude)i(will)f(write)g(the)g(dimension)g(ID)g(of)g(the)g
-(netCDF)630 3484 y(dimension)30 b(for)g(the)h(longitude)f(here.)150
-3677 y Fc(lon_varidp)630 3786 y Fi(If)i(non-NULL,)h(nccf)p
-1373 3786 V 40 w(def)p 1532 3786 V 40 w(longitude)h(will)f(write)g(the)
-g(v)-5 b(ariable)34 b(ID)f(of)g(the)g(netCDF)h(co-)630
-3896 y(ordinate)d(v)-5 b(ariable)31 b(for)f(the)h(longitude)g(here.)150
-4179 y Fh(Return)45 b(Co)t(des)150 4338 y Fi(This)30
-b(function)g(returns)f(zero)i(for)f(success,)h(or)f(an)h(error)f(co)s
-(de)g(for)g(failure.)150 4621 y Fh(Example)150 4880 y(2.10)68
-b(Learn)45 b(ab)t(out)g(a)h(longitude)f(co)t(ordinate)h(v)-7
-b(ariable)46 b(and)456 5012 y(dimension)g(with)150 5172
-y Fi(nccf)p 315 5172 V 40 w(inq)p 479 5172 V 40 w(longitude)275
-5340 y(Inquire)29 b(ab)s(out)h(a)h(longitude)g(dimension)f(and)f(co)s
-(ordinate)j(v)-5 b(ariable.)p eop end
-%%Page: 16 20
-TeXDict begin 16 19 bop 150 -116 a Fi(16)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fh(Usage)390
-458 y Fc(int)47 b(nccf_inq_longitude\(int)42 b(ncid,)k(size_t)g(*lenp,)
-g(nc_type)g(*xtypep,)1583 568 y(size_t)g(*ft_lenp,)g(char)g
-(*formula_terms,)1583 677 y(int)h(*lon_dimidp,)e(int)h(*lon_varidp\);)
-150 829 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-981 y Fc(lenp)288 b Fi(If)40 b(non-NULL,)g(the)g(length)g(of)h(the)f
-(longitude)h(dimension)e(will)i(b)s(e)e(written)h(here)g(b)m(y)630
-1091 y(nccf)p 795 1091 28 4 v 40 w(inq)p 959 1091 V 40
-w(longitude.)150 1243 y Fc(xtypep)192 b Fi(If)30 b(non-NULL,)g(the)h(t)
-m(yp)s(e)f(of)h(the)f(co)s(ordinate)i(v)-5 b(ariable)31
-b(will)g(b)s(e)e(written)i(here.)150 1395 y Fc(ft_lenp)144
-b Fi(If)32 b(non-NULL,)g(the)g(length)g(of)h(the)f(v)-5
-b(alue)33 b(of)f(the)g(\\form)m(ula)p 2762 1395 V 41
-w(terms")g(attribute)h(will)g(b)s(e)630 1504 y(written)h(here)f(b)m(y)h
-(ft)p 1351 1504 V 40 w(lenp.)50 b(If)34 b(there)f(is)h(no)g(\\form)m
-(ula)p 2536 1504 V 40 w(terms")h(attribute,)g(zero)g(will)f(b)s(e)630
-1614 y(written.)150 1766 y Fc(lon_dimidp)630 1876 y Fi(If)c(non-NULL,)g
-(the)h(dimid)e(of)i(the)f(longitude)h(dimension)f(will)h(b)s(e)f
-(written)g(here.)150 2027 y Fc(lon_varidp)630 2137 y
-Fi(If)22 b(non-NULL,)h(the)f(v)-5 b(arid)23 b(of)f(the)h(longitude)g
-(co)s(ordinate)h(v)-5 b(ariable)23 b(will)g(b)s(e)f(written)h(here.)150
-2362 y Fh(Return)45 b(Co)t(des)150 2521 y Fi(This)30
-b(function)g(returns)f(zero)i(for)f(success,)h(or)f(an)h(error)f(co)s
-(de)g(for)g(failure.)150 2746 y Fh(Example)150 2985 y(2.11)68
-b(De\014ne)45 b(a)h(co)t(ordinate)f(v)-7 b(ariable)46
-b(and)f(dimension)g(for)g(lev)l(el)456 3117 y(with)h(nccf)p
-1008 3117 41 6 v 58 w(def)p 1243 3117 V 60 w(lvl)150
-3277 y Fi(De\014ne)31 b(a)h(co)s(ordinate)g(v)-5 b(ariable)32
-b(and)e(dimension)h(with)g(all)h(the)f(CF)g(recommended)g(attribute)h
-(acces-)150 3386 y(sories)f(for)f(a)h(v)m(ertical)h(lev)m(el.)150
-3611 y Fh(Usage)390 3771 y Fc(int)47 b(nccf_def_lvl\(int)c(ncid,)k
-(const)f(char)h(*name,)f(size_t)g(len,)g(nc_type)g(xtype,)1201
-3880 y(const)h(char)f(*units,)g(int)h(positive_up,)e(const)h(char)h
-(*standard_name,)1201 3990 y(const)g(char)f(*long_name,)f(const)h(char)
-h(*formula_terms,)1201 4100 y(int)g(*lvl_dimidp,)e(int)i
-(*lvl_varidp\);)150 4252 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h
-(\014le.)150 4403 y Fc(name)288 b Fi(The)30 b(name)g(of)h(the)f(co)s
-(ordinate)i(dimension)d(and)h(v)-5 b(ariable.)150 4555
-y Fc(len)336 b Fi(The)30 b(length)h(of)f(this)g(co)s(ordinate)i
-(dimension)d(and)h(v)-5 b(ariable.)150 4707 y Fc(xtype)240
-b Fi(The)30 b(t)m(yp)s(e)g(of)h(this)f(co)s(ordinate)h(v)-5
-b(ariable.)150 4859 y Fc(units)240 b Fi(If)39 b(non-NULL,)g(a)h(string)
-f(whic)m(h)g(will)g(b)s(e)g(written)g(as)h(the)f(\\units")h(attribute)g
-(on)f(the)630 4969 y(co)s(ordinate)31 b(v)-5 b(ariable.)150
-5121 y Fc(positive_up)630 5230 y Fi(Set)31 b(to)h(0)f(and)g(the)g
-(attribute)h(\\p)s(ositiv)m(e")g(to)g(\\do)m(wn".)43
-b(Set)31 b(to)h(an)m(y)f(other)h(v)-5 b(alue)31 b(to)h(get)630
-5340 y(\\up".)p eop end
-%%Page: 17 21
-TeXDict begin 17 20 bop 150 -116 a Fi(Chapter)30 b(2:)41
-b(V)-8 b(ariables)2681 b(17)150 299 y Fc(standard_name)630
-408 y Fi(If)29 b(non-NULL,)h(a)g(string)g(whic)m(h)g(will)g(b)s(e)f
-(written)h(as)g(the)g(\\standard)p 3075 408 28 4 v 40
-w(name")g(attribute)630 518 y(on)g(the)h(co)s(ordinate)g(v)-5
-b(ariable.)150 670 y Fc(long_name)630 780 y Fi(If)34
-b(non-NULL,)h(a)g(string)f(whic)m(h)g(will)h(b)s(e)f(written)h(as)g
-(the)g(\\long)p 2939 780 V 41 w(name")g(attribute)g(on)630
-889 y(the)c(co)s(ordinate)g(v)-5 b(ariable.)150 1042
-y Fc(lon_dimidp)630 1151 y Fi(If)23 b(non-NULL,)h(nccf)p
-1355 1151 V 40 w(def)p 1514 1151 V 40 w(lvl)g(will)g(write)g(the)g
-(dimension)f(ID)g(of)h(the)g(netCDF)h(dimension)630 1261
-y(for)30 b(the)h(lev)m(el)h(here.)150 1413 y Fc(lon_varidp)630
-1523 y Fi(If)e(non-NULL,)g(nccf)p 1368 1523 V 40 w(def)p
-1527 1523 V 40 w(lvl)g(will)h(write)f(the)g(v)-5 b(ariable)31
-b(ID)g(of)f(the)g(netCDF)h(co)s(ordinate)630 1632 y(v)-5
-b(ariable)31 b(for)f(the)h(lev)m(el)h(here.)150 1857
-y Fh(Return)45 b(Co)t(des)150 2017 y Fi(This)30 b(function)g(returns)f
-(zero)i(for)f(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)150
-2242 y Fh(Example)150 2480 y(2.12)68 b(Learn)45 b(ab)t(out)g(a)h(lev)l
-(el)g(co)t(ordinate)g(v)-7 b(ariable)46 b(and)e(dimension)456
-2613 y(with)150 2773 y Fi(nccf)p 315 2773 V 40 w(inq)p
-479 2773 V 40 w(lvl)275 2904 y(Inquire)29 b(ab)s(out)h(a)h(lev)m(el)h
-(dimension)e(and)f(co)s(ordinate)j(v)-5 b(ariable.)150
-3129 y Fh(Usage)390 3288 y Fc(int)47 b(nccf_inq_lvl\(int)c(ncid,)k
-(char)f(*name,)g(size_t)g(*lenp,)h(nc_type)e(*xtypep,)1201
-3398 y(size_t)h(*ft_lenp,)g(char)g(*formula_terms,)e(int)j
-(*positive_upp,)1201 3507 y(int)g(*lvl_dimidp,)e(int)i(*lvl_varidp\);)
-150 3660 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-3812 y Fc(name)288 b Fi(If)34 b(non-NULL,)h(the)g(name)g(of)g(this)f(v)
-m(ertical)j(lev)m(el)g(dimension)d(\(and)h(v)-5 b(ariable\))35
-b(will)h(b)s(e)630 3921 y(written)30 b(here.)150 4074
-y Fc(lenp)288 b Fi(If)56 b(non-NULL,)g(the)g(length)g(of)h(the)f(lev)m
-(el)i(dimension)d(will)i(b)s(e)e(written)h(here)g(b)m(y)630
-4183 y(nccf)p 795 4183 V 40 w(inq)p 959 4183 V 40 w(lvl.)150
-4335 y Fc(xtypep)192 b Fi(If)30 b(non-NULL,)g(the)h(t)m(yp)s(e)f(of)h
-(the)f(co)s(ordinate)i(v)-5 b(ariable)31 b(will)g(b)s(e)e(written)i
-(here.)150 4488 y Fc(ft_lenp)144 b Fi(If)32 b(non-NULL,)g(the)g(length)
-g(of)h(the)f(v)-5 b(alue)33 b(of)f(the)g(\\form)m(ula)p
-2762 4488 V 41 w(terms")g(attribute)h(will)g(b)s(e)630
-4597 y(written)h(here)f(b)m(y)h(ft)p 1351 4597 V 40 w(lenp.)50
-b(If)34 b(there)f(is)h(no)g(\\form)m(ula)p 2536 4597
-V 40 w(terms")h(attribute,)g(zero)g(will)f(b)s(e)630
-4707 y(written.)150 4859 y Fc(positive_upp)630 4969 y
-Fi(If)45 b(non-NULL,)g(a)g(one)h(will)f(b)s(e)f(written)i(here)f(if)g
-(the)g(\\p)s(ositiv)m(e")i(attribute)f(of)f(this)630
-5078 y(co)s(ordinate)31 b(v)-5 b(ariable)31 b(is)g(\\up",)f(a)h(zero)g
-(will)g(b)s(e)f(written)g(if)g(it)h(is)g(\\do)m(wn".)150
-5230 y Fc(lvl_dimidp)630 5340 y Fi(If)f(non-NULL,)g(the)h(dimid)e(of)i
-(the)f(lev)m(el)j(dimension)c(will)i(b)s(e)f(written)g(here.)p
-eop end
-%%Page: 18 22
-TeXDict begin 18 21 bop 150 -116 a Fi(18)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fc(lvl_varidp)630
-408 y Fi(If)g(non-NULL,)g(the)h(v)-5 b(arid)30 b(of)g(the)h(lev)m(el)h
-(co)s(ordinate)f(v)-5 b(ariable)31 b(will)g(b)s(e)f(written)g(here.)150
-649 y Fh(Return)45 b(Co)t(des)150 809 y Fi(This)30 b(function)g
-(returns)f(zero)i(for)f(success,)h(or)f(an)h(error)f(co)s(de)g(for)g
-(failure.)150 1050 y Fh(Example)150 1294 y(2.13)68 b(De\014ne)45
-b(a)h(co)t(ordinate)f(v)-7 b(ariable)46 b(and)f(dimension)g(for)g(lev)l
-(el)456 1427 y(with)h(nccf)p 1008 1427 41 6 v 58 w(def)p
-1243 1427 V 60 w(lvl)150 1587 y Fi(De\014ne)40 b(a)h(unitless)f(v)m
-(ertical)j(co)s(ordinate)e(v)-5 b(ariable)41 b(and)f(dimension)f(from)h
-(Ap)s(endix)f(D)i(of)g(the)f(CF)150 1696 y(Con)m(v)m(en)m(tion,)32
-b(with)e(all)h(the)g(CF)f(recommended)g(attribute)h(accessories)i(for)d
-(a)h(v)m(ertical)h(lev)m(el.)150 1937 y Fh(Usage)390
-2097 y Fc(int)47 b(nccf_def_lvl_vert\(int)42 b(ncid,)k(int)h(lvl_type,)
-e(const)i(char)f(*name,)h(nc_type)e(xtype,)1440 2206
-y(size_t)h(len,)h(int)g(*lvl_dimidp,)d(int)j(*lvl_varidp\);)150
-2374 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-2539 y Fc(lvl_type)96 b Fi(One)20 b(of:)36 b(CF)p 1077
-2539 28 4 v 40 w(VER)-8 b(T)p 1372 2539 V 40 w(A)g(TM)p
-1621 2539 V 40 w(LN,)21 b(CF)p 1957 2539 V 40 w(VER)-8
-b(T)p 2252 2539 V 40 w(SIGMA,)20 b(CF)p 2768 2539 V 40
-w(VER)-8 b(T)p 3063 2539 V 41 w(HYBRID)p 3473 2539 V
-40 w(SIGMA,)630 2649 y(CF)p 761 2649 V 40 w(VER)g(T)p
-1056 2649 V 40 w(HYBRID)p 1465 2649 V 41 w(HEIGHT,)21
-b(CF)p 2045 2649 V 40 w(VER)-8 b(T)p 2340 2649 V 40 w(SLEVE,)19
-b(CF)p 2849 2649 V 40 w(VER)-8 b(T)p 3144 2649 V 40 w(OCEAN)p
-3519 2649 V 40 w(SIGMA,)630 2758 y(CF)p 761 2758 V 40
-w(VER)g(T)p 1056 2758 V 40 w(OCEAN)p 1431 2758 V 40 w(S,)20
-b(CF)p 1692 2758 V 40 w(VER)-8 b(T)p 1987 2758 V 40 w(OCEAN)p
-2362 2758 V 39 w(SIGMA)p 2707 2758 V 40 w(Z,)20 b(CF)p
-2973 2758 V 40 w(VER)-8 b(T)p 3268 2758 V 41 w(OCEAN)p
-3644 2758 V 39 w(DBL)p 3873 2758 V 41 w(SIGMA.)150 2923
-y Fc(name)288 b Fi(The)30 b(name)g(of)h(the)f(co)s(ordinate)i
-(dimension)d(and)h(v)-5 b(ariable.)150 3088 y Fc(xtype)240
-b Fi(The)30 b(t)m(yp)s(e)g(of)h(this)f(co)s(ordinate)h(v)-5
-b(ariable.)150 3253 y Fc(len)336 b Fi(The)30 b(length)h(of)f(this)g(co)
-s(ordinate)i(dimension)d(and)h(v)-5 b(ariable.)150 3418
-y Fc(lvl_dimidp)630 3528 y Fi(If)22 b(non-NULL,)g(the)g(function)g
-(will)g(write)g(the)h(dimension)e(ID)h(of)h(the)f(netCDF)h(dimension)
-630 3637 y(for)30 b(the)h(lev)m(el)h(here.)150 3803 y
-Fc(llvl_varidp)630 3912 y Fi(If)c(non-NULL,)f(the)i(function)e(will)i
-(write)f(the)g(v)-5 b(ariable)29 b(ID)f(of)g(the)g(netCDF)h(co)s
-(ordinate)630 4022 y(v)-5 b(ariable)31 b(for)f(the)h(lev)m(el)h(here.)
-150 4263 y Fh(Return)45 b(Co)t(des)150 4422 y Fi(This)30
-b(function)g(returns)f(zero)i(for)f(success,)h(or)f(an)h(error)f(co)s
-(de)g(for)g(failure.)150 4663 y Fh(Example)150 4908 y(2.14)68
-b(Learn)45 b(ab)t(out)g(a)h(lev)l(el)g(co)t(ordinate)g(v)-7
-b(ariable)46 b(and)e(dimension)456 5040 y(with)150 5200
-y Fi(nccf)p 315 5200 V 40 w(inq)p 479 5200 V 40 w(lvl)275
-5340 y(Inquire)29 b(ab)s(out)h(a)h(lev)m(el)h(dimension)e(and)f(co)s
-(ordinate)j(v)-5 b(ariable.)p eop end
-%%Page: 19 23
-TeXDict begin 19 22 bop 150 -116 a Fi(Chapter)30 b(2:)41
-b(V)-8 b(ariables)2681 b(19)150 299 y Fh(Usage)390 458
-y Fc(int)47 b(nccf_inq_lvl_vert\(int)42 b(ncid,)k(char)h(*name,)f
-(nc_type)g(*xtypep,)f(size_t)h(*lenp,)1440 568 y(int)h(*lvl_typep,)e
-(int)i(*lvl_dimidp,)d(int)j(*lvl_varidp\);)150 741 y(ncid)288
-b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150 909 y Fc(name)288
-b Fi(If)34 b(non-NULL,)h(the)g(name)g(of)g(this)f(v)m(ertical)j(lev)m
-(el)g(dimension)d(\(and)h(v)-5 b(ariable\))35 b(will)h(b)s(e)630
-1019 y(written)30 b(here.)150 1187 y Fc(xtypep)192 b
-Fi(If)30 b(non-NULL,)g(the)h(t)m(yp)s(e)f(of)h(the)f(co)s(ordinate)i(v)
--5 b(ariable)31 b(will)g(b)s(e)e(written)i(here.)150
-1356 y Fc(lenp)288 b Fi(If)30 b(non-NULL,)g(the)h(length)g(of)f(the)h
-(lev)m(el)h(dimension)e(will)g(b)s(e)g(written)g(here.)150
-1524 y Fc(lvl_typep)630 1634 y Fi(If)51 b(non-NULL,)f(the)i(t)m(yp)s(e)
-f(of)g(v)m(ertical)i(dimension)d(will)i(b)s(e)e(written)h(here,)56
-b(one)c(of)630 1743 y(CF)p 761 1743 28 4 v 40 w(VER)-8
-b(T)p 1056 1743 V 40 w(A)g(TM)p 1305 1743 V 41 w(LN,)133
-b(CF)p 1754 1743 V 40 w(VER)-8 b(T)p 2049 1743 V 41 w(SIGMA,)134
-b(CF)p 2680 1743 V 40 w(VER)-8 b(T)p 2975 1743 V 40 w(HYBRID)p
-3384 1743 V 41 w(SIGMA,)630 1853 y(CF)p 761 1853 V 40
-w(VER)g(T)p 1056 1853 V 40 w(HYBRID)p 1465 1853 V 41
-w(HEIGHT,)21 b(CF)p 2045 1853 V 40 w(VER)-8 b(T)p 2340
-1853 V 40 w(SLEVE,)19 b(CF)p 2849 1853 V 40 w(VER)-8
-b(T)p 3144 1853 V 40 w(OCEAN)p 3519 1853 V 40 w(SIGMA,)630
-1962 y(CF)p 761 1962 V 40 w(VER)g(T)p 1056 1962 V 40
-w(OCEAN)p 1431 1962 V 40 w(S,)20 b(CF)p 1692 1962 V 40
-w(VER)-8 b(T)p 1987 1962 V 40 w(OCEAN)p 2362 1962 V 39
-w(SIGMA)p 2707 1962 V 40 w(Z,)20 b(CF)p 2973 1962 V 40
-w(VER)-8 b(T)p 3268 1962 V 41 w(OCEAN)p 3644 1962 V 39
-w(DBL)p 3873 1962 V 41 w(SIGMA.)150 2131 y Fc(lvl_dimidp)630
-2240 y Fi(If)30 b(non-NULL,)g(the)h(dimid)e(of)i(the)f(lev)m(el)j
-(dimension)c(will)i(b)s(e)f(written)g(here.)150 2409
-y Fc(lvl_varidp)630 2518 y Fi(If)g(non-NULL,)g(the)h(v)-5
-b(arid)30 b(of)g(the)h(lev)m(el)h(co)s(ordinate)f(v)-5
-b(ariable)31 b(will)g(b)s(e)f(written)g(here.)150 2764
-y Fh(Return)45 b(Co)t(des)150 2924 y Fi(This)30 b(function)g(returns)f
-(zero)i(for)f(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)150
-3170 y Fh(Example)150 3416 y(2.15)68 b(De\014ne)45 b(a)h(co)t(ordinate)
-f(v)-7 b(ariable)46 b(and)f(dimension)g(for)g(time)456
-3549 y(with)h(nccf)p 1008 3549 41 6 v 58 w(def)p 1243
-3549 V 60 w(time)150 3708 y Fi(De\014ne)31 b(a)h(co)s(ordinate)g(v)-5
-b(ariable)32 b(and)e(dimension)h(with)g(all)h(the)f(CF)g(recommended)g
-(attribute)h(acces-)150 3818 y(sories)f(for)f(time.)150
-4064 y Fh(Usage)390 4223 y Fc(int)47 b(nccf_def_time\(int)c(ncid,)j
-(const)h(char)f(*name,)g(size_t)h(len,)f(nc_type)g(xtype,)1392
-4333 y(const)h(char)f(*units,)g(const)g(char)h(*standard_name,)d(const)
-i(char)h(*long_name,)1392 4443 y(const)g(char)f(*formula_terms,)e(int)j
-(*time_dimidp,)d(int)j(*time_varidp\);)150 4616 y(ncid)288
-b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150 4784 y Fc(len)336
-b Fi(The)30 b(length)h(of)f(this)g(co)s(ordinate)i(dimension.)150
-4952 y Fc(xtype)240 b Fi(The)30 b(t)m(yp)s(e)g(of)h(this)f(co)s
-(ordinate)h(v)-5 b(ariable.)150 5121 y Fc(formula_terms)630
-5230 y Fi(If)33 b(non-NULL,)g(a)g(string)g(whic)m(h)g(will)g(b)s(e)f
-(written)i(as)f(the)g(\\form)m(ula)p 3060 5230 28 4 v
-41 w(terms")g(attribute)630 5340 y(on)d(the)h(co)s(ordinate)g(v)-5
-b(ariable.)p eop end
-%%Page: 20 24
-TeXDict begin 20 23 bop 150 -116 a Fi(20)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fc(lon_dimidp)630
-408 y Fi(If)e(non-NULL,)g(nccf)p 1364 408 28 4 v 40 w(def)p
-1523 408 V 39 w(time)h(will)g(write)f(the)g(dimension)g(ID)g(of)g(the)h
-(netCDF)f(dimen-)630 518 y(sion)i(for)h(the)f(time)h(here.)150
-683 y Fc(lon_varidp)630 793 y Fi(If)23 b(non-NULL,)g(nccf)p
-1354 793 V 40 w(def)p 1513 793 V 39 w(time)h(will)f(write)h(the)f(v)-5
-b(ariable)24 b(ID)f(of)g(the)g(netCDF)h(co)s(ordinate)630
-902 y(v)-5 b(ariable)31 b(for)f(the)h(time)g(here.)150
-1143 y Fh(Return)45 b(Co)t(des)150 1303 y Fi(This)30
-b(function)g(returns)f(zero)i(for)f(success,)h(or)f(an)h(error)f(co)s
-(de)g(for)g(failure.)150 1544 y Fh(Example)150 1788 y(2.16)68
-b(Learn)45 b(ab)t(out)g(a)h(time)f(co)t(ordinate)h(v)-7
-b(ariable)46 b(and)f(dimension)456 1921 y(with)150 2081
-y Fi(nccf)p 315 2081 V 40 w(inq)p 479 2081 V 40 w(time)275
-2221 y(Inquire)29 b(ab)s(out)h(a)h(time)g(dimension)f(and)f(co)s
-(ordinate)j(v)-5 b(ariable.)150 2462 y Fh(Usage)390 2621
-y Fc(int)47 b(nccf_inq_time\(int)c(ncid,)j(size_t)g(*lenp,)h(nc_type)e
-(*xtypep,)h(size_t)g(*ft_lenp,)1392 2731 y(char)h(*formula_terms,)d
-(int)i(*time_dimidp,)f(int)i(*time_varidp\);)150 2899
-y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-3064 y Fc(lenp)288 b Fi(If)56 b(non-NULL,)g(the)g(length)g(of)h(the)f
-(time)h(dimension)e(will)i(b)s(e)e(written)h(here)g(b)m(y)630
-3173 y(nccf)p 795 3173 V 40 w(inq)p 959 3173 V 40 w(time.)150
-3338 y Fc(xtypep)192 b Fi(If)30 b(non-NULL,)g(the)h(t)m(yp)s(e)f(of)h
-(the)f(co)s(ordinate)i(v)-5 b(ariable)31 b(will)g(b)s(e)e(written)i
-(here.)150 3503 y Fc(ft_lenp)144 b Fi(If)32 b(non-NULL,)g(the)g(length)
-g(of)h(the)f(v)-5 b(alue)33 b(of)f(the)g(\\form)m(ula)p
-2762 3503 V 41 w(terms")g(attribute)h(will)g(b)s(e)630
-3613 y(written)h(here)f(b)m(y)h(ft)p 1351 3613 V 40 w(lenp.)50
-b(If)34 b(there)f(is)h(no)g(\\form)m(ula)p 2536 3613
-V 40 w(terms")h(attribute,)g(zero)g(will)f(b)s(e)630
-3723 y(written.)150 3888 y Fc(formula_terms)630 3997
-y Fi(If)c(non-NULL)g(the)h(v)-5 b(alue)31 b(of)g(the)g(\\form)m(ula)p
-2185 3997 V 41 w(terms")g(attribute,)g(if)g(an)m(y)-8
-b(,)32 b(will)e(b)s(e)g(copied)630 4107 y(here.)150 4272
-y Fc(time_dimidp)630 4381 y Fi(If)g(non-NULL,)g(the)h(dimid)e(of)i(the)
-f(time)i(dimension)d(will)i(b)s(e)f(written)g(here.)150
-4547 y Fc(time_varidp)630 4656 y Fi(If)g(non-NULL,)g(the)h(v)-5
-b(arid)30 b(of)g(the)h(time)g(co)s(ordinate)g(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)150 4897 y Fh(Return)45
-b(Co)t(des)150 5057 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)150
-5297 y Fh(Example)p eop end
-%%Page: 21 25
-TeXDict begin 21 24 bop 150 -116 a Fi(Chapter)30 b(2:)41
-b(V)-8 b(ariables)2681 b(21)150 299 y Fh(2.17)68 b(De\014ne)45
-b(atmosphere)h(sigma)g(co)t(ordinate.)150 458 y Fi(De\014ne)31
-b(form)m(ula)f(terms)g(attribute)i(for)e(atmosphere)g(sigma)h(co)s
-(ordinate)h(v)-5 b(ariable.)150 691 y Fh(Usage)390 851
-y Fc(int)47 b(nccf_def_ft_sigma\(int)42 b(ncid,)k(int)h(varid,)f(int)h
-(ps_varid,)e(int)i(ptop_varid\);)150 1120 y(ncid)288
-b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150 1280 y Fc(varid)240
-b Fi(The)30 b(v)-5 b(arid)30 b(of)g(the)h(v)m(ertical)i(co)s(ordinate)e
-(v)-5 b(ariable.)150 1439 y Fc(ps_varid)96 b Fi(The)30
-b(v)-5 b(ariable)31 b(ID)g(of)f(the)h(ps)e(v)-5 b(ariable.)150
-1599 y Fc(ptop_varid)630 1709 y Fi(The)30 b(v)-5 b(ariable)31
-b(ID)g(of)f(the)h(ptop)f(v)-5 b(ariable.)150 1941 y Fh(Return)45
-b(Co)t(des)150 2101 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)150
-2334 y Fh(Example)150 2591 y(2.18)68 b(Inquire)45 b(ab)t(out)g
-(atmosphere)h(sigma)g(co)t(ordinate.)150 2751 y Fi(nccf)p
-315 2751 28 4 v 40 w(inq)p 479 2751 V 40 w(time)275 2885
-y(Inquire)29 b(ab)s(out)h(atmosphere)h(sigma)g(co)s(ordinate.)150
-3118 y Fh(Usage)390 3278 y Fc(int)47 b(nccf_inq_lvl_sigma\(int)42
-b(ncid,)k(char)h(*name,)f(nc_type)g(*xtypep,)f(size_t)h(*lenp,)1488
-3387 y(int)h(*ps_varidp,)d(int)j(*ptop_varidp,)d(int)j(*lvl_dimidp,)
-1488 3497 y(int)g(*lvl_varidp\);)150 3657 y(ncid)288
-b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150 3816 y Fc(name)288
-b Fi(If)28 b(non-NULL,)g(this)f(p)s(oin)m(ter)h(gets)h(the)g(name)f(of)
-g(the)g(co)s(ordinate)h(v)-5 b(ariable)29 b(and)e(dimen-)630
-3926 y(sion.)150 4086 y Fc(xtypep)192 b Fi(If)30 b(non-NULL,)g(the)h(t)
-m(yp)s(e)f(of)h(the)f(co)s(ordinate)i(v)-5 b(ariable)31
-b(will)g(b)s(e)e(written)i(here.)150 4245 y Fc(lenp)288
-b Fi(If)30 b(non-NULL,)g(the)h(length)g(of)f(the)h(co)s(ordinate)g
-(dimension)f(will)g(b)s(e)g(written)h(here.)150 4405
-y Fc(ps_varidp)630 4515 y Fi(If)f(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(ps)e(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)150 4674 y Fc(ptop_varidp)630
-4784 y Fi(If)g(non-NULL,)g(the)h(v)-5 b(ariable)31 b(ID)g(of)f(the)h
-(ptop)f(v)-5 b(ariable)31 b(will)g(b)s(e)e(written)i(here.)150
-4943 y Fc(lvl_dimidp)630 5053 y Fi(If)f(non-NULL,)g(the)h(dimid)e(of)i
-(the)f(co)s(ordinate)i(dimension)d(will)i(b)s(e)f(written)g(here.)150
-5213 y Fc(lvl_varidp)630 5322 y Fi(If)g(non-NULL,)g(the)h(v)-5
-b(arid)30 b(of)g(the)h(co)s(ordinate)g(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)p eop end
-%%Page: 22 26
-TeXDict begin 22 25 bop 150 -116 a Fi(22)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fh(Return)45
-b(Co)t(des)150 458 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)150
-691 y Fh(Example)150 948 y(2.19)68 b(De\014ne)45 b(atmosphere)h(sigma)g
-(co)t(ordinate.)150 1107 y Fi(De\014ne)31 b(form)m(ula)f(terms)g
-(attribute)i(for)e(atmosphere)g(h)m(ybrid)f(sigma)i(co)s(ordinate)h(v)
--5 b(ariable.)150 1339 y Fh(Usage)390 1499 y Fc(int)47
-b(nccf_def_ft_hybrid_sigma)o(\(int)41 b(ncid,)46 b(int)h(varid,)f(int)h
-(a_varid,)f(int)h(b_varid,)1774 1608 y(int)g(ps_varid,)e(int)i
-(p0_varid\);)150 1768 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h
-(\014le.)150 1927 y Fc(varid)240 b Fi(The)30 b(v)-5 b(arid)30
-b(of)g(the)h(v)m(ertical)i(co)s(ordinate)e(v)-5 b(ariable.)150
-2086 y Fc(a_varid)144 b Fi(The)30 b(v)-5 b(ariable)31
-b(ID)g(of)f(the)h(a)f(v)-5 b(ariable.)150 2245 y Fc(b_varid)144
-b Fi(The)30 b(v)-5 b(ariable)31 b(ID)g(of)f(the)h(b)f(v)-5
-b(ariable.)150 2405 y Fc(ps_varid)96 b Fi(The)30 b(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(ps)e(v)-5 b(ariable.)150
-2564 y Fc(ptop_varid)630 2673 y Fi(The)30 b(v)-5 b(ariable)31
-b(ID)g(of)f(the)h(ptop)f(v)-5 b(ariable.)150 2906 y Fh(Return)45
-b(Co)t(des)150 3065 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)150
-3297 y Fh(Example)150 3555 y(2.20)68 b(Inquire)45 b(ab)t(out)g
-(atmosphere)h(sigma)g(co)t(ordinate.)150 3714 y Fi(Inquire)29
-b(ab)s(out)h(atmosphere)h(h)m(ybrid)e(sigma)i(co)s(ordinate.)150
-3946 y Fh(Usage)390 4106 y Fc(int)47 b(nccf_inq_lvl_hybrid_sigm)o
-(a\(in)o(t)42 b(ncid,)k(char)h(*name,)f(nc_type)g(*xtypep,)1822
-4215 y(size_t)g(*lenp,)g(int)h(*a_varidp,)e(int)i(*b_varidp,)1822
-4325 y(int)g(*ps_varidp,)d(int)j(*p0_varidp,)e(int)i(*lvl_dimidp,)1822
-4434 y(int)g(*lvl_varidp\);)150 4594 y(ncid)288 b Fi(The)30
-b(ncid)g(of)g(the)h(\014le.)150 4753 y Fc(name)288 b
-Fi(If)28 b(non-NULL,)g(this)f(p)s(oin)m(ter)h(gets)h(the)g(name)f(of)g
-(the)g(co)s(ordinate)h(v)-5 b(ariable)29 b(and)e(dimen-)630
-4862 y(sion.)150 5022 y Fc(xtypep)192 b Fi(If)30 b(non-NULL,)g(the)h(t)
-m(yp)s(e)f(of)h(the)f(co)s(ordinate)i(v)-5 b(ariable)31
-b(will)g(b)s(e)e(written)i(here.)150 5181 y Fc(lenp)288
-b Fi(If)30 b(non-NULL,)g(the)h(length)g(of)f(the)h(co)s(ordinate)g
-(dimension)f(will)g(b)s(e)g(written)h(here.)150 5340
-y Fc(a_varidp)96 b Fi(If)30 b(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(a)f(v)-5 b(ariable)32
-b(will)e(b)s(e)g(written)g(here.)p eop end
-%%Page: 23 27
-TeXDict begin 23 26 bop 150 -116 a Fi(Chapter)30 b(2:)41
-b(V)-8 b(ariables)2681 b(23)150 299 y Fc(b_varidp)96
-b Fi(If)30 b(non-NULL,)g(the)h(v)-5 b(ariable)31 b(ID)g(of)f(the)h(b)e
-(v)-5 b(ariable)32 b(will)e(b)s(e)g(written)g(here.)150
-478 y Fc(ps_varidp)630 588 y Fi(If)g(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(ps)e(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)150 767 y Fc(ptop_varidp)630
-877 y Fi(If)g(non-NULL,)g(the)h(v)-5 b(ariable)31 b(ID)g(of)f(the)h
-(ptop)f(v)-5 b(ariable)31 b(will)g(b)s(e)e(written)i(here.)150
-1056 y Fc(lvl_dimidp)630 1165 y Fi(If)f(non-NULL,)g(the)h(dimid)e(of)i
-(the)f(co)s(ordinate)i(dimension)d(will)i(b)s(e)f(written)g(here.)150
-1345 y Fc(lvl_varidp)630 1454 y Fi(If)g(non-NULL,)g(the)h(v)-5
-b(arid)30 b(of)g(the)h(co)s(ordinate)g(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)150 1717 y Fh(Return)45
-b(Co)t(des)150 1876 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)150
-2138 y Fh(Example)150 2390 y(2.21)68 b(The)45 b(form)l(ula)p
-1188 2390 41 6 v 60 w(terms)h(attribute)g(for)f(atmosphere)h(h)l(ybrid)
-456 2523 y(heigh)l(t)150 2682 y Fi(De\014ne)31 b(form)m(ula)f(terms)g
-(attribute)i(for)e(atmosphere)g(h)m(ybrid)f(heigh)m(t)j(co)s(ordinate)f
-(v)-5 b(ariable)150 2945 y Fh(Usage)390 3104 y Fc(int)47
-b(nccf_def_ft_hybrid_heigh)o(t\(in)o(t)42 b(ncid,)k(int)h(varid,)f(int)
-h(a_varid,)f(int)g(b_varid,)1822 3214 y(int)h(orog_varid\);)150
-3403 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-3582 y Fc(varid)240 b Fi(The)30 b(v)-5 b(arid)30 b(of)g(the)h(v)m
-(ertical)i(co)s(ordinate)e(v)-5 b(ariable.)150 3761 y
-Fc(a_varid)144 b Fi(The)30 b(v)-5 b(ariable)31 b(ID)g(of)f(the)h(a)f(v)
--5 b(ariable.)150 3941 y Fc(b_varid)144 b Fi(The)30 b(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(b)f(v)-5 b(ariable.)150
-4120 y Fc(orog_varid)630 4229 y Fi(The)30 b(v)-5 b(ariable)31
-b(ID)g(of)f(the)h(orog)g(v)-5 b(ariable.)150 4492 y Fh(Return)45
-b(Co)t(des)150 4651 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)150
-4913 y Fh(Example)150 5181 y(2.22)68 b(Inquire)45 b(ab)t(out)g(h)l
-(ybrid)g(heigh)l(t)h(co)t(ordinate.)150 5340 y Fi(Inquire)29
-b(ab)s(out)h(the)h(h)m(ybrid)e(heigh)m(t)i(co)s(ordinate.)p
-eop end
-%%Page: 24 28
-TeXDict begin 24 27 bop 150 -116 a Fi(24)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fh(Usage)390
-458 y Fc(int)47 b(nccf_inq_lvl_hybrid_heig)o(ht\(i)o(nt)41
-b(ncid,)47 b(char)f(*name,)h(nc_type)e(*xtypep,)h(size_t)g(*lenp,)1870
-568 y(int)g(*a_varidp,)f(int)i(*b_varidp,)e(int)i(*orog_varidp,)1870
-677 y(int)f(*lvl_dimidp,)f(int)i(*lvl_varidp\);)150 842
-y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-1005 y Fc(name)288 b Fi(If)28 b(non-NULL,)g(this)f(p)s(oin)m(ter)h
-(gets)h(the)g(name)f(of)g(the)g(co)s(ordinate)h(v)-5
-b(ariable)29 b(and)e(dimen-)630 1114 y(sion.)150 1277
-y Fc(xtypep)192 b Fi(If)30 b(non-NULL,)g(the)h(t)m(yp)s(e)f(of)h(the)f
-(co)s(ordinate)i(v)-5 b(ariable)31 b(will)g(b)s(e)e(written)i(here.)150
-1440 y Fc(lenp)288 b Fi(If)30 b(non-NULL,)g(the)h(length)g(of)f(the)h
-(co)s(ordinate)g(dimension)f(will)g(b)s(e)g(written)h(here.)150
-1603 y Fc(a_varidp)96 b Fi(If)30 b(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(a)f(v)-5 b(ariable)32
-b(will)e(b)s(e)g(written)g(here.)150 1766 y Fc(b_varidp)96
-b Fi(If)30 b(non-NULL,)g(the)h(v)-5 b(ariable)31 b(ID)g(of)f(the)h(b)e
-(v)-5 b(ariable)32 b(will)e(b)s(e)g(written)g(here.)150
-1928 y Fc(orog_varidp)630 2038 y Fi(If)g(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(orog)g(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)150 2201 y Fc(lvl_dimidp)630
-2310 y Fi(If)g(non-NULL,)g(the)h(dimid)e(of)i(the)f(co)s(ordinate)i
-(dimension)d(will)i(b)s(e)f(written)g(here.)150 2473
-y Fc(lvl_varidp)630 2583 y Fi(If)g(non-NULL,)g(the)h(v)-5
-b(arid)30 b(of)g(the)h(co)s(ordinate)g(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)150 2820 y Fh(Return)45
-b(Co)t(des)150 2980 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)150
-3217 y Fh(Example)150 3476 y(2.23)68 b(De\014ne)45 b(atmosphere)h(slev)
-l(e)h(co)t(ordinate.)150 3636 y Fi(De\014ne)31 b(form)m(ula)f(terms)g
-(attribute)i(for)e(the)g(atmosphere)h(slev)m(e)h(co)s(ordinate)f(v)-5
-b(ariable.)150 3873 y Fh(Usage)390 4033 y Fc(int)47 b
-(nccf_def_ft_sleve\(int)42 b(ncid,)k(int)h(varid,)f(int)h(a_varid,)f
-(int)h(b1_varid,)1440 4142 y(int)g(b2_varid,)e(int)i(ztop_varid,)e(int)
-i(zsurf1_varid,)1440 4252 y(int)g(zsurf2_varid\);)150
-4416 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-4579 y Fc(varid)240 b Fi(The)30 b(v)-5 b(arid)30 b(of)g(the)h(v)m
-(ertical)i(co)s(ordinate)e(v)-5 b(ariable.)150 4742 y
-Fc(a_varid)144 b Fi(The)30 b(v)-5 b(ariable)31 b(ID)g(of)f(the)h(a)f(v)
--5 b(ariable.)150 4905 y Fc(b1_varid)96 b Fi(The)30 b(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(b1)f(v)-5 b(ariable.)150
-5068 y Fc(b2_varid)96 b Fi(The)30 b(v)-5 b(ariable)31
-b(ID)g(of)f(the)h(b2)f(v)-5 b(ariable.)150 5230 y Fc(ztop_varid)630
-5340 y Fi(The)30 b(v)-5 b(ariable)31 b(ID)g(of)f(the)h(ztop)g(v)-5
-b(ariable.)p eop end
-%%Page: 25 29
-TeXDict begin 25 28 bop 150 -116 a Fi(Chapter)30 b(2:)41
-b(V)-8 b(ariables)2681 b(25)150 299 y Fc(zsurf1_varid)630
-408 y Fi(The)30 b(v)-5 b(ariable)31 b(ID)g(of)f(the)h(zsurf1)f(v)-5
-b(ariable.)150 573 y Fc(zsurf2_varid)630 683 y Fi(The)30
-b(v)-5 b(ariable)31 b(ID)g(of)f(the)h(zsurf2)f(v)-5 b(ariable.)150
-923 y Fh(Return)45 b(Co)t(des)150 1082 y Fi(This)30 b(function)g
-(returns)f(zero)i(for)f(success,)h(or)f(an)h(error)f(co)s(de)g(for)g
-(failure.)150 1322 y Fh(Example)150 1582 y(2.24)68 b(Inquire)45
-b(Ab)t(out)f(Slev)l(e)i(Co)t(ordinate.)150 1741 y Fi(Inquire)29
-b(ab)s(out)h(the)h(slev)m(e)h(co)s(ordinate.)150 1981
-y Fh(Usage)390 2141 y Fc(int)47 b(nccf_inq_lvl_sleve\(int)42
-b(ncid,)k(char)h(*name,)f(nc_type)g(*xtypep,)f(size_t)h(*lenp,)1488
-2250 y(int)h(*a_varidp,)e(int)i(*b1_varidp,)d(int)j(*b2_varidp,)e(int)i
-(*ztop_varidp,)1488 2360 y(int)g(*zsurf1_varidp,)c(int)k
-(*zsurf2_varidp,)d(int)j(*lvl_dimidp,)1488 2470 y(int)g(*lvl_varidp\);)
-150 2637 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-2801 y Fc(name)288 b Fi(If)28 b(non-NULL,)g(this)f(p)s(oin)m(ter)h
-(gets)h(the)g(name)f(of)g(the)g(co)s(ordinate)h(v)-5
-b(ariable)29 b(and)e(dimen-)630 2911 y(sion.)150 3075
-y Fc(xtypep)192 b Fi(If)30 b(non-NULL,)g(the)h(t)m(yp)s(e)f(of)h(the)f
-(co)s(ordinate)i(v)-5 b(ariable)31 b(will)g(b)s(e)e(written)i(here.)150
-3239 y Fc(lenp)288 b Fi(If)30 b(non-NULL,)g(the)h(length)g(of)f(the)h
-(co)s(ordinate)g(dimension)f(will)g(b)s(e)g(written)h(here.)150
-3404 y Fc(a_varidp)96 b Fi(If)30 b(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(a)f(v)-5 b(ariable)32
-b(will)e(b)s(e)g(written)g(here.)150 3568 y Fc(b1_varidp)630
-3678 y Fi(If)g(non-NULL,)g(the)h(v)-5 b(ariable)31 b(ID)g(of)f(the)h
-(b1)f(v)-5 b(ariable)31 b(will)g(b)s(e)f(written)g(here.)150
-3842 y Fc(b2_varidp)630 3952 y Fi(If)g(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(b2)f(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)150 4117 y Fc(ztop_varidp)630
-4226 y Fi(If)g(non-NULL,)g(the)h(v)-5 b(ariable)31 b(ID)g(of)f(the)h
-(ztop)g(v)-5 b(ariable)31 b(will)g(b)s(e)e(written)i(here.)150
-4391 y Fc(zsurf1_varidp)630 4500 y Fi(If)f(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(zsurf1)f(v)-5 b(ariable)31
-b(will)f(b)s(e)g(written)h(here.)150 4665 y Fc(zsurf2_varidp)630
-4774 y Fi(If)f(non-NULL,)g(the)h(v)-5 b(ariable)31 b(ID)g(of)f(the)h
-(zsurf2)f(v)-5 b(ariable)31 b(will)f(b)s(e)g(written)h(here.)150
-4939 y Fc(lvl_dimidp)630 5048 y Fi(If)f(non-NULL,)g(the)h(dimid)e(of)i
-(the)f(co)s(ordinate)i(dimension)d(will)i(b)s(e)f(written)g(here.)150
-5213 y Fc(lvl_varidp)630 5322 y Fi(If)g(non-NULL,)g(the)h(v)-5
-b(arid)30 b(of)g(the)h(co)s(ordinate)g(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)p eop end
-%%Page: 26 30
-TeXDict begin 26 29 bop 150 -116 a Fi(26)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fh(Return)45
-b(Co)t(des)150 458 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)150
-677 y Fh(Example)150 927 y(2.25)68 b(De\014ne)45 b(Ocean)h(Sigma)f(Co)t
-(ordinate.)150 1086 y Fi(De\014ne)31 b(the)f(form)m(ula)h(terms)f
-(attribute)h(for)f(the)h(o)s(cean)g(sigma)g(co)s(ordinate)g(v)-5
-b(ariable.)150 1305 y Fh(Usage)390 1464 y Fc(int)47 b
-(nccf_def_ft_ocean_sigma\()o(int)41 b(ncid,)47 b(int)g(varid,)f(int)h
-(eta_varid,)e(int)h(depth_varid\);)150 1609 y(ncid)288
-b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150 1755 y Fc(varid)240
-b Fi(The)30 b(v)-5 b(arid)30 b(of)g(the)h(v)m(ertical)i(co)s(ordinate)e
-(v)-5 b(ariable.)150 1900 y Fc(eta_varid)630 2009 y Fi(The)30
-b(v)-5 b(ariable)31 b(ID)g(of)f(the)h(eta)g(v)-5 b(ariable.)150
-2155 y Fc(depth_varid)630 2264 y Fi(The)30 b(v)-5 b(ariable)31
-b(ID)g(of)f(the)h(depth)e(v)-5 b(ariable.)150 2483 y
-Fh(Return)45 b(Co)t(des)150 2642 y Fi(This)30 b(function)g(returns)f
-(zero)i(for)f(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)150
-2860 y Fh(Example)150 3111 y(2.26)68 b(Inquire)45 b(Ab)t(out)f(Ocean)i
-(Sigma)f(Co)t(ordinate.)150 3270 y Fi(Inquire)29 b(ab)s(out)h(the)h(o)s
-(cean)g(sigma)g(co)s(ordinate.)150 3488 y Fh(Usage)390
-3648 y Fc(int)47 b(nccf_inq_lvl_ocean_sigma)o(\(int)41
-b(ncid,)46 b(char)h(*name,)f(nc_type)g(*xtypep,)f(size_t)i(*lenp,)1774
-3757 y(int)g(*eta_varidp,)d(int)j(*depth_varidp,)d(int)j(*lvl_dimidp,)
-1774 3867 y(int)g(*lvl_varidp\);)150 4012 y(ncid)288
-b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150 4158 y Fc(name)288
-b Fi(If)28 b(non-NULL,)g(this)f(p)s(oin)m(ter)h(gets)h(the)g(name)f(of)
-g(the)g(co)s(ordinate)h(v)-5 b(ariable)29 b(and)e(dimen-)630
-4267 y(sion.)150 4412 y Fc(xtypep)192 b Fi(If)30 b(non-NULL,)g(the)h(t)
-m(yp)s(e)f(of)h(the)f(co)s(ordinate)i(v)-5 b(ariable)31
-b(will)g(b)s(e)e(written)i(here.)150 4558 y Fc(lenp)288
-b Fi(If)30 b(non-NULL,)g(the)h(length)g(of)f(the)h(co)s(ordinate)g
-(dimension)f(will)g(b)s(e)g(written)h(here.)150 4703
-y Fc(eta_varidp)630 4813 y Fi(If)f(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(eta)g(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)150 4958 y Fc(lvl_dimidp)630
-5067 y Fi(If)g(non-NULL,)g(the)h(dimid)e(of)i(the)f(co)s(ordinate)i
-(dimension)d(will)i(b)s(e)f(written)g(here.)150 5213
-y Fc(lvl_varidp)630 5322 y Fi(If)g(non-NULL,)g(the)h(v)-5
-b(arid)30 b(of)g(the)h(co)s(ordinate)g(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)p eop end
-%%Page: 27 31
-TeXDict begin 27 30 bop 150 -116 a Fi(Chapter)30 b(2:)41
-b(V)-8 b(ariables)2681 b(27)150 299 y Fh(Return)45 b(Co)t(des)150
-458 y Fi(This)30 b(function)g(returns)f(zero)i(for)f(success,)h(or)f
-(an)h(error)f(co)s(de)g(for)g(failure.)150 686 y Fh(Example)150
-941 y(2.27)68 b(De\014ne)45 b(Ocean)h(S)e(Co)t(ordinate.)150
-1101 y Fi(De\014ne)31 b(o)s(cean)g(s)f(co)s(ordinate.)150
-1329 y Fh(Usage)390 1488 y Fc(int)47 b(nccf_def_ft_ocean_s\(int)41
-b(ncid,)47 b(const)f(char)h(*name,)f(nc_type)g(xtype,)g(size_t)g(len,)
-1583 1598 y(int)h(eta_varid,)e(int)i(depth_varid,)d(int)j(a_varid,)f
-(int)h(b_varid,)1583 1707 y(int)g(depth_c_varid,)d(int)j(*lvl_dimidp,)d
-(int)j(*lvl_varidp\);)150 1862 y(ncid)288 b Fi(The)30
-b(ncid)g(of)g(the)h(\014le.)150 2017 y Fc(varid)240 b
-Fi(The)30 b(v)-5 b(arid)30 b(of)g(the)h(v)m(ertical)i(co)s(ordinate)e
-(v)-5 b(ariable.)150 2172 y Fc(xtype)240 b Fi(The)30
-b(t)m(yp)s(e)g(of)h(this)f(co)s(ordinate)h(v)-5 b(ariable.)150
-2327 y Fc(len)336 b Fi(The)30 b(length)h(of)f(this)g(co)s(ordinate)i
-(dimension.)150 2482 y Fc(eta_varid)630 2591 y Fi(The)e(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(eta)g(v)-5 b(ariable.)150
-2746 y Fc(depth_varid)630 2856 y Fi(The)30 b(v)-5 b(ariable)31
-b(ID)g(of)f(the)h(depth)e(v)-5 b(ariable.)150 3011 y
-Fc(a_varid)144 b Fi(The)30 b(v)-5 b(ariable)31 b(ID)g(of)f(the)h(a)f(v)
--5 b(ariable.)150 3165 y Fc(b_varid)144 b Fi(The)30 b(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(b)f(v)-5 b(ariable.)150
-3320 y Fc(depth_c_varid)630 3430 y Fi(The)30 b(v)-5 b(ariable)31
-b(ID)g(of)f(the)h(depth)p 1785 3430 28 4 v 39 w(c)g(v)-5
-b(ariable.)150 3585 y Fc(lvl_dimidp)630 3694 y Fi(If)37
-b(non-NULL,)g(the)g(dimension)g(ID)g(of)g(the)h(netCDF)f(co)s(ordinate)
-h(dimension)f(will)h(b)s(e)630 3804 y(written)30 b(here.)150
-3959 y Fc(lvl_varidp)630 4068 y Fi(If)24 b(non-NULL,)h(the)g(v)-5
-b(ariable)26 b(ID)f(of)g(the)g(netCDF)g(co)s(ordinate)h(v)-5
-b(ariable)26 b(will)f(b)s(e)f(written)630 4178 y(here.)150
-4406 y Fh(Return)45 b(Co)t(des)150 4565 y Fi(This)30
-b(function)g(returns)f(zero)i(for)f(success,)h(or)f(an)h(error)f(co)s
-(de)g(for)g(failure.)150 4793 y Fh(Example)150 5048 y(2.28)68
-b(Inquire)45 b(Ab)t(out)f(Ocean)i(S)e(Co)t(ordinate.)150
-5208 y Fi(nccf)p 315 5208 V 40 w(inq)p 479 5208 V 40
-w(time)275 5340 y(Inquire)29 b(ab)s(out)h(the)h(o)s(cean)g(s)f(co)s
-(ordinate.)p eop end
-%%Page: 28 32
-TeXDict begin 28 31 bop 150 -116 a Fi(28)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fh(Usage)390
-458 y Fc(int)47 b(nccf_inq_lvl_ocean_s\(int)41 b(ncid,)46
-b(char)h(*name,)f(nc_type)g(*xtypep,)g(size_t)g(*lenp,)1583
-568 y(int)h(*eta_varidp,)e(int)h(*depth_varidp,)e(int)j(*a_varidp,)e
-(int)i(*b_varidp,)1583 677 y(int)g(*depth_c_varidp,)c(int)k
-(*lvl_dimidp,)e(int)i(*lvl_varidp\);)150 838 y(ncid)288
-b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150 998 y Fc(name)288
-b Fi(If)28 b(non-NULL,)g(this)f(p)s(oin)m(ter)h(gets)h(the)g(name)f(of)
-g(the)g(co)s(ordinate)h(v)-5 b(ariable)29 b(and)e(dimen-)630
-1107 y(sion.)150 1267 y Fc(xtypep)192 b Fi(If)30 b(non-NULL,)g(the)h(t)
-m(yp)s(e)f(of)h(the)f(co)s(ordinate)i(v)-5 b(ariable)31
-b(will)g(b)s(e)e(written)i(here.)150 1427 y Fc(lenp)288
-b Fi(If)30 b(non-NULL,)g(the)h(length)g(of)f(the)h(co)s(ordinate)g
-(dimension)f(will)g(b)s(e)g(written)h(here.)150 1587
-y Fc(eta_varidp)630 1697 y Fi(If)f(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(eta)g(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)150 1857 y Fc(depth_varidp)630
-1966 y Fi(If)g(non-NULL,)g(the)h(v)-5 b(ariable)31 b(ID)g(of)f(the)h
-(depth)e(v)-5 b(ariable)31 b(will)g(b)s(e)f(written)g(here.)150
-2126 y Fc(a_varidp)96 b Fi(If)30 b(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(a)f(v)-5 b(ariable)32
-b(will)e(b)s(e)g(written)g(here.)150 2286 y Fc(b_varidp)96
-b Fi(If)30 b(non-NULL,)g(the)h(v)-5 b(ariable)31 b(ID)g(of)f(the)h(b)e
-(v)-5 b(ariable)32 b(will)e(b)s(e)g(written)g(here.)150
-2446 y Fc(depth_c_varidp)630 2556 y Fi(If)g(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(depth)p 2328 2556 28 4
-v 39 w(c)g(v)-5 b(ariable)31 b(will)g(b)s(e)e(written)i(here.)150
-2716 y Fc(lvl_dimidp)630 2826 y Fi(If)f(non-NULL,)g(the)h(dimid)e(of)i
-(the)f(co)s(ordinate)i(dimension)d(will)i(b)s(e)f(written)g(here.)150
-2986 y Fc(lvl_varidp)630 3095 y Fi(If)g(non-NULL,)g(the)h(v)-5
-b(arid)30 b(of)g(the)h(co)s(ordinate)g(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)150 3328 y Fh(Return)45
-b(Co)t(des)150 3488 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)150
-3721 y Fh(Example)150 3979 y(2.29)68 b(De\014ne)45 b(Ocean)h(Sigma)f(Z)
-g(Co)t(ordinate.)150 4138 y Fi(De\014ne)31 b(o)s(cean)g(sigma)g(z)f(co)
-s(ordinate.)150 4372 y Fh(Usage)390 4531 y Fc(int)47
-b(nccf_def_ft_ocean_sigma_)o(z\(in)o(t)42 b(ncid,)k(const)g(char)h
-(*name,)f(nc_type)g(xtype,)1870 4641 y(size_t)g(len,)g(int)h
-(eta_varid,)e(int)i(depth_varid,)1870 4750 y(int)f(depth_c_varid,)e
-(int)j(nsigma_varid,)1870 4860 y(int)f(zlev_varid,)f(int)i
-(*lvl_dimidp,)e(int)h(*lvl_varidp\);)150 5020 y(ncid)288
-b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150 5180 y Fc(varid)240
-b Fi(The)30 b(v)-5 b(arid)30 b(of)g(the)h(v)m(ertical)i(co)s(ordinate)e
-(v)-5 b(ariable.)150 5340 y Fc(xtype)240 b Fi(The)30
-b(t)m(yp)s(e)g(of)h(this)f(co)s(ordinate)h(v)-5 b(ariable.)p
-eop end
-%%Page: 29 33
-TeXDict begin 29 32 bop 150 -116 a Fi(Chapter)30 b(2:)41
-b(V)-8 b(ariables)2681 b(29)150 299 y Fc(len)336 b Fi(The)30
-b(length)h(of)f(this)g(co)s(ordinate)i(dimension.)150
-452 y Fc(eta_varid)630 561 y Fi(The)e(v)-5 b(ariable)31
-b(ID)g(of)f(the)h(eta)g(v)-5 b(ariable.)150 714 y Fc(depth_varid)630
-824 y Fi(The)30 b(v)-5 b(ariable)31 b(ID)g(of)f(the)h(depth)e(v)-5
-b(ariable.)150 977 y Fc(depth_c_varid)630 1086 y Fi(The)30
-b(v)-5 b(ariable)31 b(ID)g(of)f(the)h(depth)p 1785 1086
-28 4 v 39 w(c)g(v)-5 b(ariable.)150 1239 y Fc(nsigma_varid)630
-1349 y Fi(The)30 b(v)-5 b(ariable)31 b(ID)g(of)f(the)h(nsigma)f(v)-5
-b(ariable.)150 1502 y Fc(zlev_varid)630 1611 y Fi(The)30
-b(v)-5 b(ariable)31 b(ID)g(of)f(the)h(zlev)g(v)-5 b(ariable.)150
-1764 y Fc(lvl_dimidp)630 1874 y Fi(If)37 b(non-NULL,)g(the)g(dimension)
-g(ID)g(of)g(the)h(netCDF)f(co)s(ordinate)h(dimension)f(will)h(b)s(e)630
-1983 y(written)30 b(here.)150 2136 y Fc(lvl_varidp)630
-2246 y Fi(If)24 b(non-NULL,)h(the)g(v)-5 b(ariable)26
-b(ID)f(of)g(the)g(netCDF)g(co)s(ordinate)h(v)-5 b(ariable)26
-b(will)f(b)s(e)f(written)630 2355 y(here.)150 2581 y
-Fh(Return)45 b(Co)t(des)150 2741 y Fi(This)30 b(function)g(returns)f
-(zero)i(for)f(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)150
-2966 y Fh(Example)150 3221 y(2.30)68 b(Inquire)45 b(Ab)t(out)f(Ocean)i
-(Sigma)f(Z)g(Co)t(ordinate.)150 3380 y Fi(Inquire)29
-b(ab)s(out)h(the)h(o)s(cean)g(sigma)g(z)g(co)s(ordinate.)150
-3606 y Fh(Usage)390 3765 y Fc(int)47 b(nccf_inq_lvl_ocean_sigma)o
-(_z\(i)o(nt)41 b(ncid,)47 b(char)f(*name,)h(nc_type)e(*xtypep,)h
-(size_t)g(*lenp,)1870 3875 y(int)g(*eta_varidp,)f(int)i(*depth_varidp,)
-d(int)j(*depth_c_varidp,)1870 3984 y(int)f(*nsigma_varidp,)e(int)j
-(*zlev_varidp,)d(int)j(*lvl_dimidp,)1870 4094 y(int)f(*lvl_varidp\);)
-150 4247 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-4400 y Fc(name)288 b Fi(If)28 b(non-NULL,)g(this)f(p)s(oin)m(ter)h
-(gets)h(the)g(name)f(of)g(the)g(co)s(ordinate)h(v)-5
-b(ariable)29 b(and)e(dimen-)630 4509 y(sion.)150 4662
-y Fc(xtypep)192 b Fi(If)30 b(non-NULL,)g(the)h(t)m(yp)s(e)f(of)h(the)f
-(co)s(ordinate)i(v)-5 b(ariable)31 b(will)g(b)s(e)e(written)i(here.)150
-4815 y Fc(lenp)288 b Fi(If)30 b(non-NULL,)g(the)h(length)g(of)f(the)h
-(co)s(ordinate)g(dimension)f(will)g(b)s(e)g(written)h(here.)150
-4968 y Fc(eta_varidp)630 5078 y Fi(If)f(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(eta)g(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)150 5230 y Fc(depth_varidp)630
-5340 y Fi(If)g(non-NULL,)g(the)h(v)-5 b(ariable)31 b(ID)g(of)f(the)h
-(depth)e(v)-5 b(ariable)31 b(will)g(b)s(e)f(written)g(here.)p
-eop end
-%%Page: 30 34
-TeXDict begin 30 33 bop 150 -116 a Fi(30)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fc(depth_c_varidp)630
-408 y Fi(If)g(non-NULL,)g(the)h(v)-5 b(ariable)31 b(ID)g(of)f(the)h
-(depth)p 2328 408 28 4 v 39 w(c)g(v)-5 b(ariable)31 b(will)g(b)s(e)e
-(written)i(here.)150 577 y Fc(nsigma_varidp)630 686 y
-Fi(If)f(non-NULL,)g(the)h(v)-5 b(ariable)31 b(ID)g(of)f(the)h(nsigma)f
-(v)-5 b(ariable)31 b(will)g(b)s(e)f(written)g(here.)150
-854 y Fc(zlev_varidp)630 964 y Fi(If)g(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(zlev)g(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)150 1132 y Fc(lvl_dimidp)630
-1242 y Fi(If)g(non-NULL,)g(the)h(dimid)e(of)i(the)f(co)s(ordinate)i
-(dimension)d(will)i(b)s(e)f(written)g(here.)150 1410
-y Fc(lvl_varidp)630 1520 y Fi(If)g(non-NULL,)g(the)h(v)-5
-b(arid)30 b(of)g(the)h(co)s(ordinate)g(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)150 1765 y Fh(Return)45
-b(Co)t(des)150 1925 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)150
-2170 y Fh(Example)150 2432 y(2.31)68 b(De\014ne)45 b(Ocean)h(Double)f
-(Sigma)g(Co)t(ordinate.)150 2591 y Fi(De\014ne)31 b(o)s(cean)g(double)f
-(sigma)h(co)s(ordinate.)150 2837 y Fh(Usage)390 2996
-y Fc(int)47 b(nccf_def_ft_ocean_dbl_si)o(gma\()o(int)41
-b(ncid,)47 b(const)f(char)h(*name,)f(nc_type)f(xtype,)i(size_t)f(len,)
-1965 3106 y(int)h(depth_varid,)d(int)j(z1_varid,)f(int)g(z2_varid,)g
-(int)h(a_varid,)1965 3216 y(int)g(href_varid,)e(int)i(k_c_varid,)e(int)
-h(*lvl_dimidp,)1965 3325 y(int)h(*lvl_varidp\);)150 3498
-y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-3666 y Fc(varid)240 b Fi(The)30 b(v)-5 b(arid)30 b(of)g(the)h(v)m
-(ertical)i(co)s(ordinate)e(v)-5 b(ariable.)150 3834 y
-Fc(xtype)240 b Fi(The)30 b(t)m(yp)s(e)g(of)h(this)f(co)s(ordinate)h(v)
--5 b(ariable.)150 4002 y Fc(len)336 b Fi(The)30 b(length)h(of)f(this)g
-(co)s(ordinate)i(dimension.)150 4170 y Fc(depth_varid)630
-4280 y Fi(The)e(v)-5 b(ariable)31 b(ID)g(of)f(the)h(depth)e(v)-5
-b(ariable.)150 4448 y Fc(z1_varid)96 b Fi(The)30 b(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(z1)g(v)-5 b(ariable.)150
-4616 y Fc(z2_varid)96 b Fi(The)30 b(v)-5 b(ariable)31
-b(ID)g(of)f(the)h(z2)g(v)-5 b(ariable.)150 4784 y Fc(a_varid)144
-b Fi(The)30 b(v)-5 b(ariable)31 b(ID)g(of)f(the)h(a)f(v)-5
-b(ariable.)150 4953 y Fc(href_varid)630 5062 y Fi(The)30
-b(v)-5 b(ariable)31 b(ID)g(of)f(the)h(href)e(v)-5 b(ariable.)150
-5230 y Fc(k_c_varid)630 5340 y Fi(The)30 b(v)-5 b(ariable)31
-b(ID)g(of)f(the)h(k)p 1605 5340 V 40 w(c)f(v)-5 b(ariable.)p
-eop end
-%%Page: 31 35
-TeXDict begin 31 34 bop 150 -116 a Fi(Chapter)30 b(2:)41
-b(V)-8 b(ariables)2681 b(31)150 299 y Fc(lvl_dimidp)630
-408 y Fi(If)37 b(non-NULL,)g(the)g(dimension)g(ID)g(of)g(the)h(netCDF)f
-(co)s(ordinate)h(dimension)f(will)h(b)s(e)630 518 y(written)30
-b(here.)150 670 y Fc(lvl_varidp)630 779 y Fi(If)24 b(non-NULL,)h(the)g
-(v)-5 b(ariable)26 b(ID)f(of)g(the)g(netCDF)g(co)s(ordinate)h(v)-5
-b(ariable)26 b(will)f(b)s(e)f(written)630 889 y(here.)150
-1114 y Fh(Return)45 b(Co)t(des)150 1273 y Fi(This)30
-b(function)g(returns)f(zero)i(for)f(success,)h(or)f(an)h(error)f(co)s
-(de)g(for)g(failure.)150 1498 y Fh(Example)150 1752 y(2.32)68
-b(Inquire)45 b(Ab)t(out)f(Ocean)i(Double)f(Sigma)g(Co)t(ordinate.)150
-1911 y Fi(Inquire)29 b(ab)s(out)h(the)h(o)s(cean)g(double)f(sigma)h(co)
-s(ordinate.)150 2136 y Fh(Usage)390 2295 y Fc(int)47
-b(nccf_inq_lvl_ocean_dbl_s)o(igma)o(\(in)o(t)42 b(ncid,)k(char)h
-(*name,)f(nc_type)g(*xtypep,)f(size_t)h(*lenp,)1965 2405
-y(int)h(*depth_varidp,)d(int)j(*z1_varidp,)d(int)j(*z2_varidp,)1965
-2515 y(int)g(*a_varidp,)e(int)i(*href_varidp,)d(int)j(*k_c_varidp,)1965
-2624 y(int)g(*lvl_dimidp,)d(int)j(*lvl_varidp\);)150
-2776 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-2928 y Fc(name)288 b Fi(If)28 b(non-NULL,)g(this)f(p)s(oin)m(ter)h
-(gets)h(the)g(name)f(of)g(the)g(co)s(ordinate)h(v)-5
-b(ariable)29 b(and)e(dimen-)630 3037 y(sion.)150 3189
-y Fc(xtypep)192 b Fi(If)30 b(non-NULL,)g(the)h(t)m(yp)s(e)f(of)h(the)f
-(co)s(ordinate)i(v)-5 b(ariable)31 b(will)g(b)s(e)e(written)i(here.)150
-3341 y Fc(lenp)288 b Fi(If)30 b(non-NULL,)g(the)h(length)g(of)f(the)h
-(co)s(ordinate)g(dimension)f(will)g(b)s(e)g(written)h(here.)150
-3493 y Fc(depth_varidp)630 3602 y Fi(If)f(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(depth)e(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)150 3754 y Fc(z1_varidp)630
-3864 y Fi(If)g(non-NULL,)g(the)h(v)-5 b(ariable)31 b(ID)g(of)f(the)h
-(z1)g(v)-5 b(ariable)31 b(will)g(b)s(e)e(written)i(here.)150
-4015 y Fc(z2_varidp)630 4125 y Fi(If)f(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(z2)g(v)-5 b(ariable)31
-b(will)g(b)s(e)e(written)i(here.)150 4277 y Fc(a_varidp)96
-b Fi(If)30 b(non-NULL,)g(the)h(v)-5 b(ariable)31 b(ID)g(of)f(the)h(a)f
-(v)-5 b(ariable)32 b(will)e(b)s(e)g(written)g(here.)150
-4429 y Fc(href_varidp)630 4538 y Fi(If)g(non-NULL,)g(the)h(v)-5
-b(ariable)31 b(ID)g(of)f(the)h(href)e(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)150 4690 y Fc(k_c_varidp)630
-4800 y Fi(If)g(non-NULL,)g(the)h(v)-5 b(ariable)31 b(ID)g(of)f(the)h(k)
-p 2148 4800 28 4 v 40 w(c)f(v)-5 b(ariable)31 b(will)g(b)s(e)f(written)
-g(here.)150 4951 y Fc(lvl_dimidp)630 5061 y Fi(If)g(non-NULL,)g(the)h
-(dimid)e(of)i(the)f(co)s(ordinate)i(dimension)d(will)i(b)s(e)f(written)
-g(here.)150 5213 y Fc(lvl_varidp)630 5322 y Fi(If)g(non-NULL,)g(the)h
-(v)-5 b(arid)30 b(of)g(the)h(co)s(ordinate)g(v)-5 b(ariable)31
-b(will)g(b)s(e)f(written)g(here.)p eop end
-%%Page: 32 36
-TeXDict begin 32 35 bop 150 -116 a Fi(32)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fh(Return)45
-b(Co)t(des)150 458 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(an)h(error)f(co)s(de)g(for)g(failure.)150
-691 y Fh(Example)150 948 y(2.33)68 b(Get)46 b(a)f(geographic)h(subset)f
-(of)g(the)g(data.)150 1108 y Fi(Get)31 b(a)g(geographic)h(subset)e(of)g
-(the)h(data.)150 1340 y Fh(Usage)533 1499 y Fc(int)47
-b(nccf_get_vara\(int)c(ncid,)k(int)f(varid,)h(float)f(*lat_bounds,)e
-(int)j(*nlat,)f(float)h(*lon_bounds,)629 1609 y(int)g(*nlon,)f(int)h
-(*lvl_index,)d(int)j(*nlvl,)f(int)h(rec,)g(void)f(*data\);)150
-1768 y(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-1928 y Fc(varid)240 b Fi(The)30 b(v)-5 b(arid)30 b(of)g(the)h(data)g(v)
--5 b(ariable)31 b(from)f(whic)m(h)g(the)h(subset)f(will)g(b)s(e)g(tak)m
-(en.)150 2087 y Fc(lat_bounds)630 2197 y Fi(A)j(length)g(t)m(w)m(o)g
-(arra)m(y)-8 b(,)35 b(this)d(holds)g(the)h(latitude)g(start)g(and)f
-(stop)h(v)-5 b(alues)33 b(for)f(the)h(range)630 2306
-y(of)e(in)m(terest.)150 2466 y Fc(nlat)288 b Fi(A)31
-b(p)s(oin)m(ter)f(to)i(an)e(in)m(teger)i(whic)m(h)e(will)h(get)h(the)f
-(n)m(um)m(b)s(er)e(of)i(latitude)g(v)-5 b(alues)31 b(whic)m(h)f(fall)
-630 2575 y(within)g(the)g(range.)150 2735 y Fc(lon_bounds)630
-2844 y Fi(A)e(length)h(t)m(w)m(o)g(arra)m(y)-8 b(,)30
-b(this)e(holds)g(the)g(longitude)h(start)g(and)e(stop)i(v)-5
-b(alues)28 b(for)g(the)h(range)630 2954 y(of)i(in)m(terest.)41
-b(\(W)-8 b(rapping)31 b(around)f(the)g(dateline)i(is)e(not)h(allo)m(w)m
-(ed!\))150 3113 y Fc(nlon)288 b Fi(A)26 b(p)s(oin)m(ter)h(to)g(an)f(in)
-m(teger)h(whic)m(h)f(will)h(get)g(the)g(n)m(um)m(b)s(er)e(of)h
-(longitude)h(v)-5 b(alues)26 b(whic)m(h)g(fall)630 3223
-y(within)k(the)g(range.)150 3382 y Fc(lvl_index)630 3492
-y Fi(A)39 b(zero-based)g(index)f(n)m(um)m(b)s(er)f(for)h(the)h(v)m
-(erticle)h(lev)m(el)g(of)f(in)m(terest)g(to)g(the)g(subsetter.)630
-3601 y(\(Ignored)30 b(if)h(data)g(has)f(no)g(v)m(ertical)j(axis\).)150
-3761 y Fc(timestep)96 b Fi(A)35 b(zero-based)h(index)f(n)m(um)m(b)s(er)
-f(for)h(the)h(timestep)g(of)f(in)m(terest)i(to)e(the)h(subsetter.)55
-b(\(Ig-)630 3870 y(nored)30 b(if)g(data)h(has)f(no)h(time)g(axis\).)150
-4030 y Fc(data)288 b Fi(A)29 b(p)s(oin)m(ter)g(to)g(whic)m(h)g(the)g
-(data)h(subset)e(will)h(b)s(e)f(written.)41 b(Memory)29
-b(m)m(ust)g(b)s(e)f(allo)s(cated)630 4139 y(\(and)i(deallo)s(cated\))j
-(b)m(y)d(the)h(user.)150 4372 y Fh(Return)45 b(Co)t(des)150
-4531 y Fi(This)30 b(function)g(returns)f(zero)i(for)f(success,)h(or)f
-(an)h(error)f(co)s(de)g(for)g(failure.)150 4764 y Fh(Example)p
-eop end
-%%Page: 33 37
-TeXDict begin 33 36 bop 150 -116 a Fi(Chapter)30 b(3:)41
-b(Co)s(ordinate)30 b(Systems)2250 b(33)150 299 y Ff(3)80
-b(Co)t(ordinate)53 b(Systems)150 657 y Fh(3.1)68 b(Lab)t(el)45
-b(the)h(axis)f(t)l(yp)t(e)g(of)g(a)h(co)t(ordinate)f(v)-7
-b(ar)45 b(with)389 790 y(nccf)p 634 790 41 6 v 59 w(def)p
-870 790 V 59 w(axis)p 1155 790 V 60 w(t)l(yp)t(e)150
-1053 y(Usage)390 1212 y Fc(int)390 1322 y(nccf_def_axis_type\(int)d
-(ncid,)k(int)h(varid,)f(int)h(axis_type\);)150 1497 y(ncid)288
-b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150 1745 y Fh(Return)45
-b(Co)t(des)150 1905 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(a)h(netCDF)g(error)f(co)s(de)h(for)f(failure.)150
-2153 y Fh(Example)150 2400 y(3.2)68 b(Find)44 b(out)h(the)h(axis)f(t)l
-(yp)t(e)g(of)h(a)f(co)t(ordinate)g(v)-7 b(ar)45 b(with)389
-2533 y(nccf)p 634 2533 V 59 w(inq)p 876 2533 V 59 w(axis)p
-1161 2533 V 60 w(t)l(yp)t(e)150 2796 y(Usage)390 2955
-y Fc(int)390 3065 y(nccf_inq_axis_type\(int)d(ncid,)k(int)h(varid,)f
-(int)h(*axis_type\);)150 3240 y(ncid)288 b Fi(The)30
-b(ncid)g(of)g(the)h(\014le.)150 3489 y Fh(Return)45 b(Co)t(des)150
-3648 y Fi(This)30 b(function)g(returns)f(zero)i(for)f(success,)h(or)f
-(a)h(netCDF)g(error)f(co)s(de)h(for)f(failure.)150 3896
-y Fh(Example)150 4159 y(3.3)68 b(De\014ne)45 b(a)g(co)t(ordinate)h
-(system)g(with)f(nccf)p 2582 4159 V 59 w(def)p 2818 4159
-V 59 w(co)t(ord)p 3205 4159 V 59 w(system)150 4422 y(Usage)390
-4581 y Fc(int)390 4691 y(nccf_def_coord_system\(in)o(t)d(ncid,)k(const)
-h(char)f(*name,)g(int)h(naxes,)f(int)h(*axis_varids,)1345
-4800 y(int)f(*system_varid\);)275 4945 y Fi(De\014ne)21
-b(a)g(co)s(ordinate)h(system)f(consisting)g(of)g(naxes)g(axes,)j(eac)m
-(h)e(axis)f(represen)m(ted)g(b)m(y)g(a)g(co)s(ordinate)150
-5055 y(v)-5 b(arid)35 b(in)f(the)i(axis)p 817 5055 28
-4 v 40 w(v)-5 b(arids)35 b(arra)m(y)-8 b(.)55 b(This)35
-b(create)h(a)g(new)e(\(scalar,)k(NC)p 2623 5055 V 40
-w(CHAR\))d(v)-5 b(ar,)36 b(whose)f(v)-5 b(arid)35 b(is)150
-5165 y(returned)29 b(in)h(system)p 902 5165 V 40 w(v)-5
-b(arid.)150 5340 y Fc(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)
-p eop end
-%%Page: 34 38
-TeXDict begin 34 37 bop 150 -116 a Fi(34)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fh(Return)45
-b(Co)t(des)150 458 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(a)h(netCDF)g(error)f(co)s(de)h(for)f(failure.)150
-691 y Fh(Example)150 934 y(3.4)68 b(Find)44 b(out)h(ab)t(out)g(a)h(co)t
-(ordinate)f(system)h(with)389 1066 y(nccf)p 634 1066
-41 6 v 59 w(inq)p 876 1066 V 59 w(co)t(ord)p 1263 1066
-V 59 w(system)150 1324 y(Usage)390 1483 y Fc(int)390
-1593 y(nccf_inq_coord_system\(in)o(t)c(ncid,)k(int)h(system_varid,)d
-(char)j(*name,)1345 1703 y(int)f(*naxes,)g(int)h(*axis_varids\);)275
-1838 y Fi(Find)34 b(out)h(ab)s(out)f(a)h(co)s(ordinate)h(system,)g
-(it's)f(name,)h(n)m(um)m(b)s(er)d(of)i(axes,)i(and)d(the)h(v)-5
-b(arid)34 b(of)h(eac)m(h)150 1947 y(axis)c(co)s(ordinate)g(v)-5
-b(ar.)150 2107 y Fc(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)
-150 2341 y Fh(Return)45 b(Co)t(des)150 2500 y Fi(This)30
-b(function)g(returns)f(zero)i(for)f(success,)h(or)f(a)h(netCDF)g(error)
-f(co)s(de)h(for)f(failure.)150 2733 y Fh(Example)150
-2975 y(3.5)68 b(Assign)45 b(a)g(co)t(ordinate)h(system)f(to)h(a)f(v)-7
-b(ar)45 b(with)389 3108 y(nccf)p 634 3108 V 59 w(assign)p
-1043 3108 V 60 w(co)t(ord)p 1431 3108 V 58 w(system)150
-3366 y(Usage)390 3525 y Fc(int)390 3635 y(nccf_assign_coord_system)o
-(\(int)c(ncid,)46 b(int)h(varid,)f(int)h(system_varid\);)275
-3770 y Fi(Assign)30 b(a)h(co)s(ordinate)g(system)f(to)i(a)e(v)-5
-b(ar.)41 b(This)30 b(adds)f(an)h(attribute)i(to)f(the)f(v)-5
-b(ar.)150 3930 y Fc(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)
-150 4163 y Fh(Return)45 b(Co)t(des)150 4323 y Fi(This)30
-b(function)g(returns)f(zero)i(for)f(success,)h(or)f(a)h(netCDF)g(error)
-f(co)s(de)h(for)f(failure.)150 4556 y Fh(Example)150
-4813 y(3.6)68 b(De\014ne)45 b(a)g(co)t(ordinate)h(transform)g(with)f
-(nccf)p 2755 4813 V 58 w(def)p 2990 4813 V 60 w(transform)150
-5071 y(Usage)390 5230 y Fc(int)390 5340 y(nccf_def_transform\(int)d
-(ncid,)k(const)g(char)h(*name,)f(const)h(char)f(*transform_type,)p
-eop end
-%%Page: 35 39
-TeXDict begin 35 38 bop 150 -116 a Fi(Chapter)30 b(3:)41
-b(Co)s(ordinate)30 b(Systems)2250 b(35)1201 299 y Fc(const)47
-b(char)f(*transform_name,)e(int)j(*transform_varid\);)275
-437 y Fi(De\014ne)40 b(a)g(co)s(ordinate)h(transform.)68
-b(This)39 b(adds)h(a)g(\(scalar,)k(NC)p 2585 437 28 4
-v 40 w(CHAR\))c(v)-5 b(ar,)42 b(whic)m(h)e(con)m(tains)150
-546 y(some)31 b(attributes.)41 b(The)30 b(v)-5 b(arid)30
-b(of)h(this)f(new)g(v)-5 b(ariable)31 b(is)f(returned)f(in)i(transform)
-p 3020 546 V 39 w(v)-5 b(arid.)150 711 y Fc(ncid)288
-b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150 949 y Fh(Return)45
-b(Co)t(des)150 1108 y Fi(This)30 b(function)g(returns)f(zero)i(for)f
-(success,)h(or)f(a)h(netCDF)g(error)f(co)s(de)h(for)f(failure.)150
-1346 y Fh(Example)150 1589 y(3.7)68 b(Find)44 b(out)h(ab)t(out)g(a)h
-(co)t(ordinate)f(transform)h(with)389 1722 y(nccf)p 634
-1722 41 6 v 59 w(inq)p 876 1722 V 59 w(transform)150
-1981 y(Usage)390 2141 y Fc(int)390 2250 y(nccf_inq_transform\(int)c
-(ncid,)k(int)h(transform_varid,)c(char)k(*name,)f(size_t)g(*type_len,)
-1201 2360 y(char)h(*transform_type,)c(size_t)j(*name_len,)f(char)i
-(*transform_name\);)275 2498 y Fi(Find)21 b(out)i(ab)s(out)f(a)h(co)s
-(ordinate)g(transform,)g(it's)g(name,)h(and)e(the)g(con)m(ten)m(ts)i
-(of)f(the)f(transform)p 3542 2498 28 4 v 40 w(t)m(yp)s(e)150
-2608 y(and)38 b(transform)p 729 2608 V 39 w(name)h(attributes.)67
-b(P)m(ass)39 b(NULL)f(for)h(an)m(y)g(that)g(y)m(ou're)g(not)g(in)m
-(terested)h(in.)65 b(P)m(ass)150 2717 y(NULL)48 b(for)g(transform)p
-999 2717 V 39 w(t)m(yp)s(e)g(and)g(transform)p 1843 2717
-V 39 w(name)g(to)h(get)g(their)f(lengths)g(with)g(t)m(yp)s(e)p
-3405 2717 V 40 w(len)h(and)150 2827 y(name)p 368 2827
-V 40 w(len.)150 2991 y Fc(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h
-(\014le.)150 3229 y Fh(Return)45 b(Co)t(des)150 3388
-y Fi(This)30 b(function)g(returns)f(zero)i(for)f(success,)h(or)f(a)h
-(netCDF)g(error)f(co)s(de)h(for)f(failure.)150 3626 y
-Fh(Example)150 3870 y(3.8)68 b(Assign)45 b(a)g(co)t(ordinate)h
-(transform)f(to)h(a)f(co)t(ordinate)h(system)389 4003
-y(with)f(nccf)p 940 4003 41 6 v 59 w(assign)p 1349 4003
-V 60 w(transform)150 4262 y(Usage)390 4421 y Fc(int)390
-4531 y(nccf_assign_transform\(in)o(t)d(ncid,)k(int)h(system_varid,)d
-(int)j(transform_varid\);)275 4669 y Fi(Assign)37 b(a)h(co)s(ordinate)g
-(transform)e(to)j(a)e(co)s(ordinate)h(system.)62 b(This)37
-b(adds)f(an)i(attribute)g(to)g(the)150 4778 y(v)-5 b(ariable)31
-b(that)g(holds)f(the)h(co)s(ordinate)g(system)f(attributes.)150
-4943 y Fc(ncid)288 b Fi(The)30 b(ncid)g(of)g(the)h(\014le.)150
-5181 y Fh(Return)45 b(Co)t(des)150 5340 y Fi(This)30
-b(function)g(returns)f(zero)i(for)f(success,)h(or)f(a)h(netCDF)g(error)
-f(co)s(de)h(for)f(failure.)p eop end
-%%Page: 36 40
-TeXDict begin 36 39 bop 150 -116 a Fi(36)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fh(Example)p
-eop end
-%%Page: 37 41
-TeXDict begin 37 40 bop 150 -116 a Fi(Chapter)20 b(4:)36
-b(GRIDSPEC)19 b(-)i(A)f(standard)g(for)g(the)g(description)h(of)f
-(grids)g(used)f(in)h(Earth)g(System)g(mo)s(dels37)150
-141 y Ff(4)80 b(GRIDSPEC)54 b(-)f(A)h(standard)f(for)h(the)f
-(description)d(of)311 299 y(grids)j(used)f(in)i(Earth)f(System)g(mo)t
-(dels)150 575 y Fi(The)28 b(GRIDSPEC)f(is)i(a)f(prop)s(osed)f(CF)h
-(standard.)39 b(It)29 b(is)f(not)h(y)m(et)g(part)f(of)g(the)h(Climate)g
-(and)f(F)-8 b(orecast)150 685 y(Con)m(v)m(en)m(tions.)40
-b(Supp)s(ort)21 b(for)i(GRIDSPEC)g(in)g(lib)s(cf)h(is)f(pro)m(vided)g
-(as)h(a)g(service)g(to)g(the)g(CF)f(comm)m(unit)m(y)-8
-b(,)150 795 y(allo)m(wing)32 b(for)e(the)h(ev)-5 b(aluation)32
-b(of)e(the)h(prop)s(osed)e(GRIDSPEC)h(standard.)275 943
-y(Eac)m(h)43 b(of)f(the)h(GRIDSPEC)e(to)s(ols)i(listed)g(b)s(elo)m(w)g
-(ma)m(y)g(b)s(e)f(call)h(programmatically)-8 b(,)48 b(or)42
-b(with)h(a)150 1053 y(command)30 b(line)h(utilit)m(y)-8
-b(.)275 1202 y(F)g(or)21 b(more)f(information)h(ab)s(out)f(GRIDSPEC)f
-(see)i Fc(http://www.gfdl.noaa.gov)o(/~vb)o(/gri)o(dst)o(d/gr)o(idst)o
-(d.h)o(tml)p Fi(.)150 1455 y Fh(4.1)68 b(Mak)l(e)46 b(a)f(Horizon)l
-(tal)h(Grid)150 1615 y Fi(This)27 b(function)g(can)h(generate)h
-(di\013eren)m(t)f(t)m(yp)s(es)g(of)f(horizon)m(tal)i(grids.)40
-b(The)27 b(output)g(data)h(is)g(on)f(sup)s(er-)150 1724
-y(grid)k(\()h(mo)s(del)f(grid)g(size)h(x)f(re\014nemen)m(t\(=2\))h(\).)
-44 b(F)-8 b(or)32 b('cubic)p 2257 1724 28 4 v 40 w(grid',)g(six)f(grid)
-g(\014les)g(whic)m(h)g(con)m(tain)i(the)150 1834 y(grid)d(information)h
-(for)f(eac)m(h)h(tile)h(will)f(b)s(e)f(generated,)h(otherwise)g(one)g
-(\014le)f(will)h(b)s(e)f(generated.)275 1983 y(Sp)s(ecify)44
-b(the)i(grid)f(t)m(yp)s(e)g(through)g(grid)p 1720 1983
-V 40 w(t)m(yp)s(e)g(parameter.)86 b(The)45 b(v)-5 b(alue)46
-b(of)g(grid)p 3222 1983 V 39 w(t)m(yp)s(e)g(can)g(b)s(e)150
-2092 y('from)p 366 2092 V 40 w(\014le',)40 b('sp)s(ectral)p
-948 2092 V 41 w(grid',)f('spherical)p 1609 2092 V 41
-w(grid',)g('conformal)p 2312 2092 V 41 w(cubic)p 2560
-2092 V 40 w(grid',)h('gnomonic)p 3250 2092 V 41 w(ed')e(or)g('sim-)150
-2202 y(ple)p 272 2202 V 40 w(cartesian)p 665 2202 V 41
-w(grid',)31 b(with)f(default)h(v)-5 b(alue)31 b('spherical)p
-2066 2202 V 40 w(grid'.)275 2350 y(The)22 b(nlon)h(and)f(nlat)h
-(parameters)h(m)m(ust)f(b)s(e)f(sp)s(eci\014ed)g(to)i(indicate)g(sup)s
-(ergrid)d(size)j(\(for)f(cubic)p 3534 2350 V 40 w(grid,)150
-2460 y(nlat)31 b(is)f(not)h(needed)f(b)s(ecause)g(nlat)h(has)f(the)h
-(same)g(v)-5 b(alue)30 b(as)h(nlon\).)390 2609 y Fc(int)390
-2718 y(gs_make_hgrid\(char)43 b(*grid_type,)i(int)h(*nlat,)h(int)f
-(*nlon,)676 2828 y(int)h(nxbnds0,)f(int)h(nybnds0,)e(int)i(nxbnds1,)f
-(int)h(nybnds1,)676 2937 y(int)g(nxbnds2,)f(int)h(nybnds2,)e(double)h
-(lat_join,)g(int)h(nratio,)676 3047 y(double)f(simple_dx,)f(double)i
-(simple_dy,)e(int)h(ntilex,)g(int)h(ntiley,)1058 3157
-y(char)g(*gridname,)e(char)h(*center,)g(char)h(*history,)e(double)h
-(*xbnds,)676 3266 y(double)g(*ybnds\))275 3415 y Fi(The)29
-b(follo)m(wing)j(grid)e(t)m(yp)s(es)h(are)g(a)m(v)-5
-b(ailable:)150 3595 y Fc(from_file)630 3705 y Fi(m)m(y)p
-757 3705 V 40 w(grid)p 954 3705 V 40 w(\014le)35 b(m)m(ust)f(b)s(e)g
-(sp)s(eci\014ed.)52 b(The)34 b(grid)g Fc(")h Fi(sp)s(eci\014ed)e(in)h
-(m)m(y)p 2982 3705 V 41 w(grid)p 3180 3705 V 39 w(\014le)h(should)f(b)s
-(e)630 3815 y(sup)s(er)29 b(grid)h(v)m(ertex.)150 3988
-y Fc(spectral_grid)630 4098 y Fi(no)g(other)h(optional)g(or)g(required)
-e(argumen)m(ts.)150 4271 y Fc(regular_lonlat_grid)630
-4381 y Fi(nxbnds,)f(n)m(ybnds)h(xbnds,)g(ybnds,)g(m)m(ust)h(b)s(e)g(sp)
-s(eci\014ed)g(to)h(de\014ne)e(the)i(grid)f(b)s(ounds.)150
-4554 y Fc(tripolar_grid)630 4664 y Fi(nxbnds,)40 b(n)m(ybnds,)h(xbnds,)
-g(ybnds,)f(m)m(ust)g(b)s(e)f(sp)s(eci\014ed)h(to)g(de\014ne)f(the)h
-(grid)g(b)s(ounds.)630 4774 y(lat)p 741 4774 V 41 w(join)30
-b(is)h(optional)g(with)f(default)h(v)-5 b(alue)31 b(65.)150
-4947 y Fc(conformal_cubic_grid)630 5057 y Fi(nratio)g(is)f(optional)i
-(argumen)m(t.)150 5230 y Fc(gnomonic_ed)630 5340 y Fi(equal)f(distance)
-g(gnomonic)g(cubic)f(grid.)p eop end
-%%Page: 38 42
-TeXDict begin 38 41 bop 150 -116 a Fi(38)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fc(simple_cartesian_grid)630
-408 y Fi(xbnds,)25 b(ybnds)f(m)m(ust)h(b)s(e)g(sp)s(eci\014ed)g(to)h
-(de\014ne)f(the)g(grid)g(b)s(ounds)f(lo)s(cation)j(and)e(grid)g(size.)
-630 518 y(n)m(um)m(b)s(er)38 b(of)h(b)s(ounds)e(m)m(ust)i(b)s(e)f(2)i
-(in)f(b)s(oth)f(and)h(x)g(and)f(y-direction.)68 b(simple)p
-3432 518 28 4 v 40 w(dx)39 b(and)630 628 y(simple)p 889
-628 V 40 w(dy)30 b(m)m(ust)g(b)g(sp)s(eci\014ed)g(to)h(sp)s(ecify)f
-(uniform)f(cell)i(length.)150 799 y Fc(grid_type)630
-908 y Fi(sp)s(ecify)f(t)m(yp)s(e)h(of)f(top)s(ograph)m(y)h(\(see)g
-(table)g(ab)s(o)m(v)m(e\).)150 1080 y Fc(my_grid_file)630
-1189 y Fi(when)60 b(this)g(\015ag)h(is)g(presen)m(t,)69
-b(the)61 b(program)f(will)h(read)g(grid)f(information)h(from)630
-1299 y('m)m(y)p 782 1299 V 40 w(grid)p 979 1299 V 40
-w(\014le'.)41 b(The)27 b(\014le)h(format)h(can)f(b)s(e)f(ascii)j
-(\014le)e(or)g(netcdf)g(\014le.)40 b(Multiple)29 b(\014le)f(en)m(try)
-630 1408 y(are)j(allo)m(w)m(ed)h(but)e(the)g(n)m(um)m(b)s(er)f(should)h
-(b)s(e)f(less)i(than)f(MAXBOUNDS.)150 1580 y Fc(nxbnds)192
-b Fi(Sp)s(ecify)30 b(n)m(um)m(b)s(er)f(of)h(zonal)i(regions)e(for)h(v)
--5 b(arying)30 b(resolution.)150 1751 y Fc(nybnds)192
-b Fi(Sp)s(ecify)30 b(n)m(um)m(b)s(er)f(of)h(meridinal)h(regions)f(for)h
-(v)-5 b(arying)30 b(resolution.)150 1922 y Fc(xbnds)240
-b Fi(Sp)s(ecify)23 b(b)s(oundaries)g(for)g(de\014ning)g(zonal)i
-(regions)g(of)f(v)-5 b(arying)24 b(resolution.)39 b(When)24
-b(trip)s(o-)630 2032 y(lar)36 b(is)g(presen)m(t,)h(x)f(also)g
-(de\014nes)f(the)h(longitude)g(of)g(the)g(t)m(w)m(o)h(new)e(p)s(oles)h
-(nxbnds)d(m)m(ust)630 2141 y(b)s(e)f(2)i(and)e(lon)p
-1141 2141 V 40 w(start)h(=)g(x\(1\),)i(lon)p 1849 2141
-V 40 w(end)d(=)h(x\(nxbnds\))e(are)j(longitude)f(of)g(the)g(t)m(w)m(o)h
-(new)630 2251 y(p)s(oles.)150 2422 y Fc(ybnds)240 b Fi(Sp)s(ecify)30
-b(b)s(oundaries)f(for)h(de\014ning)f(meridional)i(regions)g(of)f(v)-5
-b(arying)31 b(resolution)150 2593 y Fc(nlon)288 b Fi(Num)m(b)s(er)28
-b(of)h(mo)s(del)h(grid)e(p)s(oin)m(ts\(sup)s(ergrid\))g(for)h(eac)m(h)i
-(zonal)f(regions)g(of)f(v)-5 b(arying)29 b(reso-)630
-2703 y(lution.)150 2874 y Fc(nlat)288 b Fi(Num)m(b)s(er)37
-b(of)h(mo)s(del)f(grid)h(p)s(oin)m(ts\(sup)s(ergid\))f(for)g(eac)m(h)i
-(meridinal)f(regions)g(of)g(v)-5 b(arying)630 2984 y(resolution.)150
-3155 y Fc(lat_join)96 b Fi(Sp)s(ecify)33 b(latitude)i(for)f(joining)h
-(spherical)f(and)f(rotate)j(bip)s(olar)e(grid.)51 b(Default)35
-b(v)-5 b(alue)35 b(is)630 3265 y(65)c(degree.)150 3436
-y Fc(nratio)192 b Fi(Sp)s(eicify)25 b(the)h(re\014nemen)m(t)f(ratio)i
-(when)d(calculating)k(cell)f(length)f(and)e(area)j(of)f(sup)s(ergrid.)
-150 3607 y Fc(simple_dx)630 3717 y Fi(Sp)s(ecify)k(the)g(uniform)f
-(cell)j(length)f(in)f(x-direction)h(fo)g(simple)f(cartesian)i(grid.)150
-3888 y Fc(simple_dy)630 3998 y Fi(Sp)s(ecify)e(the)g(uniform)f(cell)j
-(length)f(in)f(y-direction)h(fo)g(simple)f(cartesian)i(grid.)150
-4169 y Fc(ndivx)240 b Fi(Sp)s(ecify)30 b(n)m(um)m(b)s(er)f(division)h
-(in)g(x-direction)h(for)g(eac)m(h)g(face,)h(default)e(v)-5
-b(alue)31 b(is)g(1.)150 4340 y Fc(ndivy)240 b Fi(Sp)s(ecify)30
-b(n)m(um)m(b)s(er)f(division)h(in)g(y-direction)h(for)g(eac)m(h)g
-(face,)h(default)e(v)-5 b(alue)31 b(is)g(1.)150 4511
-y Fc(grid_name)630 4621 y Fi(Sp)s(ecify)d(the)i(grid)f(name.)40
-b(The)29 b(output)g(grid)g(\014le)g(name)g(will)h(b)s(e)e(grid)p
-3074 4621 V 40 w(name.nc)i(if)f(there)630 4730 y(is)39
-b(one)h(tile)g(and)e(grid)p 1419 4730 V 40 w(name.tile#.nc)j(if)e
-(there)g(is)g(more)h(than)e(one)i(tile)g(The)f(default)630
-4840 y(v)-5 b(alue)31 b(will)g(b)s(e)e(horizon)m(tal)p
-1561 4840 V 42 w(grid.)150 5011 y Fc(center)192 b Fi(Sp)s(ecify)36
-b(the)i(cen)m(ter)g(lo)s(cation)h(of)e(grid.)61 b(The)37
-b(v)-5 b(alid)38 b(en)m(try)f(will)h(b)s(e)e('none',)k('t)p
-3441 5011 V 40 w(cell')f(or)630 5121 y('c)p 701 5121
-V 41 w(cell')g(with)f(default)g(v)-5 b(alue)38 b('none'.)64
-b(The)37 b(grid)h(re\014nemen)m(t)g(is)g(assumed)f(to)i(b)s(e)e(2)h(in)
-630 5230 y(x)c(and)f(y-direction)i(when)d(cen)m(ter)j(is)f(not)g
-('none'.)51 b('c)p 2511 5230 V 41 w(cell')35 b(should)e(b)s(e)g(used)g
-(for)h(the)g(gr)630 5340 y(used)c(in)g(MOM4.)p eop end
-%%Page: 39 43
-TeXDict begin 39 42 bop 150 -116 a Fi(Chapter)20 b(4:)36
-b(GRIDSPEC)19 b(-)i(A)f(standard)g(for)g(the)g(description)h(of)f
-(grids)g(used)f(in)h(Earth)g(System)g(mo)s(dels39)150
-299 y Fh(4.2)68 b(Remap)46 b(data)f(from)h(Input)e(Mosaic)h(to)h
-(Output)e(Mosaic)150 458 y Fi(This)30 b(function)g(remaps)g(data)h
-(\(scalar)g(or)g(v)m(ector\))h(from)e(input)p 2382 458
-28 4 v 39 w(mosaic)h(on)m(to)h(output)p 3192 458 V 40
-w(mosaic.)275 602 y(The)25 b(target)i(grid)f(also)g(could)g(b)s(e)f(sp)
-s(eci\014ed)g(through)g(lonBegin,)k(lonEnd,)d(latBegin,)i(latEnd,)f
-(nlon)150 712 y(and)j(nlat.)275 856 y(Curren)m(tly)h(only)h(T-cell)i
-(scalar)f(regridding)f(and)f(A)m(GRID)i(v)m(ector)h(regridding)e
-(\(only)h(bilinear)f(in-)150 965 y(terp)s(olation)25
-b(is)g(implemen)m(ted)g(for)f(cubic)g(grid)g(v)m(ector)i(in)m(terp)s
-(olation\).)40 b(The)24 b(in)m(terp)s(olation)i(algorithm)150
-1075 y(used)k(is)g(con)m(trolled)i(b)m(y)e(in)m(terp)p
-1238 1075 V 40 w(metho)s(d)g(with)g(default)h('conserv)m(e)p
-2480 1075 V 41 w(order1'.)275 1219 y(Curren)m(tly)c(only)h('conserv)m
-(e)p 1248 1219 V 41 w(order1',)h('conserv)m(e)p 1979
-1219 V 42 w(order2')f(and)g('bilinear')g(remapping)g(sc)m(heme)h(are)
-150 1329 y(implemen)m(ted.)45 b('bilinear')32 b(is)g(only)g(used)f(to)h
-(remap)g(data)g(from)f(cubic)h(grid)f(to)i(latlon)f(grid.)45
-b(W)-8 b(e)33 b(will)150 1438 y(add)24 b(more)i(sc)m(heme)g(in)e(the)i
-(future)e(if)h(needed.)38 b(fregrid)25 b(exp)s(ects)g(NetCDF)i(format)e
-(input.)38 b(scalar)p 3548 1438 V 41 w(\014eld)150 1548
-y(and/or)30 b(u)p 510 1548 V 40 w(\014eld/v)p 810 1548
-V 40 w(\014eld)g(m)m(ust)g(b)s(e)g(sp)s(eci\014ed.)40
-b(u)p 1849 1548 V 39 w(\015d)30 b(and)f(v)p 2244 1548
-V 40 w(\015d)h(m)m(ust)g(b)s(e)g(paired)g(together.)390
-1692 y Fc(int)390 1801 y(gs_fregrid\(char)44 b(*history,)h(char)i
-(*mosaic_in,)d(char)j(*mosaic_out,)d(char)j(*dir_in,)915
-1911 y(char)g(*dir_out,)e(char)i(**input_file,)d(int)j(nfiles,)e(char)i
-(**output_file,)915 2021 y(int)g(nfiles_out,)e(char)h(*remap_file,)f
-(char)h(**scalar_name,)e(int)j(nscalar,)915 2130 y(char)g(**u_name,)e
-(int)i(nvector,)e(char)i(**v_name,)e(int)i(nvector2,)915
-2240 y(char)g(*interp_method,)c(char)k(*test_case,)e(double)h
-(test_param,)915 2349 y(unsigned)g(int)g(opcode,)g(int)h(grid_type,)e
-(unsigned)h(int)h(finer_step,)915 2459 y(int)g(fill_missing,)d(int)j
-(nlon,)f(int)h(nlat,)g(int)g(check_conserve,)915 2568
-y(int)g(y_at_center,)d(double)i(lonbegin,)g(double)g(lonend,)g(double)g
-(latbegin,)915 2678 y(double)g(latend,)g(int)h(kbegin,)f(int)h(kend,)f
-(int)h(lbegin,)f(int)h(lend\))150 2852 y(innput_mosaic)630
-2961 y Fi(Sp)s(ecify)33 b(the)h(input)e(mosaic)j(information.)50
-b(This)33 b(\014le)g(con)m(tains)i(list)f(of)g(tile)h(\014les)e(whic)m
-(h)630 3071 y(sp)s(ecify)d(the)h(grid)f(information)g(for)h(eac)m(h)g
-(tile.)150 3240 y Fc(input_file)630 3349 y Fi(sp)s(ecify)h(the)g(input)
-f(\014le)h(name.)46 b(The)31 b(su\016x)g('.nc')i(can)f(b)s(e)f
-(omitted.)47 b(The)31 b(su\016x)g('tile#')630 3459 y(should)39
-b(not)i(presen)m(t)f(for)g(m)m(ultiple-tile)i(\014les.)70
-b(The)40 b(n)m(um)m(b)s(er)f(of)h(\014les)g(m)m(ust)g(b)s(e)g(1)g(for)
-630 3569 y(scalar)31 b(regridding)f(and)g(can)h(b)s(e)f(1)h(or)f(2)h
-(for)g(v)m(ector)h(regridding.)40 b(File)32 b(path)e(should)g(not)630
-3678 y(b)s(e)g(includes.)150 3847 y Fc(scalar_field)630
-3957 y Fi(sp)s(ecify)35 b(the)g(scalar)h(\014eld)e(name)h(to)h(b)s(e)e
-(regridded.)54 b(The)35 b(m)m(ultiple)g(en)m(try)g(\014eld)g(names)630
-4066 y(are)c(sep)s(erated)f(b)m(y)g(comma.)150 4235 y
-Fc(u_field)144 b Fi(sp)s(ecify)31 b(the)g(v)m(ector)i(\014eld)e(u-comp)
-s(onen)m(tname)g(to)h(b)s(e)f(regridded.)42 b(The)31
-b(m)m(ultiple)h(en)m(try)630 4345 y(\014eld)42 b(names)h(are)g(sep)s
-(erated)g(b)m(y)f(comma.)79 b(u)p 2295 4345 V 40 w(\014eld)42
-b(m)m(ust)h(b)s(e)f(paired)g(together)i(with)630 4454
-y(v)p 684 4454 V 40 w(\014eld.)150 4623 y Fc(v_field)144
-b Fi(sp)s(ecify)31 b(the)h(v)m(ector)h(\014eld)e(v-comp)s(onen)m(tname)
-h(to)g(b)s(e)f(regridded.)43 b(The)31 b(m)m(ultiple)h(en)m(try)630
-4733 y(\014eld)43 b(names)f(are)i(sep)s(erated)f(b)m(y)f(comma.)80
-b(v)p 2294 4733 V 40 w(\014eld)42 b(m)m(ust)h(b)s(e)f(paired)h
-(together)h(with)630 4842 y(u)p 687 4842 V 40 w(\014eld.)150
-5011 y Fc(output_mosaic)630 5121 y Fi(sp)s(ecify)30 b(the)h(output)f
-(mosaic)i(information.)42 b(This)29 b(\014le)i(con)m(tains)h(list)f(of)
-g(tile)h(\014les)e(whic)m(h)630 5230 y(sp)s(ecify)24
-b(the)h(grid)f(information)g(for)h(eac)m(h)g(tile.)40
-b(If)24 b(output)p 2624 5230 V 40 w(mosaic)h(is)g(not)f(sp)s
-(eci\014ed,)h(nlon)630 5340 y(and)30 b(nlat)h(m)m(ust)f(b)s(e)g(sp)s
-(eci\014ed.)p eop end
-%%Page: 40 44
-TeXDict begin 40 43 bop 150 -116 a Fi(40)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fc(lonBegin)e(#)630
-408 y Fi(sp)s(ecify)c(the)h(starting)h(longitude\(in)f(degree\))h(of)f
-(the)g(geographical)i(region)e(of)g(the)g(target)630
-518 y(grid)30 b(on)g(whic)m(h)g(the)h(output)f(is)g(desired.)41
-b(The)30 b(default)g(v)-5 b(alue)31 b(is)f(0.)150 667
-y Fc(lonEnd)192 b Fi(sp)s(ecify)29 b(the)g(ending)f(longitude\(in)i
-(degree\))g(of)f(the)g(geographical)i(region)f(of)f(the)g(target)630
-776 y(grid)h(on)g(whic)m(h)g(the)h(output)f(is)g(desired.)41
-b(The)30 b(default)g(v)-5 b(alue)31 b(is)f(360.)150 925
-y Fc(latBegin)96 b Fi(sp)s(ecify)30 b(the)g(starting)h(latitude\(in)h
-(degree\))f(of)g(the)f(geographical)j(region)d(of)h(the)f(target)630
-1035 y(grid)g(on)g(whic)m(h)g(the)h(output)f(is)g(desired.)41
-b(The)30 b(default)g(v)-5 b(alue)31 b(is)f(-90.)150 1183
-y Fc(latEnd)192 b Fi(sp)s(ecify)34 b(the)h(ending)f(latitude\(in)h
-(degree\))h(of)f(the)f(geographical)j(region)e(of)g(the)f(target)630
-1293 y(grid)c(on)g(whic)m(h)g(the)h(output)f(is)g(desired.)41
-b(The)30 b(default)g(v)-5 b(alue)31 b(is)f(90.)150 1442
-y Fc(nlon)288 b Fi(sp)s(ecify)30 b(n)m(um)m(b)s(er)f(of)i(grid)f(b)s(o)
-m(x)g(cells)h(in)g(x-direction)g(for)f(a)h(regular)f(lat-lon)i(grid.)
-150 1590 y Fc(nlat)288 b Fi(sp)s(ecify)30 b(n)m(um)m(b)s(er)f(of)i
-(grid)f(b)s(o)m(x)g(cells)h(in)g(y-direction)g(for)f(a)h(regular)f
-(lat-lon)i(grid.)150 1739 y Fc(KlevelBegin)630 1849 y
-Fi(sp)s(ecify)e(b)s(egin)g(index)g(of)g(the)h(k-lev)m(el)h(\(depth)e
-(axis\))h(that)g(to)h(b)s(e)d(regridded.)150 1998 y Fc(KlevelEnd)630
-2107 y Fi(sp)s(ecify)h(end)g(index)g(of)g(the)h(k-lev)m(el)h(\(depth)e
-(axis\))h(that)g(to)g(b)s(e)f(regridded.)150 2256 y Fc(LstepBegin)630
-2365 y Fi(sp)s(ecify)g(the)h(b)s(egin)f(index)f(of)i(L-step)g(\(time)g
-(axis\))g(that)g(to)g(b)s(e)f(regridded.)150 2514 y Fc(LstepEnd)96
-b Fi(sp)s(ecify)30 b(the)h(end)e(index)h(of)h(L-step)f(\(time)i(axis\))
-f(that)g(to)g(b)s(e)f(regridded.)150 2663 y Fc(output_file)630
-2772 y Fi(sp)s(ecify)d(the)h(output)g(\014le)f(name.)40
-b(If)27 b(not)h(presen)m(ted,)h(output)p 2750 2772 28
-4 v 40 w(\014le)e(will)h(tak)m(e)i(the)e(v)-5 b(alue)28
-b(of)630 2882 y(input)p 849 2882 V 39 w(\014le.)39 b(The)26
-b(su\016x)f('.nc')h(can)g(b)s(e)f(omitted.)41 b(The)25
-b(su\016x)g('tile#')i(should)e(not)h(presen)m(t)630 2992
-y(for)33 b(m)m(ultiple-tile)j(\014les.)49 b(The)33 b(n)m(um)m(b)s(er)f
-(of)h(\014les)g(m)m(ust)g(b)s(e)g(1)h(for)f(scalar)h(regridding)f(and)
-630 3101 y(can)e(b)s(e)e(1)i(or)g(2)f(for)g(v)m(ector)i(regridding.)41
-b(File)31 b(path)f(should)g(not)g(b)s(e)g(includes)150
-3250 y Fc(input_dir)630 3360 y Fi(sp)s(ecify)22 b(the)h(path)f(that)h
-(stores)g(input)p 1935 3360 V 39 w(\014le.)38 b(If)22
-b(not)h(presen)m(ted,)h(the)f(input)f(\014le)g(is)h(assumed)630
-3469 y(to)31 b(b)s(e)f(stored)g(in)g(curren)m(t)h(diretory)-8
-b(.)150 3618 y Fc(output_dir)630 3727 y Fi(sp)s(ecify)26
-b(the)h(path)g(that)g(will)g(store)g(output)f(\014le.)40
-b(If)26 b(not)h(presen)m(ted,)h(the)f(output)f(\014le)h(will)630
-3837 y(b)s(e)j(stored)g(in)g(curren)m(t)g(diretory)-8
-b(.)150 3986 y Fc(remap_file)630 4095 y Fi(sp)s(ecify)34
-b(the)g(\014le)h(name)f(that)h(sa)m(v)m(es)h(remapping)e(information.)
-53 b(If)33 b(remap)p 3270 4095 V 40 w(\014le)i(is)f(sp)s(ec-)630
-4205 y(i\014ed)f(and)g(the)g(\014le)h(do)s(es)f(not)h(exist,)h
-(remapping)e(information)g(will)h(b)s(e)f(calculated)i(ans)630
-4315 y(stored)k(in)f(remap)p 1280 4315 V 40 w(\014le.)66
-b(If)39 b(remap)p 1875 4315 V 40 w(\014le)f(is)h(sp)s(eci\014ed)g(and)f
-(the)h(\014le)g(exists,)j(remapping)630 4424 y(information)31
-b(will)f(b)s(e)g(read)g(from)g(remap)p 2089 4424 V 40
-w(\014le.)150 4573 y Fc(interp_method)630 4682 y Fi(sp)s(ecify)48
-b(the)h(remapping)f(algorithm)i(to)g(b)s(e)e(used.)95
-b(Default)49 b(is)g('conserv)m(e)p 3411 4682 V 41 w(order1'.)630
-4792 y(Curren)m(tly)44 b(only)h('conserv)m(e)p 1637 4792
-V 41 w(order1',)k('conserv)m(e)p 2388 4792 V 41 w(order2')c(and)f
-('bilinear')i(remapping)630 4902 y(sc)m(heme)40 b(are)f(implemen)m(ted)
-h(in)f(this)g(to)s(ol.)68 b(The)38 b(bilinear)i(sc)m(heme)g(can)f(only)
-g(b)s(e)g(used)630 5011 y(to)c(remap)f(data)g(from)g(cubic)g(grid)g(to)
-h(regular)f(latlon)i(grid.)51 b(When)34 b(in)m(terp)p
-3320 5011 V 40 w(metho)s(d)g(is)630 5121 y('bilinear',)k(nlon)d(and)g
-(nlat)h(m)m(ust)f(b)s(e)g(sp)s(eci\014ed)g(and)g(the)g(output)h(data)g
-(in)f(y-direction)630 5230 y(will)25 b(b)s(e)e(lo)s(cated)j(at)f(the)g
-(cen)m(ter)g(of)g(cell)h(or)e(b)s(ound)e(of)j(the)f(cell)i(dep)s
-(ending)d(on)h(the)h(setting)630 5340 y(of)31 b(y)p 788
-5340 V 40 w(cen)m(ter.)p eop end
-%%Page: 41 45
-TeXDict begin 41 44 bop 150 -116 a Fi(Chapter)20 b(4:)36
-b(GRIDSPEC)19 b(-)i(A)f(standard)g(for)g(the)g(description)h(of)f
-(grids)g(used)f(in)h(Earth)g(System)g(mo)s(dels41)150
-299 y Fc(test_case)630 408 y Fi(sp)s(ecify)30 b(the)h(test)g(function)f
-(to)h(b)s(e)f(used)f(for)h(testing.)150 572 y Fc(grid_type)630
-681 y Fi(sp)s(ecify)38 b(the)h(v)m(ector)i(\014eld)d(grid)g(lo)s
-(cation.)68 b(default)39 b(is)f(A)m(GRID)i(and)e(only)h(A)m(GRID)h(is)
-630 791 y(implemen)m(ted)31 b(y)m(et.)150 954 y Fc(symmetry)96
-b Fi(the)31 b(grid)f(is)g(symmetry)g(or)g(not.)150 1118
-y Fc(target_grid)630 1227 y Fi(input)36 b(cell)i(area)f(instead)g(of)g
-(calculating)h(based)f(on)f(exc)m(hange)i(grid)f(area.)60
-b(default)37 b(is)630 1337 y(o\013.)150 1500 y Fc(-finer_step)630
-1610 y Fi(This)30 b(is)h(used)g(only)g(for)g(bilinear)g(in)m(terp)s
-(olation.)45 b(Set)31 b(\014ner)p 2728 1610 28 4 v 39
-w(step)g(to)h(a)f(p)s(ositiv)m(e)i(in)m(teger)630 1719
-y(to)25 b(reduce)f(noise)g(in)g(in)m(terp)s(olation)h(and)f(get)h(a)g
-(relativ)m(ely)h(smo)s(oth)e(output.)38 b(The)24 b(default)630
-1829 y(v)-5 b(alue)29 b(is)f(0.)41 b(When)28 b(\014ner)p
-1510 1829 V 39 w(step)h(is)f(greater)i(than)e(0,)i(fregrid)e(will)g
-(\014rst)g(remap)g(data)h(from)630 1938 y(source)23 b(grid)g(on)m(to)h
-(a)f(\014ner)f(grid)h(with)g(resolution)g(that)h(is)f(p)s(o)m(w)m(er)g
-(of)g(2)g(of)g(destination)h(grid)630 2048 y(resolution)36
-b(using)e(bilinear)i(in)m(terp)s(olation,)h(then)e(using)g(v)m(olume)h
-(a)m(v)m(eraging)h(to)f(remap)630 2158 y(data)31 b(from)f(\014ner)f
-(grid)h(on)m(to)i(destination)f(grid.)150 2321 y Fc(center_y)96
-b Fi(output)34 b(latitude)i(will)e(lo)s(cate)j(at)e(cell)h(cen)m(ter,)h
-(i.e.,)g(the)d(starting)i(latitude)f(will)g(b)s(e)f(-89)630
-2431 y(when)k(nlat)h(=)f(90.)67 b(when)38 b(cen)m(ter)p
-1853 2431 V 41 w(y)h(is)g(not)g(set,)i(starting)f(latitude)g(will)f(b)s
-(e)f(-90.)67 b(for)630 2540 y(bilinear)31 b(in)m(terp)s(olation.)42
-b(F)-8 b(or)31 b(conserv)-5 b(ativ)m(e)32 b(in)m(terp)s(olation,)g(cen)
-m(ter)p 3022 2540 V 41 w(y)e(is)h(assumed.)150 2703 y
-Fc(check_conserve)630 2813 y Fi(c)m(hec)m(k)45 b(the)f(conserv)-5
-b(ation)45 b(of)f(conserv)-5 b(ativ)m(e)46 b(in)m(terp)s(olation.)82
-b(The)43 b(area)i(sum)d(will)j(b)s(e)630 2923 y(prin)m(ted)30
-b(out)h(for)f(input)f(and)h(output)g(mosaic.)150 3161
-y Fh(4.3)68 b(Generate)46 b(Mosaic)f(Information)h(Bet)l(w)l(een)h
-(Tiles)150 3320 y Fi(This)23 b(function)g(generates)i(Mosaic)g
-(information)f(b)s(et)m(w)m(een)h(tiles.)39 b(The)23
-b(mosaic)i(information)f(includes:)150 3430 y(list)31
-b(of)g(tile)g(\014les,)g(list)g(of)f(con)m(tact)j(region)e(sp)s
-(eci\014ed)f(b)m(y)g(index,)g(con)m(tact)j(t)m(yp)s(e.)390
-3568 y Fc(int)390 3678 y(gs_make_solo_mosaic\(char)41
-b(*history,)k(int)i(ntiles,)f(char)h(*mosaic_name,)d(char)j
-(*grid_descriptor,)1345 3787 y(char)f(**tilefile,)f(double)h(periodx,)g
-(double)g(periody,)f(char)i(*dir\))150 3953 y(num_tiles)630
-4062 y Fi(Num)m(b)s(er)29 b(of)i(tiles)g(in)f(the)h(mosaic.)150
-4226 y Fc(dir)336 b Fi(The)30 b(directory)h(that)g(con)m(tains)g(all)h
-(the)e(tile)i(grid)e(\014le.)150 4389 y Fc(mosaic_name)630
-4499 y Fi(mosaic)h(name.)41 b(The)30 b(output)g(\014le)h(will)f(b)s(e)g
-(mosaic)p 2406 4499 V 41 w(name.nc.)41 b(default)31 b(is)f('mosaic'.)
-150 4662 y Fc(tile_file)630 4771 y Fi(Grid)k(\014le)h(name)g(of)f(all)i
-(tiles)f(in)g(the)g(mosaic.)54 b(The)34 b(\014le)h(name)g(should)e(b)s
-(e)h(relativ)m(e)j(\014le)630 4881 y(name)20 b(\()h(exclude)g(the)f
-(absolute)i(\014le)e(path\).)37 b(The)20 b(absolute)h(\014le)g(path)f
-(will)h(b)s(e)f(dir/tile)p 3574 4881 V 41 w(\014le.)630
-4991 y(If)30 b(this)g(option)h(is)f(not)h(sp)s(eci\014ed,)f(the)h(tile)
-p 2114 4991 V 41 w(\014le)f(will)h(b)s(e)f('horizon)m(tal)p
-3017 4991 V 42 w(grid.tile#.nc')150 5154 y Fc(periodx)144
-b Fi(Sp)s(ecify)30 b(the)g(p)s(erio)s(d)f(in)h(x-direction)i(of)e
-(mosaic.)42 b(Default)32 b(v)-5 b(alue)30 b(is)h(0)g(\(not)g(p)s(erio)s
-(dic\).)150 5317 y Fc(periody)144 b Fi(Sp)s(ecify)30
-b(the)g(p)s(erio)s(d)f(in)h(y-direction)i(of)e(mosaic.)42
-b(Default)32 b(v)-5 b(alue)30 b(is)h(0)g(\(not)g(p)s(erio)s(dic\).)p
-eop end
-%%Page: 42 46
-TeXDict begin 42 45 bop 150 -116 a Fi(42)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fh(4.4)68 b(Remap)46
-b(Riv)l(er)g(Net)l(w)l(ork)g(Data)150 458 y Fi(riv)m(er)p
-338 458 28 4 v 40 w(regrid)32 b(will)h(remap)f(riv)m(er)g(net)m(w)m
-(ork)h(data)g(from)f(global)h(regular)g(lat-lon)h(grid)d(on)m(to)j(an)m
-(y)e(Other)150 568 y(grid)24 b(\(includes)g(regular)g(lat-lon)i(grid)e
-(and)g(cubic)g(grid)g(\),)i(whic)m(h)e(is)g(sp)s(eci\014ed)f(through)h
-(option)h(mosaic.)150 677 y(The)30 b(riv)m(er)g(net)m(w)m(ork)i(source)
-e(data)h(is)g(sp)s(eci\014ed)e(through)h(option)h(riv)m(er)p
-2654 677 V 40 w(src.)390 825 y Fc(int)390 935 y(gs_river_regrid\(char)
-42 b(*history,)k(char)g(*mosaic_file,)e(char)j(*river_src_file,)533
-1044 y(char)g(*output_file\))150 1223 y(mosaic)192 b
-Fi(sp)s(ecify)29 b(the)h(mosaic)h(\014le)f(of)g(destination)h(grid.)40
-b(This)29 b(mosaic)i(\014le)f(should)f(b)s(e)g(a)h(coupler)630
-1333 y(mosaic)h(\014le,)g(whic)m(h)f(con)m(tains)i(link)e(to)h(land)f
-(solo)i(mosaic)f(and)f(the)g(exc)m(hange)i(grid)e(\014le.)150
-1505 y Fc(river_src)630 1615 y Fi(sp)s(ecify)21 b(the)h(riv)m(er)g(net)
-m(w)m(ork)h(source)f(data)g(\014le.)38 b(The)22 b(data)g(is)g(assumed)f
-(on)g(regular)h(lat-lon)630 1724 y(grid)27 b(and)f(the)h(longitude)h
-(is)f(assumed)f(from)g(0)i(to)f(360)i(degree)e(and)g(latitude)h(is)f
-(assumed)630 1834 y(from)j(-90)h(to)h(90)f(degree.)150
-2007 y Fc(output)192 b Fi(sp)s(ecify)39 b(the)g(output)g(\014le)g(base)
-g(name.)67 b(the)39 b(su\016x)f('.nc')i(should)e(not)h(b)s(e)g
-(included)f(in)630 2116 y(the)j(output)p 1071 2116 V
-40 w(\014le.)73 b(The)40 b(default)i(v)-5 b(alue)41 b(is)g(riv)m(er)p
-2368 2116 V 41 w(output.)72 b(F)-8 b(or)42 b(one)f(tile)i(mosaic,)i
-(the)630 2226 y(actual)29 b(result)f(will)g(b)s(e)g($output)p
-1761 2226 V 40 w(\014le.nc.)40 b(F)-8 b(or)29 b(m)m(ultiple)f(tile)i
-(mosaic,)f(the)f(result)g(will)h(b)s(e)630 2335 y($output.tile#.nc.)150
-2587 y Fh(4.5)68 b(T)-11 b(ransfer)45 b(to)g(Mosaic)390
-2747 y Fc(int)390 2856 y(gs_transfer_to_mosaic\(ch)o(ar)d(*old_file,)j
-(char)h(*mosaic_dir\))150 3035 y(old_file)96 b Fi(The)30
-b(old)g(\014le.)150 3208 y Fc(mosaic_dir)630 3317 y Fi(The)g(mosaic)h
-(directory)-8 b(.)150 3569 y Fh(4.6)68 b(Mak)l(e)46 b(a)f(V)-11
-b(ertical)45 b(Grid)150 3729 y Fi(This)31 b(program)h(call)h(b)s(e)e
-(used)g(to)h(mak)m(e)h(v)m(ertical)h(grid)e(for)f(FMS)h(mo)s(del.)45
-b(It)32 b(uses)f(cubic-spline)h(algo-)150 3838 y(rithm)k(to)h
-(calculate)i(the)e(grid)g(cell)g(lo)s(cation.)62 b(The)36
-b(output)g(netcdf)g(will)h(con)m(tains)h(information)f(on)150
-3948 y(sup)s(ergrid)20 b(with)i(grid)g(size)i(equal)e(mo)s(del)h(grid)f
-(size)h(m)m(ultipling)g(re\014nemen)m(t)f(\()g(alw)m(a)m(ys)i(2)f(\).)
-38 b(mak)m(e)p 3510 3948 V 41 w(vgrid)150 4058 y(tak)m(es)32
-b(the)e(follo)m(wing)i(\015ags)390 4205 y Fc(int)390
-4315 y(gs_make_vgrid\(char)43 b(*history,)i(int)i(nbnds,)f(int)h
-(*bnds,)f(int)h(n1,)676 4424 y(int)g(n2,)g(int)g(*nz,)g(char)f
-(*gridname,)f(char)i(*center\))150 4603 y(nbnds)240 b
-Fi(Sp)s(ecify)30 b(n)m(um)m(b)s(er)f(of)h(v)m(ertical)j(regions)e(for)f
-(v)-5 b(arying)30 b(resolution.)150 4776 y Fc(bnds)288
-b Fi(Sp)s(ecify)30 b(b)s(oundaries)f(for)h(de\014ning)f(v)m(ertical)k
-(regions)d(of)h(v)-5 b(arying)30 b(resolution.)150 4948
-y Fc(nz)384 b Fi(Num)m(b)s(er)29 b(of)i(mo)s(del)f(grid)g(p)s(oin)m(ts)
-g(for)g(eac)m(h)i(v)m(ertical)h(regions)d(of)h(v)-5 b(arying)30
-b(resolution.)150 5121 y Fc(grid_name)630 5230 y Fi(Sp)s(ecify)35
-b(the)g(grid)g(name.)56 b(The)35 b(output)g(grid)g(\014le)g(name)g
-(will)h(b)s(e)f(grid)p 3151 5230 V 40 w(name.nc.)55 b(The)630
-5340 y(default)31 b(v)-5 b(alue)30 b(is)h(v)m(ertical)p
-1559 5340 V 42 w(grid.)p eop end
-%%Page: 43 47
-TeXDict begin 43 46 bop 150 -116 a Fi(Chapter)20 b(4:)36
-b(GRIDSPEC)19 b(-)i(A)f(standard)g(for)g(the)g(description)h(of)f
-(grids)g(used)f(in)h(Earth)g(System)g(mo)s(dels43)150
-299 y Fc(center)192 b Fi(Sp)s(ecify)36 b(the)i(cen)m(ter)g(lo)s(cation)
-h(of)e(grid.)61 b(The)37 b(v)-5 b(alid)38 b(en)m(try)f(will)h(b)s(e)e
-('none',)k('t)p 3441 299 28 4 v 40 w(cell')f(or)630 408
-y('c)p 701 408 V 41 w(cell')34 b(with)e(default)h(v)-5
-b(alue)33 b('none'.)47 b(The)32 b(grid)h(re\014nemen)m(t)f(is)h
-(assumed)f(to)h(b)s(e)f(2)h(in)f(x)630 518 y(and)i(y-direction)h(when)e
-(cen)m(ter)i(is)f(not)h('none'.)52 b('c)p 2433 518 V
-41 w(cell')36 b(should)d(b)s(e)g(used)h(for)g(the)g(grid)630
-628 y(used)c(in)g(MOM4.)150 852 y Fh(4.7)68 b(Generate)46
-b(Three)f(Exc)l(hange)g(Grids)g(for)g(FMS)f(Coupler)150
-1012 y Fi(mak)m(e)p 362 1012 V 41 w(coupler)p 691 1012
-V 40 w(mosaic)h(generates)f(three)g(exc)m(hange)g(grids)f(for)g(the)h
-(FMS)f(coupler.)80 b(The)42 b(output)150 1121 y(\014le)h(includes)f
-(exc)m(hange)j(grid)d(\014les)h(for)g(\015uxes)f(b)s(et)m(w)m(een)h
-(atmosphere)g(and)f(surface)h(\(sea)h(ice)g(and)150 1231
-y(land\),)35 b(exc)m(hange)h(grid)e(\014les)g(for)g(runo\013)f(b)s(et)m
-(w)m(een)i(land)f(and)f(sea)i(ice.)53 b(There)34 b(migh)m(t)g(b)s(e)g
-(more)g(than)150 1341 y(one)40 b(exc)m(hange)h(grid)f(\014les)g(b)s(et)
-m(w)m(een)g(t)m(w)m(o)h(mo)s(del)f(solo)h(mosaic)g(b)s(ecause)f(there)g
-(migh)m(t)g(b)s(e)f(m)m(ultiple)150 1450 y(tiles)45 b(in)e(a)i(solo)f
-(mosaic.)83 b(All)44 b(the)g(exc)m(hange)h(grid)f(information)g(are)g
-(b)s(et)m(w)m(een)h(mo)s(del)e(grid,)48 b(not)150 1560
-y(b)s(et)m(w)m(een)36 b(sup)s(ergrid.)54 b(W)-8 b(e)37
-b(assume)e(the)g(re\014nemen)m(t)h(ratio)g(b)s(et)m(w)m(een)g(mo)s(del)
-f(grid)h(and)e(sup)s(ergrid)g(is)150 1669 y(2.)57 b(Curren)m(tly)35
-b(w)m(e)h(only)g(output)f(the)h(exc)m(hange)h(grid)e(on)h(T-cell.)57
-b(Besides)36 b(generate)i(the)d(exc)m(hange)150 1779
-y(grid)42 b(\014les,)j(mak)m(e)p 783 1779 V 41 w(coupler)p
-1112 1779 V 40 w(mosaic)e(also)g(generate)h(the)e(coupler)g(mosaic)i
-(\014le)e(\(the)g(\014le)g(name)h(will)150 1888 y(b)s(e)31
-b(mosaic)p 548 1888 V 41 w(name.nc\))h(whic)m(h)f(con)m(tains)i(the)f
-(atmos,)h(land)e(and)g(o)s(cean)h(mosaic)h(path,)f(o)s(cean)g(mosaic)
-150 1998 y(top)s(og)44 b(path)f(and)g(exc)m(hange)h(grid)f(\014le)h
-(path.)79 b(mak)m(e)p 2092 1998 V 41 w(coupler)p 2421
-1998 V 40 w(mosaic)44 b(exp)s(ects)g(NetCDF)h(format)150
-2108 y(input.)390 2238 y Fc(int)390 2348 y(gs_make_coupler_mosaic\(c)o
-(har)c(*history,)46 b(char)g(*amosaic,)g(char)g(*lmosaic,)724
-2457 y(char)h(*omosaic,)e(char)i(*otopog,)e(int)i(interp_order,)724
-2567 y(double)f(sea_level,)f(char)i(*mosaic_name,)d(int)j(check\))150
-2719 y(atmos_mosaic)630 2828 y Fi(sp)s(ecify)36 b(the)g(atmosphere)h
-(mosaic)g(information.)58 b(This)36 b(\014le)g(con)m(tains)h(list)g(of)
-g(tile)g(\014les)630 2938 y(whic)m(h)h(sp)s(ecify)g(the)h(grid)f
-(information)h(for)f(eac)m(h)i(tile.)66 b(Eac)m(h)39
-b(grid)f(is)h(required)e(to)j(b)s(e)630 3047 y(regular)31
-b(lon/lat)h(grid.)40 b(The)30 b(\014le)g(name)h(can)g(not)f(b)s(e)g
-('mosaic.nc')150 3199 y Fc(ocean_mosaic)630 3309 y Fi(sp)s(ecify)j(the)
-h(o)s(cean)g(mosaic)h(information.)51 b(This)33 b(\014le)h(con)m(tains)
-h(list)f(of)g(tile)h(\014les)e(whic)m(h)630 3418 y(sp)s(ecify)c(the)g
-(grid)g(information)g(for)g(eac)m(h)h(tile.)42 b(The)29
-b(\014le)g(name)g(can)g(not)h(b)s(e)e('mosaic.nc')150
-3570 y Fc(ocean_topog)630 3680 y Fi(sp)s(ecify)38 b(the)g(top)s(ograph)
-m(y)h(information)g(for)f(o)s(cean)h(mosaic.)65 b(The)38
-b(\014eld)g(name)g(of)h(the)630 3789 y(top)s(ograph)m(y)c(is)h(depth)p
-1448 3789 V 39 w(tile#)g(or)g(depth)e(when)g(n)m(tiles)j(=)e(1,)i(The)d
-(top)s(ograph)m(y)i(data)g(is)630 3899 y(p)s(ositiv)m(e)31
-b(do)m(wn.)150 4050 y Fc(land_mosaic)630 4160 y Fi(sp)s(ecify)37
-b(the)h(land)f(mosaic)h(information.)63 b(This)36 b(\014le)i(con)m
-(tains)g(list)h(of)e(tile)i(\014les)e(whic)m(h)630 4270
-y(sp)s(ecify)e(the)g(grid)g(information)h(for)f(eac)m(h)h(tile.)57
-b(Eac)m(h)36 b(grid)e(is)i(required)e(to)i(b)s(e)f(regular)630
-4379 y(lon/lat)42 b(grid.)71 b(When)41 b(land)p 1650
-4379 V 39 w(mosaic)h(is)f(not)f(sp)s(eci\014ed,)j(atmosphere)e(mosaic)h
-(will)f(b)s(e)630 4489 y(used)30 b(to)h(sp)s(ecify)f(land)g(mosaic.)42
-b(The)29 b(\014le)i(name)f(can)h(not)g(b)s(e)e('mosaic.nc'.)150
-4640 y Fc(interp_order)630 4750 y Fi(sp)s(ecify)i(the)h(order)f(of)h
-(conserv)-5 b(ativ)m(e)33 b(in)m(terplation.)46 b(Its)32
-b(v)-5 b(alue)32 b(can)g(b)s(e)f(1)h(\()f(linear)h(order)630
-4860 y(\))f(or)f(2)h(\()f(second)h(order)f(\))g(with)g(default)h(v)-5
-b(alue)31 b(2.)150 5011 y Fc(sea_level)d(#)630 5121 y
-Fi(sp)s(ecify)21 b(the)h(sea)g(lev)m(el)h(\()e(in)h(meters)f(\))h(and)f
-(its)g(v)-5 b(alue)22 b(will)g(b)s(e)f(used)f(to)j(determine)e
-(land/sea)630 5230 y(mask.)50 b(When)33 b(top)s(ograph)m(y)g(of)h(a)f
-(grid)g(cell)i(is)e(less)h(than)f(sea)h(lev)m(el,)i(this)d(grid)g(cell)
-i(will)630 5340 y(b)s(e)30 b(land,)g(otherwise)h(it)g(will)f(b)s(e)g(o)
-s(cean.)42 b(Default)31 b(v)-5 b(alue)31 b(is)f(0)p eop
-end
-%%Page: 44 48
-TeXDict begin 44 47 bop 150 -116 a Fi(44)2356 b(The)30
-b(CF)g(Library)g(Users)g(Guide)150 299 y Fc(mosaic_name)630
-408 y Fi(coupler)i(mosaic)h(name.)46 b(The)32 b(output)f(coupler)h
-(mosaic)h(\014le)g(will)f(b)s(e)f(mosaic)p 3361 408 28
-4 v 41 w(name.nc.)630 518 y(default)g(v)-5 b(alue)30
-b(is)h('mosaic'.)150 674 y Fc(check)240 b Fi(c)m(hec)m(k)32
-b(the)f(tiling)g(error.)150 903 y Fh(4.8)68 b(Generate)46
-b(T)-11 b(op)t(ograph)l(y)44 b(for)i(An)l(y)e(Mosaic)150
-1063 y Fi(mak)m(e)p 362 1063 V 41 w(top)s(og)e(can)f(generate)h(top)s
-(ograph)m(y)f(for)g(an)m(y)g(Mosaic.)74 b(The)40 b(output)h(\014le)g
-(will)g(con)m(tains)h(the)150 1172 y(top)s(ograph)m(y)26
-b(for)g(eac)m(h)h(tile)g(in)f(the)g(Mosaic.)41 b(The)25
-b(\014eld)h(name)g(in)f(the)i(output)e(top)s(ograph)m(y)h(\014le)g
-(will)h(b)s(e)150 1282 y(depth)p 384 1282 V 39 w(tile#)e(and)f(it)g(is)
-g(p)s(ositiv)m(e)h(do)m(wn.)38 b(The)24 b(top)s(ograph)m(y)g(data)g
-(will)h(b)s(e)e(de\014ned)g(on)h(mo)s(del)f(grid,)j(the)150
-1391 y(mo)s(del)j(grid)g(size)h(will)g(b)s(e)f(sup)s(ergrid)e(grid)i
-(size)h(divided)f(b)m(y)g(re\014nemen)m(t)g(\(x)p 2808
-1391 V 41 w(re\014ne,)g(y)p 3169 1391 V 40 w(re\014ne,)g(default)150
-1501 y(is)j(2\).)47 b(mosaic)33 b(is)f(a)h(required)e(option)i(and)f
-(all)h(other)f(options)g(are)h(optional,)h(but)e(some)g(options)h(are)
-150 1611 y(required)d(dep)s(ending)e(on)j(the)f(c)m(hoice)i(of)f(top)s
-(og)p 1830 1611 V 41 w(t)m(yp)s(e.)390 1743 y Fc(int)390
-1853 y(gs_make_topog\(char)43 b(*history,)i(char)i(*mosaic_file,)d
-(char)j(*topog_type,)1058 1963 y(int)g(x_refine,)e(int)i(y_refine,)1058
-2072 y(double)f(basin_depth,)f(char)h(*topog_file,)f(double)h
-(bottom_depth,)1058 2182 y(double)g(min_depth,)f(double)h
-(scale_factor,)f(int)h(num_filter_pass,)1058 2291 y(double)g
-(gauss_amp,)f(double)h(gauss_scale,)f(double)h(slope_x,)1058
-2401 y(double)g(slope_y,)g(double)g(bowl_south,)f(double)h(bowl_north,)
-1058 2511 y(double)g(bowl_west,)f(double)h(bowl_east,)f(int)i
-(fill_first_row,)1058 2620 y(int)g(filter_topog,)d(int)j
-(round_shallow,)d(int)j(fill_shallow,)1058 2730 y(int)g
-(deepen_shallow,)d(int)j(smooth_topo_allow_deepe)o(ning)o(,)1058
-2839 y(char)g(*output_file\))150 2995 y(mosaic)192 b
-Fi(Sp)s(ecify)30 b(the)g(mosaic)i(\014le)e(where)g(top)s(ograph)m(y)h
-(data)g(lo)s(cated.)150 3152 y Fc(topog_type)630 3261
-y Fi(Sp)s(ecify)42 b(t)m(yp)s(e)h(of)g(top)s(ograph)m(y)-8
-b(.)78 b(Its)42 b(v)-5 b(alue)43 b(can)g(b)s(e)f('realistic',)49
-b('rectangular)p 3457 3261 V 41 w(basin',)630 3371 y('gaussian',)31
-b('b)s(o)m(wl')g(or)f('idealized'.)43 b(The)30 b(default)g(v)-5
-b(alue)31 b(is)g('realistic'.)150 3527 y Fc(x_refine)d(#)630
-3636 y Fi(the)j(re\014nemen)m(t)f(ratio)h(of)g(mo)s(del)f(grid)g(vs)g
-(sup)s(ergrid)f(ins)h(x-directin.)41 b(default)30 b(v)-5
-b(alue)31 b(2.)150 3792 y Fc(y_refine)d(#)630 3902 y
-Fi(the)j(re\014nemen)m(t)f(ratio)h(of)g(mo)s(del)f(grid)g(vs)g(sup)s
-(ergrid)f(ins)h(y-directin.)41 b(default)30 b(v)-5 b(alue)31
-b(2.)150 4058 y Fc(basin_depth)c(#)630 4168 y Fi(the)33
-b(basin)e(depth)h(when)f(top)s(og)p 1757 4168 V 41 w(t)m(yp)s(e)i(is)f
-('rectangular)p 2572 4168 V 41 w(basin'.)47 b(Default)33
-b(v)-5 b(alue)33 b(is)f(5000)630 4277 y(meter.)150 4433
-y Fc(topog_file)630 4543 y Fi(Sp)s(ecify)e(name)g(of)h(top)s(ograh)m(y)
-g(\014le)f(\(e.g.)42 b(scripps,)30 b(na)m(vy)p 2607 4543
-V 40 w(top)s(o,)h(...\))150 4699 y Fc(topog_field)630
-4809 y Fi(Sp)s(ecify)f(name)g(of)h(top)s(ograph)m(y)f(\014eld)g(name)h
-(in)f(top)s(og)p 2550 4809 V 40 w(\014le.)150 4965 y
-Fc(bottom_depth)d(#)630 5074 y Fi(maxim)m(um)j(depth)g(\(or)h(b)s
-(ottom)f(depth\))g(of)h(o)s(cean.)41 b(default)31 b(v)-5
-b(alue)31 b(is)f(5000)i(meter.)150 5230 y Fc(min_depth)c(#)630
-5340 y Fi(minim)m(um)i(depth)f(of)i(o)s(cean.)41 b(default)31
-b(v)-5 b(alue)30 b(is)h(10)g(meter.)p eop end
-%%Page: 45 49
-TeXDict begin 45 48 bop 150 -116 a Fi(Chapter)20 b(4:)36
-b(GRIDSPEC)19 b(-)i(A)f(standard)g(for)g(the)g(description)h(of)f
-(grids)g(used)f(in)h(Earth)g(System)g(mo)s(dels45)150
-299 y Fc(scale_factor)27 b(#)630 408 y Fi(scaling)34
-b(factor)g(for)e(top)s(ograph)m(y)h(data)h(\(e.g.)49
-b(-1)34 b(to)f(\015ip)f(sign)h(or)g(0.01)h(to)g(con)m(v)m(ert)g(from)
-630 518 y(cen)m(timeters\).)43 b(default)30 b(v)-5 b(alue)31
-b(is)g(1.)150 677 y Fc(num_filter_pass)26 b(#)630 787
-y Fi(n)m(um)m(b)s(er)j(of)i(passes)f(of)g(spatial)i(\014lter)e(default)
-h(v)-5 b(alue)31 b(is)f(1.)150 946 y Fc(gauss_amp)e(#)630
-1056 y Fi(heigh)m(t)j(of)g(gaussian)f(bump)f(as)i(p)s(ercen)m(tage)g
-(of)g(o)s(cean)g(depth.)40 b(default)30 b(v)-5 b(alue)31
-b(is)g(0.5.)150 1215 y Fc(gauss_scale)c(#)630 1325 y
-Fi(width)j(of)g(gaussian)h(bump)d(as)j(p)s(ercen)m(tag)g(e)g(of)g
-(basin)e(width.)40 b(Default)32 b(v)-5 b(alue)31 b(is)f(0.25.)150
-1484 y Fc(slope_x)e(#)68 b Fi(rise)30 b(of)h(the)g(o)s(cean)g(\015o)s
-(or)e(to)j(the)e(east)h(for)g(the)f(gaussian)h(bump.)39
-b(Default)31 b(v)-5 b(alue)31 b(is)g(0.)150 1644 y Fc(slope_y)d(#)68
-b Fi(rise)30 b(of)h(the)g(o)s(cean)g(\015o)s(or)e(to)j(the)e(north)g
-(for)g(the)h(gaussian)f(bump.)39 b(Default)32 b(v)-5
-b(alue)30 b(is)h(0.)150 1803 y Fc(bowl_south)d(#)630
-1913 y Fi(southern)h(b)s(oundary)g(of)h(Win)m(ton)i(b)s(o)m(wl.)40
-b(Default)32 b(v)-5 b(alue)31 b(is)f(60.)150 2072 y Fc(bowl_north)e(#)
-630 2182 y Fi(northern)h(b)s(oundary)g(of)h(Win)m(ton)h(b)s(o)m(wl.)41
-b(Default)31 b(v)-5 b(alue)31 b(is)g(70.)150 2341 y Fc(bowl_west)d(#)
-630 2451 y Fi(w)m(estern)j(b)s(oundary)d(of)i(Win)m(ton)i(b)s(o)m(wl.)
-40 b(Default)32 b(v)-5 b(alue)31 b(is)f(0.)150 2610 y
-Fc(bowl_east)e(#)630 2720 y Fi(eastern)j(b)s(oundary)d(of)j(Win)m(ton)g
-(b)s(o)m(wl.)41 b(Default)31 b(v)-5 b(alue)31 b(is)f(20.)150
-2879 y Fc(fill_first_row)630 2989 y Fi(when)f(true,)i(mak)m(e)g
-(\014rst)f(ro)m(w)g(of)h(o)s(cean)g(mo)s(del)f(all)h(land)f(p)s(oin)m
-(ts)h(for)f(ice)h(mo)s(del.)150 3148 y Fc(filter_topog)630
-3258 y Fi(when)e(true,)i(apply)f(\014lter)g(to)h(top)s(ograph)m(y)-8
-b(.)150 3417 y Fc(round_shallow)630 3527 y Fi(when)26
-b(true,)h(Mak)m(e)h(cells)g(land)e(if)h(depth)f(is)g(less)h(than)g(1/2)
-h(mim)m(umim)e(depth,)h(otherwise)630 3636 y(mak)m(e)k(o)s(cean.)150
-3796 y Fc(fill_shallow)630 3905 y Fi(when)e(sp)s(eci\014ed,)h(Mak)m(e)i
-(cells)g(less)e(than)h(minim)m(um)e(depth)h(land.)150
-4065 y Fc(deepen_shallow)630 4174 y Fi(when)f(sp)s(eci\014ed,)g(Mak)m
-(e)j(cells)f(less)f(than)f(minim)m(um)g(depth)g(equal)i(to)f(minim)m
-(um)f(depth.)150 4334 y Fc(smooth_topo_allow_deepen)o(ing)630
-4443 y Fi(when)g(sp)s(eci\014ed,)h(allo)m(w)i(\014lter)f(to)g(deep)s
-(en)e(cells.)150 4603 y Fc(output)192 b Fi(The)33 b(created)i(netcdf)f
-(\014le)f(that)i(con)m(tains)g(mosaic)f(top)s(ograph)m(y)-8
-b(.)52 b(Default)35 b(v)-5 b(alue)34 b(is)g('to-)630
-4712 y(p)s(og.nc')p eop end
-%%Page: 46 50
-TeXDict begin 46 49 bop eop end
-%%Page: 47 51
-TeXDict begin 47 50 bop 150 -116 a Fi(Index)3286 b(47)150
-299 y Ff(Index)150 610 y Fh(A)150 726 y Fb(API,)25 b(C)17
-b Fa(:)d(:)f(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)
-g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g
-(:)g(:)h(:)f(:)g(:)g(:)g(:)44 b Fb(1)150 814 y(API,)25
-b(F90)15 b Fa(:)g(:)e(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)h
-(:)f(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)
-g(:)g(:)g(:)g(:)g(:)h(:)f(:)42 b Fb(1)150 901 y(API,)25
-b(F)-6 b(ortran)21 b Fa(:)13 b(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)h
-(:)f(:)g(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)
-g(:)g(:)g(:)g(:)g(:)h(:)47 b Fb(1)2025 610 y Fh(S)2025
-919 y Fb(supp)r(orted)25 b(programming)i(languages)18
-b Fa(:)c(:)g(:)f(:)g(:)g(:)g(:)g(:)g(:)h(:)f(:)g(:)g(:)g(:)45
-b Fb(1)p eop end
-%%Page: 48 52
-TeXDict begin 48 51 bop eop end
-%%Trailer
-
-userdict /end-hook known{end-hook}if
-%%EOF
diff --git a/doc/libcf.texi b/doc/libcf.texi
deleted file mode 100644
index 48db11f..0000000
--- a/doc/libcf.texi
+++ /dev/null
@@ -1,3185 +0,0 @@
-\input texinfo @c -*-texinfo-*-
- at comment $Id: libcf.texi,v 1.3 2009/09/15 17:39:45 ed Exp $
- at c %**start of header
- at setfilename libcf.info
- at settitle The CF Library Users Guide 
- at setcontentsaftertitlepage
- at c Combine the variable, concept, and function indices.
- at synindex vr cp
- at synindex fn cp
- at c %**end of header
-
- at c version.texi is automatically generated by automake and contains
- at c defined variables VERSION, UPDATED, UPDATED-MONTH.
- at include version.texi
- at include defines.texi
-
- at ifinfo
- at dircategory netCDF CF Library
- at direntry
-* libcf: (libcf).         @value{libcf-man}
- at end direntry
- at end ifinfo
-
- at titlepage
- at title @value{libcf-man}
- at subtitle Version @value{VERSION}
- at subtitle @value{UPDATED-MONTH}
- at author Ed Hartnett
- at author Unidata Program Center
- at page
- at vskip 0pt plus 1filll
- at insertcopying
- at end titlepage
-
- at ifnottex
- at node Top, Summary, (dir), (dir)
- at top @value{libcf-man}
-
-This guide describes libcf, the netCDF CF Library. This document
-applies to libcf version @value{VERSION}, and was last updated on
- at value{UPDATED}.
-
- at end ifnottex
-
- at menu
-* Summary::                     
-* Installation::                
-* Files::                       
-* Variables::                   
-* Coordinates::                 
-* GRIDSPEC::                    
-* Combined Index::              
- at end menu
-
- at node Summary, Installation, Top, Top
- at unnumbered Summary
- at cindex supported programming languages
- at cindex API, C
- at cindex API, Fortran
- at cindex API, F90
-
-The CF conventions for climate and forecast metadata are designed to
-promote the processing and sharing of files created with the netCDF
-API.
-
-This library, libcf, makes it easier to create and work with data
-files which conform to the CF conventions.
-
-The functions of the CF library are intended to be interspersed with
-netCDF library calls. That is, the programmer will open or create a
-netCDF file with the netCDF API, and then add or read metadata with
-libcf library functions, then continue to working with the netCDF API
-to read and write data.
-
-By using libcf, a data producer can produce files that conform to the
-CF standards, without having to write netCDF code to create and decode
-all the attributes that the CF convention uses to store meta-data. A
-data consumer can use libcf to read any file which conforms to the CF
-conventions; the file does not need to be created with libcf to be
-read by libcf.
-
-Fortran-77 wrapper functions provide a Fortran 77 API, just as is done
-with netCDF itself. A Fortran 90 API is planned, but not yet begun.
-
-For more information about the CF Conventions, see the CF Metadata
-web site at @uref{@value{cf-url}}.
-
- at node Installation, Files, Summary, Top
- at unnumbered Downloading and Installing libcf
-
-Currently, and for some time to come, libcf is in alpha release. The
-code is tested, but not extensively. The API may be extended, and
-possibly changed, in each release.
-
-You must have either netCDF-3 (or netCDF-4) installed. And reasonably
-recent version of netCDF should work. libcf is tested with netCDF
-3.6.2-beta4.
-
-Get the latest version of the libcf tarball at the libcf ftp site:
- at value{ftp-site}
-
-Unpack the tarball, and run:
-
- at example
-./configure --with-netcdf=/my/netcdf --prefix=/my/libcf && make check install > output.txt
- at end example
-
-Where /my/netcdf is the root install directory of the netCDF library
-you want to use, and /my/libcf is the root directory where you want
-libcf installed. (They may be the same directory.) 
-
-If you wish to use netCDF-4, you must also have HDF5 and libz, the
-compression library, installed. In this case, configure libcf like
-this:
-
- at example
-./configure --with-netcdf=/s/n4_new1/install --enable-netcdf-4 --with-hdf5=/home/ed/local/s && make check install > output.txt
- at end example
-
-If the build does not work for you, please email libcf support:
- at value{libcf-support-email}. Please send the *complete* output of the
-configure and build output, in ASCII (the output.txt file produced by
-the above build commands), and the file config.log, which is generated
-by the configure script.
-
- at c  @node cfcheck, Files, Installation, Top
- at c  @chapter The cfcheck Utility
-
- at c  The cfchck utility will chck a file to see if it contains valid CF
- at c  metadata. Messages about the file are printed to stdout.
-
- at node Files, Variables, Installation, Top
- at chapter Files
-
- at menu
-* nccf_def_convention::         
-* nccf_inq_convention::         
-* nccf_def_file::               
-* nccf_inq_file::               
-* nccf_add_history::            
- at end menu
-
- at node nccf_def_convention, nccf_inq_convention, Files, Files
- at section Mark a File as Conforming to CF Conventions
-
-Mark the file as following CF-1.0 conventions.
-
-This functions is called automatically by nccf_def_file, so need not
-be called by the user if nccf_def_file is being called.
-
- at heading Usage 
-
- at example
-   int nccf_def_convention(int ncid);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_convention, nccf_def_file, nccf_def_convention, Files
- at section Determine if a File Claims to Conform to CF Conventions
-
-Determine if the file claims to follow CF-1.0 conventions. This
-function only checks the global ``Conventions'' attribute. It does not
-look at file metadata to ensure that this is a well-formed CF file. It
-only tells whether the file claims to be a CF file.
-
- at heading Usage 
-
- at example
-   int nccf_inq_convention(int ncid, int *cf_convention);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item cf_conventions
-If this pointer to an int is provided, a 1 is written there if this
-file claims to follow CF 1.0 conventions, a 0 otherwise.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_file, nccf_inq_file, nccf_inq_convention, Files
- at section Add description to the data with nccf_def_file
-
-Add some or all of the CF recommended text attributes to a file. Any
-parameters which are set to NULL will be ignored.
-
- at heading Usage 
-
- at example
-int nccf_def_file(int ncid, char *title, char *history, char *institution, 
-                  char *source, char *comment, char *references);
- at end example
-
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item title
-If non-NULL, this text string will be written as the CF-recommended
-``title'' attribute.
-
- at item history
-If non-NULL, this text string will be written as the CF-recommended
-``history'' attribute.
-
- at item institution
-If non-NULL, this text string will be written as the CF-recommended
-``institution'' attribute.
-
- at item source
-If non-NULL, this text string will be written as the CF-recommended
-``source'' attribute.
-
- at item comment
-If non-NULL, this text string will be written as the CF-recommended
-``comment'' attribute.
-
- at item references
-If non-NULL, this text string will be written as the CF-recommended
-``references'' attribute.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_file, nccf_add_history, nccf_def_file, Files
- at section Read the description of the data with nccf_inq_file
-
-Read any existing CF recommended text attributes from the file.
-
-Recall that in C, strlens do not include the null terminator. To get
-the lengths before the strings (in order to allocated) pass NULL for
-any or all strings and the lengths will be returned. Then call the
-function again after allocating memory.
-
-The CF version is guaranteed to be less than NC_MAX_NAME.
-
-Any of these pointer arguments may be NULL, in which case it will be
-ignored.
-
- at heading Usage 
-
- at example
-int nccf_inq_file(int ncid, size_t *title_lenp, char *title, 
-                  size_t *history_lenp, char *history, 
-                  size_t *institution_lenp, char *institution, 
-                  size_t *source_lenp, char *source, 
-                  size_t *comment_lenp, char *comment,
-                  size_t *references_lenp, char *references);
- at end example
-
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item title_lenp
-Pointer to size_t which, if not NULL, will get the length of the title
-attribute.
-
- at item title
-Pointer to char array which, if not NULL, will get the title
-string. Memory must be allocated before this function is called. Call
-this function with a NULL for this parameter to get the size first.
-
- at item history_lenp
-Pointer to size_t which, if not NULL, will get the length of the history
-attribute.
-
- at item history
-Pointer to char array which, if not NULL, will get the history
-string. Memory must be allocated before this function is called. Call
-this function with a NULL for this parameter to get the size first.
-
- at item institution_lenp
-Pointer to size_t which, if not NULL, will get the length of the institution
-attribute.
-
- at item institution
-Pointer to char array which, if not NULL, will get the institution
-string. Memory must be allocated before this function is called. Call
-this function with a NULL for this parameter to get the size first.
-
- at item source_lenp
-Pointer to size_t which, if not NULL, will get the length of the source
-attribute.
-
- at item source
-Pointer to char array which, if not NULL, will get the source
-string. Memory must be allocated before this function is called. Call
-this function with a NULL for this parameter to get the size first.
-
- at item comment_lenp
-Pointer to size_t which, if not NULL, will get the length of the comment
-attribute.
-
- at item comment
-Pointer to char array which, if not NULL, will get the comment
-string. Memory must be allocated before this function is called. Call
-this function with a NULL for this parameter to get the size first.
-
- at item references_lenp
-Pointer to size_t which, if not NULL, will get the length of the references
-attribute.
-
- at item references
-Pointer to char array which, if not NULL, will get the references
-string. Memory must be allocated before this function is called. Call
-this function with a NULL for this parameter to get the size first.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_add_history,  , nccf_inq_file, Files
- at section Append to a History Attribute
-
-This function appends a time-stamped history string to the history
-attribute, creating the attribute if it doesn't already exist.
-
- at heading Usage 
-
- at example
-int nccf_add_history(int ncid, const char *history);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item history
-The string to append to the history attribute. 
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node Variables, Coordinates, Files, Top
- at chapter Variables
-
- at menu
-* nccf_def_var::                
-* nccf_inq_var::                
-* nccf_def_var_missing::        
-* nccf_inq_var_missing::        
-* nccf_def_notes::              
-* nccf_inq_notes::              
-* nccf_def_latitude::           
-* nccf_inq_latitude::           
-* nccf_def_longitude::          
-* nccf_inq_longitude::          
-* nccf_def_lvl::                
-* nccf_inq_lvl::                
-* nccf_def_lvl_vert::           
-* nccf_inq_lvl_vert::           
-* nccf_def_time::               
-* nccf_inq_time::               
-* nccf_def_ft_sigma::           
-* nccf_inq_lvl_sigma::          
-* nccf_def_ft_hybrid_sigma::    
-* nccf_inq_lvl_hybrid_sigma::   
-* nccf_def_ft_hybrid_height::   
-* nccf_inq_lvl_hybrid_height::  
-* nccf_def_ft_sleve::           
-* nccf_inq_lvl_sleve::          
-* nccf_def_ft_ocean_sigma::     
-* nccf_inq_lvl_ocean_sigma::    
-* nccf_def_ft_ocean_s::         
-* nccf_inq_lvl_ocean_s::        
-* nccf_def_ft_ocean_sigma_z::   
-* nccf_inq_lvl_ocean_sigma_z::  
-* nccf_def_ft_ocean_dbl_sigma::  
-* nccf_inq_lvl_ocean_dbl_sigma::  
-* nccf_get_vara::               
- at end menu
-
- at node nccf_def_var, nccf_inq_var, Variables, Variables
- at section Add description to a variable with nccf_def_var
-
- at heading Usage 
-
- at example
-int nccf_def_var(int ncid, int varid, const char *units, 
-                    const char *long_name, const char *standard_name, 
-                    int ncoord_vars, int *coord_varids);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item varid
-The varid of the netCDF variable being described.
-
- at item units
-If non-NULL, this text string will be written as the CF-recommended
-``units'' attribute.
-
- at item long_name
-If non-NULL, this text string will be written as the CF-recommended
-``long_name'' attribute.
-
- at item standard_name
-If non-NULL, this text string will be written as the CF-recommended
-``standard_name'' attribute.
-
- at item ncoord_vars
-Number of coordinate variables for this variable.
-
- at item coord_varids
-The variable IDs of the coordinate variables for this variable.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_var, nccf_def_var_missing, nccf_def_var, Variables
- at section Read variable description with nccf_inq_var
-
-Read any existing CF recommended text attributes from a variable. 
-
- at heading Usage 
-
- at example
-int nccf_inq_var(int ncid, int varid, size_t *units_lenp, char *units, 
-                 size_t *long_name_lenp, char *long_name, 
-                 size_t *standard_name_lenp, char *standard_name,
-                 int *ncoord_vars, int *coord_varids);
-
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item varid
-The varid of the netCDF variable.
-
- at item units_lenp
-Pointer to size_t which, if not NULL, will get the length of the units
-attribute.
-
- at item units
-Pointer to char array which, if not NULL, will get the long_name
-string. Memory must be allocated before this function is called. Call
-this function with a NULL for this parameter to get the size first.
-
- at item long_name_lenp
-Pointer to size_t which, if not NULL, will get the length of the long_name
-attribute.
-
- at item long_name
-Pointer to char array which, if not NULL, will get the long_name
-string. Memory must be allocated before this function is called. Call
-this function with a NULL for this parameter to get the size first.
-
- at item standard_name_lenp
-Pointer to size_t which, if not NULL, will get the length of the standard_name
-attribute.
-
- at item standard_name
-Pointer to char array which, if not NULL, will get the standard_name
-string. Memory must be allocated before this function is called. Call
-this function with a NULL for this parameter to get the size first.
-
- at item ncoord_vars
-Pointer to an integer, which, if non-NULL, will get the number of
-coordinate variables identified in the ``coordinates'' attribute.
-
- at item coord_varids
-Pointer to an array of integer, which, if non-NULL, will be filled
-with the variable IDs of the variables listed int he ``coordinates''
-attribute.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_var_missing, nccf_inq_var_missing, nccf_inq_var, Variables
- at section Define missing data values for a variable with nccf_def_var_missing
-nccf_def_notes
-
-This function sets the ``fill_value'', ``valid_min'', and
-``valid_max'' attributes.
-
- at heading Usage 
-
- at example
-int nccf_def_var_missing(int ncid, int varid, const void *fill_valuep, 
-                            const void *valid_minp, const void *valid_maxp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item varid
-The varid of the netCDF variable being described. 
-
- at item fill_valuep
-If non-NULL, this will point to a value of the same type as this
-varid, which will be used as the fill_value for the data.
-
- at item valid_minp
-If non-NULL, this will point to a value of the same type as this
-varid, which will be written as the ``valid_min'' attribute. If this
-parameter is non-NULL, valid_max must also be provided.
-
- at item valid_maxp
-If non-NULL, this will point to a value of the same type as this
-varid, which will be written as the ``valid_max'' attribute. If this
-parameter is non-NULL, valid_min must also be provided.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_var_missing, nccf_def_notes, nccf_def_var_missing, Variables
- at section Learn about missing data settings with nccf_inq_var_missing
-
-Get attributes which define missing data information. If the
-attributes are not there, then provide the valid data anyway, based on
-netCDF defaults.
-
- at heading Usage 
-
- at example
-int nccf_inq_var_missing(int ncid, int varid, void *fill_valuep, 
-                            void *valid_minp, void *valid_maxp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item varid
-The varid of the netCDF variable.
-
- at item fill_valuep
-If this is not NULL, the fill value of the variable will be written at
-this address by nccf_inq_var_missing. If the fill value was not
-defined for the variable, the netCDF default value will be used.
-
- at item valid_minp
-If this is not NULL, the valid_min value of the variable will be
-written at this address by nccf_inq_var_missing. If the valid_min was
-not defined for the variable, the netCDF default value will be used.
-
- at item valid_maxp
-If this is not NULL, the valid_max value of the variable will be
-written at this address by nccf_inq_var_missing. If the valid_max
-value was not defined for the variable, the netCDF default value will
-be used.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_notes, nccf_inq_notes, nccf_inq_var_missing, Variables
- at section Add CF-Recommended Metadata to a File or Variable with
-nccf_def_notes
-
-This functions writes up to four text attributes for either a
-variable, or an entire file. These text attributes, ``institution,''
-``source,'' ``comment,'' and ``references'' are recommended by the CF
-Metadata Convention.
-
- at heading Usage 
-
- at example
-int nccf_def_notes(int ncid, int varid, char *units, char *long_name, 
-                   char *standard_name, char *institution, 
-                   char *source, char *comment, char *references);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item varid
-The varid of the netCDF variable being described. Use NC_GLOBAL if you
-wish these attributes to apply to the entire file.
-
- at item institution
-If non-NULL, this text string will be written as the CF-recommended
-``institution'' attribute.
-
- at item source
-If non-NULL, this text string will be written as the CF-recommended
-``source'' attribute.
-
- at item comment
-If non-NULL, this text string will be written as the CF-recommended
-``comment'' attribute.
-
- at item references
-If non-NULL, this text string will be written as the CF-recommended
-``references'' attribute.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_notes, nccf_def_latitude, nccf_def_notes, Variables
- at section Read variable description with nccf_inq_notes
-
-Read any existing CF recommended text attributes from a variable. 
-
- at heading Usage 
-
- at example
-int nccf_inq_notes(int ncid, int varid, 
-                   size_t *institution_lenp, char *institution, 
-                   size_t *source_lenp, char *source, 
-                   size_t *comment_lenp, char *comment, 
-                   size_t *references_lenp, char *references);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item varid
-The varid of the netCDF variable.
-
- at item institution_lenp
-Pointer to size_t which, if not NULL, will get the length of the institution
-attribute.
-
- at item institution
-Pointer to char array which, if not NULL, will get the institution
-string. Memory must be allocated before this function is called. Call
-this function with a NULL for this parameter to get the size first.
-
- at item source_lenp
-Pointer to size_t which, if not NULL, will get the length of the source
-attribute.
-
- at item source
-Pointer to char array which, if not NULL, will get the source
-string. Memory must be allocated before this function is called. Call
-this function with a NULL for this parameter to get the size first.
-
- at item comment_lenp
-Pointer to size_t which, if not NULL, will get the length of the comment
-attribute.
-
- at item comment
-Pointer to char array which, if not NULL, will get the comment
-string. Memory must be allocated before this function is called. Call
-this function with a NULL for this parameter to get the size first.
-
- at item references_lenp
-Pointer to size_t which, if not NULL, will get the length of the references
-attribute.
-
- at item references
-Pointer to char array which, if not NULL, will get the references
-string. Memory must be allocated before this function is called. Call
-this function with a NULL for this parameter to get the size first.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_latitude, nccf_inq_latitude, nccf_inq_notes, Variables
- at section Define a coordinate variable and dimension for latitude with nccf_def_latitude
-
-Define a coordinate variable and dimension with all the CF
-recommended attribute accessories for latitude.
-
- at heading Usage 
-
- at example
-int nccf_def_latitude(int ncid, size_t len, nc_type xtype, 
-                         const char *formula_terms, int *lat_dimidp, 
-                         int *lat_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item len
-The length of this coordinate dimension.
-
- at item xtype
-The type of this coordinate variable.
-
- at item formula_terms
-If non-NULL, a string which will be written as the ``formula_terms''
-attribute on the coordinate variable.
-
- at item lat_dimidp
-If non-NULL, nccf_def_latitude will write the dimension ID of the
-netCDF dimension for the latitude here.
-
- at item lat_varidp
-If non-NULL, nccf_def_latitude will write the variable ID of the
-netCDF coordinate variable for the latitude here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_latitude, nccf_def_longitude, nccf_def_latitude, Variables
- at section Learn about a latitude coordinate variable and dimension with
-nccf_inq_latitude
-
-Inquire about a latitude dimension and coordinate variable. 
-
- at heading Usage 
-
- at example
-int nccf_inq_latitude(int ncid, size_t *lenp, nc_type *xtypep, 
-                         size_t *ft_lenp, char *formula_terms, 
-                         int *lat_dimidp, int *lat_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item lenp
-If non-NULL, the length of the latitude dimension will be written
-here by nccf_inq_latitude.
-
- at item xtypep
-If non-NULL, the type of the coordinate variable will be written here.
-
- at item ft_lenp
-If non-NULL, the length of the value of the ``formula_terms''
-attribute will be written here by ft_lenp. If there is no
-``formula_terms'' attribute, zero will be written.
-
- at item lat_dimidp
-If non-NULL, the dimid of the latitude dimension will be written here.
-
- at item lat_varidp
-If non-NULL, the varid of the latitude coordinate variable will be
-written here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_longitude, nccf_inq_longitude, nccf_inq_latitude, Variables
- at section Define a coordinate variable and dimension for longitude with nccf_def_longitude
-
-Define a coordinate variable and dimension with all the CF
-recommended attribute accessories for longitude.
-
- at heading Usage 
-
- at example
-int nccf_def_longitude(int ncid, size_t len, nc_type xtype, 
-                         const char *formula_terms, int *lon_dimidp, 
-                         int *lon_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item len
-The length of this coordinate dimension.
-
- at item xtype
-The type of this coordinate variable.
-
- at item formula_terms
-If non-NULL, a string which will be written as the ``formula_terms''
-attribute on the coordinate variable.
-
- at item lon_dimidp
-If non-NULL, nccf_def_longitude will write the dimension ID of the
-netCDF dimension for the longitude here.
-
- at item lon_varidp
-If non-NULL, nccf_def_longitude will write the variable ID of the
-netCDF coordinate variable for the longitude here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_longitude, nccf_def_lvl, nccf_def_longitude, Variables
- at section Learn about a longitude coordinate variable and dimension with
-nccf_inq_longitude
-
-Inquire about a longitude dimension and coordinate variable. 
-
- at heading Usage 
-
- at example
-int nccf_inq_longitude(int ncid, size_t *lenp, nc_type *xtypep, 
-                         size_t *ft_lenp, char *formula_terms, 
-                         int *lon_dimidp, int *lon_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item lenp
-If non-NULL, the length of the longitude dimension will be written
-here by nccf_inq_longitude.
-
- at item xtypep
-If non-NULL, the type of the coordinate variable will be written here.
-
- at item ft_lenp
-If non-NULL, the length of the value of the ``formula_terms''
-attribute will be written here by ft_lenp. If there is no
-``formula_terms'' attribute, zero will be written.
-
- at item lon_dimidp
-If non-NULL, the dimid of the longitude dimension will be written here.
-
- at item lon_varidp
-If non-NULL, the varid of the longitude coordinate variable will be
-written here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_lvl, nccf_inq_lvl, nccf_inq_longitude, Variables
- at section Define a coordinate variable and dimension for level with nccf_def_lvl
-
-Define a coordinate variable and dimension with all the CF
-recommended attribute accessories for a vertical level.
-
- at heading Usage 
-
- at example
-int nccf_def_lvl(int ncid, const char *name, size_t len, nc_type xtype, 
-                 const char *units, int positive_up, const char *standard_name, 
-                 const char *long_name, const char *formula_terms, 
-                 int *lvl_dimidp, int *lvl_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item name
-The name of the coordinate dimension and variable.
-
- at item len
-The length of this coordinate dimension and variable.
-
- at item xtype
-The type of this coordinate variable.
-
- at item units
-If non-NULL, a string which will be written as the ``units''
-attribute on the coordinate variable.
-
- at item positive_up
-Set to 0 and the attribute ``positive'' to ``down''. Set to any other
-value to get ``up''.
-
- at item standard_name
-If non-NULL, a string which will be written as the ``standard_name''
-attribute on the coordinate variable.
-
- at item long_name
-If non-NULL, a string which will be written as the ``long_name''
-attribute on the coordinate variable.
-
- at item lon_dimidp
-If non-NULL, nccf_def_lvl will write the dimension ID of the
-netCDF dimension for the level here.
-
- at item lon_varidp
-If non-NULL, nccf_def_lvl will write the variable ID of the
-netCDF coordinate variable for the level here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_lvl, nccf_def_lvl_vert, nccf_def_lvl, Variables
- at section Learn about a level coordinate variable and dimension with
-nccf_inq_lvl
-
-Inquire about a level dimension and coordinate variable. 
-
- at heading Usage 
-
- at example
-int nccf_inq_lvl(int ncid, char *name, size_t *lenp, nc_type *xtypep, 
-                 size_t *ft_lenp, char *formula_terms, int *positive_upp, 
-                 int *lvl_dimidp, int *lvl_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item name
-If non-NULL, the name of this vertical level dimension (and variable)
-will be written here.
-
- at item lenp
-If non-NULL, the length of the level dimension will be written
-here by nccf_inq_lvl.
-
- at item xtypep
-If non-NULL, the type of the coordinate variable will be written here.
-
- at item ft_lenp
-If non-NULL, the length of the value of the ``formula_terms''
-attribute will be written here by ft_lenp. If there is no
-``formula_terms'' attribute, zero will be written.
-
- at item positive_upp
-If non-NULL, a one will be written here if the ``positive'' attribute
-of this coordinate variable is ``up'', a zero will be written if it is
-``down''.
-
- at item lvl_dimidp
-If non-NULL, the dimid of the level dimension will be written here.
-
- at item lvl_varidp
-If non-NULL, the varid of the level coordinate variable will be
-written here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_lvl_vert, nccf_inq_lvl_vert, nccf_inq_lvl, Variables
- at section Define a coordinate variable and dimension for level with nccf_def_lvl
-
-Define a unitless vertical coordinate variable and dimension from
-Apendix D of the CF Convention, with all the CF recommended attribute
-accessories for a vertical level.
-
- at heading Usage 
-
- at example
-int nccf_def_lvl_vert(int ncid, int lvl_type, const char *name, nc_type xtype, 
-                      size_t len, int *lvl_dimidp, int *lvl_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item lvl_type
-One of: CF_VERT_ATM_LN, CF_VERT_SIGMA, CF_VERT_HYBRID_SIGMA,
-CF_VERT_HYBRID_HEIGHT, CF_VERT_SLEVE, CF_VERT_OCEAN_SIGMA,
-CF_VERT_OCEAN_S, CF_VERT_OCEAN_SIGMA_Z, CF_VERT_OCEAN_DBL_SIGMA.
-
- at item name
-The name of the coordinate dimension and variable.
-
- at item xtype
-The type of this coordinate variable.
-
- at item len
-The length of this coordinate dimension and variable.
-
- at item lvl_dimidp
-If non-NULL, the function will write the dimension ID of the
-netCDF dimension for the level here.
-
- at item llvl_varidp
-If non-NULL, the function will write the variable ID of the
-netCDF coordinate variable for the level here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_lvl_vert, nccf_def_time, nccf_def_lvl_vert, Variables
- at section Learn about a level coordinate variable and dimension with
-nccf_inq_lvl
-
-Inquire about a level dimension and coordinate variable. 
-
- at heading Usage 
-
- at example
-int nccf_inq_lvl_vert(int ncid, char *name, nc_type *xtypep, size_t *lenp, 
-                      int *lvl_typep, int *lvl_dimidp, int *lvl_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item name
-If non-NULL, the name of this vertical level dimension (and variable)
-will be written here.
-
- at item xtypep
-If non-NULL, the type of the coordinate variable will be written here.
-
- at item lenp
-If non-NULL, the length of the level dimension will be written
-here.
-
- at item lvl_typep
-If non-NULL, the type of vertical dimension will be written here, one
-of CF_VERT_ATM_LN, CF_VERT_SIGMA, CF_VERT_HYBRID_SIGMA,
-CF_VERT_HYBRID_HEIGHT, CF_VERT_SLEVE, CF_VERT_OCEAN_SIGMA,
-CF_VERT_OCEAN_S, CF_VERT_OCEAN_SIGMA_Z, CF_VERT_OCEAN_DBL_SIGMA.
-
- at item lvl_dimidp
-If non-NULL, the dimid of the level dimension will be written here.
-
- at item lvl_varidp
-If non-NULL, the varid of the level coordinate variable will be
-written here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_time, nccf_inq_time, nccf_inq_lvl_vert, Variables
- at section Define a coordinate variable and dimension for time with nccf_def_time
-
-Define a coordinate variable and dimension with all the CF
-recommended attribute accessories for time.
-
- at heading Usage 
-
- at example
-int nccf_def_time(int ncid, const char *name, size_t len, nc_type xtype, 
-                     const char *units, const char *standard_name, const char *long_name, 
-                     const char *formula_terms, int *time_dimidp, int *time_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item len
-The length of this coordinate dimension.
-
- at item xtype
-The type of this coordinate variable.
-
- at item formula_terms
-If non-NULL, a string which will be written as the ``formula_terms''
-attribute on the coordinate variable.
-
- at item lon_dimidp
-If non-NULL, nccf_def_time will write the dimension ID of the
-netCDF dimension for the time here.
-
- at item lon_varidp
-If non-NULL, nccf_def_time will write the variable ID of the
-netCDF coordinate variable for the time here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_time, nccf_def_ft_sigma, nccf_def_time, Variables
- at section Learn about a time coordinate variable and dimension with
-nccf_inq_time
-
-Inquire about a time dimension and coordinate variable. 
-
- at heading Usage 
-
- at example
-int nccf_inq_time(int ncid, size_t *lenp, nc_type *xtypep, size_t *ft_lenp, 
-                     char *formula_terms, int *time_dimidp, int *time_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item lenp
-If non-NULL, the length of the time dimension will be written
-here by nccf_inq_time.
-
- at item xtypep
-If non-NULL, the type of the coordinate variable will be written here.
-
- at item ft_lenp
-If non-NULL, the length of the value of the ``formula_terms''
-attribute will be written here by ft_lenp. If there is no
-``formula_terms'' attribute, zero will be written.
-
- at item formula_terms
-If non-NULL the value of the ``formula_terms'' attribute, if any, will
-be copied here.
-
- at item time_dimidp
-If non-NULL, the dimid of the time dimension will be written here.
-
- at item time_varidp
-If non-NULL, the varid of the time coordinate variable will be
-written here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_ft_sigma, nccf_inq_lvl_sigma, nccf_inq_time, Variables
- at section Define atmosphere sigma coordinate.
-
-Define formula terms attribute for atmosphere sigma coordinate variable.
-
- at heading Usage 
-
- at example
-int nccf_def_ft_sigma(int ncid, int varid, int ps_varid, int ptop_varid);
-
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item varid 
-The varid of the vertical coordinate variable.
-
- at item ps_varid
-The variable ID of the ps variable.
-
- at item ptop_varid
-The variable ID of the ptop variable.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_lvl_sigma, nccf_def_ft_hybrid_sigma, nccf_def_ft_sigma, Variables
- at section Inquire about atmosphere sigma coordinate.
-nccf_inq_time
-
-Inquire about atmosphere sigma coordinate.
-
- at heading Usage 
-
- at example
-int nccf_inq_lvl_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp, 
-                       int *ps_varidp, int *ptop_varidp, int *lvl_dimidp, 
-                       int *lvl_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item name
-If non-NULL, this pointer gets the name of the coordinate variable and
-dimension.     
-
- at item xtypep
-If non-NULL, the type of the coordinate variable will be written here.
-
- at item lenp
-If non-NULL, the length of the coordinate dimension will be written
-here.
-
- at item ps_varidp
-If non-NULL, the variable ID of the ps variable will be written
-here.
-
- at item ptop_varidp
-If non-NULL, the variable ID of the ptop variable will be written
-here.
-
- at item lvl_dimidp
-If non-NULL, the dimid of the coordinate dimension will be written here.
-
- at item lvl_varidp
-If non-NULL, the varid of the coordinate variable will be written
-here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_ft_hybrid_sigma, nccf_inq_lvl_hybrid_sigma, nccf_inq_lvl_sigma, Variables
- at section Define atmosphere sigma coordinate.
-
-Define formula terms attribute for atmosphere hybrid sigma coordinate
-variable.
-
- at heading Usage 
-
- at example
-int nccf_def_ft_hybrid_sigma(int ncid, int varid, int a_varid, int b_varid, 
-                             int ps_varid, int p0_varid);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item varid 
-The varid of the vertical coordinate variable.
-
- at item a_varid
-The variable ID of the a variable.
-
- at item b_varid
-The variable ID of the b variable.
-
- at item ps_varid
-The variable ID of the ps variable.
-
- at item ptop_varid
-The variable ID of the ptop variable.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_lvl_hybrid_sigma, nccf_def_ft_hybrid_height, nccf_def_ft_hybrid_sigma, Variables
- at section Inquire about atmosphere sigma coordinate.
-
-Inquire about atmosphere hybrid sigma coordinate.
-
- at heading Usage 
-
- at example
-int nccf_inq_lvl_hybrid_sigma(int ncid, char *name, nc_type *xtypep, 
-                              size_t *lenp, int *a_varidp, int *b_varidp, 
-                              int *ps_varidp, int *p0_varidp, int *lvl_dimidp, 
-                              int *lvl_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item name
-If non-NULL, this pointer gets the name of the coordinate variable and
-dimension.     
-
- at item xtypep
-If non-NULL, the type of the coordinate variable will be written here.
-
- at item lenp
-If non-NULL, the length of the coordinate dimension will be written
-here.
-
- at item a_varidp
-If non-NULL, the variable ID of the a variable will be written
-here.
-
- at item b_varidp
-If non-NULL, the variable ID of the b variable will be written
-here.
-
- at item ps_varidp
-If non-NULL, the variable ID of the ps variable will be written
-here.
-
- at item ptop_varidp
-If non-NULL, the variable ID of the ptop variable will be written
-here.
-
- at item lvl_dimidp
-If non-NULL, the dimid of the coordinate dimension will be written here.
-
- at item lvl_varidp
-If non-NULL, the varid of the coordinate variable will be written
-here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_ft_hybrid_height, nccf_inq_lvl_hybrid_height, nccf_inq_lvl_hybrid_sigma, Variables
- at section The formula_terms attribute for atmosphere hybrid height
-
-Define formula terms attribute for atmosphere hybrid height
-coordinate variable
-
- at heading Usage 
-
- at example
-int nccf_def_ft_hybrid_height(int ncid, int varid, int a_varid, int b_varid, 
-                              int orog_varid);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item varid 
-The varid of the vertical coordinate variable.
-
- at item a_varid
-The variable ID of the a variable.
-
- at item b_varid
-The variable ID of the b variable.
-
- at item orog_varid
-The variable ID of the orog variable.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_lvl_hybrid_height, nccf_def_ft_sleve, nccf_def_ft_hybrid_height, Variables
- at section Inquire about hybrid height coordinate.
-
-Inquire about the hybrid height coordinate.
-
- at heading Usage 
-
- at example
-int nccf_inq_lvl_hybrid_height(int ncid, char *name, nc_type *xtypep, size_t *lenp,
-                               int *a_varidp, int *b_varidp, int *orog_varidp,
-                               int *lvl_dimidp, int *lvl_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item name
-If non-NULL, this pointer gets the name of the coordinate variable and
-dimension.     
-
- at item xtypep
-If non-NULL, the type of the coordinate variable will be written here.
-
- at item lenp
-If non-NULL, the length of the coordinate dimension will be written
-here.
-
- at item a_varidp
-If non-NULL, the variable ID of the a variable will be written
-here.
-
- at item b_varidp
-If non-NULL, the variable ID of the b variable will be written
-here.
-
- at item orog_varidp
-If non-NULL, the variable ID of the orog variable will be written
-here.
-
- at item lvl_dimidp
-If non-NULL, the dimid of the coordinate dimension will be written here.
-
- at item lvl_varidp
-If non-NULL, the varid of the coordinate variable will be written
-here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_ft_sleve, nccf_inq_lvl_sleve, nccf_inq_lvl_hybrid_height, Variables
- at section Define atmosphere sleve coordinate.
-
-Define formula terms attribute for the atmosphere sleve coordinate
-variable.
-
- at heading Usage 
-
- at example
-int nccf_def_ft_sleve(int ncid, int varid, int a_varid, int b1_varid, 
-                      int b2_varid, int ztop_varid, int zsurf1_varid, 
-                      int zsurf2_varid);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item varid 
-The varid of the vertical coordinate variable.
-
- at item a_varid
-The variable ID of the a variable.
-
- at item b1_varid
-The variable ID of the b1 variable.
-
- at item b2_varid
-The variable ID of the b2 variable.
-
- at item ztop_varid
-The variable ID of the ztop variable.
-
- at item zsurf1_varid
-The variable ID of the zsurf1 variable.
-
- at item zsurf2_varid
-The variable ID of the zsurf2 variable.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_lvl_sleve, nccf_def_ft_ocean_sigma, nccf_def_ft_sleve, Variables
- at section Inquire About Sleve Coordinate.
-
-Inquire about the sleve coordinate.
-
- at heading Usage 
-
- at example
-int nccf_inq_lvl_sleve(int ncid, char *name, nc_type *xtypep, size_t *lenp,
-                       int *a_varidp, int *b1_varidp, int *b2_varidp, int *ztop_varidp,
-                       int *zsurf1_varidp, int *zsurf2_varidp, int *lvl_dimidp,
-                       int *lvl_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item name
-If non-NULL, this pointer gets the name of the coordinate variable and
-dimension.     
-
- at item xtypep
-If non-NULL, the type of the coordinate variable will be written here.
-
- at item lenp
-If non-NULL, the length of the coordinate dimension will be written
-here.
-
- at item a_varidp
-If non-NULL, the variable ID of the a variable will be written
-here.
-
- at item b1_varidp
-If non-NULL, the variable ID of the b1 variable will be written
-here.
-
- at item b2_varidp
-If non-NULL, the variable ID of the b2 variable will be written
-here.
-
- at item ztop_varidp
-If non-NULL, the variable ID of the ztop variable will be written
-here.
-
- at item zsurf1_varidp
-If non-NULL, the variable ID of the zsurf1 variable will be written
-here.
-
- at item zsurf2_varidp
-If non-NULL, the variable ID of the zsurf2 variable will be written
-here.
-
- at item lvl_dimidp
-If non-NULL, the dimid of the coordinate dimension will be written here.
-
- at item lvl_varidp
-If non-NULL, the varid of the coordinate variable will be written
-here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_ft_ocean_sigma, nccf_inq_lvl_ocean_sigma, nccf_inq_lvl_sleve, Variables
- at section Define Ocean Sigma Coordinate.
-
-Define the formula terms attribute for the ocean sigma coordinate variable.
-
- at heading Usage 
-
- at example
-int nccf_def_ft_ocean_sigma(int ncid, int varid, int eta_varid, int depth_varid);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item varid 
-The varid of the vertical coordinate variable.
-
- at item eta_varid
-The variable ID of the eta variable.
-
- at item depth_varid
-The variable ID of the depth variable.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_lvl_ocean_sigma, nccf_def_ft_ocean_s, nccf_def_ft_ocean_sigma, Variables
- at section Inquire About Ocean Sigma Coordinate.
-
-Inquire about the ocean sigma coordinate.
-
- at heading Usage 
-
- at example
-int nccf_inq_lvl_ocean_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp,
-                             int *eta_varidp, int *depth_varidp, int *lvl_dimidp,
-                             int *lvl_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item name
-If non-NULL, this pointer gets the name of the coordinate variable and
-dimension.     
-
- at item xtypep
-If non-NULL, the type of the coordinate variable will be written here.
-
- at item lenp
-If non-NULL, the length of the coordinate dimension will be written
-here.
-
- at item eta_varidp
-If non-NULL, the variable ID of the eta variable will be written
-here.
-
- at item lvl_dimidp
-If non-NULL, the dimid of the coordinate dimension will be written here.
-
- at item lvl_varidp
-If non-NULL, the varid of the coordinate variable will be written
-here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_ft_ocean_s, nccf_inq_lvl_ocean_s, nccf_inq_lvl_ocean_sigma, Variables
- at section Define Ocean S Coordinate.
-
-Define ocean s coordinate.
-
- at heading Usage 
-
- at example
-int nccf_def_ft_ocean_s(int ncid, const char *name, nc_type xtype, size_t len,
-                         int eta_varid, int depth_varid, int a_varid, int b_varid,
-                         int depth_c_varid, int *lvl_dimidp, int *lvl_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item varid 
-The varid of the vertical coordinate variable.
-
- at item xtype
-The type of this coordinate variable.
-
- at item len
-The length of this coordinate dimension.
-
- at item eta_varid
-The variable ID of the eta variable.
-
- at item depth_varid
-The variable ID of the depth variable.
-
- at item a_varid
-The variable ID of the a variable.
-
- at item b_varid
-The variable ID of the b variable.
-
- at item depth_c_varid
-The variable ID of the depth_c variable.
-
- at item lvl_dimidp
-If non-NULL, the dimension ID of the netCDF coordinate dimension will
-be written here.
-
- at item lvl_varidp
-If non-NULL, the variable ID of the netCDF coordinate variable will be
-written here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_lvl_ocean_s, nccf_def_ft_ocean_sigma_z, nccf_def_ft_ocean_s, Variables
- at section Inquire About Ocean S Coordinate.
-nccf_inq_time
-
-Inquire about the ocean s coordinate.
-
- at heading Usage 
-
- at example
-int nccf_inq_lvl_ocean_s(int ncid, char *name, nc_type *xtypep, size_t *lenp,
-                         int *eta_varidp, int *depth_varidp, int *a_varidp, int *b_varidp,
-                         int *depth_c_varidp, int *lvl_dimidp, int *lvl_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item name
-If non-NULL, this pointer gets the name of the coordinate variable and
-dimension.     
-
- at item xtypep
-If non-NULL, the type of the coordinate variable will be written here.
-
- at item lenp
-If non-NULL, the length of the coordinate dimension will be written
-here.
-
- at item eta_varidp
-If non-NULL, the variable ID of the eta variable will be written
-here.
-
- at item depth_varidp
-If non-NULL, the variable ID of the depth variable will be written
-here.
-
- at item a_varidp
-If non-NULL, the variable ID of the a variable will be written
-here.
-
- at item b_varidp
-If non-NULL, the variable ID of the b variable will be written
-here.
-
- at item depth_c_varidp
-If non-NULL, the variable ID of the depth_c variable will be written
-here.
-
- at item lvl_dimidp
-If non-NULL, the dimid of the coordinate dimension will be written here.
-
- at item lvl_varidp
-If non-NULL, the varid of the coordinate variable will be written
-here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_ft_ocean_sigma_z, nccf_inq_lvl_ocean_sigma_z, nccf_inq_lvl_ocean_s, Variables
- at section Define Ocean Sigma Z Coordinate.
-
-Define ocean sigma z coordinate.
-
- at heading Usage 
-
- at example
-int nccf_def_ft_ocean_sigma_z(int ncid, const char *name, nc_type xtype,
-                               size_t len, int eta_varid, int depth_varid,
-                               int depth_c_varid, int nsigma_varid,
-                               int zlev_varid, int *lvl_dimidp, int *lvl_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item varid 
-The varid of the vertical coordinate variable.
-
- at item xtype
-The type of this coordinate variable.
-
- at item len
-The length of this coordinate dimension.
-
- at item eta_varid
-The variable ID of the eta variable.
-
- at item depth_varid
-The variable ID of the depth variable.
-
- at item depth_c_varid
-The variable ID of the depth_c variable.
-
- at item nsigma_varid
-The variable ID of the nsigma variable.
-
- at item zlev_varid
-The variable ID of the zlev variable.
-
- at item lvl_dimidp
-If non-NULL, the dimension ID of the netCDF coordinate dimension will
-be written here.
-
- at item lvl_varidp
-If non-NULL, the variable ID of the netCDF coordinate variable will be
-written here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_lvl_ocean_sigma_z, nccf_def_ft_ocean_dbl_sigma, nccf_def_ft_ocean_sigma_z, Variables
- at section Inquire About Ocean Sigma Z Coordinate.
-
-Inquire about the ocean sigma z coordinate.
-
- at heading Usage 
-
- at example
-int nccf_inq_lvl_ocean_sigma_z(int ncid, char *name, nc_type *xtypep, size_t *lenp,
-                               int *eta_varidp, int *depth_varidp, int *depth_c_varidp,
-                               int *nsigma_varidp, int *zlev_varidp, int *lvl_dimidp,
-                               int *lvl_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item name
-If non-NULL, this pointer gets the name of the coordinate variable and
-dimension.     
-
- at item xtypep
-If non-NULL, the type of the coordinate variable will be written here.
-
- at item lenp
-If non-NULL, the length of the coordinate dimension will be written
-here.
-
- at item eta_varidp
-If non-NULL, the variable ID of the eta variable will be written
-here.
-
- at item depth_varidp
-If non-NULL, the variable ID of the depth variable will be written
-here.
-
- at item depth_c_varidp
-If non-NULL, the variable ID of the depth_c variable will be written
-here.
-
- at item nsigma_varidp
-If non-NULL, the variable ID of the nsigma variable will be written
-here.
-
- at item zlev_varidp
-If non-NULL, the variable ID of the zlev variable will be written
-here.
-
- at item lvl_dimidp
-If non-NULL, the dimid of the coordinate dimension will be written here.
-
- at item lvl_varidp
-If non-NULL, the varid of the coordinate variable will be written
-here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_def_ft_ocean_dbl_sigma, nccf_inq_lvl_ocean_dbl_sigma, nccf_inq_lvl_ocean_sigma_z, Variables
- at section Define Ocean Double Sigma Coordinate.
-
-Define ocean double sigma coordinate.
-
- at heading Usage 
-
- at example
-int nccf_def_ft_ocean_dbl_sigma(int ncid, const char *name, nc_type xtype, size_t len,
-                                 int depth_varid, int z1_varid, int z2_varid, int a_varid,
-                                 int href_varid, int k_c_varid, int *lvl_dimidp,
-                                 int *lvl_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item varid 
-The varid of the vertical coordinate variable.
-
- at item xtype
-The type of this coordinate variable.
-
- at item len
-The length of this coordinate dimension.
-
- at item depth_varid
-The variable ID of the depth variable.
-
- at item z1_varid
-The variable ID of the z1 variable.
-
- at item z2_varid
-The variable ID of the z2 variable.
-
- at item a_varid
-The variable ID of the a variable.
-
- at item href_varid
-The variable ID of the href variable.
-
- at item k_c_varid
-The variable ID of the k_c variable.
-
- at item lvl_dimidp
-If non-NULL, the dimension ID of the netCDF coordinate dimension will
-be written here.
-
- at item lvl_varidp
-If non-NULL, the variable ID of the netCDF coordinate variable will be
-written here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_inq_lvl_ocean_dbl_sigma, nccf_get_vara, nccf_def_ft_ocean_dbl_sigma, Variables
- at section Inquire About Ocean Double Sigma Coordinate.
-
-Inquire about the ocean double sigma coordinate.
-
- at heading Usage 
-
- at example
-int nccf_inq_lvl_ocean_dbl_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp,
-                                 int *depth_varidp, int *z1_varidp, int *z2_varidp,
-                                 int *a_varidp, int *href_varidp, int *k_c_varidp,
-                                 int *lvl_dimidp, int *lvl_varidp);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item name
-If non-NULL, this pointer gets the name of the coordinate variable and
-dimension.     
-
- at item xtypep
-If non-NULL, the type of the coordinate variable will be written here.
-
- at item lenp
-If non-NULL, the length of the coordinate dimension will be written
-here.
-
- at item depth_varidp
-If non-NULL, the variable ID of the depth variable will be written
-here.
-
- at item z1_varidp
-If non-NULL, the variable ID of the z1 variable will be written
-here.
-
- at item z2_varidp
-If non-NULL, the variable ID of the z2 variable will be written
-here.
-
- at item a_varidp
-If non-NULL, the variable ID of the a variable will be written
-here.
-
- at item href_varidp
-If non-NULL, the variable ID of the href variable will be written
-here.
-
- at item k_c_varidp
-If non-NULL, the variable ID of the k_c variable will be written
-here.
-
- at item lvl_dimidp
-If non-NULL, the dimid of the coordinate dimension will be written here.
-
- at item lvl_varidp
-If non-NULL, the varid of the coordinate variable will be written
-here.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf_get_vara,  , nccf_inq_lvl_ocean_dbl_sigma, Variables
- at section Get a geographic subset of the data.
-
-Get a geographic subset of the data.
-
- at heading Usage 
-
- at example
-   int nccf_get_vara(int ncid, int varid, float *lat_bounds, int *nlat, float *lon_bounds, 
-		     int *nlon, int *lvl_index, int *nlvl, int rec, void *data);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at item varid
-The varid of the data variable from which the subset will be taken.
-
- at item lat_bounds
-A length two array, this holds the latitude start and stop values for
-the range of interest.
-
- at item nlat
-A pointer to an integer which will get the number of latitude values
-which fall within the range.
-
- at item lon_bounds
-A length two array, this holds the longitude start and stop values for
-the range of interest. (Wrapping around the dateline is not allowed!)
-
- at item nlon
-A pointer to an integer which will get the number of longitude values
-which fall within the range.
-
- at item lvl_index
-A zero-based index number for the verticle level of interest to the
-subsetter. (Ignored if data has no vertical axis).
-
- at item timestep
-A zero-based index number for the timestep of interest to the
-subsetter. (Ignored if data has no time axis).
-
- at item data
-A pointer to which the data subset will be written. Memory must be
-allocated (and deallocated) by the user.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or an error code for failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node Coordinates, GRIDSPEC, Variables, Top
- at chapter Coordinate Systems
-
- at menu
-* nccf-def-axis-type::          
-* nccf-inq-axis-type::          
-* nccf-def-coord-system::       
-* nccf-inq-coord-system::       
-* nccf-assign-coord-system::    
-* nccf-def-transform::          
-* nccf-inq-transform::          
-* nccf-assign-transform::       
- at end menu
-
- at node nccf-def-axis-type, nccf-inq-axis-type, Coordinates, Coordinates
- at section Label the axis type of a coordinate var with nccf_def_axis_type
-
- at heading Usage 
-
- at example
-int
-nccf_def_axis_type(int ncid, int varid, int axis_type);
- at end example
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf-inq-axis-type, nccf-def-coord-system, nccf-def-axis-type, Coordinates
- at section Find out the axis type of a coordinate var with nccf_inq_axis_type
-
- at heading Usage 
-
- at example
-int
-nccf_inq_axis_type(int ncid, int varid, int *axis_type);
- at end example
-
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf-def-coord-system, nccf-inq-coord-system, nccf-inq-axis-type, Coordinates
- at section Define a coordinate system with nccf_def_coord_system
-
- at heading Usage 
-
- at example
-int
-nccf_def_coord_system(int ncid, const char *name, int naxes, int *axis_varids, 
-                    int *system_varid);
- at end example
-
-Define a coordinate system consisting of naxes axes, each axis
-represented by a coordinate varid in the axis_varids array. This
-create a new (scalar, NC_CHAR) var, whose varid is returned in
-system_varid.
-
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf-inq-coord-system, nccf-assign-coord-system, nccf-def-coord-system, Coordinates
- at section Find out about a coordinate system with nccf_inq_coord_system
-
- at heading Usage 
-
- at example
-int
-nccf_inq_coord_system(int ncid, int system_varid, char *name, 
-                    int *naxes, int *axis_varids);
- at end example
-
-Find out about a coordinate system, it's name, number of axes, and the
-varid of each axis coordinate var.
-
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf-assign-coord-system, nccf-def-transform, nccf-inq-coord-system, Coordinates
- at section Assign a coordinate system to a var with nccf_assign_coord_system
-
- at heading Usage 
-
- at example
-int
-nccf_assign_coord_system(int ncid, int varid, int system_varid);
- at end example
-
-Assign a coordinate system to a var. This adds an attribute to the
-var.
-
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf-def-transform, nccf-inq-transform, nccf-assign-coord-system, Coordinates
- at section Define a coordinate transform with nccf_def_transform
-
- at heading Usage 
-
- at example
-int
-nccf_def_transform(int ncid, const char *name, const char *transform_type, 
-                 const char *transform_name, int *transform_varid);
- at end example
-
-Define a coordinate transform. This adds a (scalar, NC_CHAR) var,
-which contains some attributes. The varid of this new variable is
-returned in transform_varid.
-
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf-inq-transform, nccf-assign-transform, nccf-def-transform, Coordinates
- at section Find out about a coordinate transform with nccf_inq_transform
-
- at heading Usage 
-
- at example
-int
-nccf_inq_transform(int ncid, int transform_varid, char *name, size_t *type_len, 
-                 char *transform_type, size_t *name_len, char *transform_name);
- at end example
-
-Find out about a coordinate transform, it's name, and the contents
-of the transform_type and transform_name attributes. Pass NULL for
-any that you're not interested in. Pass NULL for transform_type and
-transform_name to get their lengths with type_len and name_len.
-
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node nccf-assign-transform,  , nccf-inq-transform, Coordinates
- at section Assign a coordinate transform to a coordinate system with nccf_assign_transform
-
- at heading Usage 
-
- at example
-int
-nccf_assign_transform(int ncid, int system_varid, int transform_varid);
- at end example
-
-Assign a coordinate transform to a coordinate system. This adds an
-attribute to the variable that holds the coordinate system
-attributes.
-
-
- at table @code
-
- at item ncid
-The ncid of the file.
-
- at end table
-
- at heading Return Codes
-
-This function returns zero for success, or a netCDF error code for
-failure.
-
- at heading Example 
-
- at example
- at end example
- 
- at node GRIDSPEC, Combined Index, Coordinates, Top
- at chapter GRIDSPEC - A standard for the description of grids used in Earth System models
-
-The GRIDSPEC is a proposed CF standard. It is not yet part of the
-Climate and Forecast Conventions. Support for GRIDSPEC in libcf is
-provided as a service to the CF community, allowing for the evaluation
-of the proposed GRIDSPEC standard.
-
-Each of the GRIDSPEC tools listed below may be call programmatically, or
-with a command line utility.
-
-For more information about GRIDSPEC see @url{@value{gridspec-url}}.
-
- at menu
-* gs_make_hgrid::               
-* gs_fregrid::                  
-* gs_make_solo_mosaic::         
-* gs_river_regrid::             
-* gs_transfer_to_mosaic::       
-* gs_make_vgrid::               
-* gs_make_coupler_mosaic::      
-* gs_make_topog::               
- at end menu
-
- at node gs_make_hgrid, gs_fregrid, GRIDSPEC, GRIDSPEC
- at section Make a Horizontal Grid
-
-This function can generate different types of horizontal grids. The
-output data is on supergrid ( model grid size x refinement(=2) ).  For
-'cubic_grid', six grid files which contain the grid information for each
-tile will be generated, otherwise one file will be generated. 
-
-Specify the grid type through grid_type parameter. The value of
-grid_type can be 'from_file', 'spectral_grid', 'spherical_grid',
-'conformal_cubic_grid', 'gnomonic_ed' or 'simple_cartesian_grid', with
-default value 'spherical_grid'. 
-
-The nlon and nlat parameters must be specified to
-indicate supergrid size (for cubic_grid, nlat is not needed because
-nlat has the same value as nlon).  
-
- at example
-int
-gs_make_hgrid(char *grid_type, int *nlat, int *nlon, 
-	      int nxbnds0, int nybnds0, int nxbnds1, int nybnds1, 
-	      int nxbnds2, int nybnds2, double lat_join, int nratio, 
-	      double simple_dx, double simple_dy, int ntilex, int ntiley,
-              char *gridname, char *center, char *history, double *xbnds, 
-	      double *ybnds)
- at end example
-
-The following grid types are available:
-
- at table @code 
-
- at item from_file 
-my_grid_file must be specified. The grid " specified in my_grid_file
-should be super grid vertex.
-
- at item spectral_grid 
-no other optional or required arguments.       
-
- at item regular_lonlat_grid 
-nxbnds, nybnds xbnds, ybnds, must be specified to define the
-grid bounds.
-
- at item tripolar_grid 
-nxbnds, nybnds, xbnds, ybnds, must be specified to define the
-grid bounds. lat_join is optional with default value 65.
-
- at item conformal_cubic_grid 
-nratio is optional argument.                 
-
- at item gnomonic_ed 
-equal distance gnomonic cubic grid.            
-
- at item simple_cartesian_grid 
-xbnds, ybnds must be specified to define   
-                               the grid bounds location and grid size. number 
-                               of bounds must be 2 in both and x and          
-                               y-direction. simple_dx and simple_dy must b
-                               specified to specify uniform cell length.      
-
- at end table
-
-                                                                              
- at table @code
-                                                                              
- at item grid_type 
-specify type of topography (see table above).
-                                                                              
- at item my_grid_file 
-when this flag is present, the program will read grid information from
-'my_grid_file'. The file format can be ascii file or netcdf
-file. Multiple file entry are allowed but the number should be less than
-MAXBOUNDS.
-
- at item nxbnds
-Specify number of zonal regions for varying resolution.                                      
-                                                                              
- at item nybnds
-Specify number of meridinal regions for varying resolution.                                      
-                                                                              
- at item xbnds 
-Specify boundaries for defining zonal regions of varying
-resolution. When tripolar is present, x also defines the longitude of
-the two new poles nxbnds must be 2 and lon_start = x(1), lon_end =
-x(nxbnds) are longitude of the two new poles.
-                                                                              
- at item ybnds
-Specify boundaries for defining meridional regions of varying resolution                    
-                                                                              
- at item nlon 
-Number of model grid points(supergrid) for each zonal regions of varying
-resolution.
-                                                                               
- at item nlat 
-Number of model grid points(supergid) for each meridinal regions of
-varying resolution.
-                                                                              
- at item lat_join
-Specify latitude for joining spherical and rotate bipolar grid. Default
-value is 65 degree.
-                                                                              
- at item nratio 
-Speicify the refinement ratio when calculating cell length and area of
-supergrid.
-                                                                              
- at item simple_dx 
-Specify the uniform cell length in x-direction fo simple cartesian grid.
-                                                                              
- at item simple_dy 
-Specify the uniform cell length in y-direction fo simple cartesian grid.
-                                                                              
- at item ndivx 
-Specify number division in x-direction for each face, default value is
-1.
-                                                                              
- at item ndivy 
-Specify number division in y-direction for each face, default value is
-1.
-                                                                              
- at item grid_name 
-Specify the grid name. The output grid file name will be grid_name.nc if
-there is one tile and grid_name.tile#.nc if there is more than one tile
-The default value will be horizontal_grid.
-                                                                              
- at item center 
-Specify the center location of grid. The valid entry will be 'none',
-'t_cell' or 'c_cell' with default value 'none'. The grid refinement is
-assumed to be 2 in x and y-direction when center is not 'none'. 'c_cell'
-should be used for the gr used in MOM4.
-
- at end table
-
- at node gs_fregrid, gs_make_solo_mosaic, gs_make_hgrid, GRIDSPEC
- at section Remap data from Input Mosaic to Output Mosaic
-
-This function remaps data (scalar or vector) from input_mosaic onto
-output_mosaic.
-
-The target grid also could be specified through lonBegin,
-lonEnd, latBegin, latEnd, nlon and nlat. 
-
-Currently only T-cell scalar regridding and AGRID vector regridding
-(only bilinear interpolation is implemented for cubic grid vector
-interpolation). The interpolation algorithm used is controlled by
-interp_method with default 'conserve_order1'. 
-
-Currently only 'conserve_order1', 'conserve_order2' and 'bilinear'
-remapping scheme are implemented. 'bilinear' is only used to remap data
-from cubic grid to latlon grid. We will add more scheme in the future if
-needed. fregrid expects NetCDF format input. scalar_field and/or
-u_field/v_field must be specified. u_fld and v_fld must be paired
-together.
-
- at example
-int
-gs_fregrid(char *history, char *mosaic_in, char *mosaic_out, char *dir_in, 
-           char *dir_out, char **input_file, int nfiles, char **output_file, 
-           int nfiles_out, char *remap_file, char **scalar_name, int nscalar,
-           char **u_name, int nvector, char **v_name, int nvector2, 
-           char *interp_method, char *test_case, double test_param, 
-           unsigned int opcode, int grid_type, unsigned int finer_step,
-           int fill_missing, int nlon, int nlat, int check_conserve, 
-           int y_at_center, double lonbegin, double lonend, double latbegin,
-           double latend, int kbegin, int kend, int lbegin, int lend)
- at end example
-                                                                              
- at table @code
- at item innput_mosaic 
-Specify the input mosaic information. This file contains list of tile
-files which specify the grid information for each tile.
-                                                                                     
- at item input_file 
-specify the input file name. The suffix '.nc' can be omitted. The suffix
-'tile#' should not present for multiple-tile files. The number of files
-must be 1 for scalar regridding and can be 1 or 2 for vector
-regridding. File path should not be includes.
-                                                                                     
- at item scalar_field
-specify the scalar field name to be regridded. The multiple entry field
-names are seperated by comma.
-                                                                                         
- at item u_field 
-specify the vector field u-componentname to be regridded. The multiple
-entry field names are seperated by comma. u_field must be paired
-together with v_field.
-                                                                                         
- at item v_field 
-specify the vector field v-componentname to be regridded. The multiple
-entry field names are seperated by comma. v_field must be paired
-together with u_field.
-                                                                                       
- at item output_mosaic 
-specify the output mosaic information. This file contains list of tile
-files which specify the grid information for each tile. If output_mosaic
-is not specified, nlon and nlat must be specified.
-                                                                                     
- at item lonBegin  # 
-specify the starting longitude(in degree) of the geographical region of
-the target grid on which the output is desired. The default value is 0.
-                                                                                     
- at item lonEnd   
-specify the ending longitude(in degree) of the geographical region of
-the target grid on which the output is desired. The default value is
-360.
-                                                                                     
- at item latBegin  
-specify the starting latitude(in degree) of the geographical region of
-the target grid on which the output is desired. The default value is
--90.
-                                                                                     
- at item latEnd   
-specify the ending latitude(in degree) of the geographical region of the
-target grid on which the output is desired. The default value is 90.
-                                                                                     
- at item nlon 
-specify number of grid box cells in x-direction for a regular lat-lon
-grid.
-                                                                                     
- at item nlat 
-specify number of grid box cells in y-direction for a regular lat-lon
-grid.
-                                                                                       
- at item KlevelBegin 
-specify begin index of the k-level (depth axis) that to be regridded.
-                                                                                     
- at item KlevelEnd 
-specify end index of the k-level (depth axis) that to be regridded.
-                                                                                     
- at item LstepBegin 
-specify the begin index of L-step (time axis) that to be regridded.
-                                                                                     
- at item LstepEnd 
-specify the end index of L-step (time axis) that to be regridded.
-                                                                                       
- at item output_file 
-specify the output file name. If not presented, output_file will take
-the value of input_file. The suffix '.nc' can be omitted. The suffix
-'tile#' should not present for multiple-tile files. The number of files
-must be 1 for scalar regridding and can be 1 or 2 for vector
-regridding. File path should not be includes
-                                                                                     
- at item input_dir 
-specify the path that stores input_file. If not presented, the input
-file is assumed to be stored in current diretory.
-                                                                                     
- at item output_dir 
-specify the path that will store output file. If not presented, the
-output file will be stored in current diretory.
-                                                                                     
- at item remap_file 
-specify the file name that saves remapping information.  If remap_file
-is specified and the file does not exist, remapping information will be
-calculated ans stored in remap_file. If remap_file is specified and the
-file exists, remapping information will be read from remap_file.
-                                                                                     
- at item interp_method 
-specify the remapping algorithm to be used. Default is
-'conserve_order1'. Currently only 'conserve_order1', 'conserve_order2'
-and 'bilinear' remapping scheme are implemented in this tool. The
-bilinear scheme can only be used to remap data from cubic grid to
-regular latlon grid. When interp_method is 'bilinear', nlon and nlat
-must be specified and the output data in y-direction will be located at
-the center of cell or bound of the cell depending on the setting of
-y_center.
-                                                                                     
- at item test_case 
-specify the test function to be used for testing.
-                                                                                     
- at item grid_type 
-specify the vector field grid location. default is AGRID and only AGRID
-is implemented yet.
-                                                                                     
- at item symmetry 
-the grid is symmetry or not.
-                                                                                     
- at item target_grid 
-input cell area instead of calculating based on exchange grid
-area. default is off.
-                                                                                     
- at item -finer_step 
-This is used only for bilinear interpolation. Set finer_step to a
-positive integer to reduce noise in interpolation and get a relatively
-smooth output. The default value is 0. When finer_step is greater than
-0, fregrid will first remap data from source grid onto a finer grid with
-resolution that is power of 2 of destination grid resolution using
-bilinear interpolation, then using volume averaging to remap data from
-finer grid onto destination grid.
-                                                                                     
- at item center_y
-output latitude will locate at cell center, i.e., the starting latitude
-will be -89 when nlat = 90. when center_y is not set, starting latitude
-will be -90. for bilinear interpolation. For conservative interpolation,
-center_y is assumed.
-                                                                                     
- at item check_conserve
-check the conservation of conservative interpolation.  The area sum will
-be printed out for input and output mosaic.
-                                                                              
- at end table
-
- at node gs_make_solo_mosaic, gs_river_regrid, gs_fregrid, GRIDSPEC
- at section Generate Mosaic Information Between Tiles
-
-This function generates Mosaic information between tiles. The mosaic
-information includes: list of tile files, list of contact region
-specified by index, contact type.
-
- at example
-int
-gs_make_solo_mosaic(char *history, int ntiles, char *mosaic_name, char *grid_descriptor,
-                    char **tilefile, double periodx, double periody, char *dir)
- at end example
-                                                                              
- at table @code
-             
- at item num_tiles 
-Number of tiles in the mosaic.
-                                                                                
- at item dir 
-The directory that contains all the tile grid file.
-                                                                                
- at item mosaic_name 
-mosaic name. The output file will be mosaic_name.nc.  default is
-'mosaic'.
-                                                                                
- at item tile_file 
-Grid file name of all tiles in the mosaic. The file name should be
-relative file name ( exclude the absolute file path). The absolute file
-path will be dir/tile_file.  If this option is not specified, the
-tile_file will be 'horizontal_grid.tile#.nc'
-                                                                                
- at item periodx 
-Specify the period in x-direction of mosaic. Default    
-                        value is 0 (not periodic).                              
-                                                                                
- at item periody 
-Specify the period in y-direction of mosaic. Default value is 0 (not periodic).
-                                                                 
- at end table
-
- at node gs_river_regrid, gs_transfer_to_mosaic, gs_make_solo_mosaic, GRIDSPEC
- at section Remap River Network Data
-
-river_regrid will remap river network data from global regular lat-lon
-grid onto any Other grid (includes regular lat-lon grid and cubic grid
-), which is specified through option mosaic. The river network source
-data is specified through option river_src.
-
- at example
-int
-gs_river_regrid(char *history, char *mosaic_file, char *river_src_file, 
-   char *output_file)
- at end example
-                                                                              
- at table @code
- at item mosaic 
-specify the mosaic file of destination grid. This mosaic file should be
-a coupler mosaic file, which contains link to land solo mosaic and the
-exchange grid file.
-                                                                                     
- at item river_src 
-specify the river network source data file. The data is assumed on
-regular lat-lon grid and the longitude is assumed from 0 to 360 degree
-and latitude is assumed from -90 to 90 degree.
-                                                                                     
- at item output 
-specify the output file base name. the suffix '.nc' should not be
-included in the output_file. The default value is river_output. For one
-tile mosaic, the actual result will be $output_file.nc. For multiple
-tile mosaic, the result will be $output.tile#.nc.
-
- at end table
-
- at node gs_transfer_to_mosaic, gs_make_vgrid, gs_river_regrid, GRIDSPEC
- at section Transfer to Mosaic
-
- at example
-int
-gs_transfer_to_mosaic(char *old_file, char *mosaic_dir)
- at end example
-                                                                              
- at table @code
-
- at item old_file
-The old file.
-
- at item mosaic_dir
-The mosaic directory.
-                                                                              
- at end table
-
- at node gs_make_vgrid, gs_make_coupler_mosaic, gs_transfer_to_mosaic, GRIDSPEC
- at section Make a Vertical Grid
-
-This program call be used to make vertical grid for FMS model.     
-It uses cubic-spline algorithm to calculate the grid cell location.
-The output netcdf will contains information on supergrid with grid 
-size equal model grid size multipling refinement ( always 2 ).     
-make_vgrid takes the following flags                               
-
- at example
-int 
-gs_make_vgrid(char *history, int nbnds, int *bnds, int n1, 
-	      int n2, int *nz, char *gridname, char *center)
- at end example
-                                                                              
- at table @code
- at item nbnds 
-Specify number of vertical regions for varying resolution.
-                                                                               
- at item bnds 
-Specify boundaries for defining vertical regions of varying resolution.
-                                                                             
- at item nz 
-Number of model grid points for each vertical regions of varying
-resolution.
-                                                                                
- at item grid_name 
-Specify the grid name. The output grid file name will be
-grid_name.nc. The default value is vertical_grid.
-                                                                                  
- at item center 
-Specify the center location of grid. The valid entry will be 'none',
-'t_cell' or 'c_cell' with default value 'none'. The grid refinement is
-assumed to be 2 in x and y-direction when center is not 'none'. 'c_cell'
-should be used for the grid used in MOM4.
-                                                                              
- at end table
-
- at node gs_make_coupler_mosaic, gs_make_topog, gs_make_vgrid, GRIDSPEC
- at section Generate Three Exchange Grids for FMS Coupler
-
-make_coupler_mosaic generates three exchange grids for the FMS
-coupler. The output file includes exchange grid files for fluxes between
-atmosphere and surface (sea ice and land), exchange grid files for
-runoff between land and sea ice. There might be more than one exchange
-grid files between two model solo mosaic because there might be multiple
-tiles in a solo mosaic. All the exchange grid information are between
-model grid, not between supergrid. We assume the refinement ratio
-between model grid and supergrid is 2. Currently we only output the
-exchange grid on T-cell.  Besides generate the exchange grid files,
-make_coupler_mosaic also generate the coupler mosaic file (the file name
-will be mosaic_name.nc) which contains the atmos, land and ocean mosaic
-path, ocean mosaic topog path and exchange grid file path.
-make_coupler_mosaic expects NetCDF format input.
-
- at example
-int 
-gs_make_coupler_mosaic(char *history, char *amosaic, char *lmosaic, 
-		       char *omosaic, char *otopog, int interp_order, 
-		       double sea_level, char *mosaic_name, int check)
- at end example
-
- at table @code
-                                                                              
- at item atmos_mosaic 
-specify the atmosphere mosaic information. This file contains list of
-tile files which specify the grid information for each tile. Each grid
-is required to be regular lon/lat grid. The file name can not be
-'mosaic.nc'
-
- at item ocean_mosaic 
-specify the ocean mosaic information. This file contains list of tile
-files which specify the grid information for each tile. The file name
-can not be 'mosaic.nc'
-
- at item ocean_topog 
-specify the topography information for ocean mosaic.  The field name of
-the topography is depth_tile# or depth when ntiles = 1, The topography
-data is positive down.
-
- at item land_mosaic 
-specify the land mosaic information. This file contains list of tile
-files which specify the grid information for each tile. Each grid is
-required to be regular lon/lat grid. When land_mosaic is not specified,
-atmosphere mosaic will be used to specify land mosaic.  The file name
-can not be 'mosaic.nc'.
-
- at item interp_order 
-specify the order of conservative interplation. Its value can be 1 (
-linear order ) or 2 ( second order ) with default value 2.
-                                                                                            
- at item sea_level # 
-specify the sea level ( in meters ) and its value will be used to determine
-land/sea mask. When topography of a grid cell is less than sea level,
-this grid cell will be land, otherwise it will be ocean. Default value
-is 0
-
- at item mosaic_name 
-coupler mosaic name. The output coupler mosaic file will be
-mosaic_name.nc. default value is 'mosaic'.
-
- at item check 
-check the tiling error.
-                                                                              
- at end table
-
- at node gs_make_topog,  , gs_make_coupler_mosaic, GRIDSPEC
- at section Generate Topography for Any Mosaic
-
-make_topog can generate topography for any Mosaic. The output file will
-contains the topography for each tile in the Mosaic. The field name in
-the output topography file will be depth_tile# and it is positive down.
-The topography data will be defined on model grid, the model grid size
-will be supergrid grid size divided by refinement (x_refine, y_refine,
-default is 2).  mosaic is a required option and all other options are
-optional, but some options are required depending on the choice of
-topog_type.  
-
- at example
-int 
-gs_make_topog(char *history, char *mosaic_file, char *topog_type, 
-              int x_refine, int y_refine, 
-              double basin_depth, char *topog_file, double bottom_depth, 
-              double min_depth, double scale_factor, int num_filter_pass, 
-              double gauss_amp, double gauss_scale, double slope_x,
-              double slope_y, double bowl_south, double bowl_north, 
-              double bowl_west, double bowl_east, int fill_first_row, 
-              int filter_topog, int round_shallow, int fill_shallow, 
-              int deepen_shallow, int smooth_topo_allow_deepening, 
-              char *output_file)
- at end example
-                                                                              
- at table @code
- at item mosaic 
-Specify the mosaic file where topography data located.
-                                                                                     
- at item topog_type 
-Specify type of topography. Its value can be 'realistic',
-'rectangular_basin', 'gaussian', 'bowl' or 'idealized'. The default
-value is 'realistic'.
-                                                                                     
- at item x_refine # 
-the refinement ratio of model grid vs supergrid ins x-directin. default
-value 2.
-                                                                                     
- at item y_refine # 
-the refinement ratio of model grid vs supergrid ins y-directin. default
-value 2.
-                                                                                     
- at item basin_depth # 
-the basin depth when topog_type is 'rectangular_basin'. Default value is
-5000 meter.
-                                                                                     
- at item topog_file 
-Specify name of topograhy file (e.g. scripps, navy_topo, ...)
-                                                                                     
- at item topog_field 
-Specify name of topography field name in topog_file.
-                                                                                     
- at item bottom_depth # 
-maximum depth (or bottom depth) of ocean.  default value is 5000 meter.
-                                                                                     
- at item min_depth # 
-minimum depth of ocean.  default value is 10 meter.
-                                                                                       
- at item scale_factor # 
-scaling factor for topography data (e.g. -1 to flip sign or 0.01 to
-convert from centimeters).  default value is 1.
-                                                                                     
- at item num_filter_pass # 
-number of passes of spatial filter default value is 1.
-                                                                                     
- at item gauss_amp # 
-height of gaussian bump as percentage of ocean depth. default value is
-0.5.
-                                                                                     
- at item gauss_scale # 
-width of gaussian bump as percentag e of basin width. Default value is
-0.25.
-                                                                                     
- at item slope_x # 
-rise of the ocean floor to the east for the gaussian bump. Default value
-is 0.
-                                                                                     
- at item slope_y # 
-rise of the ocean floor to the north for the gaussian bump. Default
-value is 0.
-                                                                                     
- at item bowl_south # 
-southern boundary of Winton bowl.  Default value is 60.
-                                                                                     
- at item bowl_north # 
-northern boundary of Winton bowl.  Default value is 70.
-                                                                                     
- at item bowl_west # 
-western boundary of Winton bowl.  Default value is 0.
-                                                                                       
- at item bowl_east # 
-eastern boundary of Winton bowl.  Default value is 20.
-                                                                                     
- at item fill_first_row 
-when true, make first row of ocean model all land points for ice model.
-                                                                                     
- at item filter_topog 
-when true, apply filter to topography.
-                                                                                     
- at item round_shallow 
-when true, Make cells land if depth is less than 1/2 mimumim depth,
-otherwise make ocean.
-                                                                                     
- at item fill_shallow 
-when specified, Make cells less than minimum depth land.
-                                                                                     
- at item deepen_shallow 
-when specified, Make cells less than minimum depth equal to minimum depth.
-                                                                                     
- at item smooth_topo_allow_deepening 
-when specified, allow filter to deepen cells.
-                                                                                     
- at item output 
-The created netcdf file that contains mosaic topography. Default value
-is 'topog.nc'
-                                                                              
- at end table
-
- at node Combined Index,  , GRIDSPEC, Top
- at unnumbered Index
-
- at printindex cp
-
- at bye
-End:
diff --git a/doc/mdate-sh b/doc/mdate-sh
deleted file mode 100755
index e631b22..0000000
--- a/doc/mdate-sh
+++ /dev/null
@@ -1,205 +0,0 @@
-#!/bin/sh
-# Get modification time of a file or directory and pretty-print it.
-
-scriptversion=2009-04-28.21; # UTC
-
-# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2007, 2009 Free
-# Software Foundation, Inc.
-# written by Ulrich Drepper <drepper at gnu.ai.mit.edu>, June 1995
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# This file is maintained in Automake, please report
-# bugs to <bug-automake at gnu.org> or send patches to
-# <automake-patches at gnu.org>.
-
-case $1 in
-  '')
-     echo "$0: No file.  Try \`$0 --help' for more information." 1>&2
-     exit 1;
-     ;;
-  -h | --h*)
-    cat <<\EOF
-Usage: mdate-sh [--help] [--version] FILE
-
-Pretty-print the modification time of FILE.
-
-Report bugs to <bug-automake at gnu.org>.
-EOF
-    exit $?
-    ;;
-  -v | --v*)
-    echo "mdate-sh $scriptversion"
-    exit $?
-    ;;
-esac
-
-# Prevent date giving response in another language.
-LANG=C
-export LANG
-LC_ALL=C
-export LC_ALL
-LC_TIME=C
-export LC_TIME
-
-# GNU ls changes its time format in response to the TIME_STYLE
-# variable.  Since we cannot assume `unset' works, revert this
-# variable to its documented default.
-if test "${TIME_STYLE+set}" = set; then
-  TIME_STYLE=posix-long-iso
-  export TIME_STYLE
-fi
-
-save_arg1=$1
-
-# Find out how to get the extended ls output of a file or directory.
-if ls -L /dev/null 1>/dev/null 2>&1; then
-  ls_command='ls -L -l -d'
-else
-  ls_command='ls -l -d'
-fi
-# Avoid user/group names that might have spaces, when possible.
-if ls -n /dev/null 1>/dev/null 2>&1; then
-  ls_command="$ls_command -n"
-fi
-
-# A `ls -l' line looks as follows on OS/2.
-#  drwxrwx---        0 Aug 11  2001 foo
-# This differs from Unix, which adds ownership information.
-#  drwxrwx---   2 root  root      4096 Aug 11  2001 foo
-#
-# To find the date, we split the line on spaces and iterate on words
-# until we find a month.  This cannot work with files whose owner is a
-# user named `Jan', or `Feb', etc.  However, it's unlikely that `/'
-# will be owned by a user whose name is a month.  So we first look at
-# the extended ls output of the root directory to decide how many
-# words should be skipped to get the date.
-
-# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
-set x`$ls_command /`
-
-# Find which argument is the month.
-month=
-command=
-until test $month
-do
-  shift
-  # Add another shift to the command.
-  command="$command shift;"
-  case $1 in
-    Jan) month=January; nummonth=1;;
-    Feb) month=February; nummonth=2;;
-    Mar) month=March; nummonth=3;;
-    Apr) month=April; nummonth=4;;
-    May) month=May; nummonth=5;;
-    Jun) month=June; nummonth=6;;
-    Jul) month=July; nummonth=7;;
-    Aug) month=August; nummonth=8;;
-    Sep) month=September; nummonth=9;;
-    Oct) month=October; nummonth=10;;
-    Nov) month=November; nummonth=11;;
-    Dec) month=December; nummonth=12;;
-  esac
-done
-
-# Get the extended ls output of the file or directory.
-set dummy x`eval "$ls_command \"\$save_arg1\""`
-
-# Remove all preceding arguments
-eval $command
-
-# Because of the dummy argument above, month is in $2.
-#
-# On a POSIX system, we should have
-#
-# $# = 5
-# $1 = file size
-# $2 = month
-# $3 = day
-# $4 = year or time
-# $5 = filename
-#
-# On Darwin 7.7.0 and 7.6.0, we have
-#
-# $# = 4
-# $1 = day
-# $2 = month
-# $3 = year or time
-# $4 = filename
-
-# Get the month.
-case $2 in
-  Jan) month=January; nummonth=1;;
-  Feb) month=February; nummonth=2;;
-  Mar) month=March; nummonth=3;;
-  Apr) month=April; nummonth=4;;
-  May) month=May; nummonth=5;;
-  Jun) month=June; nummonth=6;;
-  Jul) month=July; nummonth=7;;
-  Aug) month=August; nummonth=8;;
-  Sep) month=September; nummonth=9;;
-  Oct) month=October; nummonth=10;;
-  Nov) month=November; nummonth=11;;
-  Dec) month=December; nummonth=12;;
-esac
-
-case $3 in
-  ???*) day=$1;;
-  *) day=$3; shift;;
-esac
-
-# Here we have to deal with the problem that the ls output gives either
-# the time of day or the year.
-case $3 in
-  *:*) set `date`; eval year=\$$#
-       case $2 in
-	 Jan) nummonthtod=1;;
-	 Feb) nummonthtod=2;;
-	 Mar) nummonthtod=3;;
-	 Apr) nummonthtod=4;;
-	 May) nummonthtod=5;;
-	 Jun) nummonthtod=6;;
-	 Jul) nummonthtod=7;;
-	 Aug) nummonthtod=8;;
-	 Sep) nummonthtod=9;;
-	 Oct) nummonthtod=10;;
-	 Nov) nummonthtod=11;;
-	 Dec) nummonthtod=12;;
-       esac
-       # For the first six month of the year the time notation can also
-       # be used for files modified in the last year.
-       if (expr $nummonth \> $nummonthtod) > /dev/null;
-       then
-	 year=`expr $year - 1`
-       fi;;
-  *) year=$3;;
-esac
-
-# The result.
-echo $day $month $year
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
-# End:
diff --git a/doc/stamp-vti b/doc/stamp-vti
deleted file mode 100644
index a391247..0000000
--- a/doc/stamp-vti
+++ /dev/null
@@ -1,4 +0,0 @@
- at set UPDATED 15 September 2009
- at set UPDATED-MONTH September 2009
- at set EDITION 1.0-alpha5
- at set VERSION 1.0-alpha5
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
deleted file mode 100644
index 0d3ba16..0000000
--- a/doc/texinfo.tex
+++ /dev/null
@@ -1,9291 +0,0 @@
-% texinfo.tex -- TeX macros to handle Texinfo files.
-%
-% Load plain if necessary, i.e., if running under initex.
-\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
-%
-\def\texinfoversion{2009-05-16.16}
-%
-% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
-% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-% 2007, 2008, 2009 Free Software Foundation, Inc.
-%
-% This texinfo.tex file is free software: you can redistribute it and/or
-% modify it under the terms of the GNU General Public License as
-% published by the Free Software Foundation, either version 3 of the
-% License, or (at your option) any later version.
-%
-% This texinfo.tex file is distributed in the hope that it will be
-% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-% General Public License for more details.
-%
-% You should have received a copy of the GNU General Public License
-% along with this program.  If not, see <http://www.gnu.org/licenses/>.
-%
-% As a special exception, when this file is read by TeX when processing
-% a Texinfo source document, you may use the result without
-% restriction.  (This has been our intent since Texinfo was invented.)
-%
-% Please try the latest version of texinfo.tex before submitting bug
-% reports; you can get the latest version from:
-%   http://www.gnu.org/software/texinfo/ (the Texinfo home page), or
-%   ftp://tug.org/tex/texinfo.tex
-%     (and all CTAN mirrors, see http://www.ctan.org).
-% The texinfo.tex in any given distribution could well be out
-% of date, so if that's what you're using, please check.
-%
-% Send bug reports to bug-texinfo at gnu.org.  Please include including a
-% complete document in each bug report with which we can reproduce the
-% problem.  Patches are, of course, greatly appreciated.
-%
-% To process a Texinfo manual with TeX, it's most reliable to use the
-% texi2dvi shell script that comes with the distribution.  For a simple
-% manual foo.texi, however, you can get away with this:
-%   tex foo.texi
-%   texindex foo.??
-%   tex foo.texi
-%   tex foo.texi
-%   dvips foo.dvi -o  # or whatever; this makes foo.ps.
-% The extra TeX runs get the cross-reference information correct.
-% Sometimes one run after texindex suffices, and sometimes you need more
-% than two; texi2dvi does it as many times as necessary.
-%
-% It is possible to adapt texinfo.tex for other languages, to some
-% extent.  You can get the existing language-specific files from the
-% full Texinfo distribution.
-%
-% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
-
-
-\message{Loading texinfo [version \texinfoversion]:}
-
-% If in a .fmt file, print the version number
-% and turn on active characters that we couldn't do earlier because
-% they might have appeared in the input file name.
-\everyjob{\message{[Texinfo version \texinfoversion]}%
-  \catcode`+=\active \catcode`\_=\active}
-
-
-\chardef\other=12
-
-% We never want plain's \outer definition of \+ in Texinfo.
-% For @tex, we can use \tabalign.
-\let\+ = \relax
-
-% Save some plain tex macros whose names we will redefine.
-\let\ptexb=\b
-\let\ptexbullet=\bullet
-\let\ptexc=\c
-\let\ptexcomma=\,
-\let\ptexdot=\.
-\let\ptexdots=\dots
-\let\ptexend=\end
-\let\ptexequiv=\equiv
-\let\ptexexclam=\!
-\let\ptexfootnote=\footnote
-\let\ptexgtr=>
-\let\ptexhat=^
-\let\ptexi=\i
-\let\ptexindent=\indent
-\let\ptexinsert=\insert
-\let\ptexlbrace=\{
-\let\ptexless=<
-\let\ptexnewwrite\newwrite
-\let\ptexnoindent=\noindent
-\let\ptexplus=+
-\let\ptexrbrace=\}
-\let\ptexslash=\/
-\let\ptexstar=\*
-\let\ptext=\t
-\let\ptextop=\top
-{\catcode`\'=\active
-\global\let\ptexquoteright'}% Math-mode def from plain.tex.
-\let\ptexraggedright=\raggedright
-
-% If this character appears in an error message or help string, it
-% starts a new line in the output.
-\newlinechar = `^^J
-
-% Use TeX 3.0's \inputlineno to get the line number, for better error
-% messages, but if we're using an old version of TeX, don't do anything.
-%
-\ifx\inputlineno\thisisundefined
-  \let\linenumber = \empty % Pre-3.0.
-\else
-  \def\linenumber{l.\the\inputlineno:\space}
-\fi
-
-% Set up fixed words for English if not already set.
-\ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
-\ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
-\ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
-\ifx\putwordin\undefined        \gdef\putwordin{in}\fi
-\ifx\putwordIndexIsEmpty\undefined     \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
-\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
-\ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
-\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
-\ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
-\ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
-\ifx\putwordof\undefined        \gdef\putwordof{of}\fi
-\ifx\putwordon\undefined        \gdef\putwordon{on}\fi
-\ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
-\ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
-\ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
-\ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
-\ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
-\ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
-\ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
-%
-\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
-\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
-\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
-\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
-\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
-\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
-\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
-\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
-\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
-\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
-\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
-\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
-%
-\ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
-\ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
-\ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
-\ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
-\ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
-
-% Since the category of space is not known, we have to be careful.
-\chardef\spacecat = 10
-\def\spaceisspace{\catcode`\ =\spacecat}
-
-% sometimes characters are active, so we need control sequences.
-\chardef\colonChar = `\:
-\chardef\commaChar = `\,
-\chardef\dashChar  = `\-
-\chardef\dotChar   = `\.
-\chardef\exclamChar= `\!
-\chardef\lquoteChar= `\`
-\chardef\questChar = `\?
-\chardef\rquoteChar= `\'
-\chardef\semiChar  = `\;
-\chardef\underChar = `\_
-
-% Ignore a token.
-%
-\def\gobble#1{}
-
-% The following is used inside several \edef's.
-\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
-
-% Hyphenation fixes.
-\hyphenation{
-  Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
-  ap-pen-dix bit-map bit-maps
-  data-base data-bases eshell fall-ing half-way long-est man-u-script
-  man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
-  par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
-  spell-ing spell-ings
-  stand-alone strong-est time-stamp time-stamps which-ever white-space
-  wide-spread wrap-around
-}
-
-% Margin to add to right of even pages, to left of odd pages.
-\newdimen\bindingoffset
-\newdimen\normaloffset
-\newdimen\pagewidth \newdimen\pageheight
-
-% For a final copy, take out the rectangles
-% that mark overfull boxes (in case you have decided
-% that the text looks ok even though it passes the margin).
-%
-\def\finalout{\overfullrule=0pt}
-
-% @| inserts a changebar to the left of the current line.  It should
-% surround any changed text.  This approach does *not* work if the
-% change spans more than two lines of output.  To handle that, we would
-% have adopt a much more difficult approach (putting marks into the main
-% vertical list for the beginning and end of each change).
-%
-\def\|{%
-  % \vadjust can only be used in horizontal mode.
-  \leavevmode
-  %
-  % Append this vertical mode material after the current line in the output.
-  \vadjust{%
-    % We want to insert a rule with the height and depth of the current
-    % leading; that is exactly what \strutbox is supposed to record.
-    \vskip-\baselineskip
-    %
-    % \vadjust-items are inserted at the left edge of the type.  So
-    % the \llap here moves out into the left-hand margin.
-    \llap{%
-      %
-      % For a thicker or thinner bar, change the `1pt'.
-      \vrule height\baselineskip width1pt
-      %
-      % This is the space between the bar and the text.
-      \hskip 12pt
-    }%
-  }%
-}
-
-% Sometimes it is convenient to have everything in the transcript file
-% and nothing on the terminal.  We don't just call \tracingall here,
-% since that produces some useless output on the terminal.  We also make
-% some effort to order the tracing commands to reduce output in the log
-% file; cf. trace.sty in LaTeX.
-%
-\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
-\def\loggingall{%
-  \tracingstats2
-  \tracingpages1
-  \tracinglostchars2  % 2 gives us more in etex
-  \tracingparagraphs1
-  \tracingoutput1
-  \tracingmacros2
-  \tracingrestores1
-  \showboxbreadth\maxdimen \showboxdepth\maxdimen
-  \ifx\eTeXversion\undefined\else % etex gives us more logging
-    \tracingscantokens1
-    \tracingifs1
-    \tracinggroups1
-    \tracingnesting2
-    \tracingassigns1
-  \fi
-  \tracingcommands3  % 3 gives us more in etex
-  \errorcontextlines16
-}%
-
-% add check for \lastpenalty to plain's definitions.  If the last thing
-% we did was a \nobreak, we don't want to insert more space.
-%
-\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
-  \removelastskip\penalty-50\smallskip\fi\fi}
-\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
-  \removelastskip\penalty-100\medskip\fi\fi}
-\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
-  \removelastskip\penalty-200\bigskip\fi\fi}
-
-% For @cropmarks command.
-% Do @cropmarks to get crop marks.
-%
-\newif\ifcropmarks
-\let\cropmarks = \cropmarkstrue
-%
-% Dimensions to add cropmarks at corners.
-% Added by P. A. MacKay, 12 Nov. 1986
-%
-\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
-\newdimen\cornerlong  \cornerlong=1pc
-\newdimen\cornerthick \cornerthick=.3pt
-\newdimen\topandbottommargin \topandbottommargin=.75in
-
-% Output a mark which sets \thischapter, \thissection and \thiscolor.
-% We dump everything together because we only have one kind of mark.
-% This works because we only use \botmark / \topmark, not \firstmark.
-%
-% A mark contains a subexpression of the \ifcase ... \fi construct.
-% \get*marks macros below extract the needed part using \ifcase.
-%
-% Another complication is to let the user choose whether \thischapter
-% (\thissection) refers to the chapter (section) in effect at the top
-% of a page, or that at the bottom of a page.  The solution is
-% described on page 260 of The TeXbook.  It involves outputting two
-% marks for the sectioning macros, one before the section break, and
-% one after.  I won't pretend I can describe this better than DEK...
-\def\domark{%
-  \toks0=\expandafter{\lastchapterdefs}%
-  \toks2=\expandafter{\lastsectiondefs}%
-  \toks4=\expandafter{\prevchapterdefs}%
-  \toks6=\expandafter{\prevsectiondefs}%
-  \toks8=\expandafter{\lastcolordefs}%
-  \mark{%
-                   \the\toks0 \the\toks2
-      \noexpand\or \the\toks4 \the\toks6
-    \noexpand\else \the\toks8
-  }%
-}
-% \topmark doesn't work for the very first chapter (after the title
-% page or the contents), so we use \firstmark there -- this gets us
-% the mark with the chapter defs, unless the user sneaks in, e.g.,
-% @setcolor (or @url, or @link, etc.) between @contents and the very
-% first @chapter.
-\def\gettopheadingmarks{%
-  \ifcase0\topmark\fi
-  \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
-}
-\def\getbottomheadingmarks{\ifcase1\botmark\fi}
-\def\getcolormarks{\ifcase2\topmark\fi}
-
-% Avoid "undefined control sequence" errors.
-\def\lastchapterdefs{}
-\def\lastsectiondefs{}
-\def\prevchapterdefs{}
-\def\prevsectiondefs{}
-\def\lastcolordefs{}
-
-% Main output routine.
-\chardef\PAGE = 255
-\output = {\onepageout{\pagecontents\PAGE}}
-
-\newbox\headlinebox
-\newbox\footlinebox
-
-% \onepageout takes a vbox as an argument.  Note that \pagecontents
-% does insertions, but you have to call it yourself.
-\def\onepageout#1{%
-  \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
-  %
-  \ifodd\pageno  \advance\hoffset by \bindingoffset
-  \else \advance\hoffset by -\bindingoffset\fi
-  %
-  % Do this outside of the \shipout so @code etc. will be expanded in
-  % the headline as they should be, not taken literally (outputting ''code).
-  \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
-  \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
-  \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
-  \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
-  %
-  {%
-    % Have to do this stuff outside the \shipout because we want it to
-    % take effect in \write's, yet the group defined by the \vbox ends
-    % before the \shipout runs.
-    %
-    \indexdummies         % don't expand commands in the output.
-    \normalturnoffactive  % \ in index entries must not stay \, e.g., if
-               % the page break happens to be in the middle of an example.
-               % We don't want .vr (or whatever) entries like this:
-               % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
-               % "\acronym" won't work when it's read back in;
-               % it needs to be
-               % {\code {{\tt \backslashcurfont }acronym}
-    \shipout\vbox{%
-      % Do this early so pdf references go to the beginning of the page.
-      \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
-      %
-      \ifcropmarks \vbox to \outervsize\bgroup
-        \hsize = \outerhsize
-        \vskip-\topandbottommargin
-        \vtop to0pt{%
-          \line{\ewtop\hfil\ewtop}%
-          \nointerlineskip
-          \line{%
-            \vbox{\moveleft\cornerthick\nstop}%
-            \hfill
-            \vbox{\moveright\cornerthick\nstop}%
-          }%
-          \vss}%
-        \vskip\topandbottommargin
-        \line\bgroup
-          \hfil % center the page within the outer (page) hsize.
-          \ifodd\pageno\hskip\bindingoffset\fi
-          \vbox\bgroup
-      \fi
-      %
-      \unvbox\headlinebox
-      \pagebody{#1}%
-      \ifdim\ht\footlinebox > 0pt
-        % Only leave this space if the footline is nonempty.
-        % (We lessened \vsize for it in \oddfootingyyy.)
-        % The \baselineskip=24pt in plain's \makefootline has no effect.
-        \vskip 24pt
-        \unvbox\footlinebox
-      \fi
-      %
-      \ifcropmarks
-          \egroup % end of \vbox\bgroup
-        \hfil\egroup % end of (centering) \line\bgroup
-        \vskip\topandbottommargin plus1fill minus1fill
-        \boxmaxdepth = \cornerthick
-        \vbox to0pt{\vss
-          \line{%
-            \vbox{\moveleft\cornerthick\nsbot}%
-            \hfill
-            \vbox{\moveright\cornerthick\nsbot}%
-          }%
-          \nointerlineskip
-          \line{\ewbot\hfil\ewbot}%
-        }%
-      \egroup % \vbox from first cropmarks clause
-      \fi
-    }% end of \shipout\vbox
-  }% end of group with \indexdummies
-  \advancepageno
-  \ifnum\outputpenalty>-20000 \else\dosupereject\fi
-}
-
-\newinsert\margin \dimen\margin=\maxdimen
-
-\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
-{\catcode`\@ =11
-\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
-% marginal hacks, juha at viisa.uucp (Juha Takala)
-\ifvoid\margin\else % marginal info is present
-  \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
-\dimen@=\dp#1\relax \unvbox#1\relax
-\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
-\ifr at ggedbottom \kern-\dimen@ \vfil \fi}
-}
-
-% Here are the rules for the cropmarks.  Note that they are
-% offset so that the space between them is truly \outerhsize or \outervsize
-% (P. A. MacKay, 12 November, 1986)
-%
-\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
-\def\nstop{\vbox
-  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
-\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
-\def\nsbot{\vbox
-  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
-
-% Parse an argument, then pass it to #1.  The argument is the rest of
-% the input line (except we remove a trailing comment).  #1 should be a
-% macro which expects an ordinary undelimited TeX argument.
-%
-\def\parsearg{\parseargusing{}}
-\def\parseargusing#1#2{%
-  \def\argtorun{#2}%
-  \begingroup
-    \obeylines
-    \spaceisspace
-    #1%
-    \parseargline\empty% Insert the \empty token, see \finishparsearg below.
-}
-
-{\obeylines %
-  \gdef\parseargline#1^^M{%
-    \endgroup % End of the group started in \parsearg.
-    \argremovecomment #1\comment\ArgTerm%
-  }%
-}
-
-% First remove any @comment, then any @c comment.
-\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
-\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
-
-% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
-%
-% \argremovec might leave us with trailing space, e.g.,
-%    @end itemize  @c foo
-% This space token undergoes the same procedure and is eventually removed
-% by \finishparsearg.
-%
-\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
-\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
-\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
-  \def\temp{#3}%
-  \ifx\temp\empty
-    % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
-    \let\temp\finishparsearg
-  \else
-    \let\temp\argcheckspaces
-  \fi
-  % Put the space token in:
-  \temp#1 #3\ArgTerm
-}
-
-% If a _delimited_ argument is enclosed in braces, they get stripped; so
-% to get _exactly_ the rest of the line, we had to prevent such situation.
-% We prepended an \empty token at the very beginning and we expand it now,
-% just before passing the control to \argtorun.
-% (Similarly, we have to think about #3 of \argcheckspacesY above: it is
-% either the null string, or it ends with \^^M---thus there is no danger
-% that a pair of braces would be stripped.
-%
-% But first, we have to remove the trailing space token.
-%
-\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
-
-% \parseargdef\foo{...}
-%	is roughly equivalent to
-% \def\foo{\parsearg\Xfoo}
-% \def\Xfoo#1{...}
-%
-% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
-% favourite TeX trick.  --kasal, 16nov03
-
-\def\parseargdef#1{%
-  \expandafter \doparseargdef \csname\string#1\endcsname #1%
-}
-\def\doparseargdef#1#2{%
-  \def#2{\parsearg#1}%
-  \def#1##1%
-}
-
-% Several utility definitions with active space:
-{
-  \obeyspaces
-  \gdef\obeyedspace{ }
-
-  % Make each space character in the input produce a normal interword
-  % space in the output.  Don't allow a line break at this space, as this
-  % is used only in environments like @example, where each line of input
-  % should produce a line of output anyway.
-  %
-  \gdef\sepspaces{\obeyspaces\let =\tie}
-
-  % If an index command is used in an @example environment, any spaces
-  % therein should become regular spaces in the raw index file, not the
-  % expansion of \tie (\leavevmode \penalty \@M \ ).
-  \gdef\unsepspaces{\let =\space}
-}
-
-
-\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
-
-% Define the framework for environments in texinfo.tex.  It's used like this:
-%
-%   \envdef\foo{...}
-%   \def\Efoo{...}
-%
-% It's the responsibility of \envdef to insert \begingroup before the
-% actual body; @end closes the group after calling \Efoo.  \envdef also
-% defines \thisenv, so the current environment is known; @end checks
-% whether the environment name matches.  The \checkenv macro can also be
-% used to check whether the current environment is the one expected.
-%
-% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
-% are not treated as environments; they don't open a group.  (The
-% implementation of @end takes care not to call \endgroup in this
-% special case.)
-
-
-% At run-time, environments start with this:
-\def\startenvironment#1{\begingroup\def\thisenv{#1}}
-% initialize
-\let\thisenv\empty
-
-% ... but they get defined via ``\envdef\foo{...}'':
-\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
-\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
-
-% Check whether we're in the right environment:
-\def\checkenv#1{%
-  \def\temp{#1}%
-  \ifx\thisenv\temp
-  \else
-    \badenverr
-  \fi
-}
-
-% Environment mismatch, #1 expected:
-\def\badenverr{%
-  \errhelp = \EMsimple
-  \errmessage{This command can appear only \inenvironment\temp,
-    not \inenvironment\thisenv}%
-}
-\def\inenvironment#1{%
-  \ifx#1\empty
-    out of any environment%
-  \else
-    in environment \expandafter\string#1%
-  \fi
-}
-
-% @end foo executes the definition of \Efoo.
-% But first, it executes a specialized version of \checkenv
-%
-\parseargdef\end{%
-  \if 1\csname iscond.#1\endcsname
-  \else
-    % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03
-    \expandafter\checkenv\csname#1\endcsname
-    \csname E#1\endcsname
-    \endgroup
-  \fi
-}
-
-\newhelp\EMsimple{Press RETURN to continue.}
-
-
-%% Simple single-character @ commands
-
-% @@ prints an @
-% Kludge this until the fonts are right (grr).
-\def\@{{\tt\char64}}
-
-% This is turned off because it was never documented
-% and you can use @w{...} around a quote to suppress ligatures.
-%% Define @` and @' to be the same as ` and '
-%% but suppressing ligatures.
-%\def\`{{`}}
-%\def\'{{'}}
-
-% Used to generate quoted braces.
-\def\mylbrace {{\tt\char123}}
-\def\myrbrace {{\tt\char125}}
-\let\{=\mylbrace
-\let\}=\myrbrace
-\begingroup
-  % Definitions to produce \{ and \} commands for indices,
-  % and @{ and @} for the aux/toc files.
-  \catcode`\{ = \other \catcode`\} = \other
-  \catcode`\[ = 1 \catcode`\] = 2
-  \catcode`\! = 0 \catcode`\\ = \other
-  !gdef!lbracecmd[\{]%
-  !gdef!rbracecmd[\}]%
-  !gdef!lbraceatcmd[@{]%
-  !gdef!rbraceatcmd[@}]%
-!endgroup
-
-% @comma{} to avoid , parsing problems.
-\let\comma = ,
-
-% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
-% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
-\let\, = \c
-\let\dotaccent = \.
-\def\ringaccent#1{{\accent23 #1}}
-\let\tieaccent = \t
-\let\ubaraccent = \b
-\let\udotaccent = \d
-
-% Other special characters: @questiondown @exclamdown @ordf @ordm
-% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
-\def\questiondown{?`}
-\def\exclamdown{!`}
-\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
-\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
-
-% Dotless i and dotless j, used for accents.
-\def\imacro{i}
-\def\jmacro{j}
-\def\dotless#1{%
-  \def\temp{#1}%
-  \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
-  \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
-  \else \errmessage{@dotless can be used only with i or j}%
-  \fi\fi
-}
-
-% The \TeX{} logo, as in plain, but resetting the spacing so that a
-% period following counts as ending a sentence.  (Idea found in latex.)
-%
-\edef\TeX{\TeX \spacefactor=1000 }
-
-% @LaTeX{} logo.  Not quite the same results as the definition in
-% latex.ltx, since we use a different font for the raised A; it's most
-% convenient for us to use an explicitly smaller font, rather than using
-% the \scriptstyle font (since we don't reset \scriptstyle and
-% \scriptscriptstyle).
-%
-\def\LaTeX{%
-  L\kern-.36em
-  {\setbox0=\hbox{T}%
-   \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}%
-  \kern-.15em
-  \TeX
-}
-
-% Be sure we're in horizontal mode when doing a tie, since we make space
-% equivalent to this in @example-like environments. Otherwise, a space
-% at the beginning of a line will start with \penalty -- and
-% since \penalty is valid in vertical mode, we'd end up putting the
-% penalty on the vertical list instead of in the new paragraph.
-{\catcode`@ = 11
- % Avoid using \@M directly, because that causes trouble
- % if the definition is written into an index file.
- \global\let\tiepenalty = \@M
- \gdef\tie{\leavevmode\penalty\tiepenalty\ }
-}
-
-% @: forces normal size whitespace following.
-\def\:{\spacefactor=1000 }
-
-% @* forces a line break.
-\def\*{\hfil\break\hbox{}\ignorespaces}
-
-% @/ allows a line break.
-\let\/=\allowbreak
-
-% @. is an end-of-sentence period.
-\def\.{.\spacefactor=\endofsentencespacefactor\space}
-
-% @! is an end-of-sentence bang.
-\def\!{!\spacefactor=\endofsentencespacefactor\space}
-
-% @? is an end-of-sentence query.
-\def\?{?\spacefactor=\endofsentencespacefactor\space}
-
-% @frenchspacing on|off  says whether to put extra space after punctuation.
-%
-\def\onword{on}
-\def\offword{off}
-%
-\parseargdef\frenchspacing{%
-  \def\temp{#1}%
-  \ifx\temp\onword \plainfrenchspacing
-  \else\ifx\temp\offword \plainnonfrenchspacing
-  \else
-    \errhelp = \EMsimple
-    \errmessage{Unknown @frenchspacing option `\temp', must be on/off}%
-  \fi\fi
-}
-
-% @w prevents a word break.  Without the \leavevmode, @w at the
-% beginning of a paragraph, when TeX is still in vertical mode, would
-% produce a whole line of output instead of starting the paragraph.
-\def\w#1{\leavevmode\hbox{#1}}
-
-% @group ... @end group forces ... to be all on one page, by enclosing
-% it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
-% to keep its height that of a normal line.  According to the rules for
-% \topskip (p.114 of the TeXbook), the glue inserted is
-% max (\topskip - \ht (first item), 0).  If that height is large,
-% therefore, no glue is inserted, and the space between the headline and
-% the text is small, which looks bad.
-%
-% Another complication is that the group might be very large.  This can
-% cause the glue on the previous page to be unduly stretched, because it
-% does not have much material.  In this case, it's better to add an
-% explicit \vfill so that the extra space is at the bottom.  The
-% threshold for doing this is if the group is more than \vfilllimit
-% percent of a page (\vfilllimit can be changed inside of @tex).
-%
-\newbox\groupbox
-\def\vfilllimit{0.7}
-%
-\envdef\group{%
-  \ifnum\catcode`\^^M=\active \else
-    \errhelp = \groupinvalidhelp
-    \errmessage{@group invalid in context where filling is enabled}%
-  \fi
-  \startsavinginserts
-  %
-  \setbox\groupbox = \vtop\bgroup
-    % Do @comment since we are called inside an environment such as
-    % @example, where each end-of-line in the input causes an
-    % end-of-line in the output.  We don't want the end-of-line after
-    % the `@group' to put extra space in the output.  Since @group
-    % should appear on a line by itself (according to the Texinfo
-    % manual), we don't worry about eating any user text.
-    \comment
-}
-%
-% The \vtop produces a box with normal height and large depth; thus, TeX puts
-% \baselineskip glue before it, and (when the next line of text is done)
-% \lineskip glue after it.  Thus, space below is not quite equal to space
-% above.  But it's pretty close.
-\def\Egroup{%
-    % To get correct interline space between the last line of the group
-    % and the first line afterwards, we have to propagate \prevdepth.
-    \endgraf % Not \par, as it may have been set to \lisppar.
-    \global\dimen1 = \prevdepth
-  \egroup           % End the \vtop.
-  % \dimen0 is the vertical size of the group's box.
-  \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
-  % \dimen2 is how much space is left on the page (more or less).
-  \dimen2 = \pageheight   \advance\dimen2 by -\pagetotal
-  % if the group doesn't fit on the current page, and it's a big big
-  % group, force a page break.
-  \ifdim \dimen0 > \dimen2
-    \ifdim \pagetotal < \vfilllimit\pageheight
-      \page
-    \fi
-  \fi
-  \box\groupbox
-  \prevdepth = \dimen1
-  \checkinserts
-}
-%
-% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
-% message, so this ends up printing `@group can only ...'.
-%
-\newhelp\groupinvalidhelp{%
-group can only be used in environments such as @example,^^J%
-where each line of input produces a line of output.}
-
-% @need space-in-mils
-% forces a page break if there is not space-in-mils remaining.
-
-\newdimen\mil  \mil=0.001in
-
-% Old definition--didn't work.
-%\parseargdef\need{\par %
-%% This method tries to make TeX break the page naturally
-%% if the depth of the box does not fit.
-%{\baselineskip=0pt%
-%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
-%\prevdepth=-1000pt
-%}}
-
-\parseargdef\need{%
-  % Ensure vertical mode, so we don't make a big box in the middle of a
-  % paragraph.
-  \par
-  %
-  % If the @need value is less than one line space, it's useless.
-  \dimen0 = #1\mil
-  \dimen2 = \ht\strutbox
-  \advance\dimen2 by \dp\strutbox
-  \ifdim\dimen0 > \dimen2
-    %
-    % Do a \strut just to make the height of this box be normal, so the
-    % normal leading is inserted relative to the preceding line.
-    % And a page break here is fine.
-    \vtop to #1\mil{\strut\vfil}%
-    %
-    % TeX does not even consider page breaks if a penalty added to the
-    % main vertical list is 10000 or more.  But in order to see if the
-    % empty box we just added fits on the page, we must make it consider
-    % page breaks.  On the other hand, we don't want to actually break the
-    % page after the empty box.  So we use a penalty of 9999.
-    %
-    % There is an extremely small chance that TeX will actually break the
-    % page at this \penalty, if there are no other feasible breakpoints in
-    % sight.  (If the user is using lots of big @group commands, which
-    % almost-but-not-quite fill up a page, TeX will have a hard time doing
-    % good page breaking, for example.)  However, I could not construct an
-    % example where a page broke at this \penalty; if it happens in a real
-    % document, then we can reconsider our strategy.
-    \penalty9999
-    %
-    % Back up by the size of the box, whether we did a page break or not.
-    \kern -#1\mil
-    %
-    % Do not allow a page break right after this kern.
-    \nobreak
-  \fi
-}
-
-% @br   forces paragraph break (and is undocumented).
-
-\let\br = \par
-
-% @page forces the start of a new page.
-%
-\def\page{\par\vfill\supereject}
-
-% @exdent text....
-% outputs text on separate line in roman font, starting at standard page margin
-
-% This records the amount of indent in the innermost environment.
-% That's how much \exdent should take out.
-\newskip\exdentamount
-
-% This defn is used inside fill environments such as @defun.
-\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
-
-% This defn is used inside nofill environments such as @example.
-\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
-  \leftline{\hskip\leftskip{\rm#1}}}}
-
-% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
-% paragraph.  For more general purposes, use the \margin insertion
-% class.  WHICH is `l' or `r'.
-%
-\newskip\inmarginspacing \inmarginspacing=1cm
-\def\strutdepth{\dp\strutbox}
-%
-\def\doinmargin#1#2{\strut\vadjust{%
-  \nobreak
-  \kern-\strutdepth
-  \vtop to \strutdepth{%
-    \baselineskip=\strutdepth
-    \vss
-    % if you have multiple lines of stuff to put here, you'll need to
-    % make the vbox yourself of the appropriate size.
-    \ifx#1l%
-      \llap{\ignorespaces #2\hskip\inmarginspacing}%
-    \else
-      \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
-    \fi
-    \null
-  }%
-}}
-\def\inleftmargin{\doinmargin l}
-\def\inrightmargin{\doinmargin r}
-%
-% @inmargin{TEXT [, RIGHT-TEXT]}
-% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
-% else use TEXT for both).
-%
-\def\inmargin#1{\parseinmargin #1,,\finish}
-\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
-  \setbox0 = \hbox{\ignorespaces #2}%
-  \ifdim\wd0 > 0pt
-    \def\lefttext{#1}%  have both texts
-    \def\righttext{#2}%
-  \else
-    \def\lefttext{#1}%  have only one text
-    \def\righttext{#1}%
-  \fi
-  %
-  \ifodd\pageno
-    \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
-  \else
-    \def\temp{\inleftmargin\lefttext}%
-  \fi
-  \temp
-}
-
-% @include FILE -- \input text of FILE.
-%
-\def\include{\parseargusing\filenamecatcodes\includezzz}
-\def\includezzz#1{%
-  \pushthisfilestack
-  \def\thisfile{#1}%
-  {%
-    \makevalueexpandable  % we want to expand any @value in FILE.
-    \turnoffactive        % and allow special characters in the expansion
-    \indexnofonts         % Allow `@@' and other weird things in file names.
-    \edef\temp{\noexpand\input #1 }%
-    %
-    % This trickery is to read FILE outside of a group, in case it makes
-    % definitions, etc.
-    \expandafter
-  }\temp
-  \popthisfilestack
-}
-\def\filenamecatcodes{%
-  \catcode`\\=\other
-  \catcode`~=\other
-  \catcode`^=\other
-  \catcode`_=\other
-  \catcode`|=\other
-  \catcode`<=\other
-  \catcode`>=\other
-  \catcode`+=\other
-  \catcode`-=\other
-  \catcode`\`=\other
-  \catcode`\'=\other
-}
-
-\def\pushthisfilestack{%
-  \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
-}
-\def\pushthisfilestackX{%
-  \expandafter\pushthisfilestackY\thisfile\StackTerm
-}
-\def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
-  \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
-}
-
-\def\popthisfilestack{\errthisfilestackempty}
-\def\errthisfilestackempty{\errmessage{Internal error:
-  the stack of filenames is empty.}}
-
-\def\thisfile{}
-
-% @center line
-% outputs that line, centered.
-%
-\parseargdef\center{%
-  \ifhmode
-    \let\next\centerH
-  \else
-    \let\next\centerV
-  \fi
-  \next{\hfil \ignorespaces#1\unskip \hfil}%
-}
-\def\centerH#1{%
-  {%
-    \hfil\break
-    \advance\hsize by -\leftskip
-    \advance\hsize by -\rightskip
-    \line{#1}%
-    \break
-  }%
-}
-\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}}
-
-% @sp n   outputs n lines of vertical space
-
-\parseargdef\sp{\vskip #1\baselineskip}
-
-% @comment ...line which is ignored...
-% @c is the same as @comment
-% @ignore ... @end ignore  is another way to write a comment
-
-\def\comment{\begingroup \catcode`\^^M=\other%
-\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
-\commentxxx}
-{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
-
-\let\c=\comment
-
-% @paragraphindent NCHARS
-% We'll use ems for NCHARS, close enough.
-% NCHARS can also be the word `asis' or `none'.
-% We cannot feasibly implement @paragraphindent asis, though.
-%
-\def\asisword{asis} % no translation, these are keywords
-\def\noneword{none}
-%
-\parseargdef\paragraphindent{%
-  \def\temp{#1}%
-  \ifx\temp\asisword
-  \else
-    \ifx\temp\noneword
-      \defaultparindent = 0pt
-    \else
-      \defaultparindent = #1em
-    \fi
-  \fi
-  \parindent = \defaultparindent
-}
-
-% @exampleindent NCHARS
-% We'll use ems for NCHARS like @paragraphindent.
-% It seems @exampleindent asis isn't necessary, but
-% I preserve it to make it similar to @paragraphindent.
-\parseargdef\exampleindent{%
-  \def\temp{#1}%
-  \ifx\temp\asisword
-  \else
-    \ifx\temp\noneword
-      \lispnarrowing = 0pt
-    \else
-      \lispnarrowing = #1em
-    \fi
-  \fi
-}
-
-% @firstparagraphindent WORD
-% If WORD is `none', then suppress indentation of the first paragraph
-% after a section heading.  If WORD is `insert', then do indent at such
-% paragraphs.
-%
-% The paragraph indentation is suppressed or not by calling
-% \suppressfirstparagraphindent, which the sectioning commands do.
-% We switch the definition of this back and forth according to WORD.
-% By default, we suppress indentation.
-%
-\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
-\def\insertword{insert}
-%
-\parseargdef\firstparagraphindent{%
-  \def\temp{#1}%
-  \ifx\temp\noneword
-    \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
-  \else\ifx\temp\insertword
-    \let\suppressfirstparagraphindent = \relax
-  \else
-    \errhelp = \EMsimple
-    \errmessage{Unknown @firstparagraphindent option `\temp'}%
-  \fi\fi
-}
-
-% Here is how we actually suppress indentation.  Redefine \everypar to
-% \kern backwards by \parindent, and then reset itself to empty.
-%
-% We also make \indent itself not actually do anything until the next
-% paragraph.
-%
-\gdef\dosuppressfirstparagraphindent{%
-  \gdef\indent{%
-    \restorefirstparagraphindent
-    \indent
-  }%
-  \gdef\noindent{%
-    \restorefirstparagraphindent
-    \noindent
-  }%
-  \global\everypar = {%
-    \kern -\parindent
-    \restorefirstparagraphindent
-  }%
-}
-
-\gdef\restorefirstparagraphindent{%
-  \global \let \indent = \ptexindent
-  \global \let \noindent = \ptexnoindent
-  \global \everypar = {}%
-}
-
-
-% @asis just yields its argument.  Used with @table, for example.
-%
-\def\asis#1{#1}
-
-% @math outputs its argument in math mode.
-%
-% One complication: _ usually means subscripts, but it could also mean
-% an actual _ character, as in @math{@var{some_variable} + 1}.  So make
-% _ active, and distinguish by seeing if the current family is \slfam,
-% which is what @var uses.
-{
-  \catcode`\_ = \active
-  \gdef\mathunderscore{%
-    \catcode`\_=\active
-    \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
-  }
-}
-% Another complication: we want \\ (and @\) to output a \ character.
-% FYI, plain.tex uses \\ as a temporary control sequence (why?), but
-% this is not advertised and we don't care.  Texinfo does not
-% otherwise define @\.
-%
-% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
-\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
-%
-\def\math{%
-  \tex
-  \mathunderscore
-  \let\\ = \mathbackslash
-  \mathactive
-  % make the texinfo accent commands work in math mode
-  \let\"=\ddot
-  \let\'=\acute
-  \let\==\bar
-  \let\^=\hat
-  \let\`=\grave
-  \let\u=\breve
-  \let\v=\check
-  \let\~=\tilde
-  \let\dotaccent=\dot
-  $\finishmath
-}
-\def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
-
-% Some active characters (such as <) are spaced differently in math.
-% We have to reset their definitions in case the @math was an argument
-% to a command which sets the catcodes (such as @item or @section).
-%
-{
-  \catcode`^ = \active
-  \catcode`< = \active
-  \catcode`> = \active
-  \catcode`+ = \active
-  \catcode`' = \active
-  \gdef\mathactive{%
-    \let^ = \ptexhat
-    \let< = \ptexless
-    \let> = \ptexgtr
-    \let+ = \ptexplus
-    \let' = \ptexquoteright
-  }
-}
-
-% Some math mode symbols.
-\def\bullet{$\ptexbullet$}
-\def\geq{\ifmmode \ge\else $\ge$\fi}
-\def\leq{\ifmmode \le\else $\le$\fi}
-\def\minus{\ifmmode -\else $-$\fi}
-
-% @dots{} outputs an ellipsis using the current font.
-% We do .5em per period so that it has the same spacing in the cm
-% typewriter fonts as three actual period characters; on the other hand,
-% in other typewriter fonts three periods are wider than 1.5em.  So do
-% whichever is larger.
-%
-\def\dots{%
-  \leavevmode
-  \setbox0=\hbox{...}% get width of three periods
-  \ifdim\wd0 > 1.5em
-    \dimen0 = \wd0
-  \else
-    \dimen0 = 1.5em
-  \fi
-  \hbox to \dimen0{%
-    \hskip 0pt plus.25fil
-    .\hskip 0pt plus1fil
-    .\hskip 0pt plus1fil
-    .\hskip 0pt plus.5fil
-  }%
-}
-
-% @enddots{} is an end-of-sentence ellipsis.
-%
-\def\enddots{%
-  \dots
-  \spacefactor=\endofsentencespacefactor
-}
-
-% @comma{} is so commas can be inserted into text without messing up
-% Texinfo's parsing.
-%
-\let\comma = ,
-
-% @refill is a no-op.
-\let\refill=\relax
-
-% If working on a large document in chapters, it is convenient to
-% be able to disable indexing, cross-referencing, and contents, for test runs.
-% This is done with @novalidate (before @setfilename).
-%
-\newif\iflinks \linkstrue % by default we want the aux files.
-\let\novalidate = \linksfalse
-
-% @setfilename is done at the beginning of every texinfo file.
-% So open here the files we need to have open while reading the input.
-% This makes it possible to make a .fmt file for texinfo.
-\def\setfilename{%
-   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
-   \iflinks
-     \tryauxfile
-     % Open the new aux file.  TeX will close it automatically at exit.
-     \immediate\openout\auxfile=\jobname.aux
-   \fi % \openindices needs to do some work in any case.
-   \openindices
-   \let\setfilename=\comment % Ignore extra @setfilename cmds.
-   %
-   % If texinfo.cnf is present on the system, read it.
-   % Useful for site-wide @afourpaper, etc.
-   \openin 1 texinfo.cnf
-   \ifeof 1 \else \input texinfo.cnf \fi
-   \closein 1
-   %
-   \comment % Ignore the actual filename.
-}
-
-% Called from \setfilename.
-%
-\def\openindices{%
-  \newindex{cp}%
-  \newcodeindex{fn}%
-  \newcodeindex{vr}%
-  \newcodeindex{tp}%
-  \newcodeindex{ky}%
-  \newcodeindex{pg}%
-}
-
-% @bye.
-\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
-
-
-\message{pdf,}
-% adobe `portable' document format
-\newcount\tempnum
-\newcount\lnkcount
-\newtoks\filename
-\newcount\filenamelength
-\newcount\pgn
-\newtoks\toksA
-\newtoks\toksB
-\newtoks\toksC
-\newtoks\toksD
-\newbox\boxA
-\newcount\countA
-\newif\ifpdf
-\newif\ifpdfmakepagedest
-
-% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
-% can be set).  So we test for \relax and 0 as well as \undefined,
-% borrowed from ifpdf.sty.
-\ifx\pdfoutput\undefined
-\else
-  \ifx\pdfoutput\relax
-  \else
-    \ifcase\pdfoutput
-    \else
-      \pdftrue
-    \fi
-  \fi
-\fi
-
-% PDF uses PostScript string constants for the names of xref targets,
-% for display in the outlines, and in other places.  Thus, we have to
-% double any backslashes.  Otherwise, a name like "\node" will be
-% interpreted as a newline (\n), followed by o, d, e.  Not good.
-% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html
-% (and related messages, the final outcome is that it is up to the TeX
-% user to double the backslashes and otherwise make the string valid, so
-% that's what we do).
-
-% double active backslashes.
-%
-{\catcode`\@=0 \catcode`\\=\active
- @gdef at activebackslashdouble{%
-   @catcode`@\=@active
-   @let\=@doublebackslash}
-}
-
-% To handle parens, we must adopt a different approach, since parens are
-% not active characters.  hyperref.dtx (which has the same problem as
-% us) handles it with this amazing macro to replace tokens, with minor
-% changes for Texinfo.  It is included here under the GPL by permission
-% from the author, Heiko Oberdiek.
-%
-% #1 is the tokens to replace.
-% #2 is the replacement.
-% #3 is the control sequence with the string.
-%
-\def\HyPsdSubst#1#2#3{%
-  \def\HyPsdReplace##1#1##2\END{%
-    ##1%
-    \ifx\\##2\\%
-    \else
-      #2%
-      \HyReturnAfterFi{%
-        \HyPsdReplace##2\END
-      }%
-    \fi
-  }%
-  \xdef#3{\expandafter\HyPsdReplace#3#1\END}%
-}
-\long\def\HyReturnAfterFi#1\fi{\fi#1}
-
-% #1 is a control sequence in which to do the replacements.
-\def\backslashparens#1{%
-  \xdef#1{#1}% redefine it as its expansion; the definition is simply
-             % \lastnode when called from \setref -> \pdfmkdest.
-  \HyPsdSubst{(}{\realbackslash(}{#1}%
-  \HyPsdSubst{)}{\realbackslash)}{#1}%
-}
-
-\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
-with PDF output, and none of those formats could be found.  (.eps cannot
-be supported due to the design of the PDF format; use regular TeX (DVI
-output) for that.)}
-
-\ifpdf
-  %
-  % Color manipulation macros based on pdfcolor.tex.
-  \def\cmykDarkRed{0.28 1 1 0.35}
-  \def\cmykBlack{0 0 0 1}
-  %
-  % k sets the color for filling (usual text, etc.);
-  % K sets the color for stroking (thin rules, e.g., normal _'s).
-  \def\pdfsetcolor#1{\pdfliteral{#1 k  #1 K}}
-  %
-  % Set color, and create a mark which defines \thiscolor accordingly,
-  % so that \makeheadline knows which color to restore.
-  \def\setcolor#1{%
-    \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
-    \domark
-    \pdfsetcolor{#1}%
-  }
-  %
-  \def\maincolor{\cmykBlack}
-  \pdfsetcolor{\maincolor}
-  \edef\thiscolor{\maincolor}
-  \def\lastcolordefs{}
-  %
-  \def\makefootline{%
-    \baselineskip24pt
-    \line{\pdfsetcolor{\maincolor}\the\footline}%
-  }
-  %
-  \def\makeheadline{%
-    \vbox to 0pt{%
-      \vskip-22.5pt
-      \line{%
-        \vbox to8.5pt{}%
-        % Extract \thiscolor definition from the marks.
-        \getcolormarks
-        % Typeset the headline with \maincolor, then restore the color.
-        \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
-      }%
-      \vss
-    }%
-    \nointerlineskip
-  }
-  %
-  %
-  \pdfcatalog{/PageMode /UseOutlines}
-  %
-  % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
-  \def\dopdfimage#1#2#3{%
-    \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
-    \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
-    %
-    % pdftex (and the PDF format) support .png, .jpg, .pdf (among
-    % others).  Let's try in that order.
-    \let\pdfimgext=\empty
-    \begingroup
-      \openin 1 #1.png \ifeof 1
-        \openin 1 #1.jpg \ifeof 1
-          \openin 1 #1.jpeg \ifeof 1
-            \openin 1 #1.JPG \ifeof 1
-              \openin 1 #1.pdf \ifeof 1
-                \openin 1 #1.PDF \ifeof 1
-                  \errhelp = \nopdfimagehelp
-                  \errmessage{Could not find image file #1 for pdf}%
-                \else \gdef\pdfimgext{PDF}%
-                \fi
-              \else \gdef\pdfimgext{pdf}%
-              \fi
-            \else \gdef\pdfimgext{JPG}%
-            \fi
-          \else \gdef\pdfimgext{jpeg}%
-          \fi
-        \else \gdef\pdfimgext{jpg}%
-        \fi
-      \else \gdef\pdfimgext{png}%
-      \fi
-      \closein 1
-    \endgroup
-    %
-    % without \immediate, ancient pdftex seg faults when the same image is
-    % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
-    \ifnum\pdftexversion < 14
-      \immediate\pdfimage
-    \else
-      \immediate\pdfximage
-    \fi
-      \ifdim \wd0 >0pt width \imagewidth \fi
-      \ifdim \wd2 >0pt height \imageheight \fi
-      \ifnum\pdftexversion<13
-         #1.\pdfimgext
-       \else
-         {#1.\pdfimgext}%
-       \fi
-    \ifnum\pdftexversion < 14 \else
-      \pdfrefximage \pdflastximage
-    \fi}
-  %
-  \def\pdfmkdest#1{{%
-    % We have to set dummies so commands such as @code, and characters
-    % such as \, aren't expanded when present in a section title.
-    \indexnofonts
-    \turnoffactive
-    \activebackslashdouble
-    \makevalueexpandable
-    \def\pdfdestname{#1}%
-    \backslashparens\pdfdestname
-    \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
-  }}
-  %
-  % used to mark target names; must be expandable.
-  \def\pdfmkpgn#1{#1}
-  %
-  % by default, use a color that is dark enough to print on paper as
-  % nearly black, but still distinguishable for online viewing.
-  \def\urlcolor{\cmykDarkRed}
-  \def\linkcolor{\cmykDarkRed}
-  \def\endlink{\setcolor{\maincolor}\pdfendlink}
-  %
-  % Adding outlines to PDF; macros for calculating structure of outlines
-  % come from Petr Olsak
-  \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
-    \else \csname#1\endcsname \fi}
-  \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
-    \advance\tempnum by 1
-    \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
-  %
-  % #1 is the section text, which is what will be displayed in the
-  % outline by the pdf viewer.  #2 is the pdf expression for the number
-  % of subentries (or empty, for subsubsections).  #3 is the node text,
-  % which might be empty if this toc entry had no corresponding node.
-  % #4 is the page number
-  %
-  \def\dopdfoutline#1#2#3#4{%
-    % Generate a link to the node text if that exists; else, use the
-    % page number.  We could generate a destination for the section
-    % text in the case where a section has no node, but it doesn't
-    % seem worth the trouble, since most documents are normally structured.
-    \def\pdfoutlinedest{#3}%
-    \ifx\pdfoutlinedest\empty
-      \def\pdfoutlinedest{#4}%
-    \else
-      % Doubled backslashes in the name.
-      {\activebackslashdouble \xdef\pdfoutlinedest{#3}%
-       \backslashparens\pdfoutlinedest}%
-    \fi
-    %
-    % Also double the backslashes in the display string.
-    {\activebackslashdouble \xdef\pdfoutlinetext{#1}%
-     \backslashparens\pdfoutlinetext}%
-    %
-    \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
-  }
-  %
-  \def\pdfmakeoutlines{%
-    \begingroup
-      % Thanh's hack / proper braces in bookmarks
-      \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
-      \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
-      %
-      % Read toc silently, to get counts of subentries for \pdfoutline.
-      \def\numchapentry##1##2##3##4{%
-	\def\thischapnum{##2}%
-	\def\thissecnum{0}%
-	\def\thissubsecnum{0}%
-      }%
-      \def\numsecentry##1##2##3##4{%
-	\advancenumber{chap\thischapnum}%
-	\def\thissecnum{##2}%
-	\def\thissubsecnum{0}%
-      }%
-      \def\numsubsecentry##1##2##3##4{%
-	\advancenumber{sec\thissecnum}%
-	\def\thissubsecnum{##2}%
-      }%
-      \def\numsubsubsecentry##1##2##3##4{%
-	\advancenumber{subsec\thissubsecnum}%
-      }%
-      \def\thischapnum{0}%
-      \def\thissecnum{0}%
-      \def\thissubsecnum{0}%
-      %
-      % use \def rather than \let here because we redefine \chapentry et
-      % al. a second time, below.
-      \def\appentry{\numchapentry}%
-      \def\appsecentry{\numsecentry}%
-      \def\appsubsecentry{\numsubsecentry}%
-      \def\appsubsubsecentry{\numsubsubsecentry}%
-      \def\unnchapentry{\numchapentry}%
-      \def\unnsecentry{\numsecentry}%
-      \def\unnsubsecentry{\numsubsecentry}%
-      \def\unnsubsubsecentry{\numsubsubsecentry}%
-      \readdatafile{toc}%
-      %
-      % Read toc second time, this time actually producing the outlines.
-      % The `-' means take the \expnumber as the absolute number of
-      % subentries, which we calculated on our first read of the .toc above.
-      %
-      % We use the node names as the destinations.
-      \def\numchapentry##1##2##3##4{%
-        \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
-      \def\numsecentry##1##2##3##4{%
-        \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
-      \def\numsubsecentry##1##2##3##4{%
-        \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
-      \def\numsubsubsecentry##1##2##3##4{% count is always zero
-        \dopdfoutline{##1}{}{##3}{##4}}%
-      %
-      % PDF outlines are displayed using system fonts, instead of
-      % document fonts.  Therefore we cannot use special characters,
-      % since the encoding is unknown.  For example, the eogonek from
-      % Latin 2 (0xea) gets translated to a | character.  Info from
-      % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
-      %
-      % xx to do this right, we have to translate 8-bit characters to
-      % their "best" equivalent, based on the @documentencoding.  Right
-      % now, I guess we'll just let the pdf reader have its way.
-      \indexnofonts
-      \setupdatafile
-      \catcode`\\=\active \otherbackslash
-      \input \tocreadfilename
-    \endgroup
-  }
-  %
-  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
-    \ifx\PP\D\let\nextsp\relax
-    \else\let\nextsp\skipspaces
-      \ifx\p\space\else\addtokens{\filename}{\PP}%
-        \advance\filenamelength by 1
-      \fi
-    \fi
-    \nextsp}
-  \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
-  \ifnum\pdftexversion < 14
-    \let \startlink \pdfannotlink
-  \else
-    \let \startlink \pdfstartlink
-  \fi
-  % make a live url in pdf output.
-  \def\pdfurl#1{%
-    \begingroup
-      % it seems we really need yet another set of dummies; have not
-      % tried to figure out what each command should do in the context
-      % of @url.  for now, just make @/ a no-op, that's the only one
-      % people have actually reported a problem with.
-      %
-      \normalturnoffactive
-      \def\@{@}%
-      \let\/=\empty
-      \makevalueexpandable
-      % do we want to go so far as to use \indexnofonts instead of just
-      % special-casing \var here?
-      \def\var##1{##1}%
-      %
-      \leavevmode\setcolor{\urlcolor}%
-      \startlink attr{/Border [0 0 0]}%
-        user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
-    \endgroup}
-  \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
-  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
-  \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
-  \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
-  \def\maketoks{%
-    \expandafter\poptoks\the\toksA|ENDTOKS|\relax
-    \ifx\first0\adn0
-    \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
-    \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
-    \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
-    \else
-      \ifnum0=\countA\else\makelink\fi
-      \ifx\first.\let\next=\done\else
-        \let\next=\maketoks
-        \addtokens{\toksB}{\the\toksD}
-        \ifx\first,\addtokens{\toksB}{\space}\fi
-      \fi
-    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
-    \next}
-  \def\makelink{\addtokens{\toksB}%
-    {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
-  \def\pdflink#1{%
-    \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
-    \setcolor{\linkcolor}#1\endlink}
-  \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
-\else
-  % non-pdf mode
-  \let\pdfmkdest = \gobble
-  \let\pdfurl = \gobble
-  \let\endlink = \relax
-  \let\setcolor = \gobble
-  \let\pdfsetcolor = \gobble
-  \let\pdfmakeoutlines = \relax
-\fi  % \ifx\pdfoutput
-
-
-\message{fonts,}
-
-% Change the current font style to #1, remembering it in \curfontstyle.
-% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
-% italics, not bold italics.
-%
-\def\setfontstyle#1{%
-  \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
-  \csname ten#1\endcsname  % change the current font
-}
-
-% Select #1 fonts with the current style.
-%
-\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
-
-\def\rm{\fam=0 \setfontstyle{rm}}
-\def\it{\fam=\itfam \setfontstyle{it}}
-\def\sl{\fam=\slfam \setfontstyle{sl}}
-\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
-\def\tt{\fam=\ttfam \setfontstyle{tt}}
-
-% Unfortunately, we have to override this for titles and the like, since
-% in those cases "rm" is bold.  Sigh.
-\def\rmisbold{\rm\def\curfontstyle{bf}}
-
-% Texinfo sort of supports the sans serif font style, which plain TeX does not.
-% So we set up a \sf.
-\newfam\sffam
-\def\sf{\fam=\sffam \setfontstyle{sf}}
-\let\li = \sf % Sometimes we call it \li, not \sf.
-
-% We don't need math for this font style.
-\def\ttsl{\setfontstyle{ttsl}}
-
-
-% Default leading.
-\newdimen\textleading  \textleading = 13.2pt
-
-% Set the baselineskip to #1, and the lineskip and strut size
-% correspondingly.  There is no deep meaning behind these magic numbers
-% used as factors; they just match (closely enough) what Knuth defined.
-%
-\def\lineskipfactor{.08333}
-\def\strutheightpercent{.70833}
-\def\strutdepthpercent {.29167}
-%
-% can get a sort of poor man's double spacing by redefining this.
-\def\baselinefactor{1}
-%
-\def\setleading#1{%
-  \dimen0 = #1\relax
-  \normalbaselineskip = \baselinefactor\dimen0
-  \normallineskip = \lineskipfactor\normalbaselineskip
-  \normalbaselines
-  \setbox\strutbox =\hbox{%
-    \vrule width0pt height\strutheightpercent\baselineskip
-                    depth \strutdepthpercent \baselineskip
-  }%
-}
-
-% PDF CMaps.  See also LaTeX's t1.cmap.
-%
-% do nothing with this by default.
-\expandafter\let\csname cmapOT1\endcsname\gobble
-\expandafter\let\csname cmapOT1IT\endcsname\gobble
-\expandafter\let\csname cmapOT1TT\endcsname\gobble
-
-% if we are producing pdf, and we have \pdffontattr, then define cmaps.
-% (\pdffontattr was introduced many years ago, but people still run
-% older pdftex's; it's easy to conditionalize, so we do.)
-\ifpdf \ifx\pdffontattr\undefined \else
-  \begingroup
-    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
-    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
-%%DocumentNeededResources: ProcSet (CIDInit)
-%%IncludeResource: ProcSet (CIDInit)
-%%BeginResource: CMap (TeX-OT1-0)
-%%Title: (TeX-OT1-0 TeX OT1 0)
-%%Version: 1.000
-%%EndComments
-/CIDInit /ProcSet findresource begin
-12 dict begin
-begincmap
-/CIDSystemInfo
-<< /Registry (TeX)
-/Ordering (OT1)
-/Supplement 0
->> def
-/CMapName /TeX-OT1-0 def
-/CMapType 2 def
-1 begincodespacerange
-<00> <7F>
-endcodespacerange
-8 beginbfrange
-<00> <01> <0393>
-<09> <0A> <03A8>
-<23> <26> <0023>
-<28> <3B> <0028>
-<3F> <5B> <003F>
-<5D> <5E> <005D>
-<61> <7A> <0061>
-<7B> <7C> <2013>
-endbfrange
-40 beginbfchar
-<02> <0398>
-<03> <039B>
-<04> <039E>
-<05> <03A0>
-<06> <03A3>
-<07> <03D2>
-<08> <03A6>
-<0B> <00660066>
-<0C> <00660069>
-<0D> <0066006C>
-<0E> <006600660069>
-<0F> <00660066006C>
-<10> <0131>
-<11> <0237>
-<12> <0060>
-<13> <00B4>
-<14> <02C7>
-<15> <02D8>
-<16> <00AF>
-<17> <02DA>
-<18> <00B8>
-<19> <00DF>
-<1A> <00E6>
-<1B> <0153>
-<1C> <00F8>
-<1D> <00C6>
-<1E> <0152>
-<1F> <00D8>
-<21> <0021>
-<22> <201D>
-<27> <2019>
-<3C> <00A1>
-<3D> <003D>
-<3E> <00BF>
-<5C> <201C>
-<5F> <02D9>
-<60> <2018>
-<7D> <02DD>
-<7E> <007E>
-<7F> <00A8>
-endbfchar
-endcmap
-CMapName currentdict /CMap defineresource pop
-end
-end
-%%EndResource
-%%EOF
-    }\endgroup
-  \expandafter\edef\csname cmapOT1\endcsname#1{%
-    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
-  }%
-%
-% \cmapOT1IT
-  \begingroup
-    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
-    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
-%%DocumentNeededResources: ProcSet (CIDInit)
-%%IncludeResource: ProcSet (CIDInit)
-%%BeginResource: CMap (TeX-OT1IT-0)
-%%Title: (TeX-OT1IT-0 TeX OT1IT 0)
-%%Version: 1.000
-%%EndComments
-/CIDInit /ProcSet findresource begin
-12 dict begin
-begincmap
-/CIDSystemInfo
-<< /Registry (TeX)
-/Ordering (OT1IT)
-/Supplement 0
->> def
-/CMapName /TeX-OT1IT-0 def
-/CMapType 2 def
-1 begincodespacerange
-<00> <7F>
-endcodespacerange
-8 beginbfrange
-<00> <01> <0393>
-<09> <0A> <03A8>
-<25> <26> <0025>
-<28> <3B> <0028>
-<3F> <5B> <003F>
-<5D> <5E> <005D>
-<61> <7A> <0061>
-<7B> <7C> <2013>
-endbfrange
-42 beginbfchar
-<02> <0398>
-<03> <039B>
-<04> <039E>
-<05> <03A0>
-<06> <03A3>
-<07> <03D2>
-<08> <03A6>
-<0B> <00660066>
-<0C> <00660069>
-<0D> <0066006C>
-<0E> <006600660069>
-<0F> <00660066006C>
-<10> <0131>
-<11> <0237>
-<12> <0060>
-<13> <00B4>
-<14> <02C7>
-<15> <02D8>
-<16> <00AF>
-<17> <02DA>
-<18> <00B8>
-<19> <00DF>
-<1A> <00E6>
-<1B> <0153>
-<1C> <00F8>
-<1D> <00C6>
-<1E> <0152>
-<1F> <00D8>
-<21> <0021>
-<22> <201D>
-<23> <0023>
-<24> <00A3>
-<27> <2019>
-<3C> <00A1>
-<3D> <003D>
-<3E> <00BF>
-<5C> <201C>
-<5F> <02D9>
-<60> <2018>
-<7D> <02DD>
-<7E> <007E>
-<7F> <00A8>
-endbfchar
-endcmap
-CMapName currentdict /CMap defineresource pop
-end
-end
-%%EndResource
-%%EOF
-    }\endgroup
-  \expandafter\edef\csname cmapOT1IT\endcsname#1{%
-    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
-  }%
-%
-% \cmapOT1TT
-  \begingroup
-    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
-    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
-%%DocumentNeededResources: ProcSet (CIDInit)
-%%IncludeResource: ProcSet (CIDInit)
-%%BeginResource: CMap (TeX-OT1TT-0)
-%%Title: (TeX-OT1TT-0 TeX OT1TT 0)
-%%Version: 1.000
-%%EndComments
-/CIDInit /ProcSet findresource begin
-12 dict begin
-begincmap
-/CIDSystemInfo
-<< /Registry (TeX)
-/Ordering (OT1TT)
-/Supplement 0
->> def
-/CMapName /TeX-OT1TT-0 def
-/CMapType 2 def
-1 begincodespacerange
-<00> <7F>
-endcodespacerange
-5 beginbfrange
-<00> <01> <0393>
-<09> <0A> <03A8>
-<21> <26> <0021>
-<28> <5F> <0028>
-<61> <7E> <0061>
-endbfrange
-32 beginbfchar
-<02> <0398>
-<03> <039B>
-<04> <039E>
-<05> <03A0>
-<06> <03A3>
-<07> <03D2>
-<08> <03A6>
-<0B> <2191>
-<0C> <2193>
-<0D> <0027>
-<0E> <00A1>
-<0F> <00BF>
-<10> <0131>
-<11> <0237>
-<12> <0060>
-<13> <00B4>
-<14> <02C7>
-<15> <02D8>
-<16> <00AF>
-<17> <02DA>
-<18> <00B8>
-<19> <00DF>
-<1A> <00E6>
-<1B> <0153>
-<1C> <00F8>
-<1D> <00C6>
-<1E> <0152>
-<1F> <00D8>
-<20> <2423>
-<27> <2019>
-<60> <2018>
-<7F> <00A8>
-endbfchar
-endcmap
-CMapName currentdict /CMap defineresource pop
-end
-end
-%%EndResource
-%%EOF
-    }\endgroup
-  \expandafter\edef\csname cmapOT1TT\endcsname#1{%
-    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
-  }%
-\fi\fi
-
-
-% Set the font macro #1 to the font named #2, adding on the
-% specified font prefix (normally `cm').
-% #3 is the font's design size, #4 is a scale factor, #5 is the CMap
-% encoding (currently only OT1, OT1IT and OT1TT are allowed, pass
-% empty to omit).
-\def\setfont#1#2#3#4#5{%
-  \font#1=\fontprefix#2#3 scaled #4
-  \csname cmap#5\endcsname#1%
-}
-% This is what gets called when #5 of \setfont is empty.
-\let\cmap\gobble
-% emacs-page end of cmaps
-
-% Use cm as the default font prefix.
-% To specify the font prefix, you must define \fontprefix
-% before you read in texinfo.tex.
-\ifx\fontprefix\undefined
-\def\fontprefix{cm}
-\fi
-% Support font families that don't use the same naming scheme as CM.
-\def\rmshape{r}
-\def\rmbshape{bx}               %where the normal face is bold
-\def\bfshape{b}
-\def\bxshape{bx}
-\def\ttshape{tt}
-\def\ttbshape{tt}
-\def\ttslshape{sltt}
-\def\itshape{ti}
-\def\itbshape{bxti}
-\def\slshape{sl}
-\def\slbshape{bxsl}
-\def\sfshape{ss}
-\def\sfbshape{ss}
-\def\scshape{csc}
-\def\scbshape{csc}
-
-% Definitions for a main text size of 11pt.  This is the default in
-% Texinfo.
-%
-\def\definetextfontsizexi{%
-% Text fonts (11.2pt, magstep1).
-\def\textnominalsize{11pt}
-\edef\mainmagstep{\magstephalf}
-\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
-\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
-\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
-\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
-\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
-\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
-\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
-\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
-\font\texti=cmmi10 scaled \mainmagstep
-\font\textsy=cmsy10 scaled \mainmagstep
-\def\textecsize{1095}
-
-% A few fonts for @defun names and args.
-\setfont\defbf\bfshape{10}{\magstep1}{OT1}
-\setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
-\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
-\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
-
-% Fonts for indices, footnotes, small examples (9pt).
-\def\smallnominalsize{9pt}
-\setfont\smallrm\rmshape{9}{1000}{OT1}
-\setfont\smalltt\ttshape{9}{1000}{OT1TT}
-\setfont\smallbf\bfshape{10}{900}{OT1}
-\setfont\smallit\itshape{9}{1000}{OT1IT}
-\setfont\smallsl\slshape{9}{1000}{OT1}
-\setfont\smallsf\sfshape{9}{1000}{OT1}
-\setfont\smallsc\scshape{10}{900}{OT1}
-\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
-\font\smalli=cmmi9
-\font\smallsy=cmsy9
-\def\smallecsize{0900}
-
-% Fonts for small examples (8pt).
-\def\smallernominalsize{8pt}
-\setfont\smallerrm\rmshape{8}{1000}{OT1}
-\setfont\smallertt\ttshape{8}{1000}{OT1TT}
-\setfont\smallerbf\bfshape{10}{800}{OT1}
-\setfont\smallerit\itshape{8}{1000}{OT1IT}
-\setfont\smallersl\slshape{8}{1000}{OT1}
-\setfont\smallersf\sfshape{8}{1000}{OT1}
-\setfont\smallersc\scshape{10}{800}{OT1}
-\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
-\font\smalleri=cmmi8
-\font\smallersy=cmsy8
-\def\smallerecsize{0800}
-
-% Fonts for title page (20.4pt):
-\def\titlenominalsize{20pt}
-\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
-\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
-\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
-\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
-\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
-\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
-\let\titlebf=\titlerm
-\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
-\font\titlei=cmmi12 scaled \magstep3
-\font\titlesy=cmsy10 scaled \magstep4
-\def\titleecsize{2074}
-
-% Chapter (and unnumbered) fonts (17.28pt).
-\def\chapnominalsize{17pt}
-\setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
-\setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
-\setfont\chapsl\slbshape{10}{\magstep3}{OT1}
-\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
-\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
-\setfont\chapsf\sfbshape{17}{1000}{OT1}
-\let\chapbf=\chaprm
-\setfont\chapsc\scbshape{10}{\magstep3}{OT1}
-\font\chapi=cmmi12 scaled \magstep2
-\font\chapsy=cmsy10 scaled \magstep3
-\def\chapecsize{1728}
-
-% Section fonts (14.4pt).
-\def\secnominalsize{14pt}
-\setfont\secrm\rmbshape{12}{\magstep1}{OT1}
-\setfont\secit\itbshape{10}{\magstep2}{OT1IT}
-\setfont\secsl\slbshape{10}{\magstep2}{OT1}
-\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
-\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
-\setfont\secsf\sfbshape{12}{\magstep1}{OT1}
-\let\secbf\secrm
-\setfont\secsc\scbshape{10}{\magstep2}{OT1}
-\font\seci=cmmi12 scaled \magstep1
-\font\secsy=cmsy10 scaled \magstep2
-\def\sececsize{1440}
-
-% Subsection fonts (13.15pt).
-\def\ssecnominalsize{13pt}
-\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
-\setfont\ssecit\itbshape{10}{1315}{OT1IT}
-\setfont\ssecsl\slbshape{10}{1315}{OT1}
-\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
-\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
-\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
-\let\ssecbf\ssecrm
-\setfont\ssecsc\scbshape{10}{1315}{OT1}
-\font\sseci=cmmi12 scaled \magstephalf
-\font\ssecsy=cmsy10 scaled 1315
-\def\ssececsize{1200}
-
-% Reduced fonts for @acro in text (10pt).
-\def\reducednominalsize{10pt}
-\setfont\reducedrm\rmshape{10}{1000}{OT1}
-\setfont\reducedtt\ttshape{10}{1000}{OT1TT}
-\setfont\reducedbf\bfshape{10}{1000}{OT1}
-\setfont\reducedit\itshape{10}{1000}{OT1IT}
-\setfont\reducedsl\slshape{10}{1000}{OT1}
-\setfont\reducedsf\sfshape{10}{1000}{OT1}
-\setfont\reducedsc\scshape{10}{1000}{OT1}
-\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
-\font\reducedi=cmmi10
-\font\reducedsy=cmsy10
-\def\reducedecsize{1000}
-
-% reset the current fonts
-\textfonts
-\rm
-} % end of 11pt text font size definitions
-
-
-% Definitions to make the main text be 10pt Computer Modern, with
-% section, chapter, etc., sizes following suit.  This is for the GNU
-% Press printing of the Emacs 22 manual.  Maybe other manuals in the
-% future.  Used with @smallbook, which sets the leading to 12pt.
-%
-\def\definetextfontsizex{%
-% Text fonts (10pt).
-\def\textnominalsize{10pt}
-\edef\mainmagstep{1000}
-\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
-\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
-\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
-\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
-\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
-\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
-\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
-\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
-\font\texti=cmmi10 scaled \mainmagstep
-\font\textsy=cmsy10 scaled \mainmagstep
-\def\textecsize{1000}
-
-% A few fonts for @defun names and args.
-\setfont\defbf\bfshape{10}{\magstephalf}{OT1}
-\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
-\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
-\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
-
-% Fonts for indices, footnotes, small examples (9pt).
-\def\smallnominalsize{9pt}
-\setfont\smallrm\rmshape{9}{1000}{OT1}
-\setfont\smalltt\ttshape{9}{1000}{OT1TT}
-\setfont\smallbf\bfshape{10}{900}{OT1}
-\setfont\smallit\itshape{9}{1000}{OT1IT}
-\setfont\smallsl\slshape{9}{1000}{OT1}
-\setfont\smallsf\sfshape{9}{1000}{OT1}
-\setfont\smallsc\scshape{10}{900}{OT1}
-\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
-\font\smalli=cmmi9
-\font\smallsy=cmsy9
-\def\smallecsize{0900}
-
-% Fonts for small examples (8pt).
-\def\smallernominalsize{8pt}
-\setfont\smallerrm\rmshape{8}{1000}{OT1}
-\setfont\smallertt\ttshape{8}{1000}{OT1TT}
-\setfont\smallerbf\bfshape{10}{800}{OT1}
-\setfont\smallerit\itshape{8}{1000}{OT1IT}
-\setfont\smallersl\slshape{8}{1000}{OT1}
-\setfont\smallersf\sfshape{8}{1000}{OT1}
-\setfont\smallersc\scshape{10}{800}{OT1}
-\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
-\font\smalleri=cmmi8
-\font\smallersy=cmsy8
-\def\smallerecsize{0800}
-
-% Fonts for title page (20.4pt):
-\def\titlenominalsize{20pt}
-\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
-\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
-\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
-\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
-\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
-\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
-\let\titlebf=\titlerm
-\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
-\font\titlei=cmmi12 scaled \magstep3
-\font\titlesy=cmsy10 scaled \magstep4
-\def\titleecsize{2074}
-
-% Chapter fonts (14.4pt).
-\def\chapnominalsize{14pt}
-\setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
-\setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
-\setfont\chapsl\slbshape{10}{\magstep2}{OT1}
-\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
-\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
-\setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
-\let\chapbf\chaprm
-\setfont\chapsc\scbshape{10}{\magstep2}{OT1}
-\font\chapi=cmmi12 scaled \magstep1
-\font\chapsy=cmsy10 scaled \magstep2
-\def\chapecsize{1440}
-
-% Section fonts (12pt).
-\def\secnominalsize{12pt}
-\setfont\secrm\rmbshape{12}{1000}{OT1}
-\setfont\secit\itbshape{10}{\magstep1}{OT1IT}
-\setfont\secsl\slbshape{10}{\magstep1}{OT1}
-\setfont\sectt\ttbshape{12}{1000}{OT1TT}
-\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
-\setfont\secsf\sfbshape{12}{1000}{OT1}
-\let\secbf\secrm
-\setfont\secsc\scbshape{10}{\magstep1}{OT1}
-\font\seci=cmmi12
-\font\secsy=cmsy10 scaled \magstep1
-\def\sececsize{1200}
-
-% Subsection fonts (10pt).
-\def\ssecnominalsize{10pt}
-\setfont\ssecrm\rmbshape{10}{1000}{OT1}
-\setfont\ssecit\itbshape{10}{1000}{OT1IT}
-\setfont\ssecsl\slbshape{10}{1000}{OT1}
-\setfont\ssectt\ttbshape{10}{1000}{OT1TT}
-\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
-\setfont\ssecsf\sfbshape{10}{1000}{OT1}
-\let\ssecbf\ssecrm
-\setfont\ssecsc\scbshape{10}{1000}{OT1}
-\font\sseci=cmmi10
-\font\ssecsy=cmsy10
-\def\ssececsize{1000}
-
-% Reduced fonts for @acro in text (9pt).
-\def\reducednominalsize{9pt}
-\setfont\reducedrm\rmshape{9}{1000}{OT1}
-\setfont\reducedtt\ttshape{9}{1000}{OT1TT}
-\setfont\reducedbf\bfshape{10}{900}{OT1}
-\setfont\reducedit\itshape{9}{1000}{OT1IT}
-\setfont\reducedsl\slshape{9}{1000}{OT1}
-\setfont\reducedsf\sfshape{9}{1000}{OT1}
-\setfont\reducedsc\scshape{10}{900}{OT1}
-\setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
-\font\reducedi=cmmi9
-\font\reducedsy=cmsy9
-\def\reducedecsize{0900}
-
-% reduce space between paragraphs
-\divide\parskip by 2
-
-% reset the current fonts
-\textfonts
-\rm
-} % end of 10pt text font size definitions
-
-
-% We provide the user-level command
-%   @fonttextsize 10
-% (or 11) to redefine the text font size.  pt is assumed.
-%
-\def\xword{10}
-\def\xiword{11}
-%
-\parseargdef\fonttextsize{%
-  \def\textsizearg{#1}%
-  \wlog{doing @fonttextsize \textsizearg}%
-  %
-  % Set \globaldefs so that documents can use this inside @tex, since
-  % makeinfo 4.8 does not support it, but we need it nonetheless.
-  %
- \begingroup \globaldefs=1
-  \ifx\textsizearg\xword \definetextfontsizex
-  \else \ifx\textsizearg\xiword \definetextfontsizexi
-  \else
-    \errhelp=\EMsimple
-    \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
-  \fi\fi
- \endgroup
-}
-
-
-% In order for the font changes to affect most math symbols and letters,
-% we have to define the \textfont of the standard families.  Since
-% texinfo doesn't allow for producing subscripts and superscripts except
-% in the main text, we don't bother to reset \scriptfont and
-% \scriptscriptfont (which would also require loading a lot more fonts).
-%
-\def\resetmathfonts{%
-  \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
-  \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
-  \textfont\ttfam=\tentt \textfont\sffam=\tensf
-}
-
-% The font-changing commands redefine the meanings of \tenSTYLE, instead
-% of just \STYLE.  We do this because \STYLE needs to also set the
-% current \fam for math mode.  Our \STYLE (e.g., \rm) commands hardwire
-% \tenSTYLE to set the current font.
-%
-% Each font-changing command also sets the names \lsize (one size lower)
-% and \lllsize (three sizes lower).  These relative commands are used in
-% the LaTeX logo and acronyms.
-%
-% This all needs generalizing, badly.
-%
-\def\textfonts{%
-  \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
-  \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
-  \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
-  \let\tenttsl=\textttsl
-  \def\curfontsize{text}%
-  \def\lsize{reduced}\def\lllsize{smaller}%
-  \resetmathfonts \setleading{\textleading}}
-\def\titlefonts{%
-  \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
-  \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
-  \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
-  \let\tenttsl=\titlettsl
-  \def\curfontsize{title}%
-  \def\lsize{chap}\def\lllsize{subsec}%
-  \resetmathfonts \setleading{25pt}}
-\def\titlefont#1{{\titlefonts\rmisbold #1}}
-\def\chapfonts{%
-  \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
-  \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
-  \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
-  \let\tenttsl=\chapttsl
-  \def\curfontsize{chap}%
-  \def\lsize{sec}\def\lllsize{text}%
-  \resetmathfonts \setleading{19pt}}
-\def\secfonts{%
-  \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
-  \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
-  \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
-  \let\tenttsl=\secttsl
-  \def\curfontsize{sec}%
-  \def\lsize{subsec}\def\lllsize{reduced}%
-  \resetmathfonts \setleading{16pt}}
-\def\subsecfonts{%
-  \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
-  \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
-  \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
-  \let\tenttsl=\ssecttsl
-  \def\curfontsize{ssec}%
-  \def\lsize{text}\def\lllsize{small}%
-  \resetmathfonts \setleading{15pt}}
-\let\subsubsecfonts = \subsecfonts
-\def\reducedfonts{%
-  \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
-  \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
-  \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
-  \let\tenttsl=\reducedttsl
-  \def\curfontsize{reduced}%
-  \def\lsize{small}\def\lllsize{smaller}%
-  \resetmathfonts \setleading{10.5pt}}
-\def\smallfonts{%
-  \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
-  \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
-  \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
-  \let\tenttsl=\smallttsl
-  \def\curfontsize{small}%
-  \def\lsize{smaller}\def\lllsize{smaller}%
-  \resetmathfonts \setleading{10.5pt}}
-\def\smallerfonts{%
-  \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
-  \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
-  \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
-  \let\tenttsl=\smallerttsl
-  \def\curfontsize{smaller}%
-  \def\lsize{smaller}\def\lllsize{smaller}%
-  \resetmathfonts \setleading{9.5pt}}
-
-% Fonts for short table of contents.
-\setfont\shortcontrm\rmshape{12}{1000}{OT1}
-\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
-\setfont\shortcontsl\slshape{12}{1000}{OT1}
-\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
-
-% Define these just so they can be easily changed for other fonts.
-\def\angleleft{$\langle$}
-\def\angleright{$\rangle$}
-
-% Set the fonts to use with the @small... environments.
-\let\smallexamplefonts = \smallfonts
-
-% About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
-% can fit this many characters:
-%   8.5x11=86   smallbook=72  a4=90  a5=69
-% If we use \scriptfonts (8pt), then we can fit this many characters:
-%   8.5x11=90+  smallbook=80  a4=90+  a5=77
-% For me, subjectively, the few extra characters that fit aren't worth
-% the additional smallness of 8pt.  So I'm making the default 9pt.
-%
-% By the way, for comparison, here's what fits with @example (10pt):
-%   8.5x11=71  smallbook=60  a4=75  a5=58
-% --karl, 24jan03.
-
-% Set up the default fonts, so we can use them for creating boxes.
-%
-\definetextfontsizexi
-
-
-\message{markup,}
-
-% Check if we are currently using a typewriter font.  Since all the
-% Computer Modern typewriter fonts have zero interword stretch (and
-% shrink), and it is reasonable to expect all typewriter fonts to have
-% this property, we can check that font parameter.
-%
-\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
-
-% Markup style infrastructure.  \defmarkupstylesetup\INITMACRO will
-% define and register \INITMACRO to be called on markup style changes.
-% \INITMACRO can check \currentmarkupstyle for the innermost
-% style and the set of \ifmarkupSTYLE switches for all styles
-% currently in effect.
-\newif\ifmarkupvar
-\newif\ifmarkupsamp
-\newif\ifmarkupkey
-%\newif\ifmarkupfile % @file == @samp.
-%\newif\ifmarkupoption % @option == @samp.
-\newif\ifmarkupcode
-\newif\ifmarkupkbd
-%\newif\ifmarkupenv % @env == @code.
-%\newif\ifmarkupcommand % @command == @code.
-\newif\ifmarkuptex % @tex (and part of @math, for now).
-\newif\ifmarkupexample
-\newif\ifmarkupverb
-\newif\ifmarkupverbatim
-
-\let\currentmarkupstyle\empty
-
-\def\setupmarkupstyle#1{%
-  \csname markup#1true\endcsname
-  \def\currentmarkupstyle{#1}%
-  \markupstylesetup
-}
-
-\let\markupstylesetup\empty
-
-\def\defmarkupstylesetup#1{%
-  \expandafter\def\expandafter\markupstylesetup
-    \expandafter{\markupstylesetup #1}%
-  \def#1%
-}
-
-% Markup style setup for left and right quotes.
-\defmarkupstylesetup\markupsetuplq{%
-  \expandafter\let\expandafter \temp \csname markupsetuplq\currentmarkupstyle\endcsname
-  \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
-}
-
-\defmarkupstylesetup\markupsetuprq{%
-  \expandafter\let\expandafter \temp \csname markupsetuprq\currentmarkupstyle\endcsname
-  \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
-}
-
-{
-\catcode`\'=\active
-\catcode`\`=\active
-
-\gdef\markupsetuplqdefault{\let`\lq}
-\gdef\markupsetuprqdefault{\let'\rq}
-
-\gdef\markupsetcodequoteleft{\let`\codequoteleft}
-\gdef\markupsetcodequoteright{\let'\codequoteright}
-
-\gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft}
-}
-
-\let\markupsetuplqcode \markupsetcodequoteleft
-\let\markupsetuprqcode \markupsetcodequoteright
-\let\markupsetuplqexample \markupsetcodequoteleft
-\let\markupsetuprqexample \markupsetcodequoteright
-\let\markupsetuplqverb \markupsetcodequoteleft
-\let\markupsetuprqverb \markupsetcodequoteright
-\let\markupsetuplqverbatim \markupsetcodequoteleft
-\let\markupsetuprqverbatim \markupsetcodequoteright
-
-\let\markupsetuplqsamp \markupsetnoligaturesquoteleft
-\let\markupsetuplqkbd \markupsetnoligaturesquoteleft
-
-% Allow an option to not replace quotes with a regular directed right
-% quote/apostrophe (char 0x27), but instead use the undirected quote
-% from cmtt (char 0x0d).  The undirected quote is ugly, so don't make it
-% the default, but it works for pasting with more pdf viewers (at least
-% evince), the lilypond developers report.  xpdf does work with the
-% regular 0x27.
-%
-\def\codequoteright{%
-  \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
-    \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
-      '%
-    \else \char'15 \fi
-  \else \char'15 \fi
-}
-%
-% and a similar option for the left quote char vs. a grave accent.
-% Modern fonts display ASCII 0x60 as a grave accent, so some people like
-% the code environments to do likewise.
-%
-\def\codequoteleft{%
-  \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
-    \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
-      % [Knuth] pp. 380,381,391
-      % \relax disables Spanish ligatures ?` and !` of \tt font.
-      \relax`%
-    \else \char'22 \fi
-  \else \char'22 \fi
-}
-
-% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
-\def\noligaturesquoteleft{\relax\lq}
-
-% Count depth in font-changes, for error checks
-\newcount\fontdepth \fontdepth=0
-
-%% Add scribe-like font environments, plus @l for inline lisp (usually sans
-%% serif) and @ii for TeX italic
-
-% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
-% unless the following character is such as not to need one.
-\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else
-                    \ptexslash\fi\fi\fi}
-\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx}
-\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx}
-
-% like \smartslanted except unconditionally uses \ttsl.
-% @var is set to this for defun arguments.
-\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx}
-
-% @cite is like \smartslanted except unconditionally use \sl.  We never want
-% ttsl for book titles, do we?
-\def\cite#1{{\sl #1}\futurelet\next\smartitalicx}
-
-\let\i=\smartitalic
-\let\slanted=\smartslanted
-\def\var#1{{\setupmarkupstyle{var}\smartslanted{#1}}}
-\let\dfn=\smartslanted
-\let\emph=\smartitalic
-
-% Explicit font changes: @r, @sc, undocumented @ii.
-\def\r#1{{\rm #1}}              % roman font
-\def\sc#1{{\smallcaps#1}}       % smallcaps font
-\def\ii#1{{\it #1}}             % italic font
-
-% @b, explicit bold.  Also @strong.
-\def\b#1{{\bf #1}}
-\let\strong=\b
-
-% @sansserif, explicit sans.
-\def\sansserif#1{{\sf #1}}
-
-% We can't just use \exhyphenpenalty, because that only has effect at
-% the end of a paragraph.  Restore normal hyphenation at the end of the
-% group within which \nohyphenation is presumably called.
-%
-\def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
-\def\restorehyphenation{\hyphenchar\font = `- }
-
-% Set sfcode to normal for the chars that usually have another value.
-% Can't use plain's \frenchspacing because it uses the `\x notation, and
-% sometimes \x has an active definition that messes things up.
-%
-\catcode`@=11
-  \def\plainfrenchspacing{%
-    \sfcode\dotChar  =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
-    \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
-    \def\endofsentencespacefactor{1000}% for @. and friends
-  }
-  \def\plainnonfrenchspacing{%
-    \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
-    \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
-    \def\endofsentencespacefactor{3000}% for @. and friends
-  }
-\catcode`@=\other
-\def\endofsentencespacefactor{3000}% default
-
-% @t, explicit typewriter.
-\def\t#1{%
-  {\tt \rawbackslash \plainfrenchspacing #1}%
-  \null
-}
-
-% @samp.
-\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
-
-% definition of @key that produces a lozenge.  Doesn't adjust to text size.
-%\setfont\keyrm\rmshape{8}{1000}{OT1}
-%\font\keysy=cmsy9
-%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
-%  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
-%    \vbox{\hrule\kern-0.4pt
-%     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
-%    \kern-0.4pt\hrule}%
-%  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
-
-% definition of @key with no lozenge.  If the current font is already
-% monospace, don't change it; that way, we respect @kbdinputstyle.  But
-% if it isn't monospace, then use \tt.
-%
-\def\key#1{{\setupmarkupstyle{key}%
-  \nohyphenation
-  \ifmonospace\else\tt\fi
-  #1}\null}
-
-% ctrl is no longer a Texinfo command.
-\def\ctrl #1{{\tt \rawbackslash \hat}#1}
-
-% @file, @option are the same as @samp.
-\let\file=\samp
-\let\option=\samp
-
-% @code is a modification of @t,
-% which makes spaces the same size as normal in the surrounding text.
-\def\tclose#1{%
-  {%
-    % Change normal interword space to be same as for the current font.
-    \spaceskip = \fontdimen2\font
-    %
-    % Switch to typewriter.
-    \tt
-    %
-    % But `\ ' produces the large typewriter interword space.
-    \def\ {{\spaceskip = 0pt{} }}%
-    %
-    % Turn off hyphenation.
-    \nohyphenation
-    %
-    \rawbackslash
-    \plainfrenchspacing
-    #1%
-  }%
-  \null
-}
-
-% We *must* turn on hyphenation at `-' and `_' in @code.
-% Otherwise, it is too hard to avoid overfull hboxes
-% in the Emacs manual, the Library manual, etc.
-
-% Unfortunately, TeX uses one parameter (\hyphenchar) to control
-% both hyphenation at - and hyphenation within words.
-% We must therefore turn them both off (\tclose does that)
-% and arrange explicitly to hyphenate at a dash.
-%  -- rms.
-{
-  \catcode`\-=\active \catcode`\_=\active
-  \catcode`\'=\active \catcode`\`=\active
-  \global\let'=\rq \global\let`=\lq  % default definitions
-  %
-  \global\def\code{\begingroup
-    \setupmarkupstyle{code}%
-    % The following should really be moved into \setupmarkupstyle handlers.
-    \catcode\dashChar=\active  \catcode\underChar=\active
-    \ifallowcodebreaks
-     \let-\codedash
-     \let_\codeunder
-    \else
-     \let-\realdash
-     \let_\realunder
-    \fi
-    \codex
-  }
-}
-
-\def\realdash{-}
-\def\codedash{-\discretionary{}{}{}}
-\def\codeunder{%
-  % this is all so @math{@code{var_name}+1} can work.  In math mode, _
-  % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
-  % will therefore expand the active definition of _, which is us
-  % (inside @code that is), therefore an endless loop.
-  \ifusingtt{\ifmmode
-               \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
-             \else\normalunderscore \fi
-             \discretionary{}{}{}}%
-            {\_}%
-}
-\def\codex #1{\tclose{#1}\endgroup}
-
-% An additional complication: the above will allow breaks after, e.g.,
-% each of the four underscores in __typeof__.  This is undesirable in
-% some manuals, especially if they don't have long identifiers in
-% general.  @allowcodebreaks provides a way to control this.
-%
-\newif\ifallowcodebreaks  \allowcodebreakstrue
-
-\def\keywordtrue{true}
-\def\keywordfalse{false}
-
-\parseargdef\allowcodebreaks{%
-  \def\txiarg{#1}%
-  \ifx\txiarg\keywordtrue
-    \allowcodebreakstrue
-  \else\ifx\txiarg\keywordfalse
-    \allowcodebreaksfalse
-  \else
-    \errhelp = \EMsimple
-    \errmessage{Unknown @allowcodebreaks option `\txiarg'}%
-  \fi\fi
-}
-
-% @kbd is like @code, except that if the argument is just one @key command,
-% then @kbd has no effect.
-\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}}
-
-% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
-%   `example' (@kbd uses ttsl only inside of @example and friends),
-%   or `code' (@kbd uses normal tty font always).
-\parseargdef\kbdinputstyle{%
-  \def\txiarg{#1}%
-  \ifx\txiarg\worddistinct
-    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
-  \else\ifx\txiarg\wordexample
-    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
-  \else\ifx\txiarg\wordcode
-    \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
-  \else
-    \errhelp = \EMsimple
-    \errmessage{Unknown @kbdinputstyle option `\txiarg'}%
-  \fi\fi\fi
-}
-\def\worddistinct{distinct}
-\def\wordexample{example}
-\def\wordcode{code}
-
-% Default is `distinct'.
-\kbdinputstyle distinct
-
-\def\xkey{\key}
-\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
-\ifx\one\xkey\ifx\threex\three \key{#2}%
-\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
-\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi}
-
-% For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
-\let\indicateurl=\code
-\let\env=\code
-\let\command=\code
-
-% @clicksequence{File @click{} Open ...}
-\def\clicksequence#1{\begingroup #1\endgroup}
-
-% @clickstyle @arrow   (by default)
-\parseargdef\clickstyle{\def\click{#1}}
-\def\click{\arrow}
-
-% @uref (abbreviation for `urlref') takes an optional (comma-separated)
-% second argument specifying the text to display and an optional third
-% arg as text to display instead of (rather than in addition to) the url
-% itself.  First (mandatory) arg is the url.  Perhaps eventually put in
-% a hypertex \special here.
-%
-\def\uref#1{\douref #1,,,\finish}
-\def\douref#1,#2,#3,#4\finish{\begingroup
-  \unsepspaces
-  \pdfurl{#1}%
-  \setbox0 = \hbox{\ignorespaces #3}%
-  \ifdim\wd0 > 0pt
-    \unhbox0 % third arg given, show only that
-  \else
-    \setbox0 = \hbox{\ignorespaces #2}%
-    \ifdim\wd0 > 0pt
-      \ifpdf
-        \unhbox0             % PDF: 2nd arg given, show only it
-      \else
-        \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
-      \fi
-    \else
-      \code{#1}% only url given, so show it
-    \fi
-  \fi
-  \endlink
-\endgroup}
-
-% @url synonym for @uref, since that's how everyone uses it.
-%
-\let\url=\uref
-
-% rms does not like angle brackets --karl, 17may97.
-% So now @email is just like @uref, unless we are pdf.
-%
-%\def\email#1{\angleleft{\tt #1}\angleright}
-\ifpdf
-  \def\email#1{\doemail#1,,\finish}
-  \def\doemail#1,#2,#3\finish{\begingroup
-    \unsepspaces
-    \pdfurl{mailto:#1}%
-    \setbox0 = \hbox{\ignorespaces #2}%
-    \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
-    \endlink
-  \endgroup}
-\else
-  \let\email=\uref
-\fi
-
-% Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
-% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
-%
-\def\dmn#1{\thinspace #1}
-
-% @l was never documented to mean ``switch to the Lisp font'',
-% and it is not used as such in any manual I can find.  We need it for
-% Polish suppressed-l.  --karl, 22sep96.
-%\def\l#1{{\li #1}\null}
-
-% @acronym for "FBI", "NATO", and the like.
-% We print this one point size smaller, since it's intended for
-% all-uppercase.
-%
-\def\acronym#1{\doacronym #1,,\finish}
-\def\doacronym#1,#2,#3\finish{%
-  {\selectfonts\lsize #1}%
-  \def\temp{#2}%
-  \ifx\temp\empty \else
-    \space ({\unsepspaces \ignorespaces \temp \unskip})%
-  \fi
-}
-
-% @abbr for "Comput. J." and the like.
-% No font change, but don't do end-of-sentence spacing.
-%
-\def\abbr#1{\doabbr #1,,\finish}
-\def\doabbr#1,#2,#3\finish{%
-  {\plainfrenchspacing #1}%
-  \def\temp{#2}%
-  \ifx\temp\empty \else
-    \space ({\unsepspaces \ignorespaces \temp \unskip})%
-  \fi
-}
-
-
-\message{glyphs,}
-
-% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
-%
-% Since these characters are used in examples, they should be an even number of
-% \tt widths. Each \tt character is 1en, so two makes it 1em.
-%
-\def\point{$\star$}
-\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
-\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
-\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
-\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
-\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
-
-% The @error{} command.
-% Adapted from the TeXbook's \boxit.
-%
-\newbox\errorbox
-%
-{\tentt \global\dimen0 = 3em}% Width of the box.
-\dimen2 = .55pt % Thickness of rules
-% The text. (`r' is open on the right, `e' somewhat less so on the left.)
-\setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt}
-%
-\setbox\errorbox=\hbox to \dimen0{\hfil
-   \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
-   \advance\hsize by -2\dimen2 % Rules.
-   \vbox{%
-      \hrule height\dimen2
-      \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
-         \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
-         \kern3pt\vrule width\dimen2}% Space to right.
-      \hrule height\dimen2}
-    \hfil}
-%
-\def\error{\leavevmode\lower.7ex\copy\errorbox}
-
-% @pounds{} is a sterling sign, which Knuth put in the CM italic font.
-%
-\def\pounds{{\it\$}}
-
-% @euro{} comes from a separate font, depending on the current style.
-% We use the free feym* fonts from the eurosym package by Henrik
-% Theiling, which support regular, slanted, bold and bold slanted (and
-% "outlined" (blackboard board, sort of) versions, which we don't need).
-% It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
-%
-% Although only regular is the truly official Euro symbol, we ignore
-% that.  The Euro is designed to be slightly taller than the regular
-% font height.
-%
-% feymr - regular
-% feymo - slanted
-% feybr - bold
-% feybo - bold slanted
-%
-% There is no good (free) typewriter version, to my knowledge.
-% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
-% Hmm.
-%
-% Also doesn't work in math.  Do we need to do math with euro symbols?
-% Hope not.
-%
-%
-\def\euro{{\eurofont e}}
-\def\eurofont{%
-  % We set the font at each command, rather than predefining it in
-  % \textfonts and the other font-switching commands, so that
-  % installations which never need the symbol don't have to have the
-  % font installed.
-  %
-  % There is only one designed size (nominal 10pt), so we always scale
-  % that to the current nominal size.
-  %
-  % By the way, simply using "at 1em" works for cmr10 and the like, but
-  % does not work for cmbx10 and other extended/shrunken fonts.
-  %
-  \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
-  %
-  \ifx\curfontstyle\bfstylename
-    % bold:
-    \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
-  \else
-    % regular:
-    \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
-  \fi
-  \thiseurofont
-}
-
-% Glyphs from the EC fonts.  We don't use \let for the aliases, because
-% sometimes we redefine the original macro, and the alias should reflect
-% the redefinition.
-%
-% Use LaTeX names for the Icelandic letters.
-\def\DH{{\ecfont \char"D0}} % Eth
-\def\dh{{\ecfont \char"F0}} % eth
-\def\TH{{\ecfont \char"DE}} % Thorn
-\def\th{{\ecfont \char"FE}} % thorn
-%
-\def\guillemetleft{{\ecfont \char"13}}
-\def\guillemotleft{\guillemetleft}
-\def\guillemetright{{\ecfont \char"14}}
-\def\guillemotright{\guillemetright}
-\def\guilsinglleft{{\ecfont \char"0E}}
-\def\guilsinglright{{\ecfont \char"0F}}
-\def\quotedblbase{{\ecfont \char"12}}
-\def\quotesinglbase{{\ecfont \char"0D}}
-%
-% This positioning is not perfect (see the ogonek LaTeX package), but
-% we have the precomposed glyphs for the most common cases.  We put the
-% tests to use those glyphs in the single \ogonek macro so we have fewer
-% dummy definitions to worry about for index entries, etc.
-%
-% ogonek is also used with other letters in Lithuanian (IOU), but using
-% the precomposed glyphs for those is not so easy since they aren't in
-% the same EC font.
-\def\ogonek#1{{%
-  \def\temp{#1}%
-  \ifx\temp\macrocharA\Aogonek
-  \else\ifx\temp\macrochara\aogonek
-  \else\ifx\temp\macrocharE\Eogonek
-  \else\ifx\temp\macrochare\eogonek
-  \else
-    \ecfont \setbox0=\hbox{#1}%
-    \ifdim\ht0=1ex\accent"0C #1%
-    \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
-    \fi
-  \fi\fi\fi\fi
-  }%
-}
-\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
-\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
-\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
-\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
-%
-% Use the ec* fonts (cm-super in outline format) for non-CM glyphs.
-\def\ecfont{%
-  % We can't distinguish serif/sans and italic/slanted, but this
-  % is used for crude hacks anyway (like adding French and German
-  % quotes to documents typeset with CM, where we lose kerning), so
-  % hopefully nobody will notice/care.
-  \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
-  \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
-  \ifx\curfontstyle\bfstylename
-    % bold:
-    \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
-  \else
-    % regular:
-    \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
-  \fi
-  \thisecfont
-}
-
-% @registeredsymbol - R in a circle.  The font for the R should really
-% be smaller yet, but lllsize is the best we can do for now.
-% Adapted from the plain.tex definition of \copyright.
-%
-\def\registeredsymbol{%
-  $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
-               \hfil\crcr\Orb}}%
-    }$%
-}
-
-% @textdegree - the normal degrees sign.
-%
-\def\textdegree{$^\circ$}
-
-% Laurent Siebenmann reports \Orb undefined with:
-%  Textures 1.7.7 (preloaded format=plain 93.10.14)  (68K)  16 APR 2004 02:38
-% so we'll define it if necessary.
-%
-\ifx\Orb\undefined
-\def\Orb{\mathhexbox20D}
-\fi
-
-% Quotes.
-\chardef\quotedblleft="5C
-\chardef\quotedblright=`\"
-\chardef\quoteleft=`\`
-\chardef\quoteright=`\'
-
-
-\message{page headings,}
-
-\newskip\titlepagetopglue \titlepagetopglue = 1.5in
-\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
-
-% First the title page.  Must do @settitle before @titlepage.
-\newif\ifseenauthor
-\newif\iffinishedtitlepage
-
-% Do an implicit @contents or @shortcontents after @end titlepage if the
-% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
-%
-\newif\ifsetcontentsaftertitlepage
- \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
-\newif\ifsetshortcontentsaftertitlepage
- \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
-
-\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
-        \endgroup\page\hbox{}\page}
-
-\envdef\titlepage{%
-  % Open one extra group, as we want to close it in the middle of \Etitlepage.
-  \begingroup
-    \parindent=0pt \textfonts
-    % Leave some space at the very top of the page.
-    \vglue\titlepagetopglue
-    % No rule at page bottom unless we print one at the top with @title.
-    \finishedtitlepagetrue
-    %
-    % Most title ``pages'' are actually two pages long, with space
-    % at the top of the second.  We don't want the ragged left on the second.
-    \let\oldpage = \page
-    \def\page{%
-      \iffinishedtitlepage\else
-	 \finishtitlepage
-      \fi
-      \let\page = \oldpage
-      \page
-      \null
-    }%
-}
-
-\def\Etitlepage{%
-    \iffinishedtitlepage\else
-	\finishtitlepage
-    \fi
-    % It is important to do the page break before ending the group,
-    % because the headline and footline are only empty inside the group.
-    % If we use the new definition of \page, we always get a blank page
-    % after the title page, which we certainly don't want.
-    \oldpage
-  \endgroup
-  %
-  % Need this before the \...aftertitlepage checks so that if they are
-  % in effect the toc pages will come out with page numbers.
-  \HEADINGSon
-  %
-  % If they want short, they certainly want long too.
-  \ifsetshortcontentsaftertitlepage
-    \shortcontents
-    \contents
-    \global\let\shortcontents = \relax
-    \global\let\contents = \relax
-  \fi
-  %
-  \ifsetcontentsaftertitlepage
-    \contents
-    \global\let\contents = \relax
-    \global\let\shortcontents = \relax
-  \fi
-}
-
-\def\finishtitlepage{%
-  \vskip4pt \hrule height 2pt width \hsize
-  \vskip\titlepagebottomglue
-  \finishedtitlepagetrue
-}
-
-%%% Macros to be used within @titlepage:
-
-\let\subtitlerm=\tenrm
-\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
-
-\parseargdef\title{%
-  \checkenv\titlepage
-  \leftline{\titlefonts\rmisbold #1}
-  % print a rule at the page bottom also.
-  \finishedtitlepagefalse
-  \vskip4pt \hrule height 4pt width \hsize \vskip4pt
-}
-
-\parseargdef\subtitle{%
-  \checkenv\titlepage
-  {\subtitlefont \rightline{#1}}%
-}
-
-% @author should come last, but may come many times.
-% It can also be used inside @quotation.
-%
-\parseargdef\author{%
-  \def\temp{\quotation}%
-  \ifx\thisenv\temp
-    \def\quotationauthor{#1}% printed in \Equotation.
-  \else
-    \checkenv\titlepage
-    \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
-    {\secfonts\rmisbold \leftline{#1}}%
-  \fi
-}
-
-
-%%% Set up page headings and footings.
-
-\let\thispage=\folio
-
-\newtoks\evenheadline    % headline on even pages
-\newtoks\oddheadline     % headline on odd pages
-\newtoks\evenfootline    % footline on even pages
-\newtoks\oddfootline     % footline on odd pages
-
-% Now make TeX use those variables
-\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
-                            \else \the\evenheadline \fi}}
-\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
-                            \else \the\evenfootline \fi}\HEADINGShook}
-\let\HEADINGShook=\relax
-
-% Commands to set those variables.
-% For example, this is what  @headings on  does
-% @evenheading @thistitle|@thispage|@thischapter
-% @oddheading @thischapter|@thispage|@thistitle
-% @evenfooting @thisfile||
-% @oddfooting ||@thisfile
-
-
-\def\evenheading{\parsearg\evenheadingxxx}
-\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
-\def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
-\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\def\oddheading{\parsearg\oddheadingxxx}
-\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
-\def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
-\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
-
-\def\evenfooting{\parsearg\evenfootingxxx}
-\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
-\def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
-\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\def\oddfooting{\parsearg\oddfootingxxx}
-\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
-\def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
-  \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
-  %
-  % Leave some space for the footline.  Hopefully ok to assume
-  % @evenfooting will not be used by itself.
-  \global\advance\pageheight by -12pt
-  \global\advance\vsize by -12pt
-}
-
-\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
-
-% @evenheadingmarks top     \thischapter <- chapter at the top of a page
-% @evenheadingmarks bottom  \thischapter <- chapter at the bottom of a page
-%
-% The same set of arguments for:
-%
-% @oddheadingmarks
-% @evenfootingmarks
-% @oddfootingmarks
-% @everyheadingmarks
-% @everyfootingmarks
-
-\def\evenheadingmarks{\headingmarks{even}{heading}}
-\def\oddheadingmarks{\headingmarks{odd}{heading}}
-\def\evenfootingmarks{\headingmarks{even}{footing}}
-\def\oddfootingmarks{\headingmarks{odd}{footing}}
-\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
-                          \headingmarks{odd}{heading}{#1} }
-\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
-                          \headingmarks{odd}{footing}{#1} }
-% #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
-\def\headingmarks#1#2#3 {%
-  \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
-  \global\expandafter\let\csname get#1#2marks\endcsname \temp
-}
-
-\everyheadingmarks bottom
-\everyfootingmarks bottom
-
-% @headings double      turns headings on for double-sided printing.
-% @headings single      turns headings on for single-sided printing.
-% @headings off         turns them off.
-% @headings on          same as @headings double, retained for compatibility.
-% @headings after       turns on double-sided headings after this page.
-% @headings doubleafter turns on double-sided headings after this page.
-% @headings singleafter turns on single-sided headings after this page.
-% By default, they are off at the start of a document,
-% and turned `on' after @end titlepage.
-
-\def\headings #1 {\csname HEADINGS#1\endcsname}
-
-\def\HEADINGSoff{%
-\global\evenheadline={\hfil} \global\evenfootline={\hfil}
-\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
-\HEADINGSoff
-% When we turn headings on, set the page number to 1.
-% For double-sided printing, put current file name in lower left corner,
-% chapter name on inside top of right hand pages, document
-% title on inside top of left hand pages, and page numbers on outside top
-% edge of all pages.
-\def\HEADINGSdouble{%
-\global\pageno=1
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\folio\hfil\thistitle}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chapoddpage
-}
-\let\contentsalignmacro = \chappager
-
-% For single-sided printing, chapter title goes across top left of page,
-% page number on top right.
-\def\HEADINGSsingle{%
-\global\pageno=1
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\thischapter\hfil\folio}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chappager
-}
-\def\HEADINGSon{\HEADINGSdouble}
-
-\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
-\let\HEADINGSdoubleafter=\HEADINGSafter
-\def\HEADINGSdoublex{%
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\folio\hfil\thistitle}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chapoddpage
-}
-
-\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
-\def\HEADINGSsinglex{%
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\thischapter\hfil\folio}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chappager
-}
-
-% Subroutines used in generating headings
-% This produces Day Month Year style of output.
-% Only define if not already defined, in case a txi-??.tex file has set
-% up a different format (e.g., txi-cs.tex does this).
-\ifx\today\undefined
-\def\today{%
-  \number\day\space
-  \ifcase\month
-  \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
-  \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
-  \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
-  \fi
-  \space\number\year}
-\fi
-
-% @settitle line...  specifies the title of the document, for headings.
-% It generates no output of its own.
-\def\thistitle{\putwordNoTitle}
-\def\settitle{\parsearg{\gdef\thistitle}}
-
-
-\message{tables,}
-% Tables -- @table, @ftable, @vtable, @item(x).
-
-% default indentation of table text
-\newdimen\tableindent \tableindent=.8in
-% default indentation of @itemize and @enumerate text
-\newdimen\itemindent  \itemindent=.3in
-% margin between end of table item and start of table text.
-\newdimen\itemmargin  \itemmargin=.1in
-
-% used internally for \itemindent minus \itemmargin
-\newdimen\itemmax
-
-% Note @table, @ftable, and @vtable define @item, @itemx, etc., with
-% these defs.
-% They also define \itemindex
-% to index the item name in whatever manner is desired (perhaps none).
-
-\newif\ifitemxneedsnegativevskip
-
-\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
-
-\def\internalBitem{\smallbreak \parsearg\itemzzz}
-\def\internalBitemx{\itemxpar \parsearg\itemzzz}
-
-\def\itemzzz #1{\begingroup %
-  \advance\hsize by -\rightskip
-  \advance\hsize by -\tableindent
-  \setbox0=\hbox{\itemindicate{#1}}%
-  \itemindex{#1}%
-  \nobreak % This prevents a break before @itemx.
-  %
-  % If the item text does not fit in the space we have, put it on a line
-  % by itself, and do not allow a page break either before or after that
-  % line.  We do not start a paragraph here because then if the next
-  % command is, e.g., @kindex, the whatsit would get put into the
-  % horizontal list on a line by itself, resulting in extra blank space.
-  \ifdim \wd0>\itemmax
-    %
-    % Make this a paragraph so we get the \parskip glue and wrapping,
-    % but leave it ragged-right.
-    \begingroup
-      \advance\leftskip by-\tableindent
-      \advance\hsize by\tableindent
-      \advance\rightskip by0pt plus1fil
-      \leavevmode\unhbox0\par
-    \endgroup
-    %
-    % We're going to be starting a paragraph, but we don't want the
-    % \parskip glue -- logically it's part of the @item we just started.
-    \nobreak \vskip-\parskip
-    %
-    % Stop a page break at the \parskip glue coming up.  However, if
-    % what follows is an environment such as @example, there will be no
-    % \parskip glue; then the negative vskip we just inserted would
-    % cause the example and the item to crash together.  So we use this
-    % bizarre value of 10001 as a signal to \aboveenvbreak to insert
-    % \parskip glue after all.  Section titles are handled this way also.
-    %
-    \penalty 10001
-    \endgroup
-    \itemxneedsnegativevskipfalse
-  \else
-    % The item text fits into the space.  Start a paragraph, so that the
-    % following text (if any) will end up on the same line.
-    \noindent
-    % Do this with kerns and \unhbox so that if there is a footnote in
-    % the item text, it can migrate to the main vertical list and
-    % eventually be printed.
-    \nobreak\kern-\tableindent
-    \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
-    \unhbox0
-    \nobreak\kern\dimen0
-    \endgroup
-    \itemxneedsnegativevskiptrue
-  \fi
-}
-
-\def\item{\errmessage{@item while not in a list environment}}
-\def\itemx{\errmessage{@itemx while not in a list environment}}
-
-% @table, @ftable, @vtable.
-\envdef\table{%
-  \let\itemindex\gobble
-  \tablecheck{table}%
-}
-\envdef\ftable{%
-  \def\itemindex ##1{\doind {fn}{\code{##1}}}%
-  \tablecheck{ftable}%
-}
-\envdef\vtable{%
-  \def\itemindex ##1{\doind {vr}{\code{##1}}}%
-  \tablecheck{vtable}%
-}
-\def\tablecheck#1{%
-  \ifnum \the\catcode`\^^M=\active
-    \endgroup
-    \errmessage{This command won't work in this context; perhaps the problem is
-      that we are \inenvironment\thisenv}%
-    \def\next{\doignore{#1}}%
-  \else
-    \let\next\tablex
-  \fi
-  \next
-}
-\def\tablex#1{%
-  \def\itemindicate{#1}%
-  \parsearg\tabley
-}
-\def\tabley#1{%
-  {%
-    \makevalueexpandable
-    \edef\temp{\noexpand\tablez #1\space\space\space}%
-    \expandafter
-  }\temp \endtablez
-}
-\def\tablez #1 #2 #3 #4\endtablez{%
-  \aboveenvbreak
-  \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
-  \ifnum 0#2>0 \tableindent=#2\mil \fi
-  \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
-  \itemmax=\tableindent
-  \advance \itemmax by -\itemmargin
-  \advance \leftskip by \tableindent
-  \exdentamount=\tableindent
-  \parindent = 0pt
-  \parskip = \smallskipamount
-  \ifdim \parskip=0pt \parskip=2pt \fi
-  \let\item = \internalBitem
-  \let\itemx = \internalBitemx
-}
-\def\Etable{\endgraf\afterenvbreak}
-\let\Eftable\Etable
-\let\Evtable\Etable
-\let\Eitemize\Etable
-\let\Eenumerate\Etable
-
-% This is the counter used by @enumerate, which is really @itemize
-
-\newcount \itemno
-
-\envdef\itemize{\parsearg\doitemize}
-
-\def\doitemize#1{%
-  \aboveenvbreak
-  \itemmax=\itemindent
-  \advance\itemmax by -\itemmargin
-  \advance\leftskip by \itemindent
-  \exdentamount=\itemindent
-  \parindent=0pt
-  \parskip=\smallskipamount
-  \ifdim\parskip=0pt \parskip=2pt \fi
-  %
-  % Try typesetting the item mark that if the document erroneously says
-  % something like @itemize @samp (intending @table), there's an error
-  % right away at the @itemize.  It's not the best error message in the
-  % world, but it's better than leaving it to the @item.  This means if
-  % the user wants an empty mark, they have to say @w{} not just @w.
-  \def\itemcontents{#1}%
-  \setbox0 = \hbox{\itemcontents}%
-  %
-  % @itemize with no arg is equivalent to @itemize @bullet.
-  \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
-  %
-  \let\item=\itemizeitem
-}
-
-% Definition of @item while inside @itemize and @enumerate.
-%
-\def\itemizeitem{%
-  \advance\itemno by 1  % for enumerations
-  {\let\par=\endgraf \smallbreak}% reasonable place to break
-  {%
-   % If the document has an @itemize directly after a section title, a
-   % \nobreak will be last on the list, and \sectionheading will have
-   % done a \vskip-\parskip.  In that case, we don't want to zero
-   % parskip, or the item text will crash with the heading.  On the
-   % other hand, when there is normal text preceding the item (as there
-   % usually is), we do want to zero parskip, or there would be too much
-   % space.  In that case, we won't have a \nobreak before.  At least
-   % that's the theory.
-   \ifnum\lastpenalty<10000 \parskip=0in \fi
-   \noindent
-   \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
-   %
-   \vadjust{\penalty 1200}}% not good to break after first line of item.
-  \flushcr
-}
-
-% \splitoff TOKENS\endmark defines \first to be the first token in
-% TOKENS, and \rest to be the remainder.
-%
-\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
-
-% Allow an optional argument of an uppercase letter, lowercase letter,
-% or number, to specify the first label in the enumerated list.  No
-% argument is the same as `1'.
-%
-\envparseargdef\enumerate{\enumeratey #1  \endenumeratey}
-\def\enumeratey #1 #2\endenumeratey{%
-  % If we were given no argument, pretend we were given `1'.
-  \def\thearg{#1}%
-  \ifx\thearg\empty \def\thearg{1}\fi
-  %
-  % Detect if the argument is a single token.  If so, it might be a
-  % letter.  Otherwise, the only valid thing it can be is a number.
-  % (We will always have one token, because of the test we just made.
-  % This is a good thing, since \splitoff doesn't work given nothing at
-  % all -- the first parameter is undelimited.)
-  \expandafter\splitoff\thearg\endmark
-  \ifx\rest\empty
-    % Only one token in the argument.  It could still be anything.
-    % A ``lowercase letter'' is one whose \lccode is nonzero.
-    % An ``uppercase letter'' is one whose \lccode is both nonzero, and
-    %   not equal to itself.
-    % Otherwise, we assume it's a number.
-    %
-    % We need the \relax at the end of the \ifnum lines to stop TeX from
-    % continuing to look for a <number>.
-    %
-    \ifnum\lccode\expandafter`\thearg=0\relax
-      \numericenumerate % a number (we hope)
-    \else
-      % It's a letter.
-      \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
-        \lowercaseenumerate % lowercase letter
-      \else
-        \uppercaseenumerate % uppercase letter
-      \fi
-    \fi
-  \else
-    % Multiple tokens in the argument.  We hope it's a number.
-    \numericenumerate
-  \fi
-}
-
-% An @enumerate whose labels are integers.  The starting integer is
-% given in \thearg.
-%
-\def\numericenumerate{%
-  \itemno = \thearg
-  \startenumeration{\the\itemno}%
-}
-
-% The starting (lowercase) letter is in \thearg.
-\def\lowercaseenumerate{%
-  \itemno = \expandafter`\thearg
-  \startenumeration{%
-    % Be sure we're not beyond the end of the alphabet.
-    \ifnum\itemno=0
-      \errmessage{No more lowercase letters in @enumerate; get a bigger
-                  alphabet}%
-    \fi
-    \char\lccode\itemno
-  }%
-}
-
-% The starting (uppercase) letter is in \thearg.
-\def\uppercaseenumerate{%
-  \itemno = \expandafter`\thearg
-  \startenumeration{%
-    % Be sure we're not beyond the end of the alphabet.
-    \ifnum\itemno=0
-      \errmessage{No more uppercase letters in @enumerate; get a bigger
-                  alphabet}
-    \fi
-    \char\uccode\itemno
-  }%
-}
-
-% Call \doitemize, adding a period to the first argument and supplying the
-% common last two arguments.  Also subtract one from the initial value in
-% \itemno, since @item increments \itemno.
-%
-\def\startenumeration#1{%
-  \advance\itemno by -1
-  \doitemize{#1.}\flushcr
-}
-
-% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
-% to @enumerate.
-%
-\def\alphaenumerate{\enumerate{a}}
-\def\capsenumerate{\enumerate{A}}
-\def\Ealphaenumerate{\Eenumerate}
-\def\Ecapsenumerate{\Eenumerate}
-
-
-% @multitable macros
-% Amy Hendrickson, 8/18/94, 3/6/96
-%
-% @multitable ... @end multitable will make as many columns as desired.
-% Contents of each column will wrap at width given in preamble.  Width
-% can be specified either with sample text given in a template line,
-% or in percent of \hsize, the current width of text on page.
-
-% Table can continue over pages but will only break between lines.
-
-% To make preamble:
-%
-% Either define widths of columns in terms of percent of \hsize:
-%   @multitable @columnfractions .25 .3 .45
-%   @item ...
-%
-%   Numbers following @columnfractions are the percent of the total
-%   current hsize to be used for each column. You may use as many
-%   columns as desired.
-
-
-% Or use a template:
-%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
-%   @item ...
-%   using the widest term desired in each column.
-
-% Each new table line starts with @item, each subsequent new column
-% starts with @tab. Empty columns may be produced by supplying @tab's
-% with nothing between them for as many times as empty columns are needed,
-% ie, @tab at tab@tab will produce two empty columns.
-
-% @item, @tab do not need to be on their own lines, but it will not hurt
-% if they are.
-
-% Sample multitable:
-
-%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
-%   @item first col stuff @tab second col stuff @tab third col
-%   @item
-%   first col stuff
-%   @tab
-%   second col stuff
-%   @tab
-%   third col
-%   @item first col stuff @tab second col stuff
-%   @tab Many paragraphs of text may be used in any column.
-%
-%         They will wrap at the width determined by the template.
-%   @item at tab@tab This will be in third column.
-%   @end multitable
-
-% Default dimensions may be reset by user.
-% @multitableparskip is vertical space between paragraphs in table.
-% @multitableparindent is paragraph indent in table.
-% @multitablecolmargin is horizontal space to be left between columns.
-% @multitablelinespace is space to leave between table items, baseline
-%                                                            to baseline.
-%   0pt means it depends on current normal line spacing.
-%
-\newskip\multitableparskip
-\newskip\multitableparindent
-\newdimen\multitablecolspace
-\newskip\multitablelinespace
-\multitableparskip=0pt
-\multitableparindent=6pt
-\multitablecolspace=12pt
-\multitablelinespace=0pt
-
-% Macros used to set up halign preamble:
-%
-\let\endsetuptable\relax
-\def\xendsetuptable{\endsetuptable}
-\let\columnfractions\relax
-\def\xcolumnfractions{\columnfractions}
-\newif\ifsetpercent
-
-% #1 is the @columnfraction, usually a decimal number like .5, but might
-% be just 1.  We just use it, whatever it is.
-%
-\def\pickupwholefraction#1 {%
-  \global\advance\colcount by 1
-  \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
-  \setuptable
-}
-
-\newcount\colcount
-\def\setuptable#1{%
-  \def\firstarg{#1}%
-  \ifx\firstarg\xendsetuptable
-    \let\go = \relax
-  \else
-    \ifx\firstarg\xcolumnfractions
-      \global\setpercenttrue
-    \else
-      \ifsetpercent
-         \let\go\pickupwholefraction
-      \else
-         \global\advance\colcount by 1
-         \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
-                   % separator; typically that is always in the input, anyway.
-         \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
-      \fi
-    \fi
-    \ifx\go\pickupwholefraction
-      % Put the argument back for the \pickupwholefraction call, so
-      % we'll always have a period there to be parsed.
-      \def\go{\pickupwholefraction#1}%
-    \else
-      \let\go = \setuptable
-    \fi%
-  \fi
-  \go
-}
-
-% multitable-only commands.
-%
-% @headitem starts a heading row, which we typeset in bold.
-% Assignments have to be global since we are inside the implicit group
-% of an alignment entry.  \everycr resets \everytab so we don't have to
-% undo it ourselves.
-\def\headitemfont{\b}% for people to use in the template row; not changeable
-\def\headitem{%
-  \checkenv\multitable
-  \crcr
-  \global\everytab={\bf}% can't use \headitemfont since the parsing differs
-  \the\everytab % for the first item
-}%
-%
-% A \tab used to include \hskip1sp.  But then the space in a template
-% line is not enough.  That is bad.  So let's go back to just `&' until
-% we again encounter the problem the 1sp was intended to solve.
-%					--karl, nathan at acm.org, 20apr99.
-\def\tab{\checkenv\multitable &\the\everytab}%
-
-% @multitable ... @end multitable definitions:
-%
-\newtoks\everytab  % insert after every tab.
-%
-\envdef\multitable{%
-  \vskip\parskip
-  \startsavinginserts
-  %
-  % @item within a multitable starts a normal row.
-  % We use \def instead of \let so that if one of the multitable entries
-  % contains an @itemize, we don't choke on the \item (seen as \crcr aka
-  % \endtemplate) expanding \doitemize.
-  \def\item{\crcr}%
-  %
-  \tolerance=9500
-  \hbadness=9500
-  \setmultitablespacing
-  \parskip=\multitableparskip
-  \parindent=\multitableparindent
-  \overfullrule=0pt
-  \global\colcount=0
-  %
-  \everycr = {%
-    \noalign{%
-      \global\everytab={}%
-      \global\colcount=0 % Reset the column counter.
-      % Check for saved footnotes, etc.
-      \checkinserts
-      % Keeps underfull box messages off when table breaks over pages.
-      %\filbreak
-	% Maybe so, but it also creates really weird page breaks when the
-	% table breaks over pages. Wouldn't \vfil be better?  Wait until the
-	% problem manifests itself, so it can be fixed for real --karl.
-    }%
-  }%
-  %
-  \parsearg\domultitable
-}
-\def\domultitable#1{%
-  % To parse everything between @multitable and @item:
-  \setuptable#1 \endsetuptable
-  %
-  % This preamble sets up a generic column definition, which will
-  % be used as many times as user calls for columns.
-  % \vtop will set a single line and will also let text wrap and
-  % continue for many paragraphs if desired.
-  \halign\bgroup &%
-    \global\advance\colcount by 1
-    \multistrut
-    \vtop{%
-      % Use the current \colcount to find the correct column width:
-      \hsize=\expandafter\csname col\the\colcount\endcsname
-      %
-      % In order to keep entries from bumping into each other
-      % we will add a \leftskip of \multitablecolspace to all columns after
-      % the first one.
-      %
-      % If a template has been used, we will add \multitablecolspace
-      % to the width of each template entry.
-      %
-      % If the user has set preamble in terms of percent of \hsize we will
-      % use that dimension as the width of the column, and the \leftskip
-      % will keep entries from bumping into each other.  Table will start at
-      % left margin and final column will justify at right margin.
-      %
-      % Make sure we don't inherit \rightskip from the outer environment.
-      \rightskip=0pt
-      \ifnum\colcount=1
-	% The first column will be indented with the surrounding text.
-	\advance\hsize by\leftskip
-      \else
-	\ifsetpercent \else
-	  % If user has not set preamble in terms of percent of \hsize
-	  % we will advance \hsize by \multitablecolspace.
-	  \advance\hsize by \multitablecolspace
-	\fi
-       % In either case we will make \leftskip=\multitablecolspace:
-      \leftskip=\multitablecolspace
-      \fi
-      % Ignoring space at the beginning and end avoids an occasional spurious
-      % blank line, when TeX decides to break the line at the space before the
-      % box from the multistrut, so the strut ends up on a line by itself.
-      % For example:
-      % @multitable @columnfractions .11 .89
-      % @item @code{#}
-      % @tab Legal holiday which is valid in major parts of the whole country.
-      % Is automatically provided with highlighting sequences respectively
-      % marking characters.
-      \noindent\ignorespaces##\unskip\multistrut
-    }\cr
-}
-\def\Emultitable{%
-  \crcr
-  \egroup % end the \halign
-  \global\setpercentfalse
-}
-
-\def\setmultitablespacing{%
-  \def\multistrut{\strut}% just use the standard line spacing
-  %
-  % Compute \multitablelinespace (if not defined by user) for use in
-  % \multitableparskip calculation.  We used define \multistrut based on
-  % this, but (ironically) that caused the spacing to be off.
-  % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
-\ifdim\multitablelinespace=0pt
-\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
-\global\advance\multitablelinespace by-\ht0
-\fi
-%% Test to see if parskip is larger than space between lines of
-%% table. If not, do nothing.
-%%        If so, set to same dimension as multitablelinespace.
-\ifdim\multitableparskip>\multitablelinespace
-\global\multitableparskip=\multitablelinespace
-\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
-                                      %% than skip between lines in the table.
-\fi%
-\ifdim\multitableparskip=0pt
-\global\multitableparskip=\multitablelinespace
-\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
-                                      %% than skip between lines in the table.
-\fi}
-
-
-\message{conditionals,}
-
-% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
-% @ifnotxml always succeed.  They currently do nothing; we don't
-% attempt to check whether the conditionals are properly nested.  But we
-% have to remember that they are conditionals, so that @end doesn't
-% attempt to close an environment group.
-%
-\def\makecond#1{%
-  \expandafter\let\csname #1\endcsname = \relax
-  \expandafter\let\csname iscond.#1\endcsname = 1
-}
-\makecond{iftex}
-\makecond{ifnotdocbook}
-\makecond{ifnothtml}
-\makecond{ifnotinfo}
-\makecond{ifnotplaintext}
-\makecond{ifnotxml}
-
-% Ignore @ignore, @ifhtml, @ifinfo, and the like.
-%
-\def\direntry{\doignore{direntry}}
-\def\documentdescription{\doignore{documentdescription}}
-\def\docbook{\doignore{docbook}}
-\def\html{\doignore{html}}
-\def\ifdocbook{\doignore{ifdocbook}}
-\def\ifhtml{\doignore{ifhtml}}
-\def\ifinfo{\doignore{ifinfo}}
-\def\ifnottex{\doignore{ifnottex}}
-\def\ifplaintext{\doignore{ifplaintext}}
-\def\ifxml{\doignore{ifxml}}
-\def\ignore{\doignore{ignore}}
-\def\menu{\doignore{menu}}
-\def\xml{\doignore{xml}}
-
-% Ignore text until a line `@end #1', keeping track of nested conditionals.
-%
-% A count to remember the depth of nesting.
-\newcount\doignorecount
-
-\def\doignore#1{\begingroup
-  % Scan in ``verbatim'' mode:
-  \obeylines
-  \catcode`\@ = \other
-  \catcode`\{ = \other
-  \catcode`\} = \other
-  %
-  % Make sure that spaces turn into tokens that match what \doignoretext wants.
-  \spaceisspace
-  %
-  % Count number of #1's that we've seen.
-  \doignorecount = 0
-  %
-  % Swallow text until we reach the matching `@end #1'.
-  \dodoignore{#1}%
-}
-
-{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
-  \obeylines %
-  %
-  \gdef\dodoignore#1{%
-    % #1 contains the command name as a string, e.g., `ifinfo'.
-    %
-    % Define a command to find the next `@end #1'.
-    \long\def\doignoretext##1^^M at end #1{%
-      \doignoretextyyy##1^^M@#1\_STOP_}%
-    %
-    % And this command to find another #1 command, at the beginning of a
-    % line.  (Otherwise, we would consider a line `@c @ifset', for
-    % example, to count as an @ifset for nesting.)
-    \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
-    %
-    % And now expand that command.
-    \doignoretext ^^M%
-  }%
-}
-
-\def\doignoreyyy#1{%
-  \def\temp{#1}%
-  \ifx\temp\empty			% Nothing found.
-    \let\next\doignoretextzzz
-  \else					% Found a nested condition, ...
-    \advance\doignorecount by 1
-    \let\next\doignoretextyyy		% ..., look for another.
-    % If we're here, #1 ends with ^^M\ifinfo (for example).
-  \fi
-  \next #1% the token \_STOP_ is present just after this macro.
-}
-
-% We have to swallow the remaining "\_STOP_".
-%
-\def\doignoretextzzz#1{%
-  \ifnum\doignorecount = 0	% We have just found the outermost @end.
-    \let\next\enddoignore
-  \else				% Still inside a nested condition.
-    \advance\doignorecount by -1
-    \let\next\doignoretext      % Look for the next @end.
-  \fi
-  \next
-}
-
-% Finish off ignored text.
-{ \obeylines%
-  % Ignore anything after the last `@end #1'; this matters in verbatim
-  % environments, where otherwise the newline after an ignored conditional
-  % would result in a blank line in the output.
-  \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
-}
-
-
-% @set VAR sets the variable VAR to an empty value.
-% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
-%
-% Since we want to separate VAR from REST-OF-LINE (which might be
-% empty), we can't just use \parsearg; we have to insert a space of our
-% own to delimit the rest of the line, and then take it out again if we
-% didn't need it.
-% We rely on the fact that \parsearg sets \catcode`\ =10.
-%
-\parseargdef\set{\setyyy#1 \endsetyyy}
-\def\setyyy#1 #2\endsetyyy{%
-  {%
-    \makevalueexpandable
-    \def\temp{#2}%
-    \edef\next{\gdef\makecsname{SET#1}}%
-    \ifx\temp\empty
-      \next{}%
-    \else
-      \setzzz#2\endsetzzz
-    \fi
-  }%
-}
-% Remove the trailing space \setxxx inserted.
-\def\setzzz#1 \endsetzzz{\next{#1}}
-
-% @clear VAR clears (i.e., unsets) the variable VAR.
-%
-\parseargdef\clear{%
-  {%
-    \makevalueexpandable
-    \global\expandafter\let\csname SET#1\endcsname=\relax
-  }%
-}
-
-% @value{foo} gets the text saved in variable foo.
-\def\value{\begingroup\makevalueexpandable\valuexxx}
-\def\valuexxx#1{\expandablevalue{#1}\endgroup}
-{
-  \catcode`\- = \active \catcode`\_ = \active
-  %
-  \gdef\makevalueexpandable{%
-    \let\value = \expandablevalue
-    % We don't want these characters active, ...
-    \catcode`\-=\other \catcode`\_=\other
-    % ..., but we might end up with active ones in the argument if
-    % we're called from @code, as @code{@value{foo-bar_}}, though.
-    % So \let them to their normal equivalents.
-    \let-\realdash \let_\normalunderscore
-  }
-}
-
-% We have this subroutine so that we can handle at least some @value's
-% properly in indexes (we call \makevalueexpandable in \indexdummies).
-% The command has to be fully expandable (if the variable is set), since
-% the result winds up in the index file.  This means that if the
-% variable's value contains other Texinfo commands, it's almost certain
-% it will fail (although perhaps we could fix that with sufficient work
-% to do a one-level expansion on the result, instead of complete).
-%
-\def\expandablevalue#1{%
-  \expandafter\ifx\csname SET#1\endcsname\relax
-    {[No value for ``#1'']}%
-    \message{Variable `#1', used in @value, is not set.}%
-  \else
-    \csname SET#1\endcsname
-  \fi
-}
-
-% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
-% with @set.
-%
-% To get special treatment of `@end ifset,' call \makeond and the redefine.
-%
-\makecond{ifset}
-\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
-\def\doifset#1#2{%
-  {%
-    \makevalueexpandable
-    \let\next=\empty
-    \expandafter\ifx\csname SET#2\endcsname\relax
-      #1% If not set, redefine \next.
-    \fi
-    \expandafter
-  }\next
-}
-\def\ifsetfail{\doignore{ifset}}
-
-% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
-% defined with @set, or has been undefined with @clear.
-%
-% The `\else' inside the `\doifset' parameter is a trick to reuse the
-% above code: if the variable is not set, do nothing, if it is set,
-% then redefine \next to \ifclearfail.
-%
-\makecond{ifclear}
-\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
-\def\ifclearfail{\doignore{ifclear}}
-
-% @dircategory CATEGORY  -- specify a category of the dir file
-% which this file should belong to.  Ignore this in TeX.
-\let\dircategory=\comment
-
-% @defininfoenclose.
-\let\definfoenclose=\comment
-
-
-\message{indexing,}
-% Index generation facilities
-
-% Define \newwrite to be identical to plain tex's \newwrite
-% except not \outer, so it can be used within macros and \if's.
-\edef\newwrite{\makecsname{ptexnewwrite}}
-
-% \newindex {foo} defines an index named foo.
-% It automatically defines \fooindex such that
-% \fooindex ...rest of line... puts an entry in the index foo.
-% It also defines \fooindfile to be the number of the output channel for
-% the file that accumulates this index.  The file's extension is foo.
-% The name of an index should be no more than 2 characters long
-% for the sake of vms.
-%
-\def\newindex#1{%
-  \iflinks
-    \expandafter\newwrite \csname#1indfile\endcsname
-    \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
-  \fi
-  \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
-    \noexpand\doindex{#1}}
-}
-
-% @defindex foo  ==  \newindex{foo}
-%
-\def\defindex{\parsearg\newindex}
-
-% Define @defcodeindex, like @defindex except put all entries in @code.
-%
-\def\defcodeindex{\parsearg\newcodeindex}
-%
-\def\newcodeindex#1{%
-  \iflinks
-    \expandafter\newwrite \csname#1indfile\endcsname
-    \openout \csname#1indfile\endcsname \jobname.#1
-  \fi
-  \expandafter\xdef\csname#1index\endcsname{%
-    \noexpand\docodeindex{#1}}%
-}
-
-
-% @synindex foo bar    makes index foo feed into index bar.
-% Do this instead of @defindex foo if you don't want it as a separate index.
-%
-% @syncodeindex foo bar   similar, but put all entries made for index foo
-% inside @code.
-%
-\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
-\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
-
-% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
-% #3 the target index (bar).
-\def\dosynindex#1#2#3{%
-  % Only do \closeout if we haven't already done it, else we'll end up
-  % closing the target index.
-  \expandafter \ifx\csname donesynindex#2\endcsname \relax
-    % The \closeout helps reduce unnecessary open files; the limit on the
-    % Acorn RISC OS is a mere 16 files.
-    \expandafter\closeout\csname#2indfile\endcsname
-    \expandafter\let\csname donesynindex#2\endcsname = 1
-  \fi
-  % redefine \fooindfile:
-  \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
-  \expandafter\let\csname#2indfile\endcsname=\temp
-  % redefine \fooindex:
-  \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
-}
-
-% Define \doindex, the driver for all \fooindex macros.
-% Argument #1 is generated by the calling \fooindex macro,
-%  and it is "foo", the name of the index.
-
-% \doindex just uses \parsearg; it calls \doind for the actual work.
-% This is because \doind is more useful to call from other macros.
-
-% There is also \dosubind {index}{topic}{subtopic}
-% which makes an entry in a two-level index such as the operation index.
-
-\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
-\def\singleindexer #1{\doind{\indexname}{#1}}
-
-% like the previous two, but they put @code around the argument.
-\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
-\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
-
-% Take care of Texinfo commands that can appear in an index entry.
-% Since there are some commands we want to expand, and others we don't,
-% we have to laboriously prevent expansion for those that we don't.
-%
-\def\indexdummies{%
-  \escapechar = `\\     % use backslash in output files.
-  \def\@{@}% change to @@ when we switch to @ as escape char in index files.
-  \def\ {\realbackslash\space }%
-  %
-  % Need these in case \tex is in effect and \{ is a \delimiter again.
-  % But can't use \lbracecmd and \rbracecmd because texindex assumes
-  % braces and backslashes are used only as delimiters.
-  \let\{ = \mylbrace
-  \let\} = \myrbrace
-  %
-  % I don't entirely understand this, but when an index entry is
-  % generated from a macro call, the \endinput which \scanmacro inserts
-  % causes processing to be prematurely terminated.  This is,
-  % apparently, because \indexsorttmp is fully expanded, and \endinput
-  % is an expandable command.  The redefinition below makes \endinput
-  % disappear altogether for that purpose -- although logging shows that
-  % processing continues to some further point.  On the other hand, it
-  % seems \endinput does not hurt in the printed index arg, since that
-  % is still getting written without apparent harm.
-  %
-  % Sample source (mac-idx3.tex, reported by Graham Percival to
-  % help-texinfo, 22may06):
-  % @macro funindex {WORD}
-  % @findex xyz
-  % @end macro
-  % ...
-  % @funindex commtest
-  %
-  % The above is not enough to reproduce the bug, but it gives the flavor.
-  %
-  % Sample whatsit resulting:
-  % . at write3{\entry{xyz}{@folio }{@code {xyz at endinput }}}
-  %
-  % So:
-  \let\endinput = \empty
-  %
-  % Do the redefinitions.
-  \commondummies
-}
-
-% For the aux and toc files, @ is the escape character.  So we want to
-% redefine everything using @ as the escape character (instead of
-% \realbackslash, still used for index files).  When everything uses @,
-% this will be simpler.
-%
-\def\atdummies{%
-  \def\@{@@}%
-  \def\ {@ }%
-  \let\{ = \lbraceatcmd
-  \let\} = \rbraceatcmd
-  %
-  % Do the redefinitions.
-  \commondummies
-  \otherbackslash
-}
-
-% Called from \indexdummies and \atdummies.
-%
-\def\commondummies{%
-  %
-  % \definedummyword defines \#1 as \string\#1\space, thus effectively
-  % preventing its expansion.  This is used only for control% words,
-  % not control letters, because the \space would be incorrect for
-  % control characters, but is needed to separate the control word
-  % from whatever follows.
-  %
-  % For control letters, we have \definedummyletter, which omits the
-  % space.
-  %
-  % These can be used both for control words that take an argument and
-  % those that do not.  If it is followed by {arg} in the input, then
-  % that will dutifully get written to the index (or wherever).
-  %
-  \def\definedummyword  ##1{\def##1{\string##1\space}}%
-  \def\definedummyletter##1{\def##1{\string##1}}%
-  \let\definedummyaccent\definedummyletter
-  %
-  \commondummiesnofonts
-  %
-  \definedummyletter\_%
-  %
-  % Non-English letters.
-  \definedummyword\AA
-  \definedummyword\AE
-  \definedummyword\DH
-  \definedummyword\L
-  \definedummyword\O
-  \definedummyword\OE
-  \definedummyword\TH
-  \definedummyword\aa
-  \definedummyword\ae
-  \definedummyword\dh
-  \definedummyword\exclamdown
-  \definedummyword\l
-  \definedummyword\o
-  \definedummyword\oe
-  \definedummyword\ordf
-  \definedummyword\ordm
-  \definedummyword\questiondown
-  \definedummyword\ss
-  \definedummyword\th
-  %
-  % Although these internal commands shouldn't show up, sometimes they do.
-  \definedummyword\bf
-  \definedummyword\gtr
-  \definedummyword\hat
-  \definedummyword\less
-  \definedummyword\sf
-  \definedummyword\sl
-  \definedummyword\tclose
-  \definedummyword\tt
-  %
-  \definedummyword\LaTeX
-  \definedummyword\TeX
-  %
-  % Assorted special characters.
-  \definedummyword\bullet
-  \definedummyword\comma
-  \definedummyword\copyright
-  \definedummyword\registeredsymbol
-  \definedummyword\dots
-  \definedummyword\enddots
-  \definedummyword\equiv
-  \definedummyword\error
-  \definedummyword\euro
-  \definedummyword\guillemetleft
-  \definedummyword\guillemetright
-  \definedummyword\guilsinglleft
-  \definedummyword\guilsinglright
-  \definedummyword\expansion
-  \definedummyword\minus
-  \definedummyword\ogonek
-  \definedummyword\pounds
-  \definedummyword\point
-  \definedummyword\print
-  \definedummyword\quotedblbase
-  \definedummyword\quotedblleft
-  \definedummyword\quotedblright
-  \definedummyword\quoteleft
-  \definedummyword\quoteright
-  \definedummyword\quotesinglbase
-  \definedummyword\result
-  \definedummyword\textdegree
-  %
-  % We want to disable all macros so that they are not expanded by \write.
-  \macrolist
-  %
-  \normalturnoffactive
-  %
-  % Handle some cases of @value -- where it does not contain any
-  % (non-fully-expandable) commands.
-  \makevalueexpandable
-}
-
-% \commondummiesnofonts: common to \commondummies and \indexnofonts.
-%
-\def\commondummiesnofonts{%
-  % Control letters and accents.
-  \definedummyletter\!%
-  \definedummyaccent\"%
-  \definedummyaccent\'%
-  \definedummyletter\*%
-  \definedummyaccent\,%
-  \definedummyletter\.%
-  \definedummyletter\/%
-  \definedummyletter\:%
-  \definedummyaccent\=%
-  \definedummyletter\?%
-  \definedummyaccent\^%
-  \definedummyaccent\`%
-  \definedummyaccent\~%
-  \definedummyword\u
-  \definedummyword\v
-  \definedummyword\H
-  \definedummyword\dotaccent
-  \definedummyword\ogonek
-  \definedummyword\ringaccent
-  \definedummyword\tieaccent
-  \definedummyword\ubaraccent
-  \definedummyword\udotaccent
-  \definedummyword\dotless
-  %
-  % Texinfo font commands.
-  \definedummyword\b
-  \definedummyword\i
-  \definedummyword\r
-  \definedummyword\sc
-  \definedummyword\t
-  %
-  % Commands that take arguments.
-  \definedummyword\acronym
-  \definedummyword\cite
-  \definedummyword\code
-  \definedummyword\command
-  \definedummyword\dfn
-  \definedummyword\emph
-  \definedummyword\env
-  \definedummyword\file
-  \definedummyword\kbd
-  \definedummyword\key
-  \definedummyword\math
-  \definedummyword\option
-  \definedummyword\pxref
-  \definedummyword\ref
-  \definedummyword\samp
-  \definedummyword\strong
-  \definedummyword\tie
-  \definedummyword\uref
-  \definedummyword\url
-  \definedummyword\var
-  \definedummyword\verb
-  \definedummyword\w
-  \definedummyword\xref
-}
-
-% \indexnofonts is used when outputting the strings to sort the index
-% by, and when constructing control sequence names.  It eliminates all
-% control sequences and just writes whatever the best ASCII sort string
-% would be for a given command (usually its argument).
-%
-\def\indexnofonts{%
-  % Accent commands should become @asis.
-  \def\definedummyaccent##1{\let##1\asis}%
-  % We can just ignore other control letters.
-  \def\definedummyletter##1{\let##1\empty}%
-  % Hopefully, all control words can become @asis.
-  \let\definedummyword\definedummyaccent
-  %
-  \commondummiesnofonts
-  %
-  % Don't no-op \tt, since it isn't a user-level command
-  % and is used in the definitions of the active chars like <, >, |, etc.
-  % Likewise with the other plain tex font commands.
-  %\let\tt=\asis
-  %
-  \def\ { }%
-  \def\@{@}%
-  % how to handle braces?
-  \def\_{\normalunderscore}%
-  %
-  % Non-English letters.
-  \def\AA{AA}%
-  \def\AE{AE}%
-  \def\DH{DZZ}%
-  \def\L{L}%
-  \def\OE{OE}%
-  \def\O{O}%
-  \def\TH{ZZZ}%
-  \def\aa{aa}%
-  \def\ae{ae}%
-  \def\dh{dzz}%
-  \def\exclamdown{!}%
-  \def\l{l}%
-  \def\oe{oe}%
-  \def\ordf{a}%
-  \def\ordm{o}%
-  \def\o{o}%
-  \def\questiondown{?}%
-  \def\ss{ss}%
-  \def\th{zzz}%
-  %
-  \def\LaTeX{LaTeX}%
-  \def\TeX{TeX}%
-  %
-  % Assorted special characters.
-  % (The following {} will end up in the sort string, but that's ok.)
-  \def\bullet{bullet}%
-  \def\comma{,}%
-  \def\copyright{copyright}%
-  \def\dots{...}%
-  \def\enddots{...}%
-  \def\equiv{==}%
-  \def\error{error}%
-  \def\euro{euro}%
-  \def\expansion{==>}%
-  \def\guillemetleft{<<}%
-  \def\guillemetright{>>}%
-  \def\guilsinglleft{<}%
-  \def\guilsinglright{>}%
-  \def\minus{-}%
-  \def\point{.}%
-  \def\pounds{pounds}%
-  \def\print{-|}%
-  \def\quotedblbase{"}%
-  \def\quotedblleft{"}%
-  \def\quotedblright{"}%
-  \def\quoteleft{`}%
-  \def\quoteright{'}%
-  \def\quotesinglbase{,}%
-  \def\registeredsymbol{R}%
-  \def\result{=>}%
-  \def\textdegree{o}%
-  %
-  % We need to get rid of all macros, leaving only the arguments (if present).
-  % Of course this is not nearly correct, but it is the best we can do for now.
-  % makeinfo does not expand macros in the argument to @deffn, which ends up
-  % writing an index entry, and texindex isn't prepared for an index sort entry
-  % that starts with \.
-  %
-  % Since macro invocations are followed by braces, we can just redefine them
-  % to take a single TeX argument.  The case of a macro invocation that
-  % goes to end-of-line is not handled.
-  %
-  \macrolist
-}
-
-\let\indexbackslash=0  %overridden during \printindex.
-\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
-
-% Most index entries go through here, but \dosubind is the general case.
-% #1 is the index name, #2 is the entry text.
-\def\doind#1#2{\dosubind{#1}{#2}{}}
-
-% Workhorse for all \fooindexes.
-% #1 is name of index, #2 is stuff to put there, #3 is subentry --
-% empty if called from \doind, as we usually are (the main exception
-% is with most defuns, which call us directly).
-%
-\def\dosubind#1#2#3{%
-  \iflinks
-  {%
-    % Store the main index entry text (including the third arg).
-    \toks0 = {#2}%
-    % If third arg is present, precede it with a space.
-    \def\thirdarg{#3}%
-    \ifx\thirdarg\empty \else
-      \toks0 = \expandafter{\the\toks0 \space #3}%
-    \fi
-    %
-    \edef\writeto{\csname#1indfile\endcsname}%
-    %
-    \safewhatsit\dosubindwrite
-  }%
-  \fi
-}
-
-% Write the entry in \toks0 to the index file:
-%
-\def\dosubindwrite{%
-  % Put the index entry in the margin if desired.
-  \ifx\SETmarginindex\relax\else
-    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
-  \fi
-  %
-  % Remember, we are within a group.
-  \indexdummies % Must do this here, since \bf, etc expand at this stage
-  \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now
-      % so it will be output as is; and it will print as backslash.
-  %
-  % Process the index entry with all font commands turned off, to
-  % get the string to sort by.
-  {\indexnofonts
-   \edef\temp{\the\toks0}% need full expansion
-   \xdef\indexsorttmp{\temp}%
-  }%
-  %
-  % Set up the complete index entry, with both the sort key and
-  % the original text, including any font commands.  We write
-  % three arguments to \entry to the .?? file (four in the
-  % subentry case), texindex reduces to two when writing the .??s
-  % sorted result.
-  \edef\temp{%
-    \write\writeto{%
-      \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}%
-  }%
-  \temp
-}
-
-% Take care of unwanted page breaks/skips around a whatsit:
-%
-% If a skip is the last thing on the list now, preserve it
-% by backing up by \lastskip, doing the \write, then inserting
-% the skip again.  Otherwise, the whatsit generated by the
-% \write or \pdfdest will make \lastskip zero.  The result is that
-% sequences like this:
-% @end defun
-% @tindex whatever
-% @defun ...
-% will have extra space inserted, because the \medbreak in the
-% start of the @defun won't see the skip inserted by the @end of
-% the previous defun.
-%
-% But don't do any of this if we're not in vertical mode.  We
-% don't want to do a \vskip and prematurely end a paragraph.
-%
-% Avoid page breaks due to these extra skips, too.
-%
-% But wait, there is a catch there:
-% We'll have to check whether \lastskip is zero skip.  \ifdim is not
-% sufficient for this purpose, as it ignores stretch and shrink parts
-% of the skip.  The only way seems to be to check the textual
-% representation of the skip.
-%
-% The following is almost like \def\zeroskipmacro{0.0pt} except that
-% the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
-%
-\edef\zeroskipmacro{\expandafter\the\csname z at skip\endcsname}
-%
-\newskip\whatsitskip
-\newcount\whatsitpenalty
-%
-% ..., ready, GO:
-%
-\def\safewhatsit#1{%
-\ifhmode
-  #1%
-\else
-  % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
-  \whatsitskip = \lastskip
-  \edef\lastskipmacro{\the\lastskip}%
-  \whatsitpenalty = \lastpenalty
-  %
-  % If \lastskip is nonzero, that means the last item was a
-  % skip.  And since a skip is discardable, that means this
-  % -\whatsitskip glue we're inserting is preceded by a
-  % non-discardable item, therefore it is not a potential
-  % breakpoint, therefore no \nobreak needed.
-  \ifx\lastskipmacro\zeroskipmacro
-  \else
-    \vskip-\whatsitskip
-  \fi
-  %
-  #1%
-  %
-  \ifx\lastskipmacro\zeroskipmacro
-    % If \lastskip was zero, perhaps the last item was a penalty, and
-    % perhaps it was >=10000, e.g., a \nobreak.  In that case, we want
-    % to re-insert the same penalty (values >10000 are used for various
-    % signals); since we just inserted a non-discardable item, any
-    % following glue (such as a \parskip) would be a breakpoint.  For example:
-    %
-    %   @deffn deffn-whatever
-    %   @vindex index-whatever
-    %   Description.
-    % would allow a break between the index-whatever whatsit
-    % and the "Description." paragraph.
-    \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
-  \else
-    % On the other hand, if we had a nonzero \lastskip,
-    % this make-up glue would be preceded by a non-discardable item
-    % (the whatsit from the \write), so we must insert a \nobreak.
-    \nobreak\vskip\whatsitskip
-  \fi
-\fi
-}
-
-% The index entry written in the file actually looks like
-%  \entry {sortstring}{page}{topic}
-% or
-%  \entry {sortstring}{page}{topic}{subtopic}
-% The texindex program reads in these files and writes files
-% containing these kinds of lines:
-%  \initial {c}
-%     before the first topic whose initial is c
-%  \entry {topic}{pagelist}
-%     for a topic that is used without subtopics
-%  \primary {topic}
-%     for the beginning of a topic that is used with subtopics
-%  \secondary {subtopic}{pagelist}
-%     for each subtopic.
-
-% Define the user-accessible indexing commands
-% @findex, @vindex, @kindex, @cindex.
-
-\def\findex {\fnindex}
-\def\kindex {\kyindex}
-\def\cindex {\cpindex}
-\def\vindex {\vrindex}
-\def\tindex {\tpindex}
-\def\pindex {\pgindex}
-
-\def\cindexsub {\begingroup\obeylines\cindexsub}
-{\obeylines %
-\gdef\cindexsub "#1" #2^^M{\endgroup %
-\dosubind{cp}{#2}{#1}}}
-
-% Define the macros used in formatting output of the sorted index material.
-
-% @printindex causes a particular index (the ??s file) to get printed.
-% It does not print any chapter heading (usually an @unnumbered).
-%
-\parseargdef\printindex{\begingroup
-  \dobreak \chapheadingskip{10000}%
-  %
-  \smallfonts \rm
-  \tolerance = 9500
-  \plainfrenchspacing
-  \everypar = {}% don't want the \kern\-parindent from indentation suppression.
-  %
-  % See if the index file exists and is nonempty.
-  % Change catcode of @ here so that if the index file contains
-  % \initial {@}
-  % as its first line, TeX doesn't complain about mismatched braces
-  % (because it thinks @} is a control sequence).
-  \catcode`\@ = 11
-  \openin 1 \jobname.#1s
-  \ifeof 1
-    % \enddoublecolumns gets confused if there is no text in the index,
-    % and it loses the chapter title and the aux file entries for the
-    % index.  The easiest way to prevent this problem is to make sure
-    % there is some text.
-    \putwordIndexNonexistent
-  \else
-    %
-    % If the index file exists but is empty, then \openin leaves \ifeof
-    % false.  We have to make TeX try to read something from the file, so
-    % it can discover if there is anything in it.
-    \read 1 to \temp
-    \ifeof 1
-      \putwordIndexIsEmpty
-    \else
-      % Index files are almost Texinfo source, but we use \ as the escape
-      % character.  It would be better to use @, but that's too big a change
-      % to make right now.
-      \def\indexbackslash{\backslashcurfont}%
-      \catcode`\\ = 0
-      \escapechar = `\\
-      \begindoublecolumns
-      \input \jobname.#1s
-      \enddoublecolumns
-    \fi
-  \fi
-  \closein 1
-\endgroup}
-
-% These macros are used by the sorted index file itself.
-% Change them to control the appearance of the index.
-
-\def\initial#1{{%
-  % Some minor font changes for the special characters.
-  \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
-  %
-  % Remove any glue we may have, we'll be inserting our own.
-  \removelastskip
-  %
-  % We like breaks before the index initials, so insert a bonus.
-  \nobreak
-  \vskip 0pt plus 3\baselineskip
-  \penalty 0
-  \vskip 0pt plus -3\baselineskip
-  %
-  % Typeset the initial.  Making this add up to a whole number of
-  % baselineskips increases the chance of the dots lining up from column
-  % to column.  It still won't often be perfect, because of the stretch
-  % we need before each entry, but it's better.
-  %
-  % No shrink because it confuses \balancecolumns.
-  \vskip 1.67\baselineskip plus .5\baselineskip
-  \leftline{\secbf #1}%
-  % Do our best not to break after the initial.
-  \nobreak
-  \vskip .33\baselineskip plus .1\baselineskip
-}}
-
-% \entry typesets a paragraph consisting of the text (#1), dot leaders, and
-% then page number (#2) flushed to the right margin.  It is used for index
-% and table of contents entries.  The paragraph is indented by \leftskip.
-%
-% A straightforward implementation would start like this:
-%	\def\entry#1#2{...
-% But this freezes the catcodes in the argument, and can cause problems to
-% @code, which sets - active.  This problem was fixed by a kludge---
-% ``-'' was active throughout whole index, but this isn't really right.
-%
-% The right solution is to prevent \entry from swallowing the whole text.
-%                                 --kasal, 21nov03
-\def\entry{%
-  \begingroup
-    %
-    % Start a new paragraph if necessary, so our assignments below can't
-    % affect previous text.
-    \par
-    %
-    % Do not fill out the last line with white space.
-    \parfillskip = 0in
-    %
-    % No extra space above this paragraph.
-    \parskip = 0in
-    %
-    % Do not prefer a separate line ending with a hyphen to fewer lines.
-    \finalhyphendemerits = 0
-    %
-    % \hangindent is only relevant when the entry text and page number
-    % don't both fit on one line.  In that case, bob suggests starting the
-    % dots pretty far over on the line.  Unfortunately, a large
-    % indentation looks wrong when the entry text itself is broken across
-    % lines.  So we use a small indentation and put up with long leaders.
-    %
-    % \hangafter is reset to 1 (which is the value we want) at the start
-    % of each paragraph, so we need not do anything with that.
-    \hangindent = 2em
-    %
-    % When the entry text needs to be broken, just fill out the first line
-    % with blank space.
-    \rightskip = 0pt plus1fil
-    %
-    % A bit of stretch before each entry for the benefit of balancing
-    % columns.
-    \vskip 0pt plus1pt
-    %
-    % Swallow the left brace of the text (first parameter):
-    \afterassignment\doentry
-    \let\temp =
-}
-\def\doentry{%
-    \bgroup % Instead of the swallowed brace.
-      \noindent
-      \aftergroup\finishentry
-      % And now comes the text of the entry.
-}
-\def\finishentry#1{%
-    % #1 is the page number.
-    %
-    % The following is kludged to not output a line of dots in the index if
-    % there are no page numbers.  The next person who breaks this will be
-    % cursed by a Unix daemon.
-    \setbox\boxA = \hbox{#1}%
-    \ifdim\wd\boxA = 0pt
-      \ %
-    \else
-      %
-      % If we must, put the page number on a line of its own, and fill out
-      % this line with blank space.  (The \hfil is overwhelmed with the
-      % fill leaders glue in \indexdotfill if the page number does fit.)
-      \hfil\penalty50
-      \null\nobreak\indexdotfill % Have leaders before the page number.
-      %
-      % The `\ ' here is removed by the implicit \unskip that TeX does as
-      % part of (the primitive) \par.  Without it, a spurious underfull
-      % \hbox ensues.
-      \ifpdf
-	\pdfgettoks#1.%
-	\ \the\toksA
-      \else
-	\ #1%
-      \fi
-    \fi
-    \par
-  \endgroup
-}
-
-% Like plain.tex's \dotfill, except uses up at least 1 em.
-\def\indexdotfill{\cleaders
-  \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill}
-
-\def\primary #1{\line{#1\hfil}}
-
-\newskip\secondaryindent \secondaryindent=0.5cm
-\def\secondary#1#2{{%
-  \parfillskip=0in
-  \parskip=0in
-  \hangindent=1in
-  \hangafter=1
-  \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
-  \ifpdf
-    \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
-  \else
-    #2
-  \fi
-  \par
-}}
-
-% Define two-column mode, which we use to typeset indexes.
-% Adapted from the TeXbook, page 416, which is to say,
-% the manmac.tex format used to print the TeXbook itself.
-\catcode`\@=11
-
-\newbox\partialpage
-\newdimen\doublecolumnhsize
-
-\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
-  % Grab any single-column material above us.
-  \output = {%
-    %
-    % Here is a possibility not foreseen in manmac: if we accumulate a
-    % whole lot of material, we might end up calling this \output
-    % routine twice in a row (see the doublecol-lose test, which is
-    % essentially a couple of indexes with @setchapternewpage off).  In
-    % that case we just ship out what is in \partialpage with the normal
-    % output routine.  Generally, \partialpage will be empty when this
-    % runs and this will be a no-op.  See the indexspread.tex test case.
-    \ifvoid\partialpage \else
-      \onepageout{\pagecontents\partialpage}%
-    \fi
-    %
-    \global\setbox\partialpage = \vbox{%
-      % Unvbox the main output page.
-      \unvbox\PAGE
-      \kern-\topskip \kern\baselineskip
-    }%
-  }%
-  \eject % run that output routine to set \partialpage
-  %
-  % Use the double-column output routine for subsequent pages.
-  \output = {\doublecolumnout}%
-  %
-  % Change the page size parameters.  We could do this once outside this
-  % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
-  % format, but then we repeat the same computation.  Repeating a couple
-  % of assignments once per index is clearly meaningless for the
-  % execution time, so we may as well do it in one place.
-  %
-  % First we halve the line length, less a little for the gutter between
-  % the columns.  We compute the gutter based on the line length, so it
-  % changes automatically with the paper format.  The magic constant
-  % below is chosen so that the gutter has the same value (well, +-<1pt)
-  % as it did when we hard-coded it.
-  %
-  % We put the result in a separate register, \doublecolumhsize, so we
-  % can restore it in \pagesofar, after \hsize itself has (potentially)
-  % been clobbered.
-  %
-  \doublecolumnhsize = \hsize
-    \advance\doublecolumnhsize by -.04154\hsize
-    \divide\doublecolumnhsize by 2
-  \hsize = \doublecolumnhsize
-  %
-  % Double the \vsize as well.  (We don't need a separate register here,
-  % since nobody clobbers \vsize.)
-  \vsize = 2\vsize
-}
-
-% The double-column output routine for all double-column pages except
-% the last.
-%
-\def\doublecolumnout{%
-  \splittopskip=\topskip \splitmaxdepth=\maxdepth
-  % Get the available space for the double columns -- the normal
-  % (undoubled) page height minus any material left over from the
-  % previous page.
-  \dimen@ = \vsize
-  \divide\dimen@ by 2
-  \advance\dimen@ by -\ht\partialpage
-  %
-  % box0 will be the left-hand column, box2 the right.
-  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
-  \onepageout\pagesofar
-  \unvbox255
-  \penalty\outputpenalty
-}
-%
-% Re-output the contents of the output page -- any previous material,
-% followed by the two boxes we just split, in box0 and box2.
-\def\pagesofar{%
-  \unvbox\partialpage
-  %
-  \hsize = \doublecolumnhsize
-  \wd0=\hsize \wd2=\hsize
-  \hbox to\pagewidth{\box0\hfil\box2}%
-}
-%
-% All done with double columns.
-\def\enddoublecolumns{%
-  % The following penalty ensures that the page builder is exercised
-  % _before_ we change the output routine.  This is necessary in the
-  % following situation:
-  %
-  % The last section of the index consists only of a single entry.
-  % Before this section, \pagetotal is less than \pagegoal, so no
-  % break occurs before the last section starts.  However, the last
-  % section, consisting of \initial and the single \entry, does not
-  % fit on the page and has to be broken off.  Without the following
-  % penalty the page builder will not be exercised until \eject
-  % below, and by that time we'll already have changed the output
-  % routine to the \balancecolumns version, so the next-to-last
-  % double-column page will be processed with \balancecolumns, which
-  % is wrong:  The two columns will go to the main vertical list, with
-  % the broken-off section in the recent contributions.  As soon as
-  % the output routine finishes, TeX starts reconsidering the page
-  % break.  The two columns and the broken-off section both fit on the
-  % page, because the two columns now take up only half of the page
-  % goal.  When TeX sees \eject from below which follows the final
-  % section, it invokes the new output routine that we've set after
-  % \balancecolumns below; \onepageout will try to fit the two columns
-  % and the final section into the vbox of \pageheight (see
-  % \pagebody), causing an overfull box.
-  %
-  % Note that glue won't work here, because glue does not exercise the
-  % page builder, unlike penalties (see The TeXbook, pp. 280-281).
-  \penalty0
-  %
-  \output = {%
-    % Split the last of the double-column material.  Leave it on the
-    % current page, no automatic page break.
-    \balancecolumns
-    %
-    % If we end up splitting too much material for the current page,
-    % though, there will be another page break right after this \output
-    % invocation ends.  Having called \balancecolumns once, we do not
-    % want to call it again.  Therefore, reset \output to its normal
-    % definition right away.  (We hope \balancecolumns will never be
-    % called on to balance too much material, but if it is, this makes
-    % the output somewhat more palatable.)
-    \global\output = {\onepageout{\pagecontents\PAGE}}%
-  }%
-  \eject
-  \endgroup % started in \begindoublecolumns
-  %
-  % \pagegoal was set to the doubled \vsize above, since we restarted
-  % the current page.  We're now back to normal single-column
-  % typesetting, so reset \pagegoal to the normal \vsize (after the
-  % \endgroup where \vsize got restored).
-  \pagegoal = \vsize
-}
-%
-% Called at the end of the double column material.
-\def\balancecolumns{%
-  \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
-  \dimen@ = \ht0
-  \advance\dimen@ by \topskip
-  \advance\dimen@ by-\baselineskip
-  \divide\dimen@ by 2 % target to split to
-  %debug\message{final 2-column material height=\the\ht0, target=\the\dimen at .}%
-  \splittopskip = \topskip
-  % Loop until we get a decent breakpoint.
-  {%
-    \vbadness = 10000
-    \loop
-      \global\setbox3 = \copy0
-      \global\setbox1 = \vsplit3 to \dimen@
-    \ifdim\ht3>\dimen@
-      \global\advance\dimen@ by 1pt
-    \repeat
-  }%
-  %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
-  \setbox0=\vbox to\dimen@{\unvbox1}%
-  \setbox2=\vbox to\dimen@{\unvbox3}%
-  %
-  \pagesofar
-}
-\catcode`\@ = \other
-
-
-\message{sectioning,}
-% Chapters, sections, etc.
-
-% \unnumberedno is an oxymoron, of course.  But we count the unnumbered
-% sections so that we can refer to them unambiguously in the pdf
-% outlines by their "section number".  We avoid collisions with chapter
-% numbers by starting them at 10000.  (If a document ever has 10000
-% chapters, we're in trouble anyway, I'm sure.)
-\newcount\unnumberedno \unnumberedno = 10000
-\newcount\chapno
-\newcount\secno        \secno=0
-\newcount\subsecno     \subsecno=0
-\newcount\subsubsecno  \subsubsecno=0
-
-% This counter is funny since it counts through charcodes of letters A, B, ...
-\newcount\appendixno  \appendixno = `\@
-%
-% \def\appendixletter{\char\the\appendixno}
-% We do the following ugly conditional instead of the above simple
-% construct for the sake of pdftex, which needs the actual
-% letter in the expansion, not just typeset.
-%
-\def\appendixletter{%
-  \ifnum\appendixno=`A A%
-  \else\ifnum\appendixno=`B B%
-  \else\ifnum\appendixno=`C C%
-  \else\ifnum\appendixno=`D D%
-  \else\ifnum\appendixno=`E E%
-  \else\ifnum\appendixno=`F F%
-  \else\ifnum\appendixno=`G G%
-  \else\ifnum\appendixno=`H H%
-  \else\ifnum\appendixno=`I I%
-  \else\ifnum\appendixno=`J J%
-  \else\ifnum\appendixno=`K K%
-  \else\ifnum\appendixno=`L L%
-  \else\ifnum\appendixno=`M M%
-  \else\ifnum\appendixno=`N N%
-  \else\ifnum\appendixno=`O O%
-  \else\ifnum\appendixno=`P P%
-  \else\ifnum\appendixno=`Q Q%
-  \else\ifnum\appendixno=`R R%
-  \else\ifnum\appendixno=`S S%
-  \else\ifnum\appendixno=`T T%
-  \else\ifnum\appendixno=`U U%
-  \else\ifnum\appendixno=`V V%
-  \else\ifnum\appendixno=`W W%
-  \else\ifnum\appendixno=`X X%
-  \else\ifnum\appendixno=`Y Y%
-  \else\ifnum\appendixno=`Z Z%
-  % The \the is necessary, despite appearances, because \appendixletter is
-  % expanded while writing the .toc file.  \char\appendixno is not
-  % expandable, thus it is written literally, thus all appendixes come out
-  % with the same letter (or @) in the toc without it.
-  \else\char\the\appendixno
-  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
-  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
-
-% Each @chapter defines these (using marks) as the number+name, number
-% and name of the chapter.  Page headings and footings can use
-% these.  @section does likewise.
-\def\thischapter{}
-\def\thischapternum{}
-\def\thischaptername{}
-\def\thissection{}
-\def\thissectionnum{}
-\def\thissectionname{}
-
-\newcount\absseclevel % used to calculate proper heading level
-\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
-
-% @raisesections: treat @section as chapter, @subsection as section, etc.
-\def\raisesections{\global\advance\secbase by -1}
-\let\up=\raisesections % original BFox name
-
-% @lowersections: treat @chapter as section, @section as subsection, etc.
-\def\lowersections{\global\advance\secbase by 1}
-\let\down=\lowersections % original BFox name
-
-% we only have subsub.
-\chardef\maxseclevel = 3
-%
-% A numbered section within an unnumbered changes to unnumbered too.
-% To achive this, remember the "biggest" unnum. sec. we are currently in:
-\chardef\unmlevel = \maxseclevel
-%
-% Trace whether the current chapter is an appendix or not:
-% \chapheadtype is "N" or "A", unnumbered chapters are ignored.
-\def\chapheadtype{N}
-
-% Choose a heading macro
-% #1 is heading type
-% #2 is heading level
-% #3 is text for heading
-\def\genhead#1#2#3{%
-  % Compute the abs. sec. level:
-  \absseclevel=#2
-  \advance\absseclevel by \secbase
-  % Make sure \absseclevel doesn't fall outside the range:
-  \ifnum \absseclevel < 0
-    \absseclevel = 0
-  \else
-    \ifnum \absseclevel > 3
-      \absseclevel = 3
-    \fi
-  \fi
-  % The heading type:
-  \def\headtype{#1}%
-  \if \headtype U%
-    \ifnum \absseclevel < \unmlevel
-      \chardef\unmlevel = \absseclevel
-    \fi
-  \else
-    % Check for appendix sections:
-    \ifnum \absseclevel = 0
-      \edef\chapheadtype{\headtype}%
-    \else
-      \if \headtype A\if \chapheadtype N%
-	\errmessage{@appendix... within a non-appendix chapter}%
-      \fi\fi
-    \fi
-    % Check for numbered within unnumbered:
-    \ifnum \absseclevel > \unmlevel
-      \def\headtype{U}%
-    \else
-      \chardef\unmlevel = 3
-    \fi
-  \fi
-  % Now print the heading:
-  \if \headtype U%
-    \ifcase\absseclevel
-	\unnumberedzzz{#3}%
-    \or \unnumberedseczzz{#3}%
-    \or \unnumberedsubseczzz{#3}%
-    \or \unnumberedsubsubseczzz{#3}%
-    \fi
-  \else
-    \if \headtype A%
-      \ifcase\absseclevel
-	  \appendixzzz{#3}%
-      \or \appendixsectionzzz{#3}%
-      \or \appendixsubseczzz{#3}%
-      \or \appendixsubsubseczzz{#3}%
-      \fi
-    \else
-      \ifcase\absseclevel
-	  \chapterzzz{#3}%
-      \or \seczzz{#3}%
-      \or \numberedsubseczzz{#3}%
-      \or \numberedsubsubseczzz{#3}%
-      \fi
-    \fi
-  \fi
-  \suppressfirstparagraphindent
-}
-
-% an interface:
-\def\numhead{\genhead N}
-\def\apphead{\genhead A}
-\def\unnmhead{\genhead U}
-
-% @chapter, @appendix, @unnumbered.  Increment top-level counter, reset
-% all lower-level sectioning counters to zero.
-%
-% Also set \chaplevelprefix, which we prepend to @float sequence numbers
-% (e.g., figures), q.v.  By default (before any chapter), that is empty.
-\let\chaplevelprefix = \empty
-%
-\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
-\def\chapterzzz#1{%
-  % section resetting is \global in case the chapter is in a group, such
-  % as an @include file.
-  \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
-    \global\advance\chapno by 1
-  %
-  % Used for \float.
-  \gdef\chaplevelprefix{\the\chapno.}%
-  \resetallfloatnos
-  %
-  % \putwordChapter can contain complex things in translations.
-  \toks0=\expandafter{\putwordChapter}%
-  \message{\the\toks0 \space \the\chapno}%
-  %
-  % Write the actual heading.
-  \chapmacro{#1}{Ynumbered}{\the\chapno}%
-  %
-  % So @section and the like are numbered underneath this chapter.
-  \global\let\section = \numberedsec
-  \global\let\subsection = \numberedsubsec
-  \global\let\subsubsection = \numberedsubsubsec
-}
-
-\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
-%
-\def\appendixzzz#1{%
-  \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
-    \global\advance\appendixno by 1
-  \gdef\chaplevelprefix{\appendixletter.}%
-  \resetallfloatnos
-  %
-  % \putwordAppendix can contain complex things in translations.
-  \toks0=\expandafter{\putwordAppendix}%
-  \message{\the\toks0 \space \appendixletter}%
-  %
-  \chapmacro{#1}{Yappendix}{\appendixletter}%
-  %
-  \global\let\section = \appendixsec
-  \global\let\subsection = \appendixsubsec
-  \global\let\subsubsection = \appendixsubsubsec
-}
-
-\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
-\def\unnumberedzzz#1{%
-  \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
-    \global\advance\unnumberedno by 1
-  %
-  % Since an unnumbered has no number, no prefix for figures.
-  \global\let\chaplevelprefix = \empty
-  \resetallfloatnos
-  %
-  % This used to be simply \message{#1}, but TeX fully expands the
-  % argument to \message.  Therefore, if #1 contained @-commands, TeX
-  % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
-  % expanded @cite (which turns out to cause errors because \cite is meant
-  % to be executed, not expanded).
-  %
-  % Anyway, we don't want the fully-expanded definition of @cite to appear
-  % as a result of the \message, we just want `@cite' itself.  We use
-  % \the<toks register> to achieve this: TeX expands \the<toks> only once,
-  % simply yielding the contents of <toks register>.  (We also do this for
-  % the toc entries.)
-  \toks0 = {#1}%
-  \message{(\the\toks0)}%
-  %
-  \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
-  %
-  \global\let\section = \unnumberedsec
-  \global\let\subsection = \unnumberedsubsec
-  \global\let\subsubsection = \unnumberedsubsubsec
-}
-
-% @centerchap is like @unnumbered, but the heading is centered.
-\outer\parseargdef\centerchap{%
-  % Well, we could do the following in a group, but that would break
-  % an assumption that \chapmacro is called at the outermost level.
-  % Thus we are safer this way:		--kasal, 24feb04
-  \let\centerparametersmaybe = \centerparameters
-  \unnmhead0{#1}%
-  \let\centerparametersmaybe = \relax
-}
-
-% @top is like @unnumbered.
-\let\top\unnumbered
-
-% Sections.
-\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
-\def\seczzz#1{%
-  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
-  \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
-}
-
-\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz
-\def\appendixsectionzzz#1{%
-  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
-  \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
-}
-\let\appendixsec\appendixsection
-
-\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz
-\def\unnumberedseczzz#1{%
-  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
-  \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
-}
-
-% Subsections.
-\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz
-\def\numberedsubseczzz#1{%
-  \global\subsubsecno=0  \global\advance\subsecno by 1
-  \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
-}
-
-\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz
-\def\appendixsubseczzz#1{%
-  \global\subsubsecno=0  \global\advance\subsecno by 1
-  \sectionheading{#1}{subsec}{Yappendix}%
-                 {\appendixletter.\the\secno.\the\subsecno}%
-}
-
-\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
-\def\unnumberedsubseczzz#1{%
-  \global\subsubsecno=0  \global\advance\subsecno by 1
-  \sectionheading{#1}{subsec}{Ynothing}%
-                 {\the\unnumberedno.\the\secno.\the\subsecno}%
-}
-
-% Subsubsections.
-\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz
-\def\numberedsubsubseczzz#1{%
-  \global\advance\subsubsecno by 1
-  \sectionheading{#1}{subsubsec}{Ynumbered}%
-                 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
-}
-
-\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz
-\def\appendixsubsubseczzz#1{%
-  \global\advance\subsubsecno by 1
-  \sectionheading{#1}{subsubsec}{Yappendix}%
-                 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
-}
-
-\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
-\def\unnumberedsubsubseczzz#1{%
-  \global\advance\subsubsecno by 1
-  \sectionheading{#1}{subsubsec}{Ynothing}%
-                 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
-}
-
-% These macros control what the section commands do, according
-% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
-% Define them by default for a numbered chapter.
-\let\section = \numberedsec
-\let\subsection = \numberedsubsec
-\let\subsubsection = \numberedsubsubsec
-
-% Define @majorheading, @heading and @subheading
-
-% NOTE on use of \vbox for chapter headings, section headings, and such:
-%       1) We use \vbox rather than the earlier \line to permit
-%          overlong headings to fold.
-%       2) \hyphenpenalty is set to 10000 because hyphenation in a
-%          heading is obnoxious; this forbids it.
-%       3) Likewise, headings look best if no \parindent is used, and
-%          if justification is not attempted.  Hence \raggedright.
-
-\def\majorheading{%
-  {\advance\chapheadingskip by 10pt \chapbreak }%
-  \parsearg\chapheadingzzz
-}
-
-\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
-\def\chapheadingzzz#1{%
-  {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
-                    \parindent=0pt\ptexraggedright
-                    \rmisbold #1\hfill}}%
-  \bigskip \par\penalty 200\relax
-  \suppressfirstparagraphindent
-}
-
-% @heading, @subheading, @subsubheading.
-\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
-  \suppressfirstparagraphindent}
-\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
-  \suppressfirstparagraphindent}
-\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
-  \suppressfirstparagraphindent}
-
-% These macros generate a chapter, section, etc. heading only
-% (including whitespace, linebreaking, etc. around it),
-% given all the information in convenient, parsed form.
-
-%%% Args are the skip and penalty (usually negative)
-\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
-
-%%% Define plain chapter starts, and page on/off switching for it
-% Parameter controlling skip before chapter headings (if needed)
-
-\newskip\chapheadingskip
-
-\def\chapbreak{\dobreak \chapheadingskip {-4000}}
-\def\chappager{\par\vfill\supereject}
-% Because \domark is called before \chapoddpage, the filler page will
-% get the headings for the next chapter, which is wrong.  But we don't
-% care -- we just disable all headings on the filler page.
-\def\chapoddpage{%
-  \chappager
-  \ifodd\pageno \else
-    \begingroup
-      \evenheadline={\hfil}\evenfootline={\hfil}%
-      \oddheadline={\hfil}\oddfootline={\hfil}%
-      \hbox to 0pt{}%
-      \chappager
-    \endgroup
-  \fi
-}
-
-\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
-
-\def\CHAPPAGoff{%
-\global\let\contentsalignmacro = \chappager
-\global\let\pchapsepmacro=\chapbreak
-\global\let\pagealignmacro=\chappager}
-
-\def\CHAPPAGon{%
-\global\let\contentsalignmacro = \chappager
-\global\let\pchapsepmacro=\chappager
-\global\let\pagealignmacro=\chappager
-\global\def\HEADINGSon{\HEADINGSsingle}}
-
-\def\CHAPPAGodd{%
-\global\let\contentsalignmacro = \chapoddpage
-\global\let\pchapsepmacro=\chapoddpage
-\global\let\pagealignmacro=\chapoddpage
-\global\def\HEADINGSon{\HEADINGSdouble}}
-
-\CHAPPAGon
-
-% Chapter opening.
-%
-% #1 is the text, #2 is the section type (Ynumbered, Ynothing,
-% Yappendix, Yomitfromtoc), #3 the chapter number.
-%
-% To test against our argument.
-\def\Ynothingkeyword{Ynothing}
-\def\Yomitfromtockeyword{Yomitfromtoc}
-\def\Yappendixkeyword{Yappendix}
-%
-\def\chapmacro#1#2#3{%
-  % Insert the first mark before the heading break (see notes for \domark).
-  \let\prevchapterdefs=\lastchapterdefs
-  \let\prevsectiondefs=\lastsectiondefs
-  \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
-                        \gdef\thissection{}}%
-  %
-  \def\temptype{#2}%
-  \ifx\temptype\Ynothingkeyword
-    \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
-                          \gdef\thischapter{\thischaptername}}%
-  \else\ifx\temptype\Yomitfromtockeyword
-    \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
-                          \gdef\thischapter{}}%
-  \else\ifx\temptype\Yappendixkeyword
-    \toks0={#1}%
-    \xdef\lastchapterdefs{%
-      \gdef\noexpand\thischaptername{\the\toks0}%
-      \gdef\noexpand\thischapternum{\appendixletter}%
-      % \noexpand\putwordAppendix avoids expanding indigestible
-      % commands in some of the translations.
-      \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
-                                 \noexpand\thischapternum:
-                                 \noexpand\thischaptername}%
-    }%
-  \else
-    \toks0={#1}%
-    \xdef\lastchapterdefs{%
-      \gdef\noexpand\thischaptername{\the\toks0}%
-      \gdef\noexpand\thischapternum{\the\chapno}%
-      % \noexpand\putwordChapter avoids expanding indigestible
-      % commands in some of the translations.
-      \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
-                                 \noexpand\thischapternum:
-                                 \noexpand\thischaptername}%
-    }%
-  \fi\fi\fi
-  %
-  % Output the mark.  Pass it through \safewhatsit, to take care of
-  % the preceding space.
-  \safewhatsit\domark
-  %
-  % Insert the chapter heading break.
-  \pchapsepmacro
-  %
-  % Now the second mark, after the heading break.  No break points
-  % between here and the heading.
-  \let\prevchapterdefs=\lastchapterdefs
-  \let\prevsectiondefs=\lastsectiondefs
-  \domark
-  %
-  {%
-    \chapfonts \rmisbold
-    %
-    % Have to define \lastsection before calling \donoderef, because the
-    % xref code eventually uses it.  On the other hand, it has to be called
-    % after \pchapsepmacro, or the headline will change too soon.
-    \gdef\lastsection{#1}%
-    %
-    % Only insert the separating space if we have a chapter/appendix
-    % number, and don't print the unnumbered ``number''.
-    \ifx\temptype\Ynothingkeyword
-      \setbox0 = \hbox{}%
-      \def\toctype{unnchap}%
-    \else\ifx\temptype\Yomitfromtockeyword
-      \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
-      \def\toctype{omit}%
-    \else\ifx\temptype\Yappendixkeyword
-      \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
-      \def\toctype{app}%
-    \else
-      \setbox0 = \hbox{#3\enspace}%
-      \def\toctype{numchap}%
-    \fi\fi\fi
-    %
-    % Write the toc entry for this chapter.  Must come before the
-    % \donoderef, because we include the current node name in the toc
-    % entry, and \donoderef resets it to empty.
-    \writetocentry{\toctype}{#1}{#3}%
-    %
-    % For pdftex, we have to write out the node definition (aka, make
-    % the pdfdest) after any page break, but before the actual text has
-    % been typeset.  If the destination for the pdf outline is after the
-    % text, then jumping from the outline may wind up with the text not
-    % being visible, for instance under high magnification.
-    \donoderef{#2}%
-    %
-    % Typeset the actual heading.
-    \nobreak % Avoid page breaks at the interline glue.
-    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
-          \hangindent=\wd0 \centerparametersmaybe
-          \unhbox0 #1\par}%
-  }%
-  \nobreak\bigskip % no page break after a chapter title
-  \nobreak
-}
-
-% @centerchap -- centered and unnumbered.
-\let\centerparametersmaybe = \relax
-\def\centerparameters{%
-  \advance\rightskip by 3\rightskip
-  \leftskip = \rightskip
-  \parfillskip = 0pt
-}
-
-
-% I don't think this chapter style is supported any more, so I'm not
-% updating it with the new noderef stuff.  We'll see.  --karl, 11aug03.
-%
-\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
-%
-\def\unnchfopen #1{%
-\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
-                       \parindent=0pt\ptexraggedright
-                       \rmisbold #1\hfill}}\bigskip \par\nobreak
-}
-\def\chfopen #1#2{\chapoddpage {\chapfonts
-\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
-\par\penalty 5000 %
-}
-\def\centerchfopen #1{%
-\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
-                       \parindent=0pt
-                       \hfill {\rmisbold #1}\hfill}}\bigskip \par\nobreak
-}
-\def\CHAPFopen{%
-  \global\let\chapmacro=\chfopen
-  \global\let\centerchapmacro=\centerchfopen}
-
-
-% Section titles.  These macros combine the section number parts and
-% call the generic \sectionheading to do the printing.
-%
-\newskip\secheadingskip
-\def\secheadingbreak{\dobreak \secheadingskip{-1000}}
-
-% Subsection titles.
-\newskip\subsecheadingskip
-\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
-
-% Subsubsection titles.
-\def\subsubsecheadingskip{\subsecheadingskip}
-\def\subsubsecheadingbreak{\subsecheadingbreak}
-
-
-% Print any size, any type, section title.
-%
-% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is
-% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the
-% section number.
-%
-\def\seckeyword{sec}
-%
-\def\sectionheading#1#2#3#4{%
-  {%
-    % Switch to the right set of fonts.
-    \csname #2fonts\endcsname \rmisbold
-    %
-    \def\sectionlevel{#2}%
-    \def\temptype{#3}%
-    %
-    % Insert first mark before the heading break (see notes for \domark).
-    \let\prevsectiondefs=\lastsectiondefs
-    \ifx\temptype\Ynothingkeyword
-      \ifx\sectionlevel\seckeyword
-        \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
-                              \gdef\thissection{\thissectionname}}%
-      \fi
-    \else\ifx\temptype\Yomitfromtockeyword
-      % Don't redefine \thissection.
-    \else\ifx\temptype\Yappendixkeyword
-      \ifx\sectionlevel\seckeyword
-        \toks0={#1}%
-        \xdef\lastsectiondefs{%
-          \gdef\noexpand\thissectionname{\the\toks0}%
-          \gdef\noexpand\thissectionnum{#4}%
-          % \noexpand\putwordSection avoids expanding indigestible
-          % commands in some of the translations.
-          \gdef\noexpand\thissection{\noexpand\putwordSection{}
-                                     \noexpand\thissectionnum:
-                                     \noexpand\thissectionname}%
-        }%
-      \fi
-    \else
-      \ifx\sectionlevel\seckeyword
-        \toks0={#1}%
-        \xdef\lastsectiondefs{%
-          \gdef\noexpand\thissectionname{\the\toks0}%
-          \gdef\noexpand\thissectionnum{#4}%
-          % \noexpand\putwordSection avoids expanding indigestible
-          % commands in some of the translations.
-          \gdef\noexpand\thissection{\noexpand\putwordSection{}
-                                     \noexpand\thissectionnum:
-                                     \noexpand\thissectionname}%
-        }%
-      \fi
-    \fi\fi\fi
-    %
-    % Go into vertical mode.  Usually we'll already be there, but we
-    % don't want the following whatsit to end up in a preceding paragraph
-    % if the document didn't happen to have a blank line.
-    \par
-    %
-    % Output the mark.  Pass it through \safewhatsit, to take care of
-    % the preceding space.
-    \safewhatsit\domark
-    %
-    % Insert space above the heading.
-    \csname #2headingbreak\endcsname
-    %
-    % Now the second mark, after the heading break.  No break points
-    % between here and the heading.
-    \let\prevsectiondefs=\lastsectiondefs
-    \domark
-    %
-    % Only insert the space after the number if we have a section number.
-    \ifx\temptype\Ynothingkeyword
-      \setbox0 = \hbox{}%
-      \def\toctype{unn}%
-      \gdef\lastsection{#1}%
-    \else\ifx\temptype\Yomitfromtockeyword
-      % for @headings -- no section number, don't include in toc,
-      % and don't redefine \lastsection.
-      \setbox0 = \hbox{}%
-      \def\toctype{omit}%
-      \let\sectionlevel=\empty
-    \else\ifx\temptype\Yappendixkeyword
-      \setbox0 = \hbox{#4\enspace}%
-      \def\toctype{app}%
-      \gdef\lastsection{#1}%
-    \else
-      \setbox0 = \hbox{#4\enspace}%
-      \def\toctype{num}%
-      \gdef\lastsection{#1}%
-    \fi\fi\fi
-    %
-    % Write the toc entry (before \donoderef).  See comments in \chapmacro.
-    \writetocentry{\toctype\sectionlevel}{#1}{#4}%
-    %
-    % Write the node reference (= pdf destination for pdftex).
-    % Again, see comments in \chapmacro.
-    \donoderef{#3}%
-    %
-    % Interline glue will be inserted when the vbox is completed.
-    % That glue will be a valid breakpoint for the page, since it'll be
-    % preceded by a whatsit (usually from the \donoderef, or from the
-    % \writetocentry if there was no node).  We don't want to allow that
-    % break, since then the whatsits could end up on page n while the
-    % section is on page n+1, thus toc/etc. are wrong.  Debian bug 276000.
-    \nobreak
-    %
-    % Output the actual section heading.
-    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
-          \hangindent=\wd0  % zero if no section number
-          \unhbox0 #1}%
-  }%
-  % Add extra space after the heading -- half of whatever came above it.
-  % Don't allow stretch, though.
-  \kern .5 \csname #2headingskip\endcsname
-  %
-  % Do not let the kern be a potential breakpoint, as it would be if it
-  % was followed by glue.
-  \nobreak
-  %
-  % We'll almost certainly start a paragraph next, so don't let that
-  % glue accumulate.  (Not a breakpoint because it's preceded by a
-  % discardable item.)
-  \vskip-\parskip
-  %
-  % This is purely so the last item on the list is a known \penalty >
-  % 10000.  This is so \startdefun can avoid allowing breakpoints after
-  % section headings.  Otherwise, it would insert a valid breakpoint between:
-  %
-  %   @section sec-whatever
-  %   @deffn def-whatever
-  \penalty 10001
-}
-
-
-\message{toc,}
-% Table of contents.
-\newwrite\tocfile
-
-% Write an entry to the toc file, opening it if necessary.
-% Called from @chapter, etc.
-%
-% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
-% We append the current node name (if any) and page number as additional
-% arguments for the \{chap,sec,...}entry macros which will eventually
-% read this.  The node name is used in the pdf outlines as the
-% destination to jump to.
-%
-% We open the .toc file for writing here instead of at @setfilename (or
-% any other fixed time) so that @contents can be anywhere in the document.
-% But if #1 is `omit', then we don't do anything.  This is used for the
-% table of contents chapter openings themselves.
-%
-\newif\iftocfileopened
-\def\omitkeyword{omit}%
-%
-\def\writetocentry#1#2#3{%
-  \edef\writetoctype{#1}%
-  \ifx\writetoctype\omitkeyword \else
-    \iftocfileopened\else
-      \immediate\openout\tocfile = \jobname.toc
-      \global\tocfileopenedtrue
-    \fi
-    %
-    \iflinks
-      {\atdummies
-       \edef\temp{%
-         \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
-       \temp
-      }%
-    \fi
-  \fi
-  %
-  % Tell \shipout to create a pdf destination on each page, if we're
-  % writing pdf.  These are used in the table of contents.  We can't
-  % just write one on every page because the title pages are numbered
-  % 1 and 2 (the page numbers aren't printed), and so are the first
-  % two pages of the document.  Thus, we'd have two destinations named
-  % `1', and two named `2'.
-  \ifpdf \global\pdfmakepagedesttrue \fi
-}
-
-
-% These characters do not print properly in the Computer Modern roman
-% fonts, so we must take special care.  This is more or less redundant
-% with the Texinfo input format setup at the end of this file.
-%
-\def\activecatcodes{%
-  \catcode`\"=\active
-  \catcode`\$=\active
-  \catcode`\<=\active
-  \catcode`\>=\active
-  \catcode`\\=\active
-  \catcode`\^=\active
-  \catcode`\_=\active
-  \catcode`\|=\active
-  \catcode`\~=\active
-}
-
-
-% Read the toc file, which is essentially Texinfo input.
-\def\readtocfile{%
-  \setupdatafile
-  \activecatcodes
-  \input \tocreadfilename
-}
-
-\newskip\contentsrightmargin \contentsrightmargin=1in
-\newcount\savepageno
-\newcount\lastnegativepageno \lastnegativepageno = -1
-
-% Prepare to read what we've written to \tocfile.
-%
-\def\startcontents#1{%
-  % If @setchapternewpage on, and @headings double, the contents should
-  % start on an odd page, unlike chapters.  Thus, we maintain
-  % \contentsalignmacro in parallel with \pagealignmacro.
-  % From: Torbjorn Granlund <tege at matematik.su.se>
-  \contentsalignmacro
-  \immediate\closeout\tocfile
-  %
-  % Don't need to put `Contents' or `Short Contents' in the headline.
-  % It is abundantly clear what they are.
-  \chapmacro{#1}{Yomitfromtoc}{}%
-  %
-  \savepageno = \pageno
-  \begingroup                  % Set up to handle contents files properly.
-    \raggedbottom              % Worry more about breakpoints than the bottom.
-    \advance\hsize by -\contentsrightmargin % Don't use the full line length.
-    %
-    % Roman numerals for page numbers.
-    \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
-}
-
-% redefined for the two-volume lispref.  We always output on
-% \jobname.toc even if this is redefined.
-%
-\def\tocreadfilename{\jobname.toc}
-
-% Normal (long) toc.
-%
-\def\contents{%
-  \startcontents{\putwordTOC}%
-    \openin 1 \tocreadfilename\space
-    \ifeof 1 \else
-      \readtocfile
-    \fi
-    \vfill \eject
-    \contentsalignmacro % in case @setchapternewpage odd is in effect
-    \ifeof 1 \else
-      \pdfmakeoutlines
-    \fi
-    \closein 1
-  \endgroup
-  \lastnegativepageno = \pageno
-  \global\pageno = \savepageno
-}
-
-% And just the chapters.
-\def\summarycontents{%
-  \startcontents{\putwordShortTOC}%
-    %
-    \let\numchapentry = \shortchapentry
-    \let\appentry = \shortchapentry
-    \let\unnchapentry = \shortunnchapentry
-    % We want a true roman here for the page numbers.
-    \secfonts
-    \let\rm=\shortcontrm \let\bf=\shortcontbf
-    \let\sl=\shortcontsl \let\tt=\shortconttt
-    \rm
-    \hyphenpenalty = 10000
-    \advance\baselineskip by 1pt % Open it up a little.
-    \def\numsecentry##1##2##3##4{}
-    \let\appsecentry = \numsecentry
-    \let\unnsecentry = \numsecentry
-    \let\numsubsecentry = \numsecentry
-    \let\appsubsecentry = \numsecentry
-    \let\unnsubsecentry = \numsecentry
-    \let\numsubsubsecentry = \numsecentry
-    \let\appsubsubsecentry = \numsecentry
-    \let\unnsubsubsecentry = \numsecentry
-    \openin 1 \tocreadfilename\space
-    \ifeof 1 \else
-      \readtocfile
-    \fi
-    \closein 1
-    \vfill \eject
-    \contentsalignmacro % in case @setchapternewpage odd is in effect
-  \endgroup
-  \lastnegativepageno = \pageno
-  \global\pageno = \savepageno
-}
-\let\shortcontents = \summarycontents
-
-% Typeset the label for a chapter or appendix for the short contents.
-% The arg is, e.g., `A' for an appendix, or `3' for a chapter.
-%
-\def\shortchaplabel#1{%
-  % This space should be enough, since a single number is .5em, and the
-  % widest letter (M) is 1em, at least in the Computer Modern fonts.
-  % But use \hss just in case.
-  % (This space doesn't include the extra space that gets added after
-  % the label; that gets put in by \shortchapentry above.)
-  %
-  % We'd like to right-justify chapter numbers, but that looks strange
-  % with appendix letters.  And right-justifying numbers and
-  % left-justifying letters looks strange when there is less than 10
-  % chapters.  Have to read the whole toc once to know how many chapters
-  % there are before deciding ...
-  \hbox to 1em{#1\hss}%
-}
-
-% These macros generate individual entries in the table of contents.
-% The first argument is the chapter or section name.
-% The last argument is the page number.
-% The arguments in between are the chapter number, section number, ...
-
-% Chapters, in the main contents.
-\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
-%
-% Chapters, in the short toc.
-% See comments in \dochapentry re vbox and related settings.
-\def\shortchapentry#1#2#3#4{%
-  \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
-}
-
-% Appendices, in the main contents.
-% Need the word Appendix, and a fixed-size box.
-%
-\def\appendixbox#1{%
-  % We use M since it's probably the widest letter.
-  \setbox0 = \hbox{\putwordAppendix{} M}%
-  \hbox to \wd0{\putwordAppendix{} #1\hss}}
-%
-\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}}
-
-% Unnumbered chapters.
-\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
-\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
-
-% Sections.
-\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
-\let\appsecentry=\numsecentry
-\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
-
-% Subsections.
-\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
-\let\appsubsecentry=\numsubsecentry
-\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
-
-% And subsubsections.
-\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
-\let\appsubsubsecentry=\numsubsubsecentry
-\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
-
-% This parameter controls the indentation of the various levels.
-% Same as \defaultparindent.
-\newdimen\tocindent \tocindent = 15pt
-
-% Now for the actual typesetting. In all these, #1 is the text and #2 is the
-% page number.
-%
-% If the toc has to be broken over pages, we want it to be at chapters
-% if at all possible; hence the \penalty.
-\def\dochapentry#1#2{%
-   \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
-   \begingroup
-     \chapentryfonts
-     \tocentry{#1}{\dopageno\bgroup#2\egroup}%
-   \endgroup
-   \nobreak\vskip .25\baselineskip plus.1\baselineskip
-}
-
-\def\dosecentry#1#2{\begingroup
-  \secentryfonts \leftskip=\tocindent
-  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
-\endgroup}
-
-\def\dosubsecentry#1#2{\begingroup
-  \subsecentryfonts \leftskip=2\tocindent
-  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
-\endgroup}
-
-\def\dosubsubsecentry#1#2{\begingroup
-  \subsubsecentryfonts \leftskip=3\tocindent
-  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
-\endgroup}
-
-% We use the same \entry macro as for the index entries.
-\let\tocentry = \entry
-
-% Space between chapter (or whatever) number and the title.
-\def\labelspace{\hskip1em \relax}
-
-\def\dopageno#1{{\rm #1}}
-\def\doshortpageno#1{{\rm #1}}
-
-\def\chapentryfonts{\secfonts \rm}
-\def\secentryfonts{\textfonts}
-\def\subsecentryfonts{\textfonts}
-\def\subsubsecentryfonts{\textfonts}
-
-
-\message{environments,}
-% @foo ... @end foo.
-
-% @tex ... @end tex    escapes into raw Tex temporarily.
-% One exception: @ is still an escape character, so that @end tex works.
-% But \@ or @@ will get a plain tex @ character.
-
-\envdef\tex{%
-  \setupmarkupstyle{tex}%
-  \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
-  \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
-  \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
-  \catcode `\%=14
-  \catcode `\+=\other
-  \catcode `\"=\other
-  \catcode `\|=\other
-  \catcode `\<=\other
-  \catcode `\>=\other
-  \catcode`\`=\other
-  \catcode`\'=\other
-  \escapechar=`\\
-  %
-  \let\b=\ptexb
-  \let\bullet=\ptexbullet
-  \let\c=\ptexc
-  \let\,=\ptexcomma
-  \let\.=\ptexdot
-  \let\dots=\ptexdots
-  \let\equiv=\ptexequiv
-  \let\!=\ptexexclam
-  \let\i=\ptexi
-  \let\indent=\ptexindent
-  \let\noindent=\ptexnoindent
-  \let\{=\ptexlbrace
-  \let\+=\tabalign
-  \let\}=\ptexrbrace
-  \let\/=\ptexslash
-  \let\*=\ptexstar
-  \let\t=\ptext
-  \expandafter \let\csname top\endcsname=\ptextop  % outer
-  \let\frenchspacing=\plainfrenchspacing
-  %
-  \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
-  \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
-  \def\@{@}%
-}
-% There is no need to define \Etex.
-
-% Define @lisp ... @end lisp.
-% @lisp environment forms a group so it can rebind things,
-% including the definition of @end lisp (which normally is erroneous).
-
-% Amount to narrow the margins by for @lisp.
-\newskip\lispnarrowing \lispnarrowing=0.4in
-
-% This is the definition that ^^M gets inside @lisp, @example, and other
-% such environments.  \null is better than a space, since it doesn't
-% have any width.
-\def\lisppar{\null\endgraf}
-
-% This space is always present above and below environments.
-\newskip\envskipamount \envskipamount = 0pt
-
-% Make spacing and below environment symmetrical.  We use \parskip here
-% to help in doing that, since in @example-like environments \parskip
-% is reset to zero; thus the \afterenvbreak inserts no space -- but the
-% start of the next paragraph will insert \parskip.
-%
-\def\aboveenvbreak{{%
-  % =10000 instead of <10000 because of a special case in \itemzzz and
-  % \sectionheading, q.v.
-  \ifnum \lastpenalty=10000 \else
-    \advance\envskipamount by \parskip
-    \endgraf
-    \ifdim\lastskip<\envskipamount
-      \removelastskip
-      % it's not a good place to break if the last penalty was \nobreak
-      % or better ...
-      \ifnum\lastpenalty<10000 \penalty-50 \fi
-      \vskip\envskipamount
-    \fi
-  \fi
-}}
-
-\let\afterenvbreak = \aboveenvbreak
-
-% \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins; it will
-% also clear it, so that its embedded environments do the narrowing again.
-\let\nonarrowing=\relax
-
-% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
-% environment contents.
-\font\circle=lcircle10
-\newdimen\circthick
-\newdimen\cartouter\newdimen\cartinner
-\newskip\normbskip\newskip\normpskip\newskip\normlskip
-\circthick=\fontdimen8\circle
-%
-\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
-\def\ctr{{\hskip 6pt\circle\char'010}}
-\def\cbl{{\circle\char'012\hskip -6pt}}
-\def\cbr{{\hskip 6pt\circle\char'011}}
-\def\carttop{\hbox to \cartouter{\hskip\lskip
-        \ctl\leaders\hrule height\circthick\hfil\ctr
-        \hskip\rskip}}
-\def\cartbot{\hbox to \cartouter{\hskip\lskip
-        \cbl\leaders\hrule height\circthick\hfil\cbr
-        \hskip\rskip}}
-%
-\newskip\lskip\newskip\rskip
-
-\envdef\cartouche{%
-  \ifhmode\par\fi  % can't be in the midst of a paragraph.
-  \startsavinginserts
-  \lskip=\leftskip \rskip=\rightskip
-  \leftskip=0pt\rightskip=0pt % we want these *outside*.
-  \cartinner=\hsize \advance\cartinner by-\lskip
-  \advance\cartinner by-\rskip
-  \cartouter=\hsize
-  \advance\cartouter by 18.4pt	% allow for 3pt kerns on either
-				% side, and for 6pt waste from
-				% each corner char, and rule thickness
-  \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
-  % Flag to tell @lisp, etc., not to narrow margin.
-  \let\nonarrowing = t%
-  \vbox\bgroup
-      \baselineskip=0pt\parskip=0pt\lineskip=0pt
-      \carttop
-      \hbox\bgroup
-	  \hskip\lskip
-	  \vrule\kern3pt
-	  \vbox\bgroup
-	      \kern3pt
-	      \hsize=\cartinner
-	      \baselineskip=\normbskip
-	      \lineskip=\normlskip
-	      \parskip=\normpskip
-	      \vskip -\parskip
-	      \comment % For explanation, see the end of \def\group.
-}
-\def\Ecartouche{%
-              \ifhmode\par\fi
-	      \kern3pt
-	  \egroup
-	  \kern3pt\vrule
-	  \hskip\rskip
-      \egroup
-      \cartbot
-  \egroup
-  \checkinserts
-}
-
-
-% This macro is called at the beginning of all the @example variants,
-% inside a group.
-\newdimen\nonfillparindent
-\def\nonfillstart{%
-  \aboveenvbreak
-  \hfuzz = 12pt % Don't be fussy
-  \sepspaces % Make spaces be word-separators rather than space tokens.
-  \let\par = \lisppar % don't ignore blank lines
-  \obeylines % each line of input is a line of output
-  \parskip = 0pt
-  % Turn off paragraph indentation but redefine \indent to emulate
-  % the normal \indent.
-  \nonfillparindent=\parindent
-  \parindent = 0pt
-  \let\indent\nonfillindent
-  %
-  \emergencystretch = 0pt % don't try to avoid overfull boxes
-  \ifx\nonarrowing\relax
-    \advance \leftskip by \lispnarrowing
-    \exdentamount=\lispnarrowing
-  \else
-    \let\nonarrowing = \relax
-  \fi
-  \let\exdent=\nofillexdent
-}
-
-\begingroup
-\obeyspaces
-% We want to swallow spaces (but not other tokens) after the fake
-% @indent in our nonfill-environments, where spaces are normally
-% active and set to @tie, resulting in them not being ignored after
-% @indent.
-\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
-\gdef\nonfillindentcheck{%
-\ifx\temp %
-\expandafter\nonfillindentgobble%
-\else%
-\leavevmode\nonfillindentbox%
-\fi%
-}%
-\endgroup
-\def\nonfillindentgobble#1{\nonfillindent}
-\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
-
-% If you want all examples etc. small: @set dispenvsize small.
-% If you want even small examples the full size: @set dispenvsize nosmall.
-% This affects the following displayed environments:
-%    @example, @display, @format, @lisp
-%
-\def\smallword{small}
-\def\nosmallword{nosmall}
-\let\SETdispenvsize\relax
-\def\setnormaldispenv{%
-  \ifx\SETdispenvsize\smallword
-    % end paragraph for sake of leading, in case document has no blank
-    % line.  This is redundant with what happens in \aboveenvbreak, but
-    % we need to do it before changing the fonts, and it's inconvenient
-    % to change the fonts afterward.
-    \ifnum \lastpenalty=10000 \else \endgraf \fi
-    \smallexamplefonts \rm
-  \fi
-}
-\def\setsmalldispenv{%
-  \ifx\SETdispenvsize\nosmallword
-  \else
-    \ifnum \lastpenalty=10000 \else \endgraf \fi
-    \smallexamplefonts \rm
-  \fi
-}
-
-% We often define two environments, @foo and @smallfoo.
-% Let's do it by one command:
-\def\makedispenv #1#2{
-  \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}
-  \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}
-  \expandafter\let\csname E#1\endcsname \afterenvbreak
-  \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
-}
-
-% Define two synonyms:
-\def\maketwodispenvs #1#2#3{
-  \makedispenv{#1}{#3}
-  \makedispenv{#2}{#3}
-}
-
-% @lisp: indented, narrowed, typewriter font; @example: same as @lisp.
-%
-% @smallexample and @smalllisp: use smaller fonts.
-% Originally contributed by Pavel at xerox.
-%
-\maketwodispenvs {lisp}{example}{%
-  \nonfillstart
-  \tt\setupmarkupstyle{example}%
-  \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
-  \gobble       % eat return
-}
-% @display/@smalldisplay: same as @lisp except keep current font.
-%
-\makedispenv {display}{%
-  \nonfillstart
-  \gobble
-}
-
-% @format/@smallformat: same as @display except don't narrow margins.
-%
-\makedispenv{format}{%
-  \let\nonarrowing = t%
-  \nonfillstart
-  \gobble
-}
-
-% @flushleft: same as @format, but doesn't obey \SETdispenvsize.
-\envdef\flushleft{%
-  \let\nonarrowing = t%
-  \nonfillstart
-  \gobble
-}
-\let\Eflushleft = \afterenvbreak
-
-% @flushright.
-%
-\envdef\flushright{%
-  \let\nonarrowing = t%
-  \nonfillstart
-  \advance\leftskip by 0pt plus 1fill
-  \gobble
-}
-\let\Eflushright = \afterenvbreak
-
-
-% @raggedright does more-or-less normal line breaking but no right
-% justification.  From plain.tex.
-\envdef\raggedright{%
-  \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax
-}
-\let\Eraggedright\par
-
-\envdef\raggedleft{%
-  \parindent=0pt \leftskip0pt plus2em
-  \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
-  \hbadness=10000 % Last line will usually be underfull, so turn off
-                  % badness reporting.
-}
-\let\Eraggedleft\par
-
-\envdef\raggedcenter{%
-  \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
-  \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
-  \hbadness=10000 % Last line will usually be underfull, so turn off
-                  % badness reporting.
-}
-\let\Eraggedcenter\par
-
-
-% @quotation does normal linebreaking (hence we can't use \nonfillstart)
-% and narrows the margins.  We keep \parskip nonzero in general, since
-% we're doing normal filling.  So, when using \aboveenvbreak and
-% \afterenvbreak, temporarily make \parskip 0.
-%
-\def\quotationstart{%
-  {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
-  \parindent=0pt
-  %
-  % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
-  \ifx\nonarrowing\relax
-    \advance\leftskip by \lispnarrowing
-    \advance\rightskip by \lispnarrowing
-    \exdentamount = \lispnarrowing
-  \else
-    \let\nonarrowing = \relax
-  \fi
-  \parsearg\quotationlabel
-}
-
-\envdef\quotation{%
-  \setnormaldispenv
-  \quotationstart
-}
-
-\envdef\smallquotation{%
-  \setsmalldispenv
-  \quotationstart
-}
-\let\Esmallquotation = \Equotation
-
-% We have retained a nonzero parskip for the environment, since we're
-% doing normal filling.
-%
-\def\Equotation{%
-  \par
-  \ifx\quotationauthor\undefined\else
-    % indent a bit.
-    \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
-  \fi
-  {\parskip=0pt \afterenvbreak}%
-}
-
-% If we're given an argument, typeset it in bold with a colon after.
-\def\quotationlabel#1{%
-  \def\temp{#1}%
-  \ifx\temp\empty \else
-    {\bf #1: }%
-  \fi
-}
-
-
-% LaTeX-like @verbatim... at end verbatim and @verb{<char>...<char>}
-% If we want to allow any <char> as delimiter,
-% we need the curly braces so that makeinfo sees the @verb command, eg:
-% `@verbx...x' would look like the '@verbx' command.  --janneke at gnu.org
-%
-% [Knuth]: Donald Ervin Knuth, 1996.  The TeXbook.
-%
-% [Knuth] p.344; only we need to do the other characters Texinfo sets
-% active too.  Otherwise, they get lost as the first character on a
-% verbatim line.
-\def\dospecials{%
-  \do\ \do\\\do\{\do\}\do\$\do\&%
-  \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
-  \do\<\do\>\do\|\do\@\do+\do\"%
-  % Don't do the quotes -- if we do, @set txicodequoteundirected and
-  % @set txicodequotebacktick will not have effect on @verb and
-  % @verbatim, and ?` and !` ligatures won't get disabled.
-  %\do\`\do\'%
-}
-%
-% [Knuth] p. 380
-\def\uncatcodespecials{%
-  \def\do##1{\catcode`##1=\other}\dospecials}
-%
-% Setup for the @verb command.
-%
-% Eight spaces for a tab
-\begingroup
-  \catcode`\^^I=\active
-  \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
-\endgroup
-%
-\def\setupverb{%
-  \tt  % easiest (and conventionally used) font for verbatim
-  \def\par{\leavevmode\endgraf}%
-  \setupmarkupstyle{verb}%
-  \tabeightspaces
-  % Respect line breaks,
-  % print special symbols as themselves, and
-  % make each space count
-  % must do in this order:
-  \obeylines \uncatcodespecials \sepspaces
-}
-
-% Setup for the @verbatim environment
-%
-% Real tab expansion
-\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
-%
-\def\starttabbox{\setbox0=\hbox\bgroup}
-%
-\begingroup
-  \catcode`\^^I=\active
-  \gdef\tabexpand{%
-    \catcode`\^^I=\active
-    \def^^I{\leavevmode\egroup
-      \dimen0=\wd0 % the width so far, or since the previous tab
-      \divide\dimen0 by\tabw
-      \multiply\dimen0 by\tabw % compute previous multiple of \tabw
-      \advance\dimen0 by\tabw  % advance to next multiple of \tabw
-      \wd0=\dimen0 \box0 \starttabbox
-    }%
-  }
-\endgroup
-
-% start the verbatim environment.
-\def\setupverbatim{%
-  \let\nonarrowing = t%
-  \nonfillstart
-  % Easiest (and conventionally used) font for verbatim
-  \tt
-  \def\par{\leavevmode\egroup\box0\endgraf}%
-  \tabexpand
-  \setupmarkupstyle{verbatim}%
-  % Respect line breaks,
-  % print special symbols as themselves, and
-  % make each space count
-  % must do in this order:
-  \obeylines \uncatcodespecials \sepspaces
-  \everypar{\starttabbox}%
-}
-
-% Do the @verb magic: verbatim text is quoted by unique
-% delimiter characters.  Before first delimiter expect a
-% right brace, after last delimiter expect closing brace:
-%
-%    \def\doverb'{'<char>#1<char>'}'{#1}
-%
-% [Knuth] p. 382; only eat outer {}
-\begingroup
-  \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
-  \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
-\endgroup
-%
-\def\verb{\begingroup\setupverb\doverb}
-%
-%
-% Do the @verbatim magic: define the macro \doverbatim so that
-% the (first) argument ends when '@end verbatim' is reached, ie:
-%
-%     \def\doverbatim#1 at end verbatim{#1}
-%
-% For Texinfo it's a lot easier than for LaTeX,
-% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
-% we need not redefine '\', '{' and '}'.
-%
-% Inspired by LaTeX's verbatim command set [latex.ltx]
-%
-\begingroup
-  \catcode`\ =\active
-  \obeylines %
-  % ignore everything up to the first ^^M, that's the newline at the end
-  % of the @verbatim input line itself.  Otherwise we get an extra blank
-  % line in the output.
-  \xdef\doverbatim#1^^M#2 at end verbatim{#2\noexpand\end\gobble verbatim}%
-  % We really want {...\end verbatim} in the body of the macro, but
-  % without the active space; thus we have to use \xdef and \gobble.
-\endgroup
-%
-\envdef\verbatim{%
-    \setupverbatim\doverbatim
-}
-\let\Everbatim = \afterenvbreak
-
-
-% @verbatiminclude FILE - insert text of file in verbatim environment.
-%
-\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
-%
-\def\doverbatiminclude#1{%
-  {%
-    \makevalueexpandable
-    \setupverbatim
-    \indexnofonts       % Allow `@@' and other weird things in file names.
-    \input #1
-    \afterenvbreak
-  }%
-}
-
-% @copying ... @end copying.
-% Save the text away for @insertcopying later.
-%
-% We save the uninterpreted tokens, rather than creating a box.
-% Saving the text in a box would be much easier, but then all the
-% typesetting commands (@smallbook, font changes, etc.) have to be done
-% beforehand -- and a) we want @copying to be done first in the source
-% file; b) letting users define the frontmatter in as flexible order as
-% possible is very desirable.
-%
-\def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
-\def\docopying#1 at end copying{\endgroup\def\copyingtext{#1}}
-%
-\def\insertcopying{%
-  \begingroup
-    \parindent = 0pt  % paragraph indentation looks wrong on title page
-    \scanexp\copyingtext
-  \endgroup
-}
-
-
-\message{defuns,}
-% @defun etc.
-
-\newskip\defbodyindent \defbodyindent=.4in
-\newskip\defargsindent \defargsindent=50pt
-\newskip\deflastargmargin \deflastargmargin=18pt
-\newcount\defunpenalty
-
-% Start the processing of @deffn:
-\def\startdefun{%
-  \ifnum\lastpenalty<10000
-    \medbreak
-    \defunpenalty=10003 % Will keep this @deffn together with the
-                        % following @def command, see below.
-  \else
-    % If there are two @def commands in a row, we'll have a \nobreak,
-    % which is there to keep the function description together with its
-    % header.  But if there's nothing but headers, we need to allow a
-    % break somewhere.  Check specifically for penalty 10002, inserted
-    % by \printdefunline, instead of 10000, since the sectioning
-    % commands also insert a nobreak penalty, and we don't want to allow
-    % a break between a section heading and a defun.
-    %
-    % As a minor refinement, we avoid "club" headers by signalling
-    % with penalty of 10003 after the very first @deffn in the
-    % sequence (see above), and penalty of 10002 after any following
-    % @def command.
-    \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
-    %
-    % Similarly, after a section heading, do not allow a break.
-    % But do insert the glue.
-    \medskip  % preceded by discardable penalty, so not a breakpoint
-  \fi
-  %
-  \parindent=0in
-  \advance\leftskip by \defbodyindent
-  \exdentamount=\defbodyindent
-}
-
-\def\dodefunx#1{%
-  % First, check whether we are in the right environment:
-  \checkenv#1%
-  %
-  % As above, allow line break if we have multiple x headers in a row.
-  % It's not a great place, though.
-  \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
-  %
-  % And now, it's time to reuse the body of the original defun:
-  \expandafter\gobbledefun#1%
-}
-\def\gobbledefun#1\startdefun{}
-
-% \printdefunline \deffnheader{text}
-%
-\def\printdefunline#1#2{%
-  \begingroup
-    % call \deffnheader:
-    #1#2 \endheader
-    % common ending:
-    \interlinepenalty = 10000
-    \advance\rightskip by 0pt plus 1fil
-    \endgraf
-    \nobreak\vskip -\parskip
-    \penalty\defunpenalty  % signal to \startdefun and \dodefunx
-    % Some of the @defun-type tags do not enable magic parentheses,
-    % rendering the following check redundant.  But we don't optimize.
-    \checkparencounts
-  \endgroup
-}
-
-\def\Edefun{\endgraf\medbreak}
-
-% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
-% the only thing remaining is to define \deffnheader.
-%
-\def\makedefun#1{%
-  \expandafter\let\csname E#1\endcsname = \Edefun
-  \edef\temp{\noexpand\domakedefun
-    \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
-  \temp
-}
-
-% \domakedefun \deffn \deffnx \deffnheader
-%
-% Define \deffn and \deffnx, without parameters.
-% \deffnheader has to be defined explicitly.
-%
-\def\domakedefun#1#2#3{%
-  \envdef#1{%
-    \startdefun
-    \parseargusing\activeparens{\printdefunline#3}%
-  }%
-  \def#2{\dodefunx#1}%
-  \def#3%
-}
-
-%%% Untyped functions:
-
-% @deffn category name args
-\makedefun{deffn}{\deffngeneral{}}
-
-% @deffn category class name args
-\makedefun{defop}#1 {\defopon{#1\ \putwordon}}
-
-% \defopon {category on}class name args
-\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
-
-% \deffngeneral {subind}category name args
-%
-\def\deffngeneral#1#2 #3 #4\endheader{%
-  % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
-  \dosubind{fn}{\code{#3}}{#1}%
-  \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
-}
-
-%%% Typed functions:
-
-% @deftypefn category type name args
-\makedefun{deftypefn}{\deftypefngeneral{}}
-
-% @deftypeop category class type name args
-\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
-
-% \deftypeopon {category on}class type name args
-\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
-
-% \deftypefngeneral {subind}category type name args
-%
-\def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
-  \dosubind{fn}{\code{#4}}{#1}%
-  \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
-}
-
-%%% Typed variables:
-
-% @deftypevr category type var args
-\makedefun{deftypevr}{\deftypecvgeneral{}}
-
-% @deftypecv category class type var args
-\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
-
-% \deftypecvof {category of}class type var args
-\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
-
-% \deftypecvgeneral {subind}category type var args
-%
-\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
-  \dosubind{vr}{\code{#4}}{#1}%
-  \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
-}
-
-%%% Untyped variables:
-
-% @defvr category var args
-\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
-
-% @defcv category class var args
-\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
-
-% \defcvof {category of}class var args
-\def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
-
-%%% Type:
-% @deftp category name args
-\makedefun{deftp}#1 #2 #3\endheader{%
-  \doind{tp}{\code{#2}}%
-  \defname{#1}{}{#2}\defunargs{#3\unskip}%
-}
-
-% Remaining @defun-like shortcuts:
-\makedefun{defun}{\deffnheader{\putwordDeffunc} }
-\makedefun{defmac}{\deffnheader{\putwordDefmac} }
-\makedefun{defspec}{\deffnheader{\putwordDefspec} }
-\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
-\makedefun{defvar}{\defvrheader{\putwordDefvar} }
-\makedefun{defopt}{\defvrheader{\putwordDefopt} }
-\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
-\makedefun{defmethod}{\defopon\putwordMethodon}
-\makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
-\makedefun{defivar}{\defcvof\putwordInstanceVariableof}
-\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
-
-% \defname, which formats the name of the @def (not the args).
-% #1 is the category, such as "Function".
-% #2 is the return type, if any.
-% #3 is the function name.
-%
-% We are followed by (but not passed) the arguments, if any.
-%
-\def\defname#1#2#3{%
-  % Get the values of \leftskip and \rightskip as they were outside the @def...
-  \advance\leftskip by -\defbodyindent
-  %
-  % How we'll format the type name.  Putting it in brackets helps
-  % distinguish it from the body text that may end up on the next line
-  % just below it.
-  \def\temp{#1}%
-  \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
-  %
-  % Figure out line sizes for the paragraph shape.
-  % The first line needs space for \box0; but if \rightskip is nonzero,
-  % we need only space for the part of \box0 which exceeds it:
-  \dimen0=\hsize  \advance\dimen0 by -\wd0  \advance\dimen0 by \rightskip
-  % The continuations:
-  \dimen2=\hsize  \advance\dimen2 by -\defargsindent
-  % (plain.tex says that \dimen1 should be used only as global.)
-  \parshape 2 0in \dimen0 \defargsindent \dimen2
-  %
-  % Put the type name to the right margin.
-  \noindent
-  \hbox to 0pt{%
-    \hfil\box0 \kern-\hsize
-    % \hsize has to be shortened this way:
-    \kern\leftskip
-    % Intentionally do not respect \rightskip, since we need the space.
-  }%
-  %
-  % Allow all lines to be underfull without complaint:
-  \tolerance=10000 \hbadness=10000
-  \exdentamount=\defbodyindent
-  {%
-    % defun fonts. We use typewriter by default (used to be bold) because:
-    % . we're printing identifiers, they should be in tt in principle.
-    % . in languages with many accents, such as Czech or French, it's
-    %   common to leave accents off identifiers.  The result looks ok in
-    %   tt, but exceedingly strange in rm.
-    % . we don't want -- and --- to be treated as ligatures.
-    % . this still does not fix the ?` and !` ligatures, but so far no
-    %   one has made identifiers using them :).
-    \df \tt
-    \def\temp{#2}% return value type
-    \ifx\temp\empty\else \tclose{\temp} \fi
-    #3% output function name
-  }%
-  {\rm\enskip}% hskip 0.5 em of \tenrm
-  %
-  \boldbrax
-  % arguments will be output next, if any.
-}
-
-% Print arguments in slanted roman (not ttsl), inconsistently with using
-% tt for the name.  This is because literal text is sometimes needed in
-% the argument list (groff manual), and ttsl and tt are not very
-% distinguishable.  Prevent hyphenation at `-' chars.
-%
-\def\defunargs#1{%
-  % use sl by default (not ttsl),
-  % tt for the names.
-  \df \sl \hyphenchar\font=0
-  %
-  % On the other hand, if an argument has two dashes (for instance), we
-  % want a way to get ttsl.  Let's try @var for that.
-  \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
-  #1%
-  \sl\hyphenchar\font=45
-}
-
-% We want ()&[] to print specially on the defun line.
-%
-\def\activeparens{%
-  \catcode`\(=\active \catcode`\)=\active
-  \catcode`\[=\active \catcode`\]=\active
-  \catcode`\&=\active
-}
-
-% Make control sequences which act like normal parenthesis chars.
-\let\lparen = ( \let\rparen = )
-
-% Be sure that we always have a definition for `(', etc.  For example,
-% if the fn name has parens in it, \boldbrax will not be in effect yet,
-% so TeX would otherwise complain about undefined control sequence.
-{
-  \activeparens
-  \global\let(=\lparen \global\let)=\rparen
-  \global\let[=\lbrack \global\let]=\rbrack
-  \global\let& = \&
-
-  \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
-  \gdef\magicamp{\let&=\amprm}
-}
-
-\newcount\parencount
-
-% If we encounter &foo, then turn on ()-hacking afterwards
-\newif\ifampseen
-\def\amprm#1 {\ampseentrue{\bf\&#1 }}
-
-\def\parenfont{%
-  \ifampseen
-    % At the first level, print parens in roman,
-    % otherwise use the default font.
-    \ifnum \parencount=1 \rm \fi
-  \else
-    % The \sf parens (in \boldbrax) actually are a little bolder than
-    % the contained text.  This is especially needed for [ and ] .
-    \sf
-  \fi
-}
-\def\infirstlevel#1{%
-  \ifampseen
-    \ifnum\parencount=1
-      #1%
-    \fi
-  \fi
-}
-\def\bfafterword#1 {#1 \bf}
-
-\def\opnr{%
-  \global\advance\parencount by 1
-  {\parenfont(}%
-  \infirstlevel \bfafterword
-}
-\def\clnr{%
-  {\parenfont)}%
-  \infirstlevel \sl
-  \global\advance\parencount by -1
-}
-
-\newcount\brackcount
-\def\lbrb{%
-  \global\advance\brackcount by 1
-  {\bf[}%
-}
-\def\rbrb{%
-  {\bf]}%
-  \global\advance\brackcount by -1
-}
-
-\def\checkparencounts{%
-  \ifnum\parencount=0 \else \badparencount \fi
-  \ifnum\brackcount=0 \else \badbrackcount \fi
-}
-% these should not use \errmessage; the glibc manual, at least, actually
-% has such constructs (when documenting function pointers).
-\def\badparencount{%
-  \message{Warning: unbalanced parentheses in @def...}%
-  \global\parencount=0
-}
-\def\badbrackcount{%
-  \message{Warning: unbalanced square brackets in @def...}%
-  \global\brackcount=0
-}
-
-
-\message{macros,}
-% @macro.
-
-% To do this right we need a feature of e-TeX, \scantokens,
-% which we arrange to emulate with a temporary file in ordinary TeX.
-\ifx\eTeXversion\undefined
-  \newwrite\macscribble
-  \def\scantokens#1{%
-    \toks0={#1}%
-    \immediate\openout\macscribble=\jobname.tmp
-    \immediate\write\macscribble{\the\toks0}%
-    \immediate\closeout\macscribble
-    \input \jobname.tmp
-  }
-\fi
-
-\def\scanmacro#1{%
-  \begingroup
-    \newlinechar`\^^M
-    \let\xeatspaces\eatspaces
-    % Undo catcode changes of \startcontents and \doprintindex
-    % When called from @insertcopying or (short)caption, we need active
-    % backslash to get it printed correctly.  Previously, we had
-    % \catcode`\\=\other instead.  We'll see whether a problem appears
-    % with macro expansion.				--kasal, 19aug04
-    \catcode`\@=0 \catcode`\\=\active \escapechar=`\@
-    % ... and \example
-    \spaceisspace
-    %
-    % Append \endinput to make sure that TeX does not see the ending newline.
-    % I've verified that it is necessary both for e-TeX and for ordinary TeX
-    %							--kasal, 29nov03
-    \scantokens{#1\endinput}%
-  \endgroup
-}
-
-\def\scanexp#1{%
-  \edef\temp{\noexpand\scanmacro{#1}}%
-  \temp
-}
-
-\newcount\paramno   % Count of parameters
-\newtoks\macname    % Macro name
-\newif\ifrecursive  % Is it recursive?
-
-% List of all defined macros in the form
-%    \definedummyword\macro1\definedummyword\macro2...
-% Currently is also contains all @aliases; the list can be split
-% if there is a need.
-\def\macrolist{}
-
-% Add the macro to \macrolist
-\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
-\def\addtomacrolistxxx#1{%
-     \toks0 = \expandafter{\macrolist\definedummyword#1}%
-     \xdef\macrolist{\the\toks0}%
-}
-
-% Utility routines.
-% This does \let #1 = #2, with \csnames; that is,
-%   \let \csname#1\endcsname = \csname#2\endcsname
-% (except of course we have to play expansion games).
-%
-\def\cslet#1#2{%
-  \expandafter\let
-  \csname#1\expandafter\endcsname
-  \csname#2\endcsname
-}
-
-% Trim leading and trailing spaces off a string.
-% Concepts from aro-bend problem 15 (see CTAN).
-{\catcode`\@=11
-\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
-\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
-\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
-\def\unbrace#1{#1}
-\unbrace{\gdef\trim@@@ #1 } #2@{#1}
-}
-
-% Trim a single trailing ^^M off a string.
-{\catcode`\^^M=\other \catcode`\Q=3%
-\gdef\eatcr #1{\eatcra #1Q^^MQ}%
-\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
-\gdef\eatcrb#1Q#2Q{#1}%
-}
-
-% Macro bodies are absorbed as an argument in a context where
-% all characters are catcode 10, 11 or 12, except \ which is active
-% (as in normal texinfo). It is necessary to change the definition of \.
-
-% Non-ASCII encodings make 8-bit characters active, so un-activate
-% them to avoid their expansion.  Must do this non-globally, to
-% confine the change to the current group.
-
-% It's necessary to have hard CRs when the macro is executed. This is
-% done by  making ^^M (\endlinechar) catcode 12 when reading the macro
-% body, and then making it the \newlinechar in \scanmacro.
-
-\def\scanctxt{%
-  \catcode`\"=\other
-  \catcode`\+=\other
-  \catcode`\<=\other
-  \catcode`\>=\other
-  \catcode`\@=\other
-  \catcode`\^=\other
-  \catcode`\_=\other
-  \catcode`\|=\other
-  \catcode`\~=\other
-  \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
-}
-
-\def\scanargctxt{%
-  \scanctxt
-  \catcode`\\=\other
-  \catcode`\^^M=\other
-}
-
-\def\macrobodyctxt{%
-  \scanctxt
-  \catcode`\{=\other
-  \catcode`\}=\other
-  \catcode`\^^M=\other
-  \usembodybackslash
-}
-
-\def\macroargctxt{%
-  \scanctxt
-  \catcode`\\=\other
-}
-
-% \mbodybackslash is the definition of \ in @macro bodies.
-% It maps \foo\ => \csname macarg.foo\endcsname => #N
-% where N is the macro parameter number.
-% We define \csname macarg.\endcsname to be \realbackslash, so
-% \\ in macro replacement text gets you a backslash.
-
-{\catcode`@=0 @catcode`@\=@active
- @gdef at usembodybackslash{@let\=@mbodybackslash}
- @gdef at mbodybackslash#1\{@csname macarg.#1 at endcsname}
-}
-\expandafter\def\csname macarg.\endcsname{\realbackslash}
-
-\def\macro{\recursivefalse\parsearg\macroxxx}
-\def\rmacro{\recursivetrue\parsearg\macroxxx}
-
-\def\macroxxx#1{%
-  \getargs{#1}%           now \macname is the macname and \argl the arglist
-  \ifx\argl\empty       % no arguments
-     \paramno=0%
-  \else
-     \expandafter\parsemargdef \argl;%
-  \fi
-  \if1\csname ismacro.\the\macname\endcsname
-     \message{Warning: redefining \the\macname}%
-  \else
-     \expandafter\ifx\csname \the\macname\endcsname \relax
-     \else \errmessage{Macro name \the\macname\space already defined}\fi
-     \global\cslet{macsave.\the\macname}{\the\macname}%
-     \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
-     \addtomacrolist{\the\macname}%
-  \fi
-  \begingroup \macrobodyctxt
-  \ifrecursive \expandafter\parsermacbody
-  \else \expandafter\parsemacbody
-  \fi}
-
-\parseargdef\unmacro{%
-  \if1\csname ismacro.#1\endcsname
-    \global\cslet{#1}{macsave.#1}%
-    \global\expandafter\let \csname ismacro.#1\endcsname=0%
-    % Remove the macro name from \macrolist:
-    \begingroup
-      \expandafter\let\csname#1\endcsname \relax
-      \let\definedummyword\unmacrodo
-      \xdef\macrolist{\macrolist}%
-    \endgroup
-  \else
-    \errmessage{Macro #1 not defined}%
-  \fi
-}
-
-% Called by \do from \dounmacro on each macro.  The idea is to omit any
-% macro definitions that have been changed to \relax.
-%
-\def\unmacrodo#1{%
-  \ifx #1\relax
-    % remove this
-  \else
-    \noexpand\definedummyword \noexpand#1%
-  \fi
-}
-
-% This makes use of the obscure feature that if the last token of a
-% <parameter list> is #, then the preceding argument is delimited by
-% an opening brace, and that opening brace is not consumed.
-\def\getargs#1{\getargsxxx#1{}}
-\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
-\def\getmacname #1 #2\relax{\macname={#1}}
-\def\getmacargs#1{\def\argl{#1}}
-
-% Parse the optional {params} list.  Set up \paramno and \paramlist
-% so \defmacro knows what to do.  Define \macarg.blah for each blah
-% in the params list, to be ##N where N is the position in that list.
-% That gets used by \mbodybackslash (above).
-
-% We need to get `macro parameter char #' into several definitions.
-% The technique used is stolen from LaTeX:  let \hash be something
-% unexpandable, insert that wherever you need a #, and then redefine
-% it to # just before using the token list produced.
-%
-% The same technique is used to protect \eatspaces till just before
-% the macro is used.
-
-\def\parsemargdef#1;{\paramno=0\def\paramlist{}%
-        \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
-\def\parsemargdefxxx#1,{%
-  \if#1;\let\next=\relax
-  \else \let\next=\parsemargdefxxx
-    \advance\paramno by 1%
-    \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
-        {\xeatspaces{\hash\the\paramno}}%
-    \edef\paramlist{\paramlist\hash\the\paramno,}%
-  \fi\next}
-
-% These two commands read recursive and nonrecursive macro bodies.
-% (They're different since rec and nonrec macros end differently.)
-
-\long\def\parsemacbody#1 at end macro%
-{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
-\long\def\parsermacbody#1 at end rmacro%
-{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
-
-% This defines the macro itself. There are six cases: recursive and
-% nonrecursive macros of zero, one, and many arguments.
-% Much magic with \expandafter here.
-% \xdef is used so that macro definitions will survive the file
-% they're defined in; @include reads the file inside a group.
-\def\defmacro{%
-  \let\hash=##% convert placeholders to macro parameter chars
-  \ifrecursive
-    \ifcase\paramno
-    % 0
-      \expandafter\xdef\csname\the\macname\endcsname{%
-        \noexpand\scanmacro{\temp}}%
-    \or % 1
-      \expandafter\xdef\csname\the\macname\endcsname{%
-         \bgroup\noexpand\macroargctxt
-         \noexpand\braceorline
-         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
-      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
-         \egroup\noexpand\scanmacro{\temp}}%
-    \else % many
-      \expandafter\xdef\csname\the\macname\endcsname{%
-         \bgroup\noexpand\macroargctxt
-         \noexpand\csname\the\macname xx\endcsname}%
-      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
-          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
-      \expandafter\expandafter
-      \expandafter\xdef
-      \expandafter\expandafter
-        \csname\the\macname xxx\endcsname
-          \paramlist{\egroup\noexpand\scanmacro{\temp}}%
-    \fi
-  \else
-    \ifcase\paramno
-    % 0
-      \expandafter\xdef\csname\the\macname\endcsname{%
-        \noexpand\norecurse{\the\macname}%
-        \noexpand\scanmacro{\temp}\egroup}%
-    \or % 1
-      \expandafter\xdef\csname\the\macname\endcsname{%
-         \bgroup\noexpand\macroargctxt
-         \noexpand\braceorline
-         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
-      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
-        \egroup
-        \noexpand\norecurse{\the\macname}%
-        \noexpand\scanmacro{\temp}\egroup}%
-    \else % many
-      \expandafter\xdef\csname\the\macname\endcsname{%
-         \bgroup\noexpand\macroargctxt
-         \expandafter\noexpand\csname\the\macname xx\endcsname}%
-      \expandafter\xdef\csname\the\macname xx\endcsname##1{%
-          \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
-      \expandafter\expandafter
-      \expandafter\xdef
-      \expandafter\expandafter
-      \csname\the\macname xxx\endcsname
-      \paramlist{%
-          \egroup
-          \noexpand\norecurse{\the\macname}%
-          \noexpand\scanmacro{\temp}\egroup}%
-    \fi
-  \fi}
-
-\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
-
-% \braceorline decides whether the next nonwhitespace character is a
-% {.  If so it reads up to the closing }, if not, it reads the whole
-% line.  Whatever was read is then fed to the next control sequence
-% as an argument (by \parsebrace or \parsearg)
-\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
-\def\braceorlinexxx{%
-  \ifx\nchar\bgroup\else
-    \expandafter\parsearg
-  \fi \macnamexxx}
-
-
-% @alias.
-% We need some trickery to remove the optional spaces around the equal
-% sign.  Just make them active and then expand them all to nothing.
-\def\alias{\parseargusing\obeyspaces\aliasxxx}
-\def\aliasxxx #1{\aliasyyy#1\relax}
-\def\aliasyyy #1=#2\relax{%
-  {%
-    \expandafter\let\obeyedspace=\empty
-    \addtomacrolist{#1}%
-    \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
-  }%
-  \next
-}
-
-
-\message{cross references,}
-
-\newwrite\auxfile
-\newif\ifhavexrefs    % True if xref values are known.
-\newif\ifwarnedxrefs  % True if we warned once that they aren't known.
-
-% @inforef is relatively simple.
-\def\inforef #1{\inforefzzz #1,,,,**}
-\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
-  node \samp{\ignorespaces#1{}}}
-
-% @node's only job in TeX is to define \lastnode, which is used in
-% cross-references.  The @node line might or might not have commas, and
-% might or might not have spaces before the first comma, like:
-% @node foo , bar , ...
-% We don't want such trailing spaces in the node name.
-%
-\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
-%
-% also remove a trailing comma, in case of something like this:
-% @node Help-Cross,  ,  , Cross-refs
-\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
-\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
-
-\let\nwnode=\node
-\let\lastnode=\empty
-
-% Write a cross-reference definition for the current node.  #1 is the
-% type (Ynumbered, Yappendix, Ynothing).
-%
-\def\donoderef#1{%
-  \ifx\lastnode\empty\else
-    \setref{\lastnode}{#1}%
-    \global\let\lastnode=\empty
-  \fi
-}
-
-% @anchor{NAME} -- define xref target at arbitrary point.
-%
-\newcount\savesfregister
-%
-\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
-\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
-\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
-
-% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
-% anchor), which consists of three parts:
-% 1) NAME-title - the current sectioning name taken from \lastsection,
-%                 or the anchor name.
-% 2) NAME-snt   - section number and type, passed as the SNT arg, or
-%                 empty for anchors.
-% 3) NAME-pg    - the page number.
-%
-% This is called from \donoderef, \anchor, and \dofloat.  In the case of
-% floats, there is an additional part, which is not written here:
-% 4) NAME-lof   - the text as it should appear in a @listoffloats.
-%
-\def\setref#1#2{%
-  \pdfmkdest{#1}%
-  \iflinks
-    {%
-      \atdummies  % preserve commands, but don't expand them
-      \edef\writexrdef##1##2{%
-	\write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
-	  ##1}{##2}}% these are parameters of \writexrdef
-      }%
-      \toks0 = \expandafter{\lastsection}%
-      \immediate \writexrdef{title}{\the\toks0 }%
-      \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
-      \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, during \shipout
-    }%
-  \fi
-}
-
-% @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
-% the node name, #2 the name of the Info cross-reference, #3 the printed
-% node name, #4 the name of the Info file, #5 the name of the printed
-% manual.  All but the node name can be omitted.
-%
-\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
-\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
-\def\ref#1{\xrefX[#1,,,,,,,]}
-\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
-  \unsepspaces
-  \def\printedmanual{\ignorespaces #5}%
-  \def\printedrefname{\ignorespaces #3}%
-  \setbox1=\hbox{\printedmanual\unskip}%
-  \setbox0=\hbox{\printedrefname\unskip}%
-  \ifdim \wd0 = 0pt
-    % No printed node name was explicitly given.
-    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
-      % Use the node name inside the square brackets.
-      \def\printedrefname{\ignorespaces #1}%
-    \else
-      % Use the actual chapter/section title appear inside
-      % the square brackets.  Use the real section title if we have it.
-      \ifdim \wd1 > 0pt
-        % It is in another manual, so we don't have it.
-        \def\printedrefname{\ignorespaces #1}%
-      \else
-        \ifhavexrefs
-          % We know the real title if we have the xref values.
-          \def\printedrefname{\refx{#1-title}{}}%
-        \else
-          % Otherwise just copy the Info node name.
-          \def\printedrefname{\ignorespaces #1}%
-        \fi%
-      \fi
-    \fi
-  \fi
-  %
-  % Make link in pdf output.
-  \ifpdf
-    {\indexnofonts
-     \turnoffactive
-     % This expands tokens, so do it after making catcode changes, so _
-     % etc. don't get their TeX definitions.
-     \getfilename{#4}%
-     %
-     % See comments at \activebackslashdouble.
-     {\activebackslashdouble \xdef\pdfxrefdest{#1}%
-      \backslashparens\pdfxrefdest}%
-     %
-     \leavevmode
-     \startlink attr{/Border [0 0 0]}%
-     \ifnum\filenamelength>0
-       goto file{\the\filename.pdf} name{\pdfxrefdest}%
-     \else
-       goto name{\pdfmkpgn{\pdfxrefdest}}%
-     \fi
-    }%
-    \setcolor{\linkcolor}%
-  \fi
-  %
-  % Float references are printed completely differently: "Figure 1.2"
-  % instead of "[somenode], p.3".  We distinguish them by the
-  % LABEL-title being set to a magic string.
-  {%
-    % Have to otherify everything special to allow the \csname to
-    % include an _ in the xref name, etc.
-    \indexnofonts
-    \turnoffactive
-    \expandafter\global\expandafter\let\expandafter\Xthisreftitle
-      \csname XR#1-title\endcsname
-  }%
-  \iffloat\Xthisreftitle
-    % If the user specified the print name (third arg) to the ref,
-    % print it instead of our usual "Figure 1.2".
-    \ifdim\wd0 = 0pt
-      \refx{#1-snt}{}%
-    \else
-      \printedrefname
-    \fi
-    %
-    % if the user also gave the printed manual name (fifth arg), append
-    % "in MANUALNAME".
-    \ifdim \wd1 > 0pt
-      \space \putwordin{} \cite{\printedmanual}%
-    \fi
-  \else
-    % node/anchor (non-float) references.
-    %
-    % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
-    % insert empty discretionaries after hyphens, which means that it will
-    % not find a line break at a hyphen in a node names.  Since some manuals
-    % are best written with fairly long node names, containing hyphens, this
-    % is a loss.  Therefore, we give the text of the node name again, so it
-    % is as if TeX is seeing it for the first time.
-    \ifdim \wd1 > 0pt
-      \putwordSection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}%
-    \else
-      % _ (for example) has to be the character _ for the purposes of the
-      % control sequence corresponding to the node, but it has to expand
-      % into the usual \leavevmode...\vrule stuff for purposes of
-      % printing. So we \turnoffactive for the \refx-snt, back on for the
-      % printing, back off for the \refx-pg.
-      {\turnoffactive
-       % Only output a following space if the -snt ref is nonempty; for
-       % @unnumbered and @anchor, it won't be.
-       \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
-       \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
-      }%
-      % output the `[mynode]' via a macro so it can be overridden.
-      \xrefprintnodename\printedrefname
-      %
-      % But we always want a comma and a space:
-      ,\space
-      %
-      % output the `page 3'.
-      \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
-    \fi
-  \fi
-  \endlink
-\endgroup}
-
-% This macro is called from \xrefX for the `[nodename]' part of xref
-% output.  It's a separate macro only so it can be changed more easily,
-% since square brackets don't work well in some documents.  Particularly
-% one that Bob is working on :).
-%
-\def\xrefprintnodename#1{[#1]}
-
-% Things referred to by \setref.
-%
-\def\Ynothing{}
-\def\Yomitfromtoc{}
-\def\Ynumbered{%
-  \ifnum\secno=0
-    \putwordChapter at tie \the\chapno
-  \else \ifnum\subsecno=0
-    \putwordSection at tie \the\chapno.\the\secno
-  \else \ifnum\subsubsecno=0
-    \putwordSection at tie \the\chapno.\the\secno.\the\subsecno
-  \else
-    \putwordSection at tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
-  \fi\fi\fi
-}
-\def\Yappendix{%
-  \ifnum\secno=0
-     \putwordAppendix at tie @char\the\appendixno{}%
-  \else \ifnum\subsecno=0
-     \putwordSection at tie @char\the\appendixno.\the\secno
-  \else \ifnum\subsubsecno=0
-    \putwordSection at tie @char\the\appendixno.\the\secno.\the\subsecno
-  \else
-    \putwordSection at tie
-      @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
-  \fi\fi\fi
-}
-
-% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
-% If its value is nonempty, SUFFIX is output afterward.
-%
-\def\refx#1#2{%
-  {%
-    \indexnofonts
-    \otherbackslash
-    \expandafter\global\expandafter\let\expandafter\thisrefX
-      \csname XR#1\endcsname
-  }%
-  \ifx\thisrefX\relax
-    % If not defined, say something at least.
-    \angleleft un\-de\-fined\angleright
-    \iflinks
-      \ifhavexrefs
-        \message{\linenumber Undefined cross reference `#1'.}%
-      \else
-        \ifwarnedxrefs\else
-          \global\warnedxrefstrue
-          \message{Cross reference values unknown; you must run TeX again.}%
-        \fi
-      \fi
-    \fi
-  \else
-    % It's defined, so just use it.
-    \thisrefX
-  \fi
-  #2% Output the suffix in any case.
-}
-
-% This is the macro invoked by entries in the aux file.  Usually it's
-% just a \def (we prepend XR to the control sequence name to avoid
-% collisions).  But if this is a float type, we have more work to do.
-%
-\def\xrdef#1#2{%
-  {% The node name might contain 8-bit characters, which in our current
-   % implementation are changed to commands like @'e.  Don't let these
-   % mess up the control sequence name.
-    \indexnofonts
-    \turnoffactive
-    \xdef\safexrefname{#1}%
-  }%
-  %
-  \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
-  %
-  % Was that xref control sequence that we just defined for a float?
-  \expandafter\iffloat\csname XR\safexrefname\endcsname
-    % it was a float, and we have the (safe) float type in \iffloattype.
-    \expandafter\let\expandafter\floatlist
-      \csname floatlist\iffloattype\endcsname
-    %
-    % Is this the first time we've seen this float type?
-    \expandafter\ifx\floatlist\relax
-      \toks0 = {\do}% yes, so just \do
-    \else
-      % had it before, so preserve previous elements in list.
-      \toks0 = \expandafter{\floatlist\do}%
-    \fi
-    %
-    % Remember this xref in the control sequence \floatlistFLOATTYPE,
-    % for later use in \listoffloats.
-    \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
-      {\safexrefname}}%
-  \fi
-}
-
-% Read the last existing aux file, if any.  No error if none exists.
-%
-\def\tryauxfile{%
-  \openin 1 \jobname.aux
-  \ifeof 1 \else
-    \readdatafile{aux}%
-    \global\havexrefstrue
-  \fi
-  \closein 1
-}
-
-\def\setupdatafile{%
-  \catcode`\^^@=\other
-  \catcode`\^^A=\other
-  \catcode`\^^B=\other
-  \catcode`\^^C=\other
-  \catcode`\^^D=\other
-  \catcode`\^^E=\other
-  \catcode`\^^F=\other
-  \catcode`\^^G=\other
-  \catcode`\^^H=\other
-  \catcode`\^^K=\other
-  \catcode`\^^L=\other
-  \catcode`\^^N=\other
-  \catcode`\^^P=\other
-  \catcode`\^^Q=\other
-  \catcode`\^^R=\other
-  \catcode`\^^S=\other
-  \catcode`\^^T=\other
-  \catcode`\^^U=\other
-  \catcode`\^^V=\other
-  \catcode`\^^W=\other
-  \catcode`\^^X=\other
-  \catcode`\^^Z=\other
-  \catcode`\^^[=\other
-  \catcode`\^^\=\other
-  \catcode`\^^]=\other
-  \catcode`\^^^=\other
-  \catcode`\^^_=\other
-  % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
-  % in xref tags, i.e., node names.  But since ^^e4 notation isn't
-  % supported in the main text, it doesn't seem desirable.  Furthermore,
-  % that is not enough: for node names that actually contain a ^
-  % character, we would end up writing a line like this: 'xrdef {'hat
-  % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
-  % argument, and \hat is not an expandable control sequence.  It could
-  % all be worked out, but why?  Either we support ^^ or we don't.
-  %
-  % The other change necessary for this was to define \auxhat:
-  % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
-  % and then to call \auxhat in \setq.
-  %
-  \catcode`\^=\other
-  %
-  % Special characters.  Should be turned off anyway, but...
-  \catcode`\~=\other
-  \catcode`\[=\other
-  \catcode`\]=\other
-  \catcode`\"=\other
-  \catcode`\_=\other
-  \catcode`\|=\other
-  \catcode`\<=\other
-  \catcode`\>=\other
-  \catcode`\$=\other
-  \catcode`\#=\other
-  \catcode`\&=\other
-  \catcode`\%=\other
-  \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
-  %
-  % This is to support \ in node names and titles, since the \
-  % characters end up in a \csname.  It's easier than
-  % leaving it active and making its active definition an actual \
-  % character.  What I don't understand is why it works in the *value*
-  % of the xrdef.  Seems like it should be a catcode12 \, and that
-  % should not typeset properly.  But it works, so I'm moving on for
-  % now.  --karl, 15jan04.
-  \catcode`\\=\other
-  %
-  % Make the characters 128-255 be printing characters.
-  {%
-    \count1=128
-    \def\loop{%
-      \catcode\count1=\other
-      \advance\count1 by 1
-      \ifnum \count1<256 \loop \fi
-    }%
-  }%
-  %
-  % @ is our escape character in .aux files, and we need braces.
-  \catcode`\{=1
-  \catcode`\}=2
-  \catcode`\@=0
-}
-
-\def\readdatafile#1{%
-\begingroup
-  \setupdatafile
-  \input\jobname.#1
-\endgroup}
-
-
-\message{insertions,}
-% including footnotes.
-
-\newcount \footnoteno
-
-% The trailing space in the following definition for supereject is
-% vital for proper filling; pages come out unaligned when you do a
-% pagealignmacro call if that space before the closing brace is
-% removed. (Generally, numeric constants should always be followed by a
-% space to prevent strange expansion errors.)
-\def\supereject{\par\penalty -20000\footnoteno =0 }
-
-% @footnotestyle is meaningful for info output only.
-\let\footnotestyle=\comment
-
-{\catcode `\@=11
-%
-% Auto-number footnotes.  Otherwise like plain.
-\gdef\footnote{%
-  \let\indent=\ptexindent
-  \let\noindent=\ptexnoindent
-  \global\advance\footnoteno by \@ne
-  \edef\thisfootno{$^{\the\footnoteno}$}%
-  %
-  % In case the footnote comes at the end of a sentence, preserve the
-  % extra spacing after we do the footnote number.
-  \let\@sf\empty
-  \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
-  %
-  % Remove inadvertent blank space before typesetting the footnote number.
-  \unskip
-  \thisfootno\@sf
-  \dofootnote
-}%
-
-% Don't bother with the trickery in plain.tex to not require the
-% footnote text as a parameter.  Our footnotes don't need to be so general.
-%
-% Oh yes, they do; otherwise, @ifset (and anything else that uses
-% \parseargline) fails inside footnotes because the tokens are fixed when
-% the footnote is read.  --karl, 16nov96.
-%
-\gdef\dofootnote{%
-  \insert\footins\bgroup
-  % We want to typeset this text as a normal paragraph, even if the
-  % footnote reference occurs in (for example) a display environment.
-  % So reset some parameters.
-  \hsize=\pagewidth
-  \interlinepenalty\interfootnotelinepenalty
-  \splittopskip\ht\strutbox % top baseline for broken footnotes
-  \splitmaxdepth\dp\strutbox
-  \floatingpenalty\@MM
-  \leftskip\z at skip
-  \rightskip\z at skip
-  \spaceskip\z at skip
-  \xspaceskip\z at skip
-  \parindent\defaultparindent
-  %
-  \smallfonts \rm
-  %
-  % Because we use hanging indentation in footnotes, a @noindent appears
-  % to exdent this text, so make it be a no-op.  makeinfo does not use
-  % hanging indentation so @noindent can still be needed within footnote
-  % text after an @example or the like (not that this is good style).
-  \let\noindent = \relax
-  %
-  % Hang the footnote text off the number.  Use \everypar in case the
-  % footnote extends for more than one paragraph.
-  \everypar = {\hang}%
-  \textindent{\thisfootno}%
-  %
-  % Don't crash into the line above the footnote text.  Since this
-  % expands into a box, it must come within the paragraph, lest it
-  % provide a place where TeX can split the footnote.
-  \footstrut
-  \futurelet\next\fo at t
-}
-}%end \catcode `\@=11
-
-% In case a @footnote appears in a vbox, save the footnote text and create
-% the real \insert just after the vbox finished.  Otherwise, the insertion
-% would be lost.
-% Similarly, if a @footnote appears inside an alignment, save the footnote
-% text to a box and make the \insert when a row of the table is finished.
-% And the same can be done for other insert classes.  --kasal, 16nov03.
-
-% Replace the \insert primitive by a cheating macro.
-% Deeper inside, just make sure that the saved insertions are not spilled
-% out prematurely.
-%
-\def\startsavinginserts{%
-  \ifx \insert\ptexinsert
-    \let\insert\saveinsert
-  \else
-    \let\checkinserts\relax
-  \fi
-}
-
-% This \insert replacement works for both \insert\footins{foo} and
-% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
-%
-\def\saveinsert#1{%
-  \edef\next{\noexpand\savetobox \makeSAVEname#1}%
-  \afterassignment\next
-  % swallow the left brace
-  \let\temp =
-}
-\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
-\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
-
-\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
-
-\def\placesaveins#1{%
-  \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
-    {\box#1}%
-}
-
-% eat @SAVE -- beware, all of them have catcode \other:
-{
-  \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials  %  ;-)
-  \gdef\gobblesave @SAVE{}
-}
-
-% initialization:
-\def\newsaveins #1{%
-  \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
-  \next
-}
-\def\newsaveinsX #1{%
-  \csname newbox\endcsname #1%
-  \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
-    \checksaveins #1}%
-}
-
-% initialize:
-\let\checkinserts\empty
-\newsaveins\footins
-\newsaveins\margin
-
-
-% @image.  We use the macros from epsf.tex to support this.
-% If epsf.tex is not installed and @image is used, we complain.
-%
-% Check for and read epsf.tex up front.  If we read it only at @image
-% time, we might be inside a group, and then its definitions would get
-% undone and the next image would fail.
-\openin 1 = epsf.tex
-\ifeof 1 \else
-  % Do not bother showing banner with epsf.tex v2.7k (available in
-  % doc/epsf.tex and on ctan).
-  \def\epsfannounce{\toks0 = }%
-  \input epsf.tex
-\fi
-\closein 1
-%
-% We will only complain once about lack of epsf.tex.
-\newif\ifwarnednoepsf
-\newhelp\noepsfhelp{epsf.tex must be installed for images to
-  work.  It is also included in the Texinfo distribution, or you can get
-  it from ftp://tug.org/tex/epsf.tex.}
-%
-\def\image#1{%
-  \ifx\epsfbox\undefined
-    \ifwarnednoepsf \else
-      \errhelp = \noepsfhelp
-      \errmessage{epsf.tex not found, images will be ignored}%
-      \global\warnednoepsftrue
-    \fi
-  \else
-    \imagexxx #1,,,,,\finish
-  \fi
-}
-%
-% Arguments to @image:
-% #1 is (mandatory) image filename; we tack on .eps extension.
-% #2 is (optional) width, #3 is (optional) height.
-% #4 is (ignored optional) html alt text.
-% #5 is (ignored optional) extension.
-% #6 is just the usual extra ignored arg for parsing this stuff.
-\newif\ifimagevmode
-\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
-  \catcode`\^^M = 5     % in case we're inside an example
-  \normalturnoffactive  % allow _ et al. in names
-  % If the image is by itself, center it.
-  \ifvmode
-    \imagevmodetrue
-    \nobreak\medskip
-    % Usually we'll have text after the image which will insert
-    % \parskip glue, so insert it here too to equalize the space
-    % above and below.
-    \nobreak\vskip\parskip
-    \nobreak
-  \fi
-  %
-  % Leave vertical mode so that indentation from an enclosing
-  % environment such as @quotation is respected.  On the other hand, if
-  % it's at the top level, we don't want the normal paragraph indentation.
-  \noindent
-  %
-  % Output the image.
-  \ifpdf
-    \dopdfimage{#1}{#2}{#3}%
-  \else
-    % \epsfbox itself resets \epsf?size at each figure.
-    \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
-    \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
-    \epsfbox{#1.eps}%
-  \fi
-  %
-  \ifimagevmode \medskip \fi  % space after the standalone image
-\endgroup}
-
-
-% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
-% etc.  We don't actually implement floating yet, we always include the
-% float "here".  But it seemed the best name for the future.
-%
-\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
-
-% There may be a space before second and/or third parameter; delete it.
-\def\eatcommaspace#1, {#1,}
-
-% #1 is the optional FLOATTYPE, the text label for this float, typically
-% "Figure", "Table", "Example", etc.  Can't contain commas.  If omitted,
-% this float will not be numbered and cannot be referred to.
-%
-% #2 is the optional xref label.  Also must be present for the float to
-% be referable.
-%
-% #3 is the optional positioning argument; for now, it is ignored.  It
-% will somehow specify the positions allowed to float to (here, top, bottom).
-%
-% We keep a separate counter for each FLOATTYPE, which we reset at each
-% chapter-level command.
-\let\resetallfloatnos=\empty
-%
-\def\dofloat#1,#2,#3,#4\finish{%
-  \let\thiscaption=\empty
-  \let\thisshortcaption=\empty
-  %
-  % don't lose footnotes inside @float.
-  %
-  % BEWARE: when the floats start float, we have to issue warning whenever an
-  % insert appears inside a float which could possibly float. --kasal, 26may04
-  %
-  \startsavinginserts
-  %
-  % We can't be used inside a paragraph.
-  \par
-  %
-  \vtop\bgroup
-    \def\floattype{#1}%
-    \def\floatlabel{#2}%
-    \def\floatloc{#3}% we do nothing with this yet.
-    %
-    \ifx\floattype\empty
-      \let\safefloattype=\empty
-    \else
-      {%
-        % the floattype might have accents or other special characters,
-        % but we need to use it in a control sequence name.
-        \indexnofonts
-        \turnoffactive
-        \xdef\safefloattype{\floattype}%
-      }%
-    \fi
-    %
-    % If label is given but no type, we handle that as the empty type.
-    \ifx\floatlabel\empty \else
-      % We want each FLOATTYPE to be numbered separately (Figure 1,
-      % Table 1, Figure 2, ...).  (And if no label, no number.)
-      %
-      \expandafter\getfloatno\csname\safefloattype floatno\endcsname
-      \global\advance\floatno by 1
-      %
-      {%
-        % This magic value for \lastsection is output by \setref as the
-        % XREFLABEL-title value.  \xrefX uses it to distinguish float
-        % labels (which have a completely different output format) from
-        % node and anchor labels.  And \xrdef uses it to construct the
-        % lists of floats.
-        %
-        \edef\lastsection{\floatmagic=\safefloattype}%
-        \setref{\floatlabel}{Yfloat}%
-      }%
-    \fi
-    %
-    % start with \parskip glue, I guess.
-    \vskip\parskip
-    %
-    % Don't suppress indentation if a float happens to start a section.
-    \restorefirstparagraphindent
-}
-
-% we have these possibilities:
-% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
-% @float Foo,lbl & no caption:    Foo 1.1
-% @float Foo & @caption{Cap}:     Foo: Cap
-% @float Foo & no caption:        Foo
-% @float ,lbl & Caption{Cap}:     1.1: Cap
-% @float ,lbl & no caption:       1.1
-% @float & @caption{Cap}:         Cap
-% @float & no caption:
-%
-\def\Efloat{%
-    \let\floatident = \empty
-    %
-    % In all cases, if we have a float type, it comes first.
-    \ifx\floattype\empty \else \def\floatident{\floattype}\fi
-    %
-    % If we have an xref label, the number comes next.
-    \ifx\floatlabel\empty \else
-      \ifx\floattype\empty \else % if also had float type, need tie first.
-        \appendtomacro\floatident{\tie}%
-      \fi
-      % the number.
-      \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
-    \fi
-    %
-    % Start the printed caption with what we've constructed in
-    % \floatident, but keep it separate; we need \floatident again.
-    \let\captionline = \floatident
-    %
-    \ifx\thiscaption\empty \else
-      \ifx\floatident\empty \else
-	\appendtomacro\captionline{: }% had ident, so need a colon between
-      \fi
-      %
-      % caption text.
-      \appendtomacro\captionline{\scanexp\thiscaption}%
-    \fi
-    %
-    % If we have anything to print, print it, with space before.
-    % Eventually this needs to become an \insert.
-    \ifx\captionline\empty \else
-      \vskip.5\parskip
-      \captionline
-      %
-      % Space below caption.
-      \vskip\parskip
-    \fi
-    %
-    % If have an xref label, write the list of floats info.  Do this
-    % after the caption, to avoid chance of it being a breakpoint.
-    \ifx\floatlabel\empty \else
-      % Write the text that goes in the lof to the aux file as
-      % \floatlabel-lof.  Besides \floatident, we include the short
-      % caption if specified, else the full caption if specified, else nothing.
-      {%
-        \atdummies
-        %
-        % since we read the caption text in the macro world, where ^^M
-        % is turned into a normal character, we have to scan it back, so
-        % we don't write the literal three characters "^^M" into the aux file.
-	\scanexp{%
-	  \xdef\noexpand\gtemp{%
-	    \ifx\thisshortcaption\empty
-	      \thiscaption
-	    \else
-	      \thisshortcaption
-	    \fi
-	  }%
-	}%
-        \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
-	  \ifx\gtemp\empty \else : \gtemp \fi}}%
-      }%
-    \fi
-  \egroup  % end of \vtop
-  %
-  % place the captured inserts
-  %
-  % BEWARE: when the floats start floating, we have to issue warning
-  % whenever an insert appears inside a float which could possibly
-  % float. --kasal, 26may04
-  %
-  \checkinserts
-}
-
-% Append the tokens #2 to the definition of macro #1, not expanding either.
-%
-\def\appendtomacro#1#2{%
-  \expandafter\def\expandafter#1\expandafter{#1#2}%
-}
-
-% @caption, @shortcaption
-%
-\def\caption{\docaption\thiscaption}
-\def\shortcaption{\docaption\thisshortcaption}
-\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
-\def\defcaption#1#2{\egroup \def#1{#2}}
-
-% The parameter is the control sequence identifying the counter we are
-% going to use.  Create it if it doesn't exist and assign it to \floatno.
-\def\getfloatno#1{%
-  \ifx#1\relax
-      % Haven't seen this figure type before.
-      \csname newcount\endcsname #1%
-      %
-      % Remember to reset this floatno at the next chap.
-      \expandafter\gdef\expandafter\resetallfloatnos
-        \expandafter{\resetallfloatnos #1=0 }%
-  \fi
-  \let\floatno#1%
-}
-
-% \setref calls this to get the XREFLABEL-snt value.  We want an @xref
-% to the FLOATLABEL to expand to "Figure 3.1".  We call \setref when we
-% first read the @float command.
-%
-\def\Yfloat{\floattype at tie \chaplevelprefix\the\floatno}%
-
-% Magic string used for the XREFLABEL-title value, so \xrefX can
-% distinguish floats from other xref types.
-\def\floatmagic{!!float!!}
-
-% #1 is the control sequence we are passed; we expand into a conditional
-% which is true if #1 represents a float ref.  That is, the magic
-% \lastsection value which we \setref above.
-%
-\def\iffloat#1{\expandafter\doiffloat#1==\finish}
-%
-% #1 is (maybe) the \floatmagic string.  If so, #2 will be the
-% (safe) float type for this float.  We set \iffloattype to #2.
-%
-\def\doiffloat#1=#2=#3\finish{%
-  \def\temp{#1}%
-  \def\iffloattype{#2}%
-  \ifx\temp\floatmagic
-}
-
-% @listoffloats FLOATTYPE - print a list of floats like a table of contents.
-%
-\parseargdef\listoffloats{%
-  \def\floattype{#1}% floattype
-  {%
-    % the floattype might have accents or other special characters,
-    % but we need to use it in a control sequence name.
-    \indexnofonts
-    \turnoffactive
-    \xdef\safefloattype{\floattype}%
-  }%
-  %
-  % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
-  \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
-    \ifhavexrefs
-      % if the user said @listoffloats foo but never @float foo.
-      \message{\linenumber No `\safefloattype' floats to list.}%
-    \fi
-  \else
-    \begingroup
-      \leftskip=\tocindent  % indent these entries like a toc
-      \let\do=\listoffloatsdo
-      \csname floatlist\safefloattype\endcsname
-    \endgroup
-  \fi
-}
-
-% This is called on each entry in a list of floats.  We're passed the
-% xref label, in the form LABEL-title, which is how we save it in the
-% aux file.  We strip off the -title and look up \XRLABEL-lof, which
-% has the text we're supposed to typeset here.
-%
-% Figures without xref labels will not be included in the list (since
-% they won't appear in the aux file).
-%
-\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
-\def\listoffloatsdoentry#1-title\finish{{%
-  % Can't fully expand XR#1-lof because it can contain anything.  Just
-  % pass the control sequence.  On the other hand, XR#1-pg is just the
-  % page number, and we want to fully expand that so we can get a link
-  % in pdf output.
-  \toksA = \expandafter{\csname XR#1-lof\endcsname}%
-  %
-  % use the same \entry macro we use to generate the TOC and index.
-  \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
-  \writeentry
-}}
-
-
-\message{localization,}
-
-% For single-language documents, @documentlanguage is usually given very
-% early, just after @documentencoding.  Single argument is the language
-% (de) or locale (de_DE) abbreviation.
-%
-{
-  \catcode`\_ = \active
-  \globaldefs=1
-\parseargdef\documentlanguage{\begingroup
-  \let_=\normalunderscore  % normal _ character for filenames
-  \tex % read txi-??.tex file in plain TeX.
-    % Read the file by the name they passed if it exists.
-    \openin 1 txi-#1.tex
-    \ifeof 1
-      \documentlanguagetrywithoutunderscore{#1_\finish}%
-    \else
-      \globaldefs = 1  % everything in the txi-LL files needs to persist
-      \input txi-#1.tex
-    \fi
-    \closein 1
-  \endgroup % end raw TeX
-\endgroup}
-%
-% If they passed de_DE, and txi-de_DE.tex doesn't exist,
-% try txi-de.tex.
-%
-\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
-  \openin 1 txi-#1.tex
-  \ifeof 1
-    \errhelp = \nolanghelp
-    \errmessage{Cannot read language file txi-#1.tex}%
-  \else
-    \globaldefs = 1  % everything in the txi-LL files needs to persist
-    \input txi-#1.tex
-  \fi
-  \closein 1
-}
-}% end of special _ catcode
-%
-\newhelp\nolanghelp{The given language definition file cannot be found or
-is empty.  Maybe you need to install it?  Putting it in the current
-directory should work if nowhere else does.}
-
-% This macro is called from txi-??.tex files; the first argument is the
-% \language name to set (without the "\lang@" prefix), the second and
-% third args are \{left,right}hyphenmin.
-%
-% The language names to pass are determined when the format is built.
-% See the etex.log file created at that time, e.g.,
-% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
-%
-% With TeX Live 2008, etex now includes hyphenation patterns for all
-% available languages.  This means we can support hyphenation in
-% Texinfo, at least to some extent.  (This still doesn't solve the
-% accented characters problem.)
-%
-\catcode`@=11
-\def\txisetlanguage#1#2#3{%
-  % do not set the language if the name is undefined in the current TeX.
-  \expandafter\ifx\csname lang@#1\endcsname \relax
-    \message{no patterns for #1}%
-  \else
-    \global\language = \csname lang@#1\endcsname
-  \fi
-  % but there is no harm in adjusting the hyphenmin values regardless.
-  \global\lefthyphenmin = #2\relax
-  \global\righthyphenmin = #3\relax
-}
-
-% Helpers for encodings.
-% Set the catcode of characters 128 through 255 to the specified number.
-%
-\def\setnonasciicharscatcode#1{%
-   \count255=128
-   \loop\ifnum\count255<256
-      \global\catcode\count255=#1\relax
-      \advance\count255 by 1
-   \repeat
-}
-
-\def\setnonasciicharscatcodenonglobal#1{%
-   \count255=128
-   \loop\ifnum\count255<256
-      \catcode\count255=#1\relax
-      \advance\count255 by 1
-   \repeat
-}
-
-% @documentencoding sets the definition of non-ASCII characters
-% according to the specified encoding.
-%
-\parseargdef\documentencoding{%
-  % Encoding being declared for the document.
-  \def\declaredencoding{\csname #1.enc\endcsname}%
-  %
-  % Supported encodings: names converted to tokens in order to be able
-  % to compare them with \ifx.
-  \def\ascii{\csname US-ASCII.enc\endcsname}%
-  \def\latnine{\csname ISO-8859-15.enc\endcsname}%
-  \def\latone{\csname ISO-8859-1.enc\endcsname}%
-  \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
-  \def\utfeight{\csname UTF-8.enc\endcsname}%
-  %
-  \ifx \declaredencoding \ascii
-     \asciichardefs
-  %
-  \else \ifx \declaredencoding \lattwo
-     \setnonasciicharscatcode\active
-     \lattwochardefs
-  %
-  \else \ifx \declaredencoding \latone
-     \setnonasciicharscatcode\active
-     \latonechardefs
-  %
-  \else \ifx \declaredencoding \latnine
-     \setnonasciicharscatcode\active
-     \latninechardefs
-  %
-  \else \ifx \declaredencoding \utfeight
-     \setnonasciicharscatcode\active
-     \utfeightchardefs
-  %
-  \else
-    \message{Unknown document encoding #1, ignoring.}%
-  %
-  \fi % utfeight
-  \fi % latnine
-  \fi % latone
-  \fi % lattwo
-  \fi % ascii
-}
-
-% A message to be logged when using a character that isn't available
-% the default font encoding (OT1).
-%
-\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
-
-% Take account of \c (plain) vs. \, (Texinfo) difference.
-\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
-
-% First, make active non-ASCII characters in order for them to be
-% correctly categorized when TeX reads the replacement text of
-% macros containing the character definitions.
-\setnonasciicharscatcode\active
-%
-% Latin1 (ISO-8859-1) character definitions.
-\def\latonechardefs{%
-  \gdef^^a0{~}
-  \gdef^^a1{\exclamdown}
-  \gdef^^a2{\missingcharmsg{CENT SIGN}}
-  \gdef^^a3{{\pounds}}
-  \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
-  \gdef^^a5{\missingcharmsg{YEN SIGN}}
-  \gdef^^a6{\missingcharmsg{BROKEN BAR}}
-  \gdef^^a7{\S}
-  \gdef^^a8{\"{}}
-  \gdef^^a9{\copyright}
-  \gdef^^aa{\ordf}
-  \gdef^^ab{\guillemetleft}
-  \gdef^^ac{$\lnot$}
-  \gdef^^ad{\-}
-  \gdef^^ae{\registeredsymbol}
-  \gdef^^af{\={}}
-  %
-  \gdef^^b0{\textdegree}
-  \gdef^^b1{$\pm$}
-  \gdef^^b2{$^2$}
-  \gdef^^b3{$^3$}
-  \gdef^^b4{\'{}}
-  \gdef^^b5{$\mu$}
-  \gdef^^b6{\P}
-  %
-  \gdef^^b7{$^.$}
-  \gdef^^b8{\cedilla\ }
-  \gdef^^b9{$^1$}
-  \gdef^^ba{\ordm}
-  %
-  \gdef^^bb{\guilletright}
-  \gdef^^bc{$1\over4$}
-  \gdef^^bd{$1\over2$}
-  \gdef^^be{$3\over4$}
-  \gdef^^bf{\questiondown}
-  %
-  \gdef^^c0{\`A}
-  \gdef^^c1{\'A}
-  \gdef^^c2{\^A}
-  \gdef^^c3{\~A}
-  \gdef^^c4{\"A}
-  \gdef^^c5{\ringaccent A}
-  \gdef^^c6{\AE}
-  \gdef^^c7{\cedilla C}
-  \gdef^^c8{\`E}
-  \gdef^^c9{\'E}
-  \gdef^^ca{\^E}
-  \gdef^^cb{\"E}
-  \gdef^^cc{\`I}
-  \gdef^^cd{\'I}
-  \gdef^^ce{\^I}
-  \gdef^^cf{\"I}
-  %
-  \gdef^^d0{\DH}
-  \gdef^^d1{\~N}
-  \gdef^^d2{\`O}
-  \gdef^^d3{\'O}
-  \gdef^^d4{\^O}
-  \gdef^^d5{\~O}
-  \gdef^^d6{\"O}
-  \gdef^^d7{$\times$}
-  \gdef^^d8{\O}
-  \gdef^^d9{\`U}
-  \gdef^^da{\'U}
-  \gdef^^db{\^U}
-  \gdef^^dc{\"U}
-  \gdef^^dd{\'Y}
-  \gdef^^de{\TH}
-  \gdef^^df{\ss}
-  %
-  \gdef^^e0{\`a}
-  \gdef^^e1{\'a}
-  \gdef^^e2{\^a}
-  \gdef^^e3{\~a}
-  \gdef^^e4{\"a}
-  \gdef^^e5{\ringaccent a}
-  \gdef^^e6{\ae}
-  \gdef^^e7{\cedilla c}
-  \gdef^^e8{\`e}
-  \gdef^^e9{\'e}
-  \gdef^^ea{\^e}
-  \gdef^^eb{\"e}
-  \gdef^^ec{\`{\dotless i}}
-  \gdef^^ed{\'{\dotless i}}
-  \gdef^^ee{\^{\dotless i}}
-  \gdef^^ef{\"{\dotless i}}
-  %
-  \gdef^^f0{\dh}
-  \gdef^^f1{\~n}
-  \gdef^^f2{\`o}
-  \gdef^^f3{\'o}
-  \gdef^^f4{\^o}
-  \gdef^^f5{\~o}
-  \gdef^^f6{\"o}
-  \gdef^^f7{$\div$}
-  \gdef^^f8{\o}
-  \gdef^^f9{\`u}
-  \gdef^^fa{\'u}
-  \gdef^^fb{\^u}
-  \gdef^^fc{\"u}
-  \gdef^^fd{\'y}
-  \gdef^^fe{\th}
-  \gdef^^ff{\"y}
-}
-
-% Latin9 (ISO-8859-15) encoding character definitions.
-\def\latninechardefs{%
-  % Encoding is almost identical to Latin1.
-  \latonechardefs
-  %
-  \gdef^^a4{\euro}
-  \gdef^^a6{\v S}
-  \gdef^^a8{\v s}
-  \gdef^^b4{\v Z}
-  \gdef^^b8{\v z}
-  \gdef^^bc{\OE}
-  \gdef^^bd{\oe}
-  \gdef^^be{\"Y}
-}
-
-% Latin2 (ISO-8859-2) character definitions.
-\def\lattwochardefs{%
-  \gdef^^a0{~}
-  \gdef^^a1{\ogonek{A}}
-  \gdef^^a2{\u{}}
-  \gdef^^a3{\L}
-  \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
-  \gdef^^a5{\v L}
-  \gdef^^a6{\'S}
-  \gdef^^a7{\S}
-  \gdef^^a8{\"{}}
-  \gdef^^a9{\v S}
-  \gdef^^aa{\cedilla S}
-  \gdef^^ab{\v T}
-  \gdef^^ac{\'Z}
-  \gdef^^ad{\-}
-  \gdef^^ae{\v Z}
-  \gdef^^af{\dotaccent Z}
-  %
-  \gdef^^b0{\textdegree}
-  \gdef^^b1{\ogonek{a}}
-  \gdef^^b2{\ogonek{ }}
-  \gdef^^b3{\l}
-  \gdef^^b4{\'{}}
-  \gdef^^b5{\v l}
-  \gdef^^b6{\'s}
-  \gdef^^b7{\v{}}
-  \gdef^^b8{\cedilla\ }
-  \gdef^^b9{\v s}
-  \gdef^^ba{\cedilla s}
-  \gdef^^bb{\v t}
-  \gdef^^bc{\'z}
-  \gdef^^bd{\H{}}
-  \gdef^^be{\v z}
-  \gdef^^bf{\dotaccent z}
-  %
-  \gdef^^c0{\'R}
-  \gdef^^c1{\'A}
-  \gdef^^c2{\^A}
-  \gdef^^c3{\u A}
-  \gdef^^c4{\"A}
-  \gdef^^c5{\'L}
-  \gdef^^c6{\'C}
-  \gdef^^c7{\cedilla C}
-  \gdef^^c8{\v C}
-  \gdef^^c9{\'E}
-  \gdef^^ca{\ogonek{E}}
-  \gdef^^cb{\"E}
-  \gdef^^cc{\v E}
-  \gdef^^cd{\'I}
-  \gdef^^ce{\^I}
-  \gdef^^cf{\v D}
-  %
-  \gdef^^d0{\DH}
-  \gdef^^d1{\'N}
-  \gdef^^d2{\v N}
-  \gdef^^d3{\'O}
-  \gdef^^d4{\^O}
-  \gdef^^d5{\H O}
-  \gdef^^d6{\"O}
-  \gdef^^d7{$\times$}
-  \gdef^^d8{\v R}
-  \gdef^^d9{\ringaccent U}
-  \gdef^^da{\'U}
-  \gdef^^db{\H U}
-  \gdef^^dc{\"U}
-  \gdef^^dd{\'Y}
-  \gdef^^de{\cedilla T}
-  \gdef^^df{\ss}
-  %
-  \gdef^^e0{\'r}
-  \gdef^^e1{\'a}
-  \gdef^^e2{\^a}
-  \gdef^^e3{\u a}
-  \gdef^^e4{\"a}
-  \gdef^^e5{\'l}
-  \gdef^^e6{\'c}
-  \gdef^^e7{\cedilla c}
-  \gdef^^e8{\v c}
-  \gdef^^e9{\'e}
-  \gdef^^ea{\ogonek{e}}
-  \gdef^^eb{\"e}
-  \gdef^^ec{\v e}
-  \gdef^^ed{\'\i}
-  \gdef^^ee{\^\i}
-  \gdef^^ef{\v d}
-  %
-  \gdef^^f0{\dh}
-  \gdef^^f1{\'n}
-  \gdef^^f2{\v n}
-  \gdef^^f3{\'o}
-  \gdef^^f4{\^o}
-  \gdef^^f5{\H o}
-  \gdef^^f6{\"o}
-  \gdef^^f7{$\div$}
-  \gdef^^f8{\v r}
-  \gdef^^f9{\ringaccent u}
-  \gdef^^fa{\'u}
-  \gdef^^fb{\H u}
-  \gdef^^fc{\"u}
-  \gdef^^fd{\'y}
-  \gdef^^fe{\cedilla t}
-  \gdef^^ff{\dotaccent{}}
-}
-
-% UTF-8 character definitions.
-%
-% This code to support UTF-8 is based on LaTeX's utf8.def, with some
-% changes for Texinfo conventions.  It is included here under the GPL by
-% permission from Frank Mittelbach and the LaTeX team.
-%
-\newcount\countUTFx
-\newcount\countUTFy
-\newcount\countUTFz
-
-\gdef\UTFviiiTwoOctets#1#2{\expandafter
-   \UTFviiiDefined\csname u8:#1\string #2\endcsname}
-%
-\gdef\UTFviiiThreeOctets#1#2#3{\expandafter
-   \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
-%
-\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
-   \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
-
-\gdef\UTFviiiDefined#1{%
-  \ifx #1\relax
-    \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
-  \else
-    \expandafter #1%
-  \fi
-}
-
-\begingroup
-  \catcode`\~13
-  \catcode`\"12
-
-  \def\UTFviiiLoop{%
-    \global\catcode\countUTFx\active
-    \uccode`\~\countUTFx
-    \uppercase\expandafter{\UTFviiiTmp}%
-    \advance\countUTFx by 1
-    \ifnum\countUTFx < \countUTFy
-      \expandafter\UTFviiiLoop
-    \fi}
-
-  \countUTFx = "C2
-  \countUTFy = "E0
-  \def\UTFviiiTmp{%
-    \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
-  \UTFviiiLoop
-
-  \countUTFx = "E0
-  \countUTFy = "F0
-  \def\UTFviiiTmp{%
-    \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
-  \UTFviiiLoop
-
-  \countUTFx = "F0
-  \countUTFy = "F4
-  \def\UTFviiiTmp{%
-    \xdef~{\noexpand\UTFviiiFourOctets\string~}}
-  \UTFviiiLoop
-\endgroup
-
-\begingroup
-  \catcode`\"=12
-  \catcode`\<=12
-  \catcode`\.=12
-  \catcode`\,=12
-  \catcode`\;=12
-  \catcode`\!=12
-  \catcode`\~=13
-
-  \gdef\DeclareUnicodeCharacter#1#2{%
-    \countUTFz = "#1\relax
-    \wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
-    \begingroup
-      \parseXMLCharref
-      \def\UTFviiiTwoOctets##1##2{%
-        \csname u8:##1\string ##2\endcsname}%
-      \def\UTFviiiThreeOctets##1##2##3{%
-        \csname u8:##1\string ##2\string ##3\endcsname}%
-      \def\UTFviiiFourOctets##1##2##3##4{%
-        \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
-      \expandafter\expandafter\expandafter\expandafter
-       \expandafter\expandafter\expandafter
-       \gdef\UTFviiiTmp{#2}%
-    \endgroup}
-
-  \gdef\parseXMLCharref{%
-    \ifnum\countUTFz < "A0\relax
-      \errhelp = \EMsimple
-      \errmessage{Cannot define Unicode char value < 00A0}%
-    \else\ifnum\countUTFz < "800\relax
-      \parseUTFviiiA,%
-      \parseUTFviiiB C\UTFviiiTwoOctets.,%
-    \else\ifnum\countUTFz < "10000\relax
-      \parseUTFviiiA;%
-      \parseUTFviiiA,%
-      \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
-    \else
-      \parseUTFviiiA;%
-      \parseUTFviiiA,%
-      \parseUTFviiiA!%
-      \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
-    \fi\fi\fi
-  }
-
-  \gdef\parseUTFviiiA#1{%
-    \countUTFx = \countUTFz
-    \divide\countUTFz by 64
-    \countUTFy = \countUTFz
-    \multiply\countUTFz by 64
-    \advance\countUTFx by -\countUTFz
-    \advance\countUTFx by 128
-    \uccode `#1\countUTFx
-    \countUTFz = \countUTFy}
-
-  \gdef\parseUTFviiiB#1#2#3#4{%
-    \advance\countUTFz by "#10\relax
-    \uccode `#3\countUTFz
-    \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
-\endgroup
-
-\def\utfeightchardefs{%
-  \DeclareUnicodeCharacter{00A0}{\tie}
-  \DeclareUnicodeCharacter{00A1}{\exclamdown}
-  \DeclareUnicodeCharacter{00A3}{\pounds}
-  \DeclareUnicodeCharacter{00A8}{\"{ }}
-  \DeclareUnicodeCharacter{00A9}{\copyright}
-  \DeclareUnicodeCharacter{00AA}{\ordf}
-  \DeclareUnicodeCharacter{00AB}{\guillemetleft}
-  \DeclareUnicodeCharacter{00AD}{\-}
-  \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
-  \DeclareUnicodeCharacter{00AF}{\={ }}
-
-  \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
-  \DeclareUnicodeCharacter{00B4}{\'{ }}
-  \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
-  \DeclareUnicodeCharacter{00BA}{\ordm}
-  \DeclareUnicodeCharacter{00BB}{\guillemetright}
-  \DeclareUnicodeCharacter{00BF}{\questiondown}
-
-  \DeclareUnicodeCharacter{00C0}{\`A}
-  \DeclareUnicodeCharacter{00C1}{\'A}
-  \DeclareUnicodeCharacter{00C2}{\^A}
-  \DeclareUnicodeCharacter{00C3}{\~A}
-  \DeclareUnicodeCharacter{00C4}{\"A}
-  \DeclareUnicodeCharacter{00C5}{\AA}
-  \DeclareUnicodeCharacter{00C6}{\AE}
-  \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
-  \DeclareUnicodeCharacter{00C8}{\`E}
-  \DeclareUnicodeCharacter{00C9}{\'E}
-  \DeclareUnicodeCharacter{00CA}{\^E}
-  \DeclareUnicodeCharacter{00CB}{\"E}
-  \DeclareUnicodeCharacter{00CC}{\`I}
-  \DeclareUnicodeCharacter{00CD}{\'I}
-  \DeclareUnicodeCharacter{00CE}{\^I}
-  \DeclareUnicodeCharacter{00CF}{\"I}
-
-  \DeclareUnicodeCharacter{00D0}{\DH}
-  \DeclareUnicodeCharacter{00D1}{\~N}
-  \DeclareUnicodeCharacter{00D2}{\`O}
-  \DeclareUnicodeCharacter{00D3}{\'O}
-  \DeclareUnicodeCharacter{00D4}{\^O}
-  \DeclareUnicodeCharacter{00D5}{\~O}
-  \DeclareUnicodeCharacter{00D6}{\"O}
-  \DeclareUnicodeCharacter{00D8}{\O}
-  \DeclareUnicodeCharacter{00D9}{\`U}
-  \DeclareUnicodeCharacter{00DA}{\'U}
-  \DeclareUnicodeCharacter{00DB}{\^U}
-  \DeclareUnicodeCharacter{00DC}{\"U}
-  \DeclareUnicodeCharacter{00DD}{\'Y}
-  \DeclareUnicodeCharacter{00DE}{\TH}
-  \DeclareUnicodeCharacter{00DF}{\ss}
-
-  \DeclareUnicodeCharacter{00E0}{\`a}
-  \DeclareUnicodeCharacter{00E1}{\'a}
-  \DeclareUnicodeCharacter{00E2}{\^a}
-  \DeclareUnicodeCharacter{00E3}{\~a}
-  \DeclareUnicodeCharacter{00E4}{\"a}
-  \DeclareUnicodeCharacter{00E5}{\aa}
-  \DeclareUnicodeCharacter{00E6}{\ae}
-  \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
-  \DeclareUnicodeCharacter{00E8}{\`e}
-  \DeclareUnicodeCharacter{00E9}{\'e}
-  \DeclareUnicodeCharacter{00EA}{\^e}
-  \DeclareUnicodeCharacter{00EB}{\"e}
-  \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
-  \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
-  \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
-  \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
-
-  \DeclareUnicodeCharacter{00F0}{\dh}
-  \DeclareUnicodeCharacter{00F1}{\~n}
-  \DeclareUnicodeCharacter{00F2}{\`o}
-  \DeclareUnicodeCharacter{00F3}{\'o}
-  \DeclareUnicodeCharacter{00F4}{\^o}
-  \DeclareUnicodeCharacter{00F5}{\~o}
-  \DeclareUnicodeCharacter{00F6}{\"o}
-  \DeclareUnicodeCharacter{00F8}{\o}
-  \DeclareUnicodeCharacter{00F9}{\`u}
-  \DeclareUnicodeCharacter{00FA}{\'u}
-  \DeclareUnicodeCharacter{00FB}{\^u}
-  \DeclareUnicodeCharacter{00FC}{\"u}
-  \DeclareUnicodeCharacter{00FD}{\'y}
-  \DeclareUnicodeCharacter{00FE}{\th}
-  \DeclareUnicodeCharacter{00FF}{\"y}
-
-  \DeclareUnicodeCharacter{0100}{\=A}
-  \DeclareUnicodeCharacter{0101}{\=a}
-  \DeclareUnicodeCharacter{0102}{\u{A}}
-  \DeclareUnicodeCharacter{0103}{\u{a}}
-  \DeclareUnicodeCharacter{0104}{\ogonek{A}}
-  \DeclareUnicodeCharacter{0105}{\ogonek{a}}
-  \DeclareUnicodeCharacter{0106}{\'C}
-  \DeclareUnicodeCharacter{0107}{\'c}
-  \DeclareUnicodeCharacter{0108}{\^C}
-  \DeclareUnicodeCharacter{0109}{\^c}
-  \DeclareUnicodeCharacter{0118}{\ogonek{E}}
-  \DeclareUnicodeCharacter{0119}{\ogonek{e}}
-  \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
-  \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
-  \DeclareUnicodeCharacter{010C}{\v{C}}
-  \DeclareUnicodeCharacter{010D}{\v{c}}
-  \DeclareUnicodeCharacter{010E}{\v{D}}
-
-  \DeclareUnicodeCharacter{0112}{\=E}
-  \DeclareUnicodeCharacter{0113}{\=e}
-  \DeclareUnicodeCharacter{0114}{\u{E}}
-  \DeclareUnicodeCharacter{0115}{\u{e}}
-  \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
-  \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
-  \DeclareUnicodeCharacter{011A}{\v{E}}
-  \DeclareUnicodeCharacter{011B}{\v{e}}
-  \DeclareUnicodeCharacter{011C}{\^G}
-  \DeclareUnicodeCharacter{011D}{\^g}
-  \DeclareUnicodeCharacter{011E}{\u{G}}
-  \DeclareUnicodeCharacter{011F}{\u{g}}
-
-  \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
-  \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
-  \DeclareUnicodeCharacter{0124}{\^H}
-  \DeclareUnicodeCharacter{0125}{\^h}
-  \DeclareUnicodeCharacter{0128}{\~I}
-  \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
-  \DeclareUnicodeCharacter{012A}{\=I}
-  \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
-  \DeclareUnicodeCharacter{012C}{\u{I}}
-  \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
-
-  \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
-  \DeclareUnicodeCharacter{0131}{\dotless{i}}
-  \DeclareUnicodeCharacter{0132}{IJ}
-  \DeclareUnicodeCharacter{0133}{ij}
-  \DeclareUnicodeCharacter{0134}{\^J}
-  \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
-  \DeclareUnicodeCharacter{0139}{\'L}
-  \DeclareUnicodeCharacter{013A}{\'l}
-
-  \DeclareUnicodeCharacter{0141}{\L}
-  \DeclareUnicodeCharacter{0142}{\l}
-  \DeclareUnicodeCharacter{0143}{\'N}
-  \DeclareUnicodeCharacter{0144}{\'n}
-  \DeclareUnicodeCharacter{0147}{\v{N}}
-  \DeclareUnicodeCharacter{0148}{\v{n}}
-  \DeclareUnicodeCharacter{014C}{\=O}
-  \DeclareUnicodeCharacter{014D}{\=o}
-  \DeclareUnicodeCharacter{014E}{\u{O}}
-  \DeclareUnicodeCharacter{014F}{\u{o}}
-
-  \DeclareUnicodeCharacter{0150}{\H{O}}
-  \DeclareUnicodeCharacter{0151}{\H{o}}
-  \DeclareUnicodeCharacter{0152}{\OE}
-  \DeclareUnicodeCharacter{0153}{\oe}
-  \DeclareUnicodeCharacter{0154}{\'R}
-  \DeclareUnicodeCharacter{0155}{\'r}
-  \DeclareUnicodeCharacter{0158}{\v{R}}
-  \DeclareUnicodeCharacter{0159}{\v{r}}
-  \DeclareUnicodeCharacter{015A}{\'S}
-  \DeclareUnicodeCharacter{015B}{\'s}
-  \DeclareUnicodeCharacter{015C}{\^S}
-  \DeclareUnicodeCharacter{015D}{\^s}
-  \DeclareUnicodeCharacter{015E}{\cedilla{S}}
-  \DeclareUnicodeCharacter{015F}{\cedilla{s}}
-
-  \DeclareUnicodeCharacter{0160}{\v{S}}
-  \DeclareUnicodeCharacter{0161}{\v{s}}
-  \DeclareUnicodeCharacter{0162}{\cedilla{t}}
-  \DeclareUnicodeCharacter{0163}{\cedilla{T}}
-  \DeclareUnicodeCharacter{0164}{\v{T}}
-
-  \DeclareUnicodeCharacter{0168}{\~U}
-  \DeclareUnicodeCharacter{0169}{\~u}
-  \DeclareUnicodeCharacter{016A}{\=U}
-  \DeclareUnicodeCharacter{016B}{\=u}
-  \DeclareUnicodeCharacter{016C}{\u{U}}
-  \DeclareUnicodeCharacter{016D}{\u{u}}
-  \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
-  \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
-
-  \DeclareUnicodeCharacter{0170}{\H{U}}
-  \DeclareUnicodeCharacter{0171}{\H{u}}
-  \DeclareUnicodeCharacter{0174}{\^W}
-  \DeclareUnicodeCharacter{0175}{\^w}
-  \DeclareUnicodeCharacter{0176}{\^Y}
-  \DeclareUnicodeCharacter{0177}{\^y}
-  \DeclareUnicodeCharacter{0178}{\"Y}
-  \DeclareUnicodeCharacter{0179}{\'Z}
-  \DeclareUnicodeCharacter{017A}{\'z}
-  \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
-  \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
-  \DeclareUnicodeCharacter{017D}{\v{Z}}
-  \DeclareUnicodeCharacter{017E}{\v{z}}
-
-  \DeclareUnicodeCharacter{01C4}{D\v{Z}}
-  \DeclareUnicodeCharacter{01C5}{D\v{z}}
-  \DeclareUnicodeCharacter{01C6}{d\v{z}}
-  \DeclareUnicodeCharacter{01C7}{LJ}
-  \DeclareUnicodeCharacter{01C8}{Lj}
-  \DeclareUnicodeCharacter{01C9}{lj}
-  \DeclareUnicodeCharacter{01CA}{NJ}
-  \DeclareUnicodeCharacter{01CB}{Nj}
-  \DeclareUnicodeCharacter{01CC}{nj}
-  \DeclareUnicodeCharacter{01CD}{\v{A}}
-  \DeclareUnicodeCharacter{01CE}{\v{a}}
-  \DeclareUnicodeCharacter{01CF}{\v{I}}
-
-  \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
-  \DeclareUnicodeCharacter{01D1}{\v{O}}
-  \DeclareUnicodeCharacter{01D2}{\v{o}}
-  \DeclareUnicodeCharacter{01D3}{\v{U}}
-  \DeclareUnicodeCharacter{01D4}{\v{u}}
-
-  \DeclareUnicodeCharacter{01E2}{\={\AE}}
-  \DeclareUnicodeCharacter{01E3}{\={\ae}}
-  \DeclareUnicodeCharacter{01E6}{\v{G}}
-  \DeclareUnicodeCharacter{01E7}{\v{g}}
-  \DeclareUnicodeCharacter{01E8}{\v{K}}
-  \DeclareUnicodeCharacter{01E9}{\v{k}}
-
-  \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
-  \DeclareUnicodeCharacter{01F1}{DZ}
-  \DeclareUnicodeCharacter{01F2}{Dz}
-  \DeclareUnicodeCharacter{01F3}{dz}
-  \DeclareUnicodeCharacter{01F4}{\'G}
-  \DeclareUnicodeCharacter{01F5}{\'g}
-  \DeclareUnicodeCharacter{01F8}{\`N}
-  \DeclareUnicodeCharacter{01F9}{\`n}
-  \DeclareUnicodeCharacter{01FC}{\'{\AE}}
-  \DeclareUnicodeCharacter{01FD}{\'{\ae}}
-  \DeclareUnicodeCharacter{01FE}{\'{\O}}
-  \DeclareUnicodeCharacter{01FF}{\'{\o}}
-
-  \DeclareUnicodeCharacter{021E}{\v{H}}
-  \DeclareUnicodeCharacter{021F}{\v{h}}
-
-  \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
-  \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
-  \DeclareUnicodeCharacter{0228}{\cedilla{E}}
-  \DeclareUnicodeCharacter{0229}{\cedilla{e}}
-  \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
-  \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
-
-  \DeclareUnicodeCharacter{0232}{\=Y}
-  \DeclareUnicodeCharacter{0233}{\=y}
-  \DeclareUnicodeCharacter{0237}{\dotless{j}}
-
-  \DeclareUnicodeCharacter{02DB}{\ogonek{ }}
-
-  \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
-  \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
-  \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
-  \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
-  \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
-  \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
-  \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
-  \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
-  \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
-  \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
-  \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
-  \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
-
-  \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
-  \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
-
-  \DeclareUnicodeCharacter{1E20}{\=G}
-  \DeclareUnicodeCharacter{1E21}{\=g}
-  \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
-  \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
-  \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
-  \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
-  \DeclareUnicodeCharacter{1E26}{\"H}
-  \DeclareUnicodeCharacter{1E27}{\"h}
-
-  \DeclareUnicodeCharacter{1E30}{\'K}
-  \DeclareUnicodeCharacter{1E31}{\'k}
-  \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
-  \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
-  \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
-  \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
-  \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
-  \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
-  \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
-  \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
-  \DeclareUnicodeCharacter{1E3E}{\'M}
-  \DeclareUnicodeCharacter{1E3F}{\'m}
-
-  \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
-  \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
-  \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
-  \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
-  \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
-  \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
-  \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
-  \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
-  \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
-  \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
-
-  \DeclareUnicodeCharacter{1E54}{\'P}
-  \DeclareUnicodeCharacter{1E55}{\'p}
-  \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
-  \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
-  \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
-  \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
-  \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
-  \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
-  \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
-  \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
-
-  \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
-  \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
-  \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
-  \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
-  \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
-  \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
-  \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
-  \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
-  \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
-  \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
-
-  \DeclareUnicodeCharacter{1E7C}{\~V}
-  \DeclareUnicodeCharacter{1E7D}{\~v}
-  \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
-  \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
-
-  \DeclareUnicodeCharacter{1E80}{\`W}
-  \DeclareUnicodeCharacter{1E81}{\`w}
-  \DeclareUnicodeCharacter{1E82}{\'W}
-  \DeclareUnicodeCharacter{1E83}{\'w}
-  \DeclareUnicodeCharacter{1E84}{\"W}
-  \DeclareUnicodeCharacter{1E85}{\"w}
-  \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
-  \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
-  \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
-  \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
-  \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
-  \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
-  \DeclareUnicodeCharacter{1E8C}{\"X}
-  \DeclareUnicodeCharacter{1E8D}{\"x}
-  \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
-  \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
-
-  \DeclareUnicodeCharacter{1E90}{\^Z}
-  \DeclareUnicodeCharacter{1E91}{\^z}
-  \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
-  \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
-  \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
-  \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
-  \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
-  \DeclareUnicodeCharacter{1E97}{\"t}
-  \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
-  \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
-
-  \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
-  \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
-
-  \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
-  \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
-  \DeclareUnicodeCharacter{1EBC}{\~E}
-  \DeclareUnicodeCharacter{1EBD}{\~e}
-
-  \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
-  \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
-  \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
-  \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
-
-  \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
-  \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
-
-  \DeclareUnicodeCharacter{1EF2}{\`Y}
-  \DeclareUnicodeCharacter{1EF3}{\`y}
-  \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
-
-  \DeclareUnicodeCharacter{1EF8}{\~Y}
-  \DeclareUnicodeCharacter{1EF9}{\~y}
-
-  \DeclareUnicodeCharacter{2013}{--}
-  \DeclareUnicodeCharacter{2014}{---}
-  \DeclareUnicodeCharacter{2018}{\quoteleft}
-  \DeclareUnicodeCharacter{2019}{\quoteright}
-  \DeclareUnicodeCharacter{201A}{\quotesinglbase}
-  \DeclareUnicodeCharacter{201C}{\quotedblleft}
-  \DeclareUnicodeCharacter{201D}{\quotedblright}
-  \DeclareUnicodeCharacter{201E}{\quotedblbase}
-  \DeclareUnicodeCharacter{2022}{\bullet}
-  \DeclareUnicodeCharacter{2026}{\dots}
-  \DeclareUnicodeCharacter{2039}{\guilsinglleft}
-  \DeclareUnicodeCharacter{203A}{\guilsinglright}
-  \DeclareUnicodeCharacter{20AC}{\euro}
-
-  \DeclareUnicodeCharacter{2192}{\expansion}
-  \DeclareUnicodeCharacter{21D2}{\result}
-
-  \DeclareUnicodeCharacter{2212}{\minus}
-  \DeclareUnicodeCharacter{2217}{\point}
-  \DeclareUnicodeCharacter{2261}{\equiv}
-}% end of \utfeightchardefs
-
-
-% US-ASCII character definitions.
-\def\asciichardefs{% nothing need be done
-   \relax
-}
-
-% Make non-ASCII characters printable again for compatibility with
-% existing Texinfo documents that may use them, even without declaring a
-% document encoding.
-%
-\setnonasciicharscatcode \other
-
-
-\message{formatting,}
-
-\newdimen\defaultparindent \defaultparindent = 15pt
-
-\chapheadingskip = 15pt plus 4pt minus 2pt
-\secheadingskip = 12pt plus 3pt minus 2pt
-\subsecheadingskip = 9pt plus 2pt minus 2pt
-
-% Prevent underfull vbox error messages.
-\vbadness = 10000
-
-% Don't be so finicky about underfull hboxes, either.
-\hbadness = 2000
-
-% Following George Bush, get rid of widows and orphans.
-\widowpenalty=10000
-\clubpenalty=10000
-
-% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
-% using an old version of TeX, don't do anything.  We want the amount of
-% stretch added to depend on the line length, hence the dependence on
-% \hsize.  We call this whenever the paper size is set.
-%
-\def\setemergencystretch{%
-  \ifx\emergencystretch\thisisundefined
-    % Allow us to assign to \emergencystretch anyway.
-    \def\emergencystretch{\dimen0}%
-  \else
-    \emergencystretch = .15\hsize
-  \fi
-}
-
-% Parameters in order: 1) textheight; 2) textwidth;
-% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
-% 7) physical page height; 8) physical page width.
-%
-% We also call \setleading{\textleading}, so the caller should define
-% \textleading.  The caller should also set \parskip.
-%
-\def\internalpagesizes#1#2#3#4#5#6#7#8{%
-  \voffset = #3\relax
-  \topskip = #6\relax
-  \splittopskip = \topskip
-  %
-  \vsize = #1\relax
-  \advance\vsize by \topskip
-  \outervsize = \vsize
-  \advance\outervsize by 2\topandbottommargin
-  \pageheight = \vsize
-  %
-  \hsize = #2\relax
-  \outerhsize = \hsize
-  \advance\outerhsize by 0.5in
-  \pagewidth = \hsize
-  %
-  \normaloffset = #4\relax
-  \bindingoffset = #5\relax
-  %
-  \ifpdf
-    \pdfpageheight #7\relax
-    \pdfpagewidth #8\relax
-    % if we don't reset these, they will remain at "1 true in" of
-    % whatever layout pdftex was dumped with.
-    \pdfhorigin = 1 true in
-    \pdfvorigin = 1 true in
-  \fi
-  %
-  \setleading{\textleading}
-  %
-  \parindent = \defaultparindent
-  \setemergencystretch
-}
-
-% @letterpaper (the default).
-\def\letterpaper{{\globaldefs = 1
-  \parskip = 3pt plus 2pt minus 1pt
-  \textleading = 13.2pt
-  %
-  % If page is nothing but text, make it come out even.
-  \internalpagesizes{607.2pt}{6in}% that's 46 lines
-                    {\voffset}{.25in}%
-                    {\bindingoffset}{36pt}%
-                    {11in}{8.5in}%
-}}
-
-% Use @smallbook to reset parameters for 7x9.25 trim size.
-\def\smallbook{{\globaldefs = 1
-  \parskip = 2pt plus 1pt
-  \textleading = 12pt
-  %
-  \internalpagesizes{7.5in}{5in}%
-                    {-.2in}{0in}%
-                    {\bindingoffset}{16pt}%
-                    {9.25in}{7in}%
-  %
-  \lispnarrowing = 0.3in
-  \tolerance = 700
-  \hfuzz = 1pt
-  \contentsrightmargin = 0pt
-  \defbodyindent = .5cm
-}}
-
-% Use @smallerbook to reset parameters for 6x9 trim size.
-% (Just testing, parameters still in flux.)
-\def\smallerbook{{\globaldefs = 1
-  \parskip = 1.5pt plus 1pt
-  \textleading = 12pt
-  %
-  \internalpagesizes{7.4in}{4.8in}%
-                    {-.2in}{-.4in}%
-                    {0pt}{14pt}%
-                    {9in}{6in}%
-  %
-  \lispnarrowing = 0.25in
-  \tolerance = 700
-  \hfuzz = 1pt
-  \contentsrightmargin = 0pt
-  \defbodyindent = .4cm
-}}
-
-% Use @afourpaper to print on European A4 paper.
-\def\afourpaper{{\globaldefs = 1
-  \parskip = 3pt plus 2pt minus 1pt
-  \textleading = 13.2pt
-  %
-  % Double-side printing via postscript on Laserjet 4050
-  % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
-  % To change the settings for a different printer or situation, adjust
-  % \normaloffset until the front-side and back-side texts align.  Then
-  % do the same for \bindingoffset.  You can set these for testing in
-  % your texinfo source file like this:
-  % @tex
-  % \global\normaloffset = -6mm
-  % \global\bindingoffset = 10mm
-  % @end tex
-  \internalpagesizes{673.2pt}{160mm}% that's 51 lines
-                    {\voffset}{\hoffset}%
-                    {\bindingoffset}{44pt}%
-                    {297mm}{210mm}%
-  %
-  \tolerance = 700
-  \hfuzz = 1pt
-  \contentsrightmargin = 0pt
-  \defbodyindent = 5mm
-}}
-
-% Use @afivepaper to print on European A5 paper.
-% From romildo at urano.iceb.ufop.br, 2 July 2000.
-% He also recommends making @example and @lisp be small.
-\def\afivepaper{{\globaldefs = 1
-  \parskip = 2pt plus 1pt minus 0.1pt
-  \textleading = 12.5pt
-  %
-  \internalpagesizes{160mm}{120mm}%
-                    {\voffset}{\hoffset}%
-                    {\bindingoffset}{8pt}%
-                    {210mm}{148mm}%
-  %
-  \lispnarrowing = 0.2in
-  \tolerance = 800
-  \hfuzz = 1.2pt
-  \contentsrightmargin = 0pt
-  \defbodyindent = 2mm
-  \tableindent = 12mm
-}}
-
-% A specific text layout, 24x15cm overall, intended for A4 paper.
-\def\afourlatex{{\globaldefs = 1
-  \afourpaper
-  \internalpagesizes{237mm}{150mm}%
-                    {\voffset}{4.6mm}%
-                    {\bindingoffset}{7mm}%
-                    {297mm}{210mm}%
-  %
-  % Must explicitly reset to 0 because we call \afourpaper.
-  \globaldefs = 0
-}}
-
-% Use @afourwide to print on A4 paper in landscape format.
-\def\afourwide{{\globaldefs = 1
-  \afourpaper
-  \internalpagesizes{241mm}{165mm}%
-                    {\voffset}{-2.95mm}%
-                    {\bindingoffset}{7mm}%
-                    {297mm}{210mm}%
-  \globaldefs = 0
-}}
-
-% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
-% Perhaps we should allow setting the margins, \topskip, \parskip,
-% and/or leading, also. Or perhaps we should compute them somehow.
-%
-\parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
-\def\pagesizesyyy#1,#2,#3\finish{{%
-  \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
-  \globaldefs = 1
-  %
-  \parskip = 3pt plus 2pt minus 1pt
-  \setleading{\textleading}%
-  %
-  \dimen0 = #1\relax
-  \advance\dimen0 by \voffset
-  %
-  \dimen2 = \hsize
-  \advance\dimen2 by \normaloffset
-  %
-  \internalpagesizes{#1}{\hsize}%
-                    {\voffset}{\normaloffset}%
-                    {\bindingoffset}{44pt}%
-                    {\dimen0}{\dimen2}%
-}}
-
-% Set default to letter.
-%
-\letterpaper
-
-
-\message{and turning on texinfo input format.}
-
-% DEL is a comment character, in case @c does not suffice.
-\catcode`\^^? = 14
-
-% Define macros to output various characters with catcode for normal text.
-\catcode`\"=\other
-\catcode`\~=\other
-\catcode`\^=\other
-\catcode`\_=\other
-\catcode`\|=\other
-\catcode`\<=\other
-\catcode`\>=\other
-\catcode`\+=\other
-\catcode`\$=\other
-\def\normaldoublequote{"}
-\def\normaltilde{~}
-\def\normalcaret{^}
-\def\normalunderscore{_}
-\def\normalverticalbar{|}
-\def\normalless{<}
-\def\normalgreater{>}
-\def\normalplus{+}
-\def\normaldollar{$}%$ font-lock fix
-
-% This macro is used to make a character print one way in \tt
-% (where it can probably be output as-is), and another way in other fonts,
-% where something hairier probably needs to be done.
-%
-% #1 is what to print if we are indeed using \tt; #2 is what to print
-% otherwise.  Since all the Computer Modern typewriter fonts have zero
-% interword stretch (and shrink), and it is reasonable to expect all
-% typewriter fonts to have this, we can check that font parameter.
-%
-\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
-
-% Same as above, but check for italic font.  Actually this also catches
-% non-italic slanted fonts since it is impossible to distinguish them from
-% italic fonts.  But since this is only used by $ and it uses \sl anyway
-% this is not a problem.
-\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
-
-% Turn off all special characters except @
-% (and those which the user can use as if they were ordinary).
-% Most of these we simply print from the \tt font, but for some, we can
-% use math or other variants that look better in normal text.
-
-\catcode`\"=\active
-\def\activedoublequote{{\tt\char34}}
-\let"=\activedoublequote
-\catcode`\~=\active
-\def~{{\tt\char126}}
-\chardef\hat=`\^
-\catcode`\^=\active
-\def^{{\tt \hat}}
-
-\catcode`\_=\active
-\def_{\ifusingtt\normalunderscore\_}
-\let\realunder=_
-% Subroutine for the previous macro.
-\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
-
-\catcode`\|=\active
-\def|{{\tt\char124}}
-\chardef \less=`\<
-\catcode`\<=\active
-\def<{{\tt \less}}
-\chardef \gtr=`\>
-\catcode`\>=\active
-\def>{{\tt \gtr}}
-\catcode`\+=\active
-\def+{{\tt \char 43}}
-\catcode`\$=\active
-\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
-
-% If a .fmt file is being used, characters that might appear in a file
-% name cannot be active until we have parsed the command line.
-% So turn them off again, and have \everyjob (or @setfilename) turn them on.
-% \otherifyactive is called near the end of this file.
-\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
-
-% Used sometimes to turn off (effectively) the active characters even after
-% parsing them.
-\def\turnoffactive{%
-  \normalturnoffactive
-  \otherbackslash
-}
-
-\catcode`\@=0
-
-% \backslashcurfont outputs one backslash character in current font,
-% as in \char`\\.
-\global\chardef\backslashcurfont=`\\
-\global\let\rawbackslashxx=\backslashcurfont  % let existing .??s files work
-
-% \realbackslash is an actual character `\' with catcode other, and
-% \doublebackslash is two of them (for the pdf outlines).
-{\catcode`\\=\other @gdef at realbackslash{\} @gdef at doublebackslash{\\}}
-
-% In texinfo, backslash is an active character; it prints the backslash
-% in fixed width font.
-\catcode`\\=\active
- at def@normalbackslash{{@tt at backslashcurfont}}
-% On startup, @fixbackslash assigns:
-%  @let \ = @normalbackslash
-
-% \rawbackslash defines an active \ to do \backslashcurfont.
-% \otherbackslash defines an active \ to be a literal `\' character with
-% catcode other.
- at gdef@rawbackslash{@let\=@backslashcurfont}
- at gdef@otherbackslash{@let\=@realbackslash}
-
-% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
-% the literal character `\'.
-%
- at def@normalturnoffactive{%
-  @let\=@normalbackslash
-  @let"=@normaldoublequote
-  @let~=@normaltilde
-  @let^=@normalcaret
-  @let_=@normalunderscore
-  @let|=@normalverticalbar
-  @let<=@normalless
-  @let>=@normalgreater
-  @let+=@normalplus
-  @let$=@normaldollar %$ font-lock fix
-  @markupsetuplqdefault
-  @markupsetuprqdefault
-  @unsepspaces
-}
-
-% Make _ and + \other characters, temporarily.
-% This is canceled by @fixbackslash.
- at otherifyactive
-
-% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
-% That is what \eatinput is for; after that, the `\' should revert to printing
-% a backslash.
-%
- at gdef@eatinput input texinfo{@fixbackslash}
- at global@let\ = @eatinput
-
-% On the other hand, perhaps the file did not have a `\input texinfo'. Then
-% the first `\' in the file would cause an error. This macro tries to fix
-% that, assuming it is called before the first `\' could plausibly occur.
-% Also turn back on active characters that might appear in the input
-% file name, in case not using a pre-dumped format.
-%
- at gdef@fixbackslash{%
-  @ifx\@eatinput @let\ = @normalbackslash @fi
-  @catcode`+=@active
-  @catcode`@_=@active
-}
-
-% Say @foo, not \foo, in error messages.
- at escapechar = `@@
-
-% These look ok in all fonts, so just make them not special.
- at catcode`@& = @other
- at catcode`@# = @other
- at catcode`@% = @other
-
- at c Finally, make ` and ' active, so that txicodequoteundirected and
- at c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}.  If we
- at c don't make ` and ' active, @code will not get them as active chars.
- at c Do this last of all since we use ` in the previous @catcode assignments.
- at catcode`@'=@active
- at catcode`@`=@active
- at markupsetuplqdefault
- at markupsetuprqdefault
-
- at c Gnulib now utterly and painfully insists on no trailing whitespace.
- at c So we have to nuke it.
-
- at c Local variables:
- at c eval: (add-hook 'write-file-hooks 'time-stamp)
- at c eval: (add-hook 'write-file-hooks 'nuke-trailing-whitespace)
- at c page-delimiter: "^\\\\message"
- at c time-stamp-start: "def\\\\texinfoversion{"
- at c time-stamp-format: "%:y-%02m-%02d.%02H"
- at c time-stamp-end: "}"
- at c End:
-
- at c vim:sw=2:
-
- at ignore
-   arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
- at end ignore
diff --git a/doc/version.texi b/doc/version.texi
deleted file mode 100644
index a391247..0000000
--- a/doc/version.texi
+++ /dev/null
@@ -1,4 +0,0 @@
- at set UPDATED 15 September 2009
- at set UPDATED-MONTH September 2009
- at set EDITION 1.0-alpha5
- at set VERSION 1.0-alpha5
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 0000000..a63e10c
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,54 @@
+#
+# $Id: Makefile.am 827 2011-09-14 14:04:16Z pletzer $
+#
+
+AM_CPPFLAGS = -I$(top_srcdir)/gridspec_api				\
+-I$(top_srcdir)/gridspec_api/global -I$(top_srcdir)/gridspec_api/coord	\
+-I$(top_srcdir)/gridspec_api/grid -I$(top_srcdir)/gridspec_api/data	\
+-I$(top_srcdir)/gridspec_api/regrid					\
+-I$(top_srcdir)/gridspec_api/mosaic -I$(top_srcdir)/gridspec_api/host	\
+-I$(top_srcdir)/src -I$(top_srcdir)/include
+
+EXTLIBS = -lnetcdf
+
+noinst_PROGRAMS = ex2 ex3 ex_subset
+if HAVE_MPI
+noinst_PROGRAMS += exparinterp
+endif
+
+if HAVE_FORTRAN_2003
+noinst_PROGRAMS += ex_fortran_interface
+endif
+
+LIBCF_LIBS =                                                    \
+$(top_builddir)/gridspec_api/host/libnccf_host.la	        \
+$(top_builddir)/gridspec_api/mosaic/libnccf_mosaic.la		\
+$(top_builddir)/gridspec_api/regrid/libnccf_regrid.la		\
+$(top_builddir)/gridspec_api/data/libnccf_data.la		\
+$(top_builddir)/gridspec_api/grid/libnccf_grid.la		\
+$(top_builddir)/gridspec_api/coord/libnccf_coord.la		\
+$(top_builddir)/gridspec_api/global/libnccf_global.la		\
+$(top_builddir)/src/libcf_src.la 
+
+ex2_SOURCES = ex2.c  ex_create_cube_grids.c ex_create_static_data.c \
+ex_create_time_data.c ex_create_lonlat.c examples.h
+ex2_LDADD = $(LIBCF_LIBS) $(EXTLIBS)
+
+ex3_SOURCES = ex3.c examples.h
+ex3_LDADD = $(LIBCF_LIBS) $(EXTLIBS)
+
+if HAVE_MPI
+exparinterp_SOURCES = exparinterp.c ex_create_lonlat.c examples.h
+exparinterp_LDADD = $(LIBCF_LIBS) $(EXTLIBS)
+endif
+
+ex_subset_SOURCES = ex_subset.c
+ex_subset_LDADD = $(LIBCF_LIBS) $(EXTLIBS)
+
+if HAVE_FORTRAN_2003
+ex_fortran_interface_SOURCES = ex_fortran_interface.f90
+ex_fortran_interface_LDADD = $(LIBCF_LIBS) $(EXTLIBS)
+endif
+
+# files generated by tests
+CLEANFILES = *.nc
diff --git a/gridspec/tools/shared/Makefile.in b/examples/Makefile.in
similarity index 67%
rename from gridspec/tools/shared/Makefile.in
rename to examples/Makefile.in
index 3819912..3f0c8d6 100644
--- a/gridspec/tools/shared/Makefile.in
+++ b/examples/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,10 +15,9 @@
 
 @SET_MAKE@
 
-# This automake file is in charge of building the gridspec
-# tools/shared convenience library.
-
-# $Id: Makefile.am,v 1.4 2009/11/16 14:31:30 zhi Exp $
+#
+# $Id: Makefile.am 827 2011-09-14 14:04:16Z pletzer $
+#
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
@@ -39,34 +38,11 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
- at USE_NETCDF_DIR_TRUE@am__append_1 = -I at NETCDFDIR@/include
- at USE_NETCDF_DIR_TRUE@am__append_2 = -L at NETCDFDIR@/lib
- at USE_NETCDF_DIR_TRUE@am__append_3 = -lnetcdf
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_4 = ../../../../libsrc4/libnetcdf.la 
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_5 = -I$(top_srcdir)/../libsrc4
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_6 = -L../../../../libsrc4
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_7 = ../../../../libsrc/libnetcdf.la 
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_8 = -I$(top_srcdir)/../libsrc
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_9 = -L../../../../libsrc
- at USE_NETCDF4_TRUE@am__append_10 = -lhdf5_hl -lhdf5 -lz 
- at USE_HDF4_TRUE@am__append_11 = -lmfhdf -ldf -ljpeg
-
-# If the user specified a root for HDF5, use it.
- at USE_HDF5_DIR_TRUE@am__append_12 = -I at HDF5DIR@/include
- at USE_HDF5_DIR_TRUE@am__append_13 = -L at HDF5DIR@/lib
-
-# If the user specified a prefix for the HDF4 library location, use it.
- at USE_HDF4_DIR_TRUE@am__append_14 = -I at HDF4DIR@/include
- at USE_HDF4_DIR_TRUE@am__append_15 = -L at HDF4DIR@/lib
-
-# If the user specified a root location for ZLIB, use it.
- at USE_ZLIB_DIR_TRUE@am__append_16 = -I at ZLIBDIR@/include
- at USE_ZLIB_DIR_TRUE@am__append_17 = -L at ZLIBDIR@/lib
-
-# If the user specified a root location for SZLIB, use it.
- at USE_SZLIB_DIR_TRUE@am__append_18 = -I at SZLIBDIR@/include
- at USE_SZLIB_DIR_TRUE@am__append_19 = -L at SZLIBDIR@/lib
-subdir = gridspec/tools/shared
+noinst_PROGRAMS = ex2$(EXEEXT) ex3$(EXEEXT) ex_subset$(EXEEXT) \
+	$(am__EXEEXT_1) $(am__EXEEXT_2)
+ at HAVE_MPI_TRUE@am__append_1 = exparinterp
+ at HAVE_FORTRAN_2003_TRUE@am__append_2 = ex_fortran_interface
+subdir = examples
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -76,18 +52,38 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
+CONFIG_HEADER = $(top_builddir)/cf_config.h \
+	$(top_builddir)/nfconfig.inc
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libtoolsshared_la_LIBADD =
-am_libtoolsshared_la_OBJECTS = mpp.lo mpp_domain.lo mpp_io.lo \
-	tool_util.lo create_lonlat_grid.lo \
-	create_gnomonic_cubic_grid.lo create_grid_from_file.lo \
-	create_conformal_cubic_grid.lo fregrid_util.lo \
-	conserve_interp.lo bilinear_interp.lo topog.lo create_vgrid.lo \
-	make_boundary_contact.lo make_xgrid_contact.lo
-libtoolsshared_la_OBJECTS = $(am_libtoolsshared_la_OBJECTS)
+ at HAVE_MPI_TRUE@am__EXEEXT_1 = exparinterp$(EXEEXT)
+ at HAVE_FORTRAN_2003_TRUE@am__EXEEXT_2 = ex_fortran_interface$(EXEEXT)
+PROGRAMS = $(noinst_PROGRAMS)
+am_ex2_OBJECTS = ex2.$(OBJEXT) ex_create_cube_grids.$(OBJEXT) \
+	ex_create_static_data.$(OBJEXT) ex_create_time_data.$(OBJEXT) \
+	ex_create_lonlat.$(OBJEXT)
+ex2_OBJECTS = $(am_ex2_OBJECTS)
+am__DEPENDENCIES_1 =
+ex2_DEPENDENCIES = $(LIBCF_LIBS) $(am__DEPENDENCIES_1)
+am_ex3_OBJECTS = ex3.$(OBJEXT)
+ex3_OBJECTS = $(am_ex3_OBJECTS)
+ex3_DEPENDENCIES = $(LIBCF_LIBS) $(am__DEPENDENCIES_1)
+am__ex_fortran_interface_SOURCES_DIST = ex_fortran_interface.f90
+ at HAVE_FORTRAN_2003_TRUE@am_ex_fortran_interface_OBJECTS =  \
+ at HAVE_FORTRAN_2003_TRUE@	ex_fortran_interface.$(OBJEXT)
+ex_fortran_interface_OBJECTS = $(am_ex_fortran_interface_OBJECTS)
+ at HAVE_FORTRAN_2003_TRUE@ex_fortran_interface_DEPENDENCIES =  \
+ at HAVE_FORTRAN_2003_TRUE@	$(LIBCF_LIBS) $(am__DEPENDENCIES_1)
+am_ex_subset_OBJECTS = ex_subset.$(OBJEXT)
+ex_subset_OBJECTS = $(am_ex_subset_OBJECTS)
+ex_subset_DEPENDENCIES = $(LIBCF_LIBS) $(am__DEPENDENCIES_1)
+am__exparinterp_SOURCES_DIST = exparinterp.c ex_create_lonlat.c \
+	examples.h
+ at HAVE_MPI_TRUE@am_exparinterp_OBJECTS = exparinterp.$(OBJEXT) \
+ at HAVE_MPI_TRUE@	ex_create_lonlat.$(OBJEXT)
+exparinterp_OBJECTS = $(am_exparinterp_OBJECTS)
+ at HAVE_MPI_TRUE@exparinterp_DEPENDENCIES = $(LIBCF_LIBS) \
+ at HAVE_MPI_TRUE@	$(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -101,8 +97,19 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libtoolsshared_la_SOURCES)
-DIST_SOURCES = $(libtoolsshared_la_SOURCES)
+FCCOMPILE = $(FC) $(AM_FCFLAGS) $(FCFLAGS)
+LTFCCOMPILE = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS)
+FCLD = $(FC)
+FCLINK = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(ex2_SOURCES) $(ex3_SOURCES) \
+	$(ex_fortran_interface_SOURCES) $(ex_subset_SOURCES) \
+	$(exparinterp_SOURCES)
+DIST_SOURCES = $(ex2_SOURCES) $(ex3_SOURCES) \
+	$(am__ex_fortran_interface_SOURCES_DIST) $(ex_subset_SOURCES) \
+	$(am__exparinterp_SOURCES_DIST)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -110,7 +117,6 @@ ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
 AR = @AR@
-AS = @AS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -131,15 +137,19 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-F77 = @F77@
 FC = @FC@
 FCFLAGS = @FCFLAGS@
 FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
+FCLIBS = @FCLIBS@
 FGREP = @FGREP@
 GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
+HAVE_DARWIN = @HAVE_DARWIN@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_LAPACK_LIB = @HAVE_LAPACK_LIB@
+HAVE_LAPACK_NO_UNDERSCORE = @HAVE_LAPACK_NO_UNDERSCORE@
+HAVE_LAPACK_UNDERSCORE = @HAVE_LAPACK_UNDERSCORE@
+HAVE_SHARED = @HAVE_SHARED@
+HAVE_UUID = @HAVE_UUID@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -154,8 +164,10 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 MOD_FLAG = @MOD_FLAG@
+NCDUMP = @NCDUMP@
 NCDUMPDIR = @NCDUMPDIR@
 NETCDFDIR = @NETCDFDIR@
 NM = @NM@
@@ -169,23 +181,23 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
 VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
 ac_ct_FC = @ac_ct_FC@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -217,7 +229,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -233,29 +244,43 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-noinst_LTLIBRARIES = libtoolsshared.la
-libtoolsshared_la_SOURCES = mpp.c mpp_domain.c mpp_domain.h mpp.h	\
-mpp_io.c mpp_io.h tool_util.c tool_util.h create_lonlat_grid.c		\
-create_gnomonic_cubic_grid.c create_grid_from_file.c			\
-create_conformal_cubic_grid.c create_hgrid.h fregrid_util.c fregrid_util.h \
-conserve_interp.c conserve_interp.h bilinear_interp.c bilinear_interp.h \
-topog.c topog.h create_vgrid.c create_vgrid.h \
-make_boundary_contact.c make_boundary_contact.h \
-make_xgrid_contact.c make_xgrid_contact.h
-
-AM_CPPFLAGS = -I../shared -I$(top_srcdir)/gridspec/shared/mosaic \
-	$(am__append_1) $(am__append_5) $(am__append_8) \
-	$(am__append_12) $(am__append_14) $(am__append_16) \
-	$(am__append_18)
-AM_LDFLAGS = $(am__append_2) $(am__append_6) $(am__append_9) \
-	$(am__append_13) $(am__append_15) $(am__append_17) \
-	$(am__append_19)
-LDADD = $(am__append_3) $(am__append_4) $(am__append_7) \
-	$(am__append_10) $(am__append_11)
+AM_CPPFLAGS = -I$(top_srcdir)/gridspec_api				\
+-I$(top_srcdir)/gridspec_api/global -I$(top_srcdir)/gridspec_api/coord	\
+-I$(top_srcdir)/gridspec_api/grid -I$(top_srcdir)/gridspec_api/data	\
+-I$(top_srcdir)/gridspec_api/regrid					\
+-I$(top_srcdir)/gridspec_api/mosaic -I$(top_srcdir)/gridspec_api/host	\
+-I$(top_srcdir)/src -I$(top_srcdir)/include
+
+EXTLIBS = -lnetcdf
+LIBCF_LIBS = \
+$(top_builddir)/gridspec_api/host/libnccf_host.la	        \
+$(top_builddir)/gridspec_api/mosaic/libnccf_mosaic.la		\
+$(top_builddir)/gridspec_api/regrid/libnccf_regrid.la		\
+$(top_builddir)/gridspec_api/data/libnccf_data.la		\
+$(top_builddir)/gridspec_api/grid/libnccf_grid.la		\
+$(top_builddir)/gridspec_api/coord/libnccf_coord.la		\
+$(top_builddir)/gridspec_api/global/libnccf_global.la		\
+$(top_builddir)/src/libcf_src.la 
+
+ex2_SOURCES = ex2.c  ex_create_cube_grids.c ex_create_static_data.c \
+ex_create_time_data.c ex_create_lonlat.c examples.h
+
+ex2_LDADD = $(LIBCF_LIBS) $(EXTLIBS)
+ex3_SOURCES = ex3.c examples.h
+ex3_LDADD = $(LIBCF_LIBS) $(EXTLIBS)
+ at HAVE_MPI_TRUE@exparinterp_SOURCES = exparinterp.c ex_create_lonlat.c examples.h
+ at HAVE_MPI_TRUE@exparinterp_LDADD = $(LIBCF_LIBS) $(EXTLIBS)
+ex_subset_SOURCES = ex_subset.c
+ex_subset_LDADD = $(LIBCF_LIBS) $(EXTLIBS)
+ at HAVE_FORTRAN_2003_TRUE@ex_fortran_interface_SOURCES = ex_fortran_interface.f90
+ at HAVE_FORTRAN_2003_TRUE@ex_fortran_interface_LDADD = $(LIBCF_LIBS) $(EXTLIBS)
+
+# files generated by tests
+CLEANFILES = *.nc
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
+.SUFFIXES: .c .f90 .lo .o .obj
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -265,9 +290,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec/tools/shared/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign gridspec/tools/shared/Makefile
+	  $(AUTOMAKE) --foreign examples/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -287,16 +312,29 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
-clean-noinstLTLIBRARIES:
-	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
-	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
-	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
-	  test "$$dir" != "$$p" || dir=.; \
-	  echo "rm -f \"$${dir}/so_locations\""; \
-	  rm -f "$${dir}/so_locations"; \
-	done
-libtoolsshared.la: $(libtoolsshared_la_OBJECTS) $(libtoolsshared_la_DEPENDENCIES) 
-	$(LINK)  $(libtoolsshared_la_OBJECTS) $(libtoolsshared_la_LIBADD) $(LIBS)
+clean-noinstPROGRAMS:
+	@list='$(noinst_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
+ex2$(EXEEXT): $(ex2_OBJECTS) $(ex2_DEPENDENCIES) 
+	@rm -f ex2$(EXEEXT)
+	$(LINK) $(ex2_OBJECTS) $(ex2_LDADD) $(LIBS)
+ex3$(EXEEXT): $(ex3_OBJECTS) $(ex3_DEPENDENCIES) 
+	@rm -f ex3$(EXEEXT)
+	$(LINK) $(ex3_OBJECTS) $(ex3_LDADD) $(LIBS)
+ex_fortran_interface$(EXEEXT): $(ex_fortran_interface_OBJECTS) $(ex_fortran_interface_DEPENDENCIES) 
+	@rm -f ex_fortran_interface$(EXEEXT)
+	$(FCLINK) $(ex_fortran_interface_OBJECTS) $(ex_fortran_interface_LDADD) $(LIBS)
+ex_subset$(EXEEXT): $(ex_subset_OBJECTS) $(ex_subset_DEPENDENCIES) 
+	@rm -f ex_subset$(EXEEXT)
+	$(LINK) $(ex_subset_OBJECTS) $(ex_subset_LDADD) $(LIBS)
+exparinterp$(EXEEXT): $(exparinterp_OBJECTS) $(exparinterp_DEPENDENCIES) 
+	@rm -f exparinterp$(EXEEXT)
+	$(LINK) $(exparinterp_OBJECTS) $(exparinterp_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -304,21 +342,14 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bilinear_interp.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/conserve_interp.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/create_conformal_cubic_grid.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/create_gnomonic_cubic_grid.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/create_grid_from_file.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/create_lonlat_grid.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/create_vgrid.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fregrid_util.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/make_boundary_contact.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/make_xgrid_contact.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mpp.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mpp_domain.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mpp_io.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tool_util.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/topog.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ex2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ex3.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ex_create_cube_grids.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ex_create_lonlat.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ex_create_static_data.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ex_create_time_data.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ex_subset.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/exparinterp.Po at am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -344,6 +375,15 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
+.f90.o:
+	$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
+
+.f90.obj:
+	$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'`
+
+.f90.lo:
+	$(LTFCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
@@ -434,7 +474,7 @@ distdir: $(DISTFILES)
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(LTLIBRARIES)
+all-am: Makefile $(PROGRAMS)
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -453,6 +493,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)
@@ -463,7 +504,7 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
 	mostlyclean-am
 
 distclean: distclean-am
@@ -535,7 +576,7 @@ uninstall-am:
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+	clean-libtool clean-noinstPROGRAMS ctags 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 \
diff --git a/examples/ex2.c b/examples/ex2.c
new file mode 100644
index 0000000..183580c
--- /dev/null
+++ b/examples/ex2.c
@@ -0,0 +1,239 @@
+/**
+ * Create a host file aggregation comprising static and time dependent
+ * data stored in different files. The time files contain multiple time
+ * steps. Time dependent and static data exist on multiple tiles.
+ *
+ * The grids are created in ex_create_cube_grids.c
+ * The static data are created by ex_create_static_data.c
+ * The time data are created by ex_create_time_data.c
+ *
+ * "$Id: ex2.c 851 2011-11-08 14:37:20Z pletzer $"
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <netcdf.h>
+
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_data.h"
+#include "nccf_mosaic.h"
+#include "nccf_host.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+
+#include "examples.h"
+
+int main(  ){
+
+  int status = NC_NOERR;
+  int i, j, ndims;
+
+  /* create the coordinate id */
+  char coordinates_id[36+1];
+  char data_id[36+1];
+  const int seed = 12345;
+  if ((status += nccf_generate_id(seed, coordinates_id))) ERR;
+  if ((status += nccf_generate_id(seed, data_id))) ERR;
+
+  /* Dimensions */
+  const int nGrids = 3;
+  int nvars = 2;
+  int nTimes = 2;
+  int nTimesPerFile = 3;
+  int nTimeFiles = nGrids * nTimes * nvars;
+  int nStatFiles = nGrids;
+
+  const int nCells = 10;
+
+  struct time_struct local;
+
+  local.nVars   = nvars;
+  local.nCells  = nCells;
+  local.nTimes  = nTimes;
+  local.nTimesPerFile = nTimesPerFile;
+  local.nGrids  = nGrids;
+  local.value   = 273.15;
+  local.varname = NAME_TIME_DATA_VARN_t;
+  local.st_name = "temperature";
+  local.units   = "K";
+  local.time_stanname = "Time";
+  local.time_longname = "Time";
+  local.time_units    = "days since 2000-01-01";
+
+  /* create the grids */
+  char **gridFiles   = calloc(nGrids, sizeof(char *));
+  char **staticFiles = calloc(nStatFiles, sizeof(char *));
+  char **timeFiles   = calloc(nTimeFiles, sizeof(char *));
+  for (i = 0; i < nGrids; ++i) {
+    gridFiles[i]   = calloc(STRING_SIZE, sizeof(char));
+  }
+  for( i = 0; i < nStatFiles; i++ ) staticFiles[i] = calloc(STRING_SIZE, sizeof(char));
+  for( i = 0; i < nTimeFiles; i++ ) timeFiles[i]   = calloc(STRING_SIZE, sizeof(char));
+  int gridids[nGrids];
+  int staticids[nStatFiles];
+  int timeids[nTimeFiles];
+  ex_create_cube_grids(coordinates_id, nCells, nGrids, gridFiles,
+                       gridids );
+
+  /* create the mosaic */
+  int mosaicid, globalid;
+  const double periods[] = {0., 0., 0.};
+  status += nccf_def_mosaic(nGrids, gridids, NAME_MOSAIC, &mosaicid);
+  status += nccf_compute_mosaic_contacts( mosaicid, periods );
+  if (status != NC_NOERR) ERR;
+  status += nccf_def_global( &globalid );
+  status += nccf_add_global_att(globalid, CF_COORDINATES_ID, coordinates_id, 0);
+  status += nccf_add_global_att(globalid, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0);
+  if (status != NC_NOERR) ERR;
+  int ncid;
+  status += nc_create(NAME_MOSAIC_FILE, NC_CLOBBER, &ncid);
+  if (status != NC_NOERR) ERR;
+  status += nccf_put_mosaic(mosaicid, ncid);
+  status += nccf_put_global(globalid, ncid);
+  status += nc_close(ncid);
+  if (status != NC_NOERR) ERR;
+  status += nccf_free_global(globalid);
+
+  /* create static data */
+  status += ex_create_static_data( data_id, coordinates_id, nCells, nStatFiles,
+                                   nGrids, gridids, staticFiles, staticids );
+
+ /* create time dependent data */
+
+  status = ex_create_time_data( data_id, coordinates_id, 0, &local, gridids, timeFiles, timeids);
+  if( status ) ERR;
+  local.value   = 10.0;
+  local.varname = NAME_TIME_DATA_VARN_v;
+  local.st_name = "velocity";
+  local.units = "m/s";
+  status = ex_create_time_data( data_id, coordinates_id, 1, &local, gridids, timeFiles, timeids);
+  if( status ) ERR;
+
+  /* create the host file */
+  int hostid;
+  if (( status = nccf_def_host(coordinates_id, data_id, nTimes, &hostid))) ERR;
+  if (( status += nc_create( NAME_HOST_FILE, NC_CLOBBER, &ncid ))) ERR;
+  for( i = 0; i < nGrids; i++ ){
+    if (( status += nccf_add_host_file( hostid, gridFiles[i], 0 ))) ERR;
+  }
+  for( i = 0; i < nStatFiles; i++ ){
+    if (( status += nccf_add_host_file( hostid, staticFiles[i], 0 ))) ERR;
+  }
+  for( i = 0; i < nTimeFiles; i++ ){
+    if (( status += nccf_add_host_file( hostid, timeFiles[i], 0 ))) ERR;
+  }
+  if (( status += nccf_add_host_file( hostid, NAME_MOSAIC_FILE, 0 ))) ERR;
+
+  /* Define the global attributes */
+  if(( status = nccf_def_global( &globalid ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_FILETYPE,
+                                     CF_GLATT_FILETYPE_HOST, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_DATA_ID,
+                                     data_id , 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_COORDINATES_ID,
+                                     coordinates_id, 0 ))) ERR;
+
+  if (( status = nccf_put_host(hostid, ncid))) ERR;
+  if (( status = nccf_put_global(globalid, ncid))) ERR;
+  if (( status = nc_close( ncid ))) ERR;
+  if (( status = nccf_free_global( globalid ))) ERR;
+
+  /* Build data from host */
+  int gfindx = 0; // tile  index
+  int read_data = 1; 
+  int dataidT;
+  if (( status = nccf_def_host_data(hostid, "T", gfindx, 
+                                    read_data, &dataidT) )) ERR;
+
+  /* Check that we can access the data */
+  nc_type xtype;
+  void *data_ptrT;
+  const void *fill_value;
+  if (( status = nccf_get_data_pointer(dataidT, &xtype, 
+                                       &data_ptrT, &fill_value) )) ERR;
+  if (( status = nccf_inq_data_ndims(dataidT, &ndims) )) ERR;
+  int dimsT[ndims];
+  if (( status = nccf_inq_data_dims(dataidT, dimsT) )) ERR;
+  int ntot = 1;
+  for (i = 0; i < ndims; ++i) ntot *= dimsT[i];
+#if 0
+  if (xtype == NC_FLOAT) {
+    float *data = (float *) data_ptrT;
+    for (i = 0; i < ntot; ++i) {
+      printf("i = %d float data = %f\n", i, data[i]);
+    }
+  }
+  else if (xtype == NC_DOUBLE) {
+    double *data = (double *) data_ptrT;
+    for (i = 0; i < ntot; ++i) {
+      printf("i = %d double data = %f\n", i, data[i]);
+    }
+  }
+  else {
+    printf("unsupported data type.\n");
+    return 1;
+  }
+#endif
+
+  /* Clean up data and unlerlying grid and coordinates */
+  int grididT;
+  if (( status = nccf_inq_data_gridid(dataidT, &grididT) )) ERR;
+  if (( status = nccf_inq_grid_ndims(grididT, &ndims) )) ERR;
+  int coordidsT[ndims];
+  if (( status = nccf_inq_grid_coordids(grididT, coordidsT) )) ERR;
+  if (( status = nccf_free_data(dataidT) )) ERR;
+  if (( status = nccf_free_grid(grididT) )) ERR;
+  for (i = 0; i < ndims; ++i) {
+    if (( status = nccf_free_coord(coordidsT[i]) )) ERR;
+  }
+  
+  /* Generate target grid for SCRIP interpolation */
+  int lonlat_dims[] = {90, 180};
+  int lonlat_coordids[2];
+  int lonlat_gridid;
+  const double coord_mins[] = {  0.0, -90.0};
+  const double coord_maxs[] = {360.0, +90.0};
+  ex_create_lonlat(lonlat_dims, coord_mins, coord_maxs,
+                   lonlat_coordids, &lonlat_gridid);
+
+  /* clean up */
+  if ((status = nccf_free_grid(lonlat_gridid))) ERR;
+  if ((status = nccf_free_coord(lonlat_coordids[0]))) ERR;
+  if ((status = nccf_free_coord(lonlat_coordids[1]))) ERR;
+
+  if ((status = nccf_free_host(hostid))) ERR;
+  if ((status = nccf_free_mosaic(mosaicid))) ERR;
+
+  if ((status = nccf_inq_grid_ndims(gridids[0], &ndims))) ERR;
+  int cid[ndims];
+  for (i = 0; i < nGrids; ++i) {
+    status += nccf_inq_grid_coordids( gridids[i], cid );
+
+    for( j = 0; j < ndims; j++ )
+      if ((status += nccf_free_coord(cid[j]))) ERR;
+    if ((status += nccf_free_grid(gridids[i]))) ERR;
+  }
+
+  for( i = 0; i < nStatFiles; i++ ){
+    if ((status += nccf_free_data(staticids[i]))) ERR;
+    free( staticFiles[i] );
+  }
+  for( i = 0; i < nTimeFiles; i++ ){
+    if ((status += nccf_free_data(timeids[i]))) ERR;
+    free( timeFiles[i] );
+  }
+  for (i = 0; i < 2*nGrids; ++i) {
+  }
+
+  for (i = 0; i < nGrids; ++i) {
+    free(gridFiles[i]);
+  }
+
+  free(gridFiles);
+  free(staticFiles);
+  free(timeFiles);
+
+  return status;
+}
diff --git a/examples/ex3.c b/examples/ex3.c
new file mode 100644
index 0000000..14f0cd6
--- /dev/null
+++ b/examples/ex3.c
@@ -0,0 +1,278 @@
+/**
+ * Example showing how to generate cell centered data of two cubed sphere
+ * tiles. 
+ *
+ * $Id: ex3.c 831 2011-09-14 20:24:21Z dkindig $
+ */
+
+// std includes
+#include <stdio.h>
+#include <math.h>
+
+#include <netcdf.h>
+
+#include <nccf_utility_functions.h>
+#include <nccf_global.h>
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_data.h>
+#include <nccf_regrid.h>
+#include <nccf_mosaic.h>
+#include <nccf_host.h>
+
+#include <nccf_handle_error.h>
+
+// function for setting data
+double funct(double lon, double lat) {
+  // some test field
+  return sin(5*M_PI*(lon - 30.0)/180.0 - 0.3) * cos(4*M_PI*lat/180.0);
+}
+
+double correct_for_dateline(double dlon) {
+  const double maxjump = 200.0;
+  const double period = 360.0;
+  double res = dlon;
+  if (dlon < -maxjump) {
+    res += period;
+  }
+  if (dlon > +maxjump) {
+    res -= period;
+  }
+  return res;
+}
+
+int main(int argc, char *argv[]) {
+
+  int status;
+  int i, j;
+  int k, k0;
+
+  const char *coordinates_id = "db9b6740-25a2-11e0-a724-5c260a1834c1";
+  const char *data_id = "e906f520-25a2-11e0-beeb-5c260a1834c1";
+  const char *case_name = "gsex3";
+
+  // space dimensionality
+  const int ndims = 2;
+
+  // set the tile resolutions
+  const int n1 = 20;
+  const int dims[] = {n1, n1};
+  const int dims_cell[] = {n1-1, n1-1};
+
+  // number of tiles
+  const int ntiles = 3;
+
+  // set the tile orientation on the sphere (normal vector pointing out)
+  int norm_vect[ntiles][3];
+  if (ntiles >= 1) {
+    norm_vect[0][0] = 1; norm_vect[0][1] = 0; norm_vect[0][2] = 0;
+  }
+  if (ntiles >= 2) {
+  norm_vect[1][0] = 0; norm_vect[1][1] = 1; norm_vect[1][2] = 0;
+  }
+  if (ntiles >= 3) {
+    norm_vect[2][0] = 0; norm_vect[2][1] = 0; norm_vect[2][2] = 1;
+  }
+
+  // generate nodal coordinate data
+  double **lon;
+  double **lat;
+  lon =  (double **) malloc(ntiles * sizeof(double *));
+  lat =  (double **) malloc(ntiles * sizeof(double *));
+  for (i = 0; i < ntiles; ++i) {
+    lon[i] = (double *) malloc( n1*n1 * sizeof(double));
+    lat[i] = (double *) malloc( n1*n1 * sizeof(double));
+  }
+  for (i = 0; i < ntiles; ++i) {
+    if ((status = nccf_get_cubedsphere_grid(dims, norm_vect[i],
+  					    lon[i], lat[i]))) ERR;
+  }
+
+  // generate cell centered coordinate data and scalar field
+  double **lonCell;
+  double **latCell;
+  double **field;
+  lonCell =  (double **) malloc(ntiles * sizeof(double *));
+  latCell =  (double **) malloc(ntiles * sizeof(double *));
+  field =  (double **) malloc(ntiles * sizeof(double *));
+  for (i = 0; i < ntiles; ++i) {
+    lonCell[i] = (double *) malloc( (n1-1)*(n1-1) * sizeof(double));
+    latCell[i] = (double *) malloc( (n1-1)*(n1-1) * sizeof(double));
+    field[i] = (double *) malloc( (n1-1)*(n1-1) * sizeof(double));
+    int dims_cell[] = {n1 - 1, n1 - 1};
+    int dims[] = {n1, n1};
+    int ij[ndims];
+    int ntot_cell = dims_cell[0] * dims_cell[1];
+    double lon0, dlon;
+    double lat0;
+    for (k = 0; k < ntot_cell; ++k) {
+      // compute ij
+      nccf_get_multi_index(ndims, dims_cell, k, ij);
+      // nodal flat index
+      k0 = nccf_get_flat_index(ndims, dims, ij);
+      lon0 = lon[i][k0];
+      lat0 = lat[i][k0];
+      // average nodal values, correct for dateline if necessary
+      lonCell[i][k] = lon0;
+      latCell[i][k] = lat0;
+
+      ij[0] += 1;
+      k0 = nccf_get_flat_index(ndims, dims, ij);
+      dlon = correct_for_dateline(lon[i][k0] - lon0);
+      lonCell[i][k] += (lon0 + dlon);
+      latCell[i][k] += lat[i][k0];
+
+      ij[1] += 1;
+      k0 = nccf_get_flat_index(ndims, dims, ij);
+      dlon = correct_for_dateline(lon[i][k0] - lon0);
+      lonCell[i][k] += (lon0 + dlon);
+      latCell[i][k] += lat[i][k0];
+      
+      ij[0] -= 1;
+      k0 = nccf_get_flat_index(ndims, dims, ij);
+      dlon = correct_for_dateline(lon[i][k0] - lon0);
+      lonCell[i][k] += (lon0 + dlon);
+      latCell[i][k] += lat[i][k0];
+
+      // now average
+      lonCell[i][k] /= 4.0;
+      latCell[i][k] /= 4.0;
+      // set the field
+      field[i][k] = funct(lonCell[i][k], latCell[i][k]);
+    }
+  }
+
+  // generate grid and data objects
+  int gridids[ntiles];
+  int gridids_cell[ntiles];
+  int dataids_cell[ntiles];
+  int coordids[ntiles][ndims];
+  int coordids_cell[ntiles][ndims];
+  int cellglobalid[ntiles];
+  for (i = 0; i < ntiles; ++i) {
+    int const save = 0;
+    const char *dimnames[] = {"n_x", "n_y"};
+    const char *dimnames_cell[] = {"ncell_x", "ncell_y"};
+    if ((status = nccf_def_lon_coord(ndims, dims,
+  				     dimnames, lon[i], save,
+  				     &coordids[i][0]))) ERR;
+    if ((status = nccf_def_lat_coord(ndims, dims,
+  				     dimnames, lat[i], save,
+  				     &coordids[i][1]))) ERR;
+    char tilename[STRING_SIZE];
+    sprintf(tilename, "tile%d", i);
+    if ((status = nccf_def_grid(coordids[i], tilename,
+  				       &gridids[i]))) ERR;
+    
+    // cell center coordinates
+    if ((status = nccf_def_coord(ndims, dims_cell, dimnames_cell, 
+				 lonCell[i], save, "lon_cell", 
+				 CF_COORD_LON_STNAME, CF_COORD_LON_UNITS,
+				 &coordids_cell[i][0]))) ERR;
+    if ((status = nccf_def_coord(ndims, dims_cell, dimnames_cell, 
+				 latCell[i], save, "lat_cell", 
+				 CF_COORD_LAT_STNAME, CF_COORD_LAT_UNITS,
+				 &coordids_cell[i][1]))) ERR;
+    if ((status = nccf_def_grid(coordids_cell[i], tilename,
+  				       &gridids_cell[i]))) ERR;
+    const char *time_axis = ""; // static data
+    if ((status = nccf_def_data(gridids_cell[i], "some_data",
+  				       "put_standard_name_here", 
+				       "put_units_here", 
+				         time_axis,
+  				       &dataids_cell[i]))) ERR;
+    if ((status = nccf_def_global( &cellglobalid[i] )));
+    if ((status = nccf_add_global_att(cellglobalid[i], CF_DATA_ID, data_id, 0 ))) ERR;
+    if ((status = nccf_add_global_att(cellglobalid[i], CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+    if ((status = nccf_add_global_att(cellglobalid[i], CF_FILETYPE, CF_GLATT_FILETYPE_STATIC_DATA, 0 ))) ERR;
+    if ((status = nccf_add_global_att(cellglobalid[i], CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 1 ))) ERR;
+    if ((status = nccf_add_global_att(cellglobalid[i], CF_GRIDNAME, tilename, 0 ))) ERR;
+    if ((status = nccf_set_data_double(dataids_cell[i], 
+					      field[i], save, 
+					      NC_FILL_DOUBLE))) ERR;
+  }
+
+  // generate the mosaic
+  int mosaicid, mosaicglobalid;
+  const double periods[] = {360.0, 0.0};
+  if ((status = nccf_def_mosaic(ntiles, gridids, "mosaic", &mosaicid))) ERR;
+  if ((status = nccf_compute_mosaic_contacts( mosaicid, periods ))) ERR;
+  if ((status = nccf_def_global( &mosaicglobalid ))) ERR;
+  if ((status = nccf_add_global_att(mosaicglobalid,
+					   CF_COORDINATES_ID, 
+					   coordinates_id, 0 ))) ERR;
+  if ((status = nccf_add_global_att(mosaicglobalid,
+					   CF_FILETYPE, 
+					   CF_GLATT_FILETYPE_MOSAIC, 0 ))) ERR;
+
+  // host
+  const int ntime_slices = 1;
+  int hostid, hostglobalid;
+  if ((status = nccf_def_host(coordinates_id, data_id, ntime_slices, 
+			      &hostid))) ERR;
+  const int force = 0;
+  if ((status = nccf_def_global( &hostglobalid ))) ERR;
+  if ((status = nccf_add_global_att(hostglobalid, CF_FILETYPE, 
+                                    CF_GLATT_FILETYPE_HOST, 0 ))) ERR;
+  if ((status = nccf_add_global_att(hostglobalid, CF_COORDINATES_ID, 
+                                    coordinates_id, 0 ))) ERR;
+  if ((status = nccf_add_global_att(hostglobalid, CF_DATA_ID, 
+                                    data_id, 0 ))) ERR;
+
+  // write everything to file
+  int ncid;
+  char filename[STRING_SIZE];
+  for (i = 0; i < ntiles; ++i) {
+    // data and grid in the same file
+    sprintf(filename, "%s_tile%d.nc", case_name, i);
+    if ((status = nc_create(filename, NC_CLOBBER, &ncid))) ERR;
+    if ((status = nccf_put_grid(gridids[i], ncid))) ERR;
+    if ((status = nccf_put_grid(gridids_cell[i], ncid))) ERR;
+    if ((status = nccf_put_data(dataids_cell[i], ncid))) ERR;
+    if ((status = nccf_put_global(cellglobalid[i], ncid)));
+    if ((status = nc_close(ncid))) ERR;
+    if ((status = nccf_add_host_file(hostid, filename, force))) ERR;
+  }
+  // mosaic
+  sprintf(filename, "%s_mosaic.nc", case_name);
+  if ((status = nc_create(filename, NC_CLOBBER, &ncid))) ERR;
+  if ((status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if ((status = nccf_put_global(mosaicglobalid, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+  if ((status = nccf_add_host_file(hostid, filename, force))) ERR;
+
+  // host
+  sprintf(filename, "%s_host.nc", case_name);
+  if ((status = nc_create(filename, NC_CLOBBER, &ncid))) ERR;
+  if ((status = nccf_put_host(hostid, ncid))) ERR;
+  if ((status = nccf_put_global(hostglobalid, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+
+  // clean up
+  for (i = 0; i < ntiles; ++i) {
+    if ((status = nccf_free_global(cellglobalid[i]))) ERR;
+    if ((status = nccf_free_data(dataids_cell[i]))) ERR;
+    if ((status = nccf_free_grid(gridids_cell[i]))) ERR;
+    if ((status = nccf_free_grid(gridids[i]))) ERR;
+    for (j = 0; j < ndims; ++j) {
+      if ((status = nccf_free_coord(coordids_cell[i][j]))) ERR;
+      if ((status = nccf_free_coord(coordids[i][j]))) ERR;
+    }
+    free(lonCell[i]);
+    free(latCell[i]);
+    free(lon[i]);
+    free(lat[i]);
+    free(field[i]);
+  }
+  if ((status = nccf_free_global(mosaicglobalid))) ERR;
+  if ((status = nccf_free_global(hostglobalid))) ERR;
+  if ((status = nccf_free_mosaic(mosaicid))) ERR;
+  if ((status = nccf_free_host(hostid))) ERR;
+  free(lonCell);
+  free(latCell);
+  free(lon);
+  free(lat);
+  free(field);
+  
+  return 0;
+}
diff --git a/examples/ex_create_cube_grids.c b/examples/ex_create_cube_grids.c
new file mode 100644
index 0000000..44a5a12
--- /dev/null
+++ b/examples/ex_create_cube_grids.c
@@ -0,0 +1,94 @@
+/**
+ * Create a cubed sphere mosaic of nGrids with nCells dimensions.
+ *
+ * "$Id: ex_create_cube_grids.c 784 2011-07-14 19:53:33Z pletzer $"
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <netcdf.h>
+
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_data.h"
+#include "nccf_mosaic.h"
+#include "nccf_host.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+
+#include "examples.h"
+
+int ex_create_cube_grids( const char *coordinates_id, int nCells, int nGrids,
+      char **gridFiles, int gridids[] ){
+
+  int status = NC_NOERR;
+  int i, iGrid;
+  const int ndims = 2;
+  int dims[] = {nCells, nCells};
+  double lon[dims[0] * dims[1]];
+  double lat[dims[0] * dims[1]];
+  const int save = 1;
+  const char *dimNames[] = {"nlon", "nlat"};
+  int coordids[nGrids * 2];
+  const char *grid_names[] = {NAME_GRID_0, NAME_GRID_1, NAME_GRID_2};
+
+  const int faceVect0[] = {1, 0, 0};
+  const int faceVect1[] = {0, 1, 0};
+  const int faceVect2[] = {0, 0, 1};
+  const int *faceVectors[] = {faceVect0, faceVect1, faceVect2};
+
+  int globalids[nGrids];
+
+  for (iGrid = 0; iGrid < nGrids; ++iGrid) {
+    status = nccf_get_cubedsphere_grid(dims, faceVectors[iGrid], lon, lat);
+    if (status != NC_NOERR) ERR;
+    status = nccf_def_lon_coord(ndims, dims, dimNames, lon, save, &coordids[0 + iGrid*2]);
+    if (status != NC_NOERR) ERR;
+    status = nccf_def_lat_coord(ndims, dims, dimNames, lat, save, &coordids[1 + iGrid*2]);
+    if (status != NC_NOERR) ERR;
+    status = nccf_def_grid(&coordids[iGrid*2], grid_names[iGrid], &gridids[iGrid]);
+    if (status != NC_NOERR) ERR;
+    if(( status = nccf_def_global( &globalids[iGrid] ))) ERR;
+    if(( status = nccf_add_global_att( globalids[iGrid], CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalids[iGrid], CF_GRIDNAME, grid_names[iGrid], 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalids[iGrid], CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+  }
+
+
+  /* Create some file names */
+  strncpy(gridFiles[0], NAME_GRID_0_FILE, STRING_SIZE);
+  strncpy(gridFiles[1], NAME_GRID_1_FILE, STRING_SIZE);
+  strncpy(gridFiles[2], NAME_GRID_2_FILE, STRING_SIZE);
+
+  /* write files */
+  char scrip_filename[STRING_SIZE];
+  for (i = 0; i < nGrids; ++i) {
+    sprintf(scrip_filename, "gsex2_grid%d_scrip.nc", i);
+    status = nccf_save_grid_scrip(gridids[i], scrip_filename);
+    if (status != NC_NOERR) ERR;
+    int ncid;
+    status = nc_create(gridFiles[i], NC_CLOBBER, &ncid);
+    if (status != NC_NOERR) ERR;
+    status = nccf_put_grid(gridids[i], ncid);
+    if (status != NC_NOERR) ERR;
+    status = nccf_put_global(globalids[i], ncid);
+    if (status != NC_NOERR) ERR;
+
+    /* Add global attributes */
+    nc_redef( ncid );
+    nc_put_att_text( ncid, NC_GLOBAL, CF_TITLE,
+            strlen("Dummy data for GRIDSPEC")+1,
+            "Dummy data for GRIDSPEC" );
+    nccf_def_notes( ncid, NC_GLOBAL, "Tech-X Corporation",
+                 "Multiple grids, variables, time files and times per file",
+                 "Comment", "https://ice.txcorp.com/trac/modave/wiki/CFProposalGridspec" );
+    nc_enddef( ncid );
+
+    status = nc_close(ncid);
+    if (status != NC_NOERR) ERR;
+    status = nccf_free_global(globalids[i]);
+  }
+
+  return status;
+}
diff --git a/examples/ex_create_lonlat.c b/examples/ex_create_lonlat.c
new file mode 100644
index 0000000..b4cef2c
--- /dev/null
+++ b/examples/ex_create_lonlat.c
@@ -0,0 +1,60 @@
+/**
+ * Create a longitude-latitude grid.
+ *
+ * "$Id: ex_create_lonlat.c 784 2011-07-14 19:53:33Z pletzer $"
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <netcdf.h>
+
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_data.h"
+#include "nccf_mosaic.h"
+#include "nccf_host.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+
+#include "examples.h"
+
+int ex_create_lonlat(const int dims[], 
+                     const double coord_mins[], const double coord_maxs[], 
+                     int coordids[], int *grididp){
+  const int save = 1;
+  const int ndims = 2;
+  int i, j, ntot, status;
+  double dLon, dLat;
+  double *lonData;
+  double *latData;
+  const char *dimnames[] = {"nj", "ni"};
+  char scrip_filename[STRING_SIZE];
+  dLon = (coord_maxs[0] - coord_mins[0]) / (dims[0] - 1);
+  dLat = (coord_maxs[1] - coord_mins[1]) / (dims[1] - 1);
+  ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+  lonData = malloc(ntot * sizeof(double));
+  latData = malloc(ntot * sizeof(double));
+  for (j = 0; j < dims[1]; ++j) {
+    for (i = 0; i < dims[0]; ++i) {
+      lonData[i + dims[0] * j] = coord_mins[0] + i * dLon;
+      latData[i + dims[0] * j] = coord_mins[1] + j * dLat;
+    }
+  }
+  if ((status = nccf_def_lon_coord(ndims, dims, dimnames, lonData, save, 
+                                   &coordids[0]))) ERR;
+  if ((status = nccf_def_lat_coord(ndims, dims, dimnames, latData, save, 
+                                   &coordids[1]))) ERR;
+  free(lonData);
+  free(latData);
+
+  /* Create grid */
+  if ((status = nccf_def_grid(coordids, "lonlat", grididp))) ERR;
+  strcpy(scrip_filename, "gsex2_lonlat_scrip.nc");
+  if ((status = nccf_save_grid_scrip(*grididp, scrip_filename))) ERR;
+
+  return 0;
+}
diff --git a/examples/ex_create_static_data.c b/examples/ex_create_static_data.c
new file mode 100644
index 0000000..19fbba6
--- /dev/null
+++ b/examples/ex_create_static_data.c
@@ -0,0 +1,94 @@
+/**
+ * Create static data on a cube grid mosaic.
+ *
+ * "$Id: ex_create_static_data.c 767 2011-06-06 23:20:19Z pletzer $"
+ *
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <netcdf.h>
+
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_data.h"
+#include "nccf_mosaic.h"
+#include "nccf_host.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+
+#include "examples.h"
+
+int ex_create_static_data( const char *data_id, const char *coordinates_id,
+                      int nCells, int nStatTiles, int nGrids, int gridids[],
+                      char **staticFiles, int staticids[] ){
+
+  int iStat, i, j, index, status, ncid, globalid;
+  int save = 0;
+  int toterr = 0;
+  float  data_f[nCells * nCells];
+  const char *df_sn = "static_data";
+  const char *df_ut = "meters";
+  char *name;
+  name = ( char* )calloc( STRING_SIZE, sizeof(char));
+
+  for( iStat = 0; iStat < nStatTiles; iStat++){
+
+    /* Create the data */
+    for( j = 0; j < nCells; j++ ){
+      for( i = 0; i < nCells; i++ ){
+        index = i + j * nCells;
+        data_f[index] = iStat + i * (float)( j+1 );
+      }
+    }
+
+    /* Define the data */
+    int gid = iStat % nGrids;
+    status += nccf_def_data( gridids[gid], NAME_STATIC_DATA_VARN,
+                                       df_sn, df_ut,
+                                       NULL, &staticids[iStat] );
+    status = nccf_inq_grid_name(gridids[gid], name);
+    toterr += status;
+    status += nccf_set_data_float( staticids[iStat], data_f, 
+					  save, NC_FILL_FLOAT);
+    toterr += status;
+
+    if(( status = nccf_def_global( &globalid ))) ERR;
+    if(( status = nccf_add_global_att( globalid, CF_FILETYPE,
+                                       CF_GLATT_FILETYPE_STATIC_DATA, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalid, CF_GRIDNAME,
+                                       name, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalid, CF_DATA_ID,
+                                       data_id, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalid, CF_COORDINATES_ID,
+                                       coordinates_id, 0 ))) ERR;
+
+    /* Open the file */
+    sprintf( staticFiles[iStat], "%s%d.nc", NAME_STATIC_DATA, iStat );
+    status += nc_create( staticFiles[iStat], NC_CLOBBER, &ncid );
+
+    /* Add global attributes */
+    nc_redef( ncid );
+    nc_put_att_text( ncid, NC_GLOBAL, CF_TITLE,
+            strlen("Dummy data for GRIDSPEC")+1,
+            "Dummy data for GRIDSPEC" );
+    nccf_def_notes( ncid, NC_GLOBAL, "Tech-X Corporation",
+                 "Multiple grids, variables, time files and times per file",
+                 "Comment", "https://ice.txcorp.com/trac/modave/wiki/CFProposalGridspec" );
+    nc_enddef( ncid );
+
+    /* Write the data to disk */
+    status += nccf_put_data(staticids[iStat], ncid);
+    status += nccf_put_global(globalid, ncid);
+    toterr += status;
+
+
+    status += nc_close( ncid );
+    status += nccf_free_global( globalid );
+  }
+
+  free( name );
+  return toterr;
+
+}
diff --git a/examples/ex_create_time_data.c b/examples/ex_create_time_data.c
new file mode 100644
index 0000000..b3f469b
--- /dev/null
+++ b/examples/ex_create_time_data.c
@@ -0,0 +1,137 @@
+/**
+ * Create time dependent data on a cube grid mosaic.
+ *
+ * "$Id: ex_create_time_data.c 776 2011-06-20 17:44:48Z dkindig $"
+ *
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <netcdf.h>
+
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_data.h"
+#include "nccf_mosaic.h"
+#include "nccf_host.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+
+#include "examples.h"
+
+int ex_create_time_data( const char *data_id, const char *coordinates_id,
+                         int iVar, struct time_struct *time, int gridids[],
+                         char **timeFiles, int timeids[] ){
+
+  int iTile, iTPF, i, j, ind, index, ii, status, ncid, iTime, globalid;
+  int time_dimidp, time_varidp;
+  int save = 0;
+  int toterr = 0;
+  long *times;
+  float  data_f[time->nCells * time->nCells];
+  char *name;
+  name = ( char* )calloc( STRING_SIZE, sizeof(char));
+
+  /* Initialize the time data */
+  for( j = 0; j < time->nCells; j++ ){
+    for( i = 0; i < time->nCells; i++ ){
+      ind = i + j * time->nCells;
+      data_f[ind] = 0.0;
+    }
+  }
+
+  float div = time->nGrids + time->nTimes + time->nTimesPerFile +
+              time->nCells + time->nCells;
+  div = div - 5;
+  float div2  =  div / 2.0;
+
+  for( iTime = 0; iTime < time->nTimes; iTime++ ){
+    for( iTile = 0; iTile < time->nGrids; iTile++){
+
+      /* Create the data */
+      index = iTile + ( time->nGrids * ( iTime + ( time->nTimes * iVar )));
+
+      /* Open the file*/
+      sprintf( timeFiles[index], "%s_%d-%d-%d.nc", NAME_TIME_DATA,
+               iVar, iTime, iTile );
+      status = nc_create( timeFiles[index], NC_CLOBBER, &ncid );
+      if( status ) return status;
+
+      /* Add the time coordinate */
+      nc_redef( ncid );
+      status = nccf_def_time(ncid,
+                    "time",
+                    time->nTimesPerFile,
+                    NC_LONG,
+                    time->time_units,
+                    time->time_stanname,
+                    &time_dimidp,
+                    &time_varidp);
+      nc_enddef( ncid );
+
+      times = malloc( time->nTimesPerFile * sizeof(long));
+      for( ii = 0; ii < time->nTimesPerFile; ii++ )
+        times[ii] = ii + time->nTimesPerFile * iTime;
+      if( status ) ERR;
+      status = nc_put_var_long( ncid, time_varidp, times );
+      if( status ) ERR;
+
+      /* Define the time data for each tile */
+      status = nccf_def_data( gridids[iTile], time->varname,
+                                         time->st_name, time->units,
+                                         NAME_TIME_VARN, &timeids[index] );
+      toterr += status;
+
+      status = nccf_set_data_float( timeids[index], data_f, 
+					   save, NC_FILL_FLOAT );
+      toterr += status;
+
+      /* Add global attributes */
+      nc_redef( ncid );
+      nc_put_att_text( ncid, NC_GLOBAL, CF_TITLE,
+              strlen("Dummy data for GRIDSPEC")+1,
+              "Dummy data for GRIDSPEC" );
+      nccf_def_notes( ncid, NC_GLOBAL, "Tech-X Corporation",
+                   "Multiple grids, variables, time files and times per file",
+                   "Comment", "https://ice.txcorp.com/trac/modave/wiki/CFProposalGridspec" );
+      nc_enddef( ncid );
+
+
+      /* populate the data */
+      for( iTPF = 0; iTPF < time->nTimesPerFile; iTPF++ ){
+        for( j = 0; j < time->nCells; j++ ){
+          for( i = 0; i < time->nCells; i++ ){
+            ind = i + j * time->nCells;
+            data_f[ind] = time->value + (( iTile + iTime + iTPF + j + i ) - div2);
+          }
+        }
+
+        /* Write to disk*/
+        status = nccf_put_data(timeids[index], ncid);
+        toterr += status;
+      }
+
+      /* Global Attributes */
+      status = nccf_inq_grid_name(gridids[iTile], name);
+      status = nccf_def_global( &globalid );
+      status = nccf_add_global_att(globalid, CF_GRIDNAME, name, 0);
+      status = nccf_add_global_att(globalid, CF_FILETYPE,
+                                   CF_GLATT_FILETYPE_TIME_DATA, 0);
+      status = nccf_add_global_att(globalid, CF_DATA_ID, data_id, 0);
+      status = nccf_add_global_att(globalid, CF_COORDINATES_ID, coordinates_id, 0);
+      status = nccf_put_global(globalid, ncid);
+
+      toterr += status;
+      status = nc_close( ncid );
+      status = nccf_free_global( globalid );
+      if( status ) return status;
+      free( times );
+    }
+  }
+
+  free( name );
+  return toterr;
+
+}
+
diff --git a/examples/ex_fortran_interface.f90 b/examples/ex_fortran_interface.f90
new file mode 100644
index 0000000..12223d9
--- /dev/null
+++ b/examples/ex_fortran_interface.f90
@@ -0,0 +1,77 @@
+!
+! Example showing how to call a LibCF function from Fortran 2003
+! $Id: $
+
+program test
+   use iso_c_binding
+   implicit none
+
+   integer, parameter            :: r8 = selected_real_kind(12,100)
+   real(r8), allocatable, target :: lon(:)
+   real(r8), parameter           :: lonmin = 0.0, lonmax = 360.0
+   real(r8)                      :: dlon
+   integer                       :: nlon, nlat, i, j, k, stat, sav, lonid
+   integer, parameter            :: ndims = 2
+   integer                       :: dims(ndims)
+   character(len=128), target    :: dimnames(ndims)
+   type(c_ptr)                   :: sa_dimnames(ndims)
+
+   ! interface for calling C routine
+   interface 
+      function nccf_def_lon_coord(ndims, dims, sa_dimnames, coorddata, &
+         &                           sav, coordid) result(stat) &
+         &                           bind(C, name="nccf_def_lon_coord")
+         use iso_c_binding
+         implicit none
+         integer(c_int), value     :: ndims
+	     integer(c_int)            :: dims(*)
+         type(c_ptr)               :: sa_dimnames(*)
+         real(c_double)            :: coorddata(*)
+         integer(c_int), value     :: sav
+         integer(c_int)            :: coordid
+         integer(c_int)            :: stat
+       end function 
+
+       function nccf_free_coord(coordid) result(stat) &
+         &                           bind(C, name="nccf_free_coord")
+          use iso_c_binding
+          implicit none
+          integer(c_int), value     :: coordid
+          integer(c_int)            :: stat
+       end function
+    end interface
+
+    ! create a longitude coordinate
+    nlon = 11
+    nlat = 12
+    dlon = (lonmax - lonmin)/real(nlon-1, r8)
+    allocate(lon(nlon*nlat))
+    do j = 1, nlat
+       do i = 1, nlon
+          k = i + nlon*(j-1)
+          lon(k) = lonmin + dlon*(i-1)
+       enddo
+    enddo
+	
+    ! note: index order is reversed between fortran and C
+    dims(1) = nlat
+    dims(2) = nlon
+
+    dimnames(1) = 'nlat'//c_null_char
+    dimnames(2) = 'nlon'//c_null_char
+
+    sa_dimnames(1) = c_loc(dimnames(1))
+    sa_dimnames(2) = c_loc(dimnames(2))
+    sav = 1
+    lonid = -12134567
+    ! note that we pass the first element of lon since lon is array object 
+    ! with a decorator
+    stat = nccf_def_lon_coord(ndims, dims, sa_dimnames, lon(1), sav, lonid)
+    print *,'stat = ', stat, ' lonid = ', lonid
+	
+    stat = nccf_free_coord(lonid)
+    deallocate(lon)
+
+    print *,'stat = ', stat
+
+end program
diff --git a/examples/ex_subset.c b/examples/ex_subset.c
new file mode 100644
index 0000000..aec1d0c
--- /dev/null
+++ b/examples/ex_subset.c
@@ -0,0 +1,244 @@
+/*
+ * Example of data subsetting
+ * $Id: ex_subset.c 881 2011-12-17 21:53:14Z pletzer $
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+#include <netcdf.h>
+
+#include <nccf_utility_functions.h>
+#include <nccf_global.h>
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_data.h>
+#include <nccf_regrid.h>
+
+/**
+ * Subsetting a field
+ * \param srcdata_id data id on source grid
+ * \param dstgrid_id destination
+ * \param subsampled_data will set the pointer to the sub-sampled data
+ *        on return. Caller responsible for free'ing the data
+ * \return 0 on success, or a positive number equial to the numeber points
+ *        of points that could not be interpolated (likely because these
+ *        fell out of the domain, or perhaps due to singularities in the 
+ *        coordinate system). A negative number indicates other failures.
+ */
+int subset(int srcdata_id, int dstgrid_id, float* subsampled_data) {
+
+  int i;
+  int status;
+
+  // get the grid sizes of dstgrid_id
+  int ndims;
+  status = nccf_inq_grid_ndims(dstgrid_id, &ndims);
+  if (status) ERR;
+  if (ndims <= 0) return -2;
+
+  // get the grid id attached to the source data
+  int srcgrid_id;
+  status = nccf_inq_data_gridid(srcdata_id, &srcgrid_id);
+  if (status) ERR;
+  
+  // define the regrid object 
+  int regrid_id;
+  status = nccf_def_regrid(srcgrid_id, dstgrid_id, &regrid_id);
+  if (status) ERR;
+
+  // compute the interpolation weights
+  // caller may want to pass parameters down this routine....
+  const int nitermax = 100;
+  const double tolpos = 0.01;
+  status = nccf_compute_regrid_weights(regrid_id, nitermax, tolpos);
+  if (status) ERR;
+
+  int dstcoordids[ndims];
+  status = nccf_inq_grid_coordids(dstgrid_id, dstcoordids);
+  if (status) ERR;
+  int dstdims[ndims];
+  status = nccf_inq_coord_dims(dstcoordids[0], dstdims);
+  if (status) ERR;
+  int dstntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    dstntot *= dstdims[i];
+  }
+
+  // create container for the interpolated data, no standard_name, 
+  // no units, and no time dependence
+  int dstdata_id;
+  status = nccf_def_data(dstgrid_id, "temporary", "", "", NULL, &dstdata_id);
+  if (status) ERR;
+
+  // initialize the interpolated data
+  float *dstdata = malloc(dstntot * sizeof(float));
+  for (i = 0; i < dstntot; ++i) {
+      dstdata[i] = 0.0f;
+  }
+  const int not_save = 0;
+  status = nccf_set_data_float(dstdata_id, dstdata, not_save, NC_FILL_FLOAT);
+  if (status) ERR;
+ 
+  // interpolate
+  status = nccf_apply_regrid(regrid_id, srcdata_id, dstdata_id);
+  if (status) ERR;
+
+  // copy
+  for (i = 0; i < dstntot; ++i) {
+    subsampled_data[i] = dstdata[i];
+  }
+
+  // cleanup
+  status = nccf_free_regrid(regrid_id);
+  if (status) ERR;
+  status = nccf_free_data(dstdata_id);
+  if (status) ERR;
+  free(dstdata);
+
+  return 0;
+}
+
+/**
+ * Function to set data 
+ * @param lat latitude
+ * @param lon longitude
+ * @return value
+ */
+float funct(double lat, double lon) {
+  return 292.0 + cosf(2*lon*M_PI/180.0)*sinf(3*lat*M_PI/180.0);
+}
+
+/* =================================================================== */
+
+int main() {
+
+  const int ndims = 2;
+  int i, j, k, status;
+  int srclon_id, srclat_id;
+  
+  // create source coordinates and grid
+  const int nlon = 181;
+  const int nlat = 91;
+  const double lonmin = 0.0; 
+  const double lonmax = 360.0; 
+  const double latmin = -90.0; 
+  const double latmax = +90.0; 
+  const double dlon = (lonmax - lonmin)/(nlon-1);
+  const double dlat = (latmax - latmin)/(nlat-1);
+  double *lon = malloc(nlat * nlon * sizeof(double));
+  double *lat = malloc(nlat * nlon * sizeof(double));
+  for (j = 0; j < nlat; ++j) {
+    for (i = 0; i < nlon; ++i) {
+      k = i + j*nlon;
+      lon[k] = lonmin + i*dlon;
+      lat[k] = latmin + j*dlat;
+    }
+  }
+  const int srcdims[] = {nlat, nlon};
+  const char *srcdimnames[] = {"nlat", "nlon"};
+  const int save = 1;
+  status = nccf_def_lon_coord(ndims, srcdims, srcdimnames,
+                              lon, save, &srclon_id);
+  if (status) ERR;
+  status = nccf_def_lat_coord(ndims, srcdims, srcdimnames,
+                              lat, save, &srclat_id);
+  if (status) ERR;
+  const int srccoord_ids[] = {srclat_id, srclon_id};
+  int srcgrid_id;
+  status = nccf_def_grid(srccoord_ids, "lat_lon", &srcgrid_id);
+  if (status) ERR;
+
+  // create static data
+  const char* time_dimname = NULL;
+  int srcta_id;
+  status = nccf_def_data(srcgrid_id, "ta", "air_temperature", 
+                         "Kelvin", time_dimname, &srcta_id);
+  if (status) ERR;
+
+  // set the data to some values, floats
+  float *ta = malloc(nlat * nlon * sizeof(float));
+  for (j = 0; j < nlat; ++j) {
+    for (i = 0; i < nlon; ++i) {
+      k = i + j*nlon;
+      ta[k] = funct(lat[k], lon[k]);
+    }
+  }
+  const int not_save = 0;
+  status = nccf_set_data_float(srcta_id, ta, not_save, NC_FILL_FLOAT);
+  if (status) ERR;
+  
+  // create destination coordinates and grid
+  const int nlon_dest = 11;
+  const int nlat_dest = 6;
+  const double dstlonmin = 20.0;
+  const double dstlonmax = 40.0;
+  const double dstlatmin = 10.0;
+  const double dstlatmax = 50.0;
+  const double dstdlon = (dstlonmax - dstlonmin)/(nlon_dest - 1);
+  const double dstdlat = (dstlatmax - dstlatmin)/(nlat_dest - 1);
+  double *dstlon = malloc(nlon_dest * nlat_dest * sizeof(double));
+  double *dstlat = malloc(nlon_dest * nlat_dest * sizeof(double));
+  for (j = 0; j < nlat_dest; ++j) {
+    for (i = 0; i < nlon_dest; ++i) {
+      k = i + j*nlon_dest;
+      dstlon[k] = dstlonmin + i*dstdlon;
+      dstlat[k] = dstlatmin + j*dstdlat;
+    }
+  }
+  const int dstdims[] = {nlat_dest, nlon_dest};
+  const char *dstdimnames[] = {"nlat_dest", "nlon_dest"};
+  int dstlon_id, dstlat_id;
+  status = nccf_def_lon_coord(ndims, dstdims, dstdimnames,
+                              dstlon, save, &dstlon_id);
+  if (status) ERR;
+  status = nccf_def_lat_coord(ndims, dstdims, dstdimnames,
+                              dstlat, save, &dstlat_id);
+  if (status) ERR;
+  const int dstcoord_ids[] = {dstlat_id, dstlon_id};
+  int dstgrid_id;
+  status = nccf_def_grid(dstcoord_ids, "lat_lon_dest", &dstgrid_id);
+  if (status) ERR;
+
+  //
+  // sub-sample
+  //
+
+  float *dstta = malloc(nlat_dest * nlon_dest * sizeof(float));
+  status = subset(srcta_id, dstgrid_id, dstta);
+  if (status != 0) {
+    printf("Subsetting error: %d\n", status);
+    return 1;
+  }
+
+  // check
+  float error = 0.0f;
+  for (j = 0; j < nlat_dest; ++j) {
+    for (i = 0; i < nlon_dest; ++i) {
+      k = i + j*nlon_dest;
+      error += fabs(dstta[k] - funct(dstlat[k], dstlon[k]));
+    }
+  }
+  error /= (nlon_dest * nlat_dest);
+  printf("average interpolation error = %g\n", error);
+  
+
+  // clean up
+  status = nccf_free_data(srcta_id); if(status) ERR;
+  free(ta);
+  status = nccf_free_grid(srcgrid_id); if(status) ERR;
+  status = nccf_free_coord(srclat_id); if(status) ERR;
+  status = nccf_free_coord(srclon_id); if(status) ERR;
+  free(lat);
+  free(lon);
+  status = nccf_free_grid(dstgrid_id); if(status) ERR;
+  free(dstlat);
+  free(dstlon);
+  status = nccf_free_coord(dstlat_id); if(status) ERR;
+  status = nccf_free_coord(dstlon_id); if(status) ERR;
+  free(dstta);
+
+  // done
+  return 0;
+}
diff --git a/examples/examples.h b/examples/examples.h
new file mode 100644
index 0000000..53d2282
--- /dev/null
+++ b/examples/examples.h
@@ -0,0 +1,117 @@
+/**
+ * Header for ex2.c. This applies to ex_create_cube_grids.c, 
+ * ex_create_static_data.c, and ex_create_time_data.c
+ *
+ * "$Id: examples.h 784 2011-07-14 19:53:33Z pletzer $"
+ */
+
+
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <netcdf.h>
+
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_data.h"
+#include "nccf_regrid.h"
+#include "nccf_mosaic.h"
+#include "nccf_host.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+
+/* A structure for the time variable */
+struct time_struct{
+  int nVars;
+  int nCells;
+  int nTimes;
+  int nTimesPerFile;
+  int nGrids;
+
+  float value;
+  char *varname;
+  char *st_name;
+  char *units;
+  char *time_units;
+  char *time_stanname;
+  char *time_longname;
+};
+
+/* Grid */
+#define NAME_GRID_0 "gsex2_grid0"
+#define NAME_GRID_1 "gsex2_grid1"
+#define NAME_GRID_2 "gsex2_grid2"
+#define NAME_GRID_0_FILE "gsex2_grid0.nc"
+#define NAME_GRID_1_FILE "gsex2_grid1.nc"
+#define NAME_GRID_2_FILE "gsex2_grid2.nc"
+
+/* Static data */
+#define NAME_STATIC_DATA_VARN "distance"
+#define NAME_STATIC_DATA "gsex2_static_data"
+
+/* Time data */
+#define NAME_TIME_DATA   "gsex2_time_data"
+#define NAME_TIME_DATA_VARN_v   "V"
+#define NAME_TIME_DATA_VARN_t   "T"
+#define NAME_TIME_VARN        "time"
+
+/* Host and mosaic */
+#define NAME_MOSAIC "gsex2_mosaic"
+#define NAME_MOSAIC_FILE "gsex2_mosaic.nc"
+#define NAME_HOST_FILE   "gsex2_host.nc"
+
+/**
+ * Create nGrids of a cube sphere with nCells resolution.
+ *
+ * \param coordinates_id The coordinates_id
+ * \param nCells The resolution of the grid. 
+ * \param nGrids The number of cube-sphere grids. e.g. 3 out of 6
+ * \param gridFiles The filenames for each of the grids
+ * \param gridids The Id for each grid ( returned )
+ */
+int ex_create_cube_grids( const char *coordinates_id, int nCells, int nGrids,
+      char **gridFiles, int gridids[] );
+
+/**
+ * Create a uniform longitude-latitude grid.
+ *
+ * \param dims The resolutions of the grid
+ * \param coord_mins a 2 value tuple for the minimum lon/lat coordinate values
+ * \param coord_maxs a 2 value tuple for the maximum lon/lat coordinate values
+ * \param coordids The Id for each coordinate (returned)
+ * \param gridid The Id of the grid (returned)
+ */
+int ex_create_lonlat(const int dims[], const double coord_mins[],
+                     const double coord_maxs[], int coordids[], 
+                     int *gridid);
+/**
+ * Create nGrids of timeic data dummy data.
+ *
+ * \param data_id The data_id
+ * \param coordinates_id The coordinates_id
+ * \param nCells The resolution of the grid. 
+ * \param ntimeFiles The number of timeic data variable files
+ * \param nGrids The number of cube-sphere grids. e.g. 3 of 6
+ * \param gridids The Id for each grid ( returned )
+ * \param timeicFiles The file name for each timeic data variable for each grid
+ * \param timeicids The Id for each timeic file ( returned )
+ */
+int ex_create_static_data( const char *data_id, const char *coordinates_id,
+      int nCells, int ntimeFiles, int nGrids, int gridids[],
+      char **timeicFiles, int timeicids[] );
+
+/**
+ * Create nGrids of time data dummy data.
+ *
+ * \param data_id The data_id
+ * \param coordinates_id The coordinates_id
+ * \param iVar Which variable is being created
+ * \param time Structure of time dependent information. See examples.h for contents
+ * \param gridids The Id for each grid ( returned )
+ * \param timeFiles The file name for each time data variable for each grid
+ * \param timeids The Id for each time file ( returned )
+ */
+int ex_create_time_data( const char *data_id, const char *coordinates_id,
+      int iVar, struct time_struct *time, int gridids[], char **timeFiles,
+      int timeids[] );
+
diff --git a/examples/exparinterp.c b/examples/exparinterp.c
new file mode 100644
index 0000000..235bd0e
--- /dev/null
+++ b/examples/exparinterp.c
@@ -0,0 +1,248 @@
+/**
+ * $Id: exparinterp.c 901 2011-12-23 20:33:15Z pletzer $
+ *
+ * Example of code to perform interpolation in parallel
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <examples.h>
+
+#ifdef HAVE_MPI_H
+#include <mpi.h>
+#endif
+
+double cost_function(int ny, int nx) {
+  // ~ ratio of surface over volume
+  return (double)(ny + nx)/(double)(ny * nx);
+}
+
+void create_domain_decomp(int nprocs, int *ny, int *nx) {
+  // create an optimal 2D domain decomposition, one 
+  // one which minimizes the ratio of surface over volume
+  int i = 1;
+  int j = nprocs;
+  double newCost;
+  double cost = cost_function(i, j);
+  *ny = i; 
+  *nx = j;
+  for (i = 2; i < nprocs/2; ++i) {
+    j = nprocs / i;
+    if ( (double)(nprocs)/(double)(i) == j) {
+      newCost = cost_function(i, j);
+      if (newCost < cost) {
+        *ny = i;
+        *nx = j;
+        cost = newCost;
+      }
+    }
+  }
+}
+
+double data_fct_tgt(double lat, double lon) {
+  return NC_FILL_DOUBLE;
+}
+
+double data_fct(double lat, double lon) {
+  return sin(3*M_PI*lat/180.0)*cos(5*M_PI*lon/180.0);
+}
+
+int check_data(int dataid, double (*data_fct)(double, double), 
+               double tolfct) {
+  int fails = 0;
+  int dims[2];
+  int status;
+  int i, j;
+  status = nccf_inq_data_dims(dataid, dims);
+  int gridid;
+  status = nccf_inq_data_gridid(dataid, &gridid);
+  int coordids[2];
+  status = nccf_inq_grid_coordids(gridid, coordids);
+  double *lats;
+  double *lons;
+  status = nccf_get_coord_data_pointer(coordids[0], &lats);
+  status = nccf_get_coord_data_pointer(coordids[1], &lons);
+  nc_type type;
+  double *data;
+  double *missing_value;
+  status = nccf_get_data_pointer(dataid, &type, (void **) &data, 
+                                 (const void **) &missing_value);
+  int index;
+  for (j = 0; j < dims[0]; ++j) {
+    for (i = 0; i < dims[1]; ++i) {
+      index = i + dims[1]*j;
+      double fexact = data_fct(lats[index], lons[index]);
+      double fintrp = data[index];
+      if (fabs(fexact - fintrp) > tolfct) {
+        fails++;
+        printf("interpolation error %f for lat, lon = %f, %f\n", 
+               fabs(fexact - fintrp), 
+               lats[index], lons[index]);
+      }
+    }
+  }
+  return fails;
+}
+
+int create_latlon(const int dims[], 
+                  const double coord_mins[], const double coord_maxs[], 
+                  int coordids[], int *gridid) {
+  const char *dimnames[NC_MAX_NAME+1] = {"nlat", "nlon"};
+  int j, i, status;
+  double *lats = (double *) malloc(dims[0]*dims[1]*sizeof(double));
+  double *lons = (double *) malloc(dims[0]*dims[1]*sizeof(double));
+  double dlat = (coord_maxs[0] - coord_mins[0]) / ((double) dims[0]-1);
+  double dlon = (coord_maxs[1] - coord_mins[1]) / ((double) dims[1]-1);
+  for (j = 0; j < dims[0]; ++j) {
+    for (i = 0; i < dims[1]; ++i) {
+      int index = i + dims[1]*j;
+      lats[index] = coord_mins[0] + j*dlat;
+      lons[index] = coord_mins[1] + i*dlon;
+    }
+  }
+  const int save = 1;
+  status = nccf_def_lat_coord(2, dims, dimnames, lats, save, &coordids[0]);
+  status = nccf_def_lon_coord(2, dims, dimnames, lons, save, &coordids[1]);
+  status = nccf_def_grid(coordids, "latlon", gridid);
+  free(lats);
+  free(lons);
+  return status;
+}
+
+/**
+ * Create data object and fill in values
+ * \param gridid grid ID
+ * \param fct function of (lat, lon), can be NULL in which case data will 
+ *            be set to missing value
+ * \param dataid return ID
+ */
+int create_data(int gridid, double (*fct)(double, double), int *dataid) {
+  int status;
+  const char *standard_name = "";
+  const char *units = "";
+  // static data
+  status = nccf_def_data(gridid, "data", standard_name, units, NULL, 
+                         dataid);
+  if (fct) {
+    int dims[2];
+    status = nccf_inq_data_dims(*dataid, dims);
+    int coordids[2];
+    status = nccf_inq_grid_coordids(gridid, coordids);
+    double *lats, *lons;
+    status = nccf_get_coord_data_pointer(coordids[0], &lats);
+    status = nccf_get_coord_data_pointer(coordids[1], &lons);
+    double *data = (double *) malloc(dims[0]*dims[1]*sizeof(double));
+    int i, j, index;
+    for (j = 0; j < dims[0]; ++j) {
+      for (i = 0; i < dims[1]; ++i) {
+        index = i + dims[1]*j;
+        data[index] = fct(lats[index], lons[index]);
+      }
+    }
+    const int save = 1;
+    status = nccf_set_data_double(*dataid, data, save, NC_FILL_DOUBLE);
+    free(data);
+  }
+  return status;
+}
+
+//////////////////////////////////////////////////////////////////////
+int main(int argc, char **argv) {
+
+  int status;
+  int nprocs = 1; 
+  int procid = 0;
+#ifdef HAVE_MPI_H
+  MPI_Init(&argc, &argv);
+  MPI_Comm comm = MPI_COMM_WORLD;
+  MPI_Comm_size(comm, &nprocs);
+  MPI_Comm_rank(comm, &procid);
+#endif
+  if (procid == 0) {
+    printf("\nRegridding from a rectilinear grid to another in parallel.\n\n");
+    printf("MPI number of procs: %d\n", nprocs);
+  }
+
+  // source grid
+  const int nlat = 180 + 1;
+  const int nlon = 360 + 1;
+  const int dims[] = {nlat, nlon};
+  const double coord_mins[] = {-90.0, -180.0};
+  const double coord_maxs[] = {+90.0, +180.0};
+  int coordids[2];
+  int gridid;
+  create_latlon(dims, coord_mins, coord_maxs, 
+                coordids, &gridid);
+  int dataid;
+  create_data(gridid, data_fct, &dataid);
+
+  // target grids, different for each proc
+  const int nlat_tgt = 2*50 + 1;
+  const int nlon_tgt = 2*60 + 1;
+  const int dims_tgt[] = {nlat_tgt, nlon_tgt};
+  int nx, ny;
+  create_domain_decomp(nprocs, &ny, &nx);
+  if (procid == 0) {
+    printf("source grid is                              %d x %d\n", nlat, nlon);
+    printf("domain decomposition of destination grid is %d x %d\n", ny, nx);
+    printf("destination grid is                         %d x %d\n", nlat_tgt, nlon_tgt);
+    printf("total number of interpolation points is     %d\n", nprocs*nlat_tgt*nlon_tgt);
+  }
+  double dy_dom = (coord_maxs[0] - coord_mins[0])/( (double)(ny) );
+  double dx_dom = (coord_maxs[1] - coord_mins[1])/( (double)(nx) );
+  int j = procid / nx;
+  int i = procid % nx;
+  double coord_mins_tgt[] = {coord_mins[0] + j*dy_dom, 
+                             coord_mins[1] + i*dx_dom};
+  double coord_maxs_tgt[] = {coord_mins[0] + (j+1)*dy_dom, 
+                             coord_mins[1] + (i+1)*dx_dom};
+  printf("[%d] min/max target corners are: %f %f / %f %f\n", procid,
+         coord_mins_tgt[0], coord_mins_tgt[1], 
+         coord_maxs_tgt[0], coord_maxs_tgt[1]);
+  int coordids_tgt[2];
+  int gridid_tgt;
+  create_latlon(dims_tgt, coord_mins_tgt, coord_maxs_tgt, 
+                coordids_tgt, &gridid_tgt);
+  int dataid_tgt;
+  create_data(gridid_tgt, data_fct_tgt, &dataid_tgt);
+  
+  // interpolation
+  int regridid;
+  if ((status = nccf_def_regrid(gridid, gridid_tgt, &regridid))) ERR;
+  const int nitermax = 5;
+  const double tolpos = 1.e-6;
+  if ((status = nccf_compute_regrid_weights(regridid, nitermax, tolpos))) ERR;
+  if ((status = nccf_apply_regrid(regridid, dataid, dataid_tgt))) ERR;
+  
+  // check
+  const double tolfct = 0.01;
+  int nfails = check_data(dataid_tgt, data_fct, tolfct);
+  if (nfails > 0) {
+    printf("[%d] number of interpolation failures: %d\n", procid, nfails);
+  }
+  int ntotfails = nfails;
+#ifdef HAVE_MPI_H
+  MPI_Reduce(&nfails, &ntotfails, 1, MPI_INT, MPI_SUM, 0, comm);
+#endif
+  if (procid == 0) {
+    printf("total number of interpolation failures: %d\n", ntotfails);
+  }
+
+  // clean up
+  if ((status = nccf_free_regrid(regridid))) ERR;
+  if ((status = nccf_free_data(dataid))) ERR;
+  if ((status = nccf_free_data(dataid_tgt))) ERR;
+  if ((status = nccf_free_grid(gridid))) ERR;
+  if ((status = nccf_free_grid(gridid_tgt))) ERR;
+  if ((status = nccf_free_coord(coordids_tgt[0]))) ERR;
+  if ((status = nccf_free_coord(coordids_tgt[1]))) ERR;
+  if ((status = nccf_free_coord(coordids[0]))) ERR;
+  if ((status = nccf_free_coord(coordids[1]))) ERR;
+
+#ifdef HAVE_MPI_H
+  MPI_Finalize();
+#endif
+  return 0;
+}
diff --git a/gridspec/Makefile.am b/gridspec/Makefile.am
deleted file mode 100644
index 486effd..0000000
--- a/gridspec/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-# This is an automake file, part of libcf, a NetCDF CF Library
-# package. Libcf is developed by Ed Hartnett at Unidata, copyright
-# 2009; GRIDSPEC code is developed by Zhi Liang, GFDL, copyright 2008.
-# See the COPYRIGHT file for more information.
-
-# $Id: Makefile.am,v 1.2 2009/11/21 12:58:06 ed Exp $
-
-SUBDIRS = shared tools
\ No newline at end of file
diff --git a/gridspec/shared/Makefile.am b/gridspec/shared/Makefile.am
deleted file mode 100644
index f246388..0000000
--- a/gridspec/shared/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-# This is an automake file, part of libcf, a NetCDF CF Library
-# package. Libcf is developed by Ed Hartnett at Unidata, copyright
-# 2009; GRIDSPEC code is developed by Zhi Liang, GFDL, copyright 2008.
-# See the COPYRIGHT file for more information.
-
-SUBDIRS = mosaic
\ No newline at end of file
diff --git a/gridspec/shared/Makefile.in b/gridspec/shared/Makefile.in
deleted file mode 100644
index 3d20fc1..0000000
--- a/gridspec/shared/Makefile.in
+++ /dev/null
@@ -1,574 +0,0 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-
-# This is an automake file, part of libcf, a NetCDF CF Library
-# package. Libcf is developed by Ed Hartnett at Unidata, copyright
-# 2009; GRIDSPEC code is developed by Zhi Liang, GFDL, copyright 2008.
-# See the COPYRIGHT file for more information.
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = gridspec/shared
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-SOURCES =
-DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
-	html-recursive info-recursive install-data-recursive \
-	install-dvi-recursive install-exec-recursive \
-	install-html-recursive install-info-recursive \
-	install-pdf-recursive install-ps-recursive install-recursive \
-	installcheck-recursive installdirs-recursive pdf-recursive \
-	ps-recursive uninstall-recursive
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
-  distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
-	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
-	distdir
-ETAGS = etags
-CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-am__relativize = \
-  dir0=`pwd`; \
-  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
-  sed_rest='s,^[^/]*/*,,'; \
-  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
-  sed_butlast='s,/*[^/]*$$,,'; \
-  while test -n "$$dir1"; do \
-    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
-    if test "$$first" != "."; then \
-      if test "$$first" = ".."; then \
-        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
-        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
-      else \
-        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
-        if test "$$first2" = "$$first"; then \
-          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
-        else \
-          dir2="../$$dir2"; \
-        fi; \
-        dir0="$$dir0"/"$$first"; \
-      fi; \
-    fi; \
-    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
-  done; \
-  reldir="$$dir2"
-ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
-AMTAR = @AMTAR@
-AR = @AR@
-AS = @AS@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-F77 = @F77@
-FC = @FC@
-FCFLAGS = @FCFLAGS@
-FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
-FGREP = @FGREP@
-GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-MOD_FLAG = @MOD_FLAG@
-NCDUMPDIR = @NCDUMPDIR@
-NETCDFDIR = @NETCDFDIR@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
-VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
-ac_ct_FC = @ac_ct_FC@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-SUBDIRS = mosaic
-all: all-recursive
-
-.SUFFIXES:
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-	        && { if test -f $@; then exit 0; else break; fi; }; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec/shared/Makefile'; \
-	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign gridspec/shared/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-
-# 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,
-# (1) if the variable is set in `config.status', edit `config.status'
-#     (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
-	dot_seen=no; \
-	target=`echo $@ | sed s/-recursive//`; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    dot_seen=yes; \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done; \
-	if test "$$dot_seen" = "no"; then \
-	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
-	fi; test -z "$$fail"
-
-$(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
-	dot_seen=no; \
-	case "$@" in \
-	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-	  *) list='$(SUBDIRS)' ;; \
-	esac; \
-	rev=''; for subdir in $$list; do \
-	  if test "$$subdir" = "."; then :; else \
-	    rev="$$subdir $$rev"; \
-	  fi; \
-	done; \
-	rev="$$rev ."; \
-	target=`echo $@ | sed s/-recursive//`; \
-	for subdir in $$rev; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done && test -z "$$fail"
-tags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
-	done
-ctags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
-	done
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	set x; \
-	here=`pwd`; \
-	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
-	  include_option=--etags-include; \
-	  empty_fix=.; \
-	else \
-	  include_option=--include; \
-	  empty_fix=; \
-	fi; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    test ! -f $$subdir/TAGS || \
-	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
-	  fi; \
-	done; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	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
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	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"
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d "$(distdir)/$$file"; then \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-	  else \
-	    test -f "$(distdir)/$$file" \
-	    || cp -p $$d/$$file "$(distdir)/$$file" \
-	    || exit 1; \
-	  fi; \
-	done
-	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	  fi; \
-	done
-	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
-	    $(am__relativize); \
-	    new_distdir=$$reldir; \
-	    dir1=$$subdir; dir2="$(top_distdir)"; \
-	    $(am__relativize); \
-	    new_top_distdir=$$reldir; \
-	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
-	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
-	    ($(am__cd) $$subdir && \
-	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$new_top_distdir" \
-	        distdir="$$new_distdir" \
-		am__remove_distdir=: \
-		am__skip_length_check=: \
-		am__skip_mode_fix=: \
-	        distdir) \
-	      || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-check: check-recursive
-all-am: Makefile
-installdirs: installdirs-recursive
-installdirs-am:
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-recursive
-install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-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)
-
-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
-
-distclean: distclean-recursive
-	-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-tags
-
-dvi: dvi-recursive
-
-dvi-am:
-
-html: html-recursive
-
-html-am:
-
-info: info-recursive
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-recursive
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-recursive
-
-install-html-am:
-
-install-info: install-info-recursive
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-recursive
-
-install-pdf-am:
-
-install-ps: install-ps-recursive
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-recursive
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-recursive
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-recursive
-
-pdf-am:
-
-ps: ps-recursive
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
-	install-am install-strip tags-recursive
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
-	all all-am check check-am clean clean-generic clean-libtool \
-	ctags ctags-recursive 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 pdf pdf-am ps ps-am tags tags-recursive \
-	uninstall uninstall-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.
-.NOEXPORT:
diff --git a/gridspec/shared/mosaic/Makefile.am b/gridspec/shared/mosaic/Makefile.am
deleted file mode 100644
index f8f0415..0000000
--- a/gridspec/shared/mosaic/Makefile.am
+++ /dev/null
@@ -1,71 +0,0 @@
-# This is an automake file, part of libcf, a NetCDF CF Library
-# package. Libcf is developed by Ed Hartnett at Unidata, copyright
-# 2009; GRIDSPEC code is developed by Zhi Liang, GFDL, copyright 2008.
-# See the COPYRIGHT file for more information.
-
-# This automake file is in charge of building the gridspec
-# tools/shared convenience library.
-
-# $Id: Makefile.am,v 1.3 2009/09/10 16:30:14 ed Exp $
-
-noinst_LTLIBRARIES = libshared.la 
-libshared_la_SOURCES = constant.h create_xgrid.c create_xgrid.h	\
-gradient_c2l.c gradient_c2l.h interp.c interp.h mosaic_util.c	\
-mosaic_util.h read_mosaic.c read_mosaic.h
-
-AM_CPPFLAGS = 
-AM_LDFLAGS =
-LDADD = -lm
-
-if USE_NETCDF_DIR
-AM_CPPFLAGS += -I at NETCDFDIR@/include
-AM_LDFLAGS += -L at NETCDFDIR@/lib
-LDADD += -lnetcdf
-else
-if USE_NETCDF4
-LDADD += ../../../../libsrc4/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc4
-AM_LDFLAGS += -L../../../../libsrc4
-else
-LDADD += ../../../../libsrc/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc
-AM_LDFLAGS += -L../../../../libsrc
-endif # USE_NETCDF4
-endif # USE_NETCDF_DIR
-
-if USE_NETCDF4
-LDADD += -lhdf5_hl -lhdf5 -lz 
-endif
-
-if USE_HDF4
-LDADD += -lmfhdf -ldf -ljpeg
-endif # USE_HDF4
-
-# If the user specified a root for HDF5, use it.
-if USE_HDF5_DIR
-AM_CPPFLAGS += -I at HDF5DIR@/include
-AM_LDFLAGS += -L at HDF5DIR@/lib
-endif
-
-# If the user specified a prefix for the HDF4 library location, use it.
-if USE_HDF4_DIR
-AM_CPPFLAGS += -I at HDF4DIR@/include
-AM_LDFLAGS += -L at HDF4DIR@/lib
-endif
-
-# If the user specified a root location for ZLIB, use it.
-if USE_ZLIB_DIR
-AM_CPPFLAGS += -I at ZLIBDIR@/include
-AM_LDFLAGS += -L at ZLIBDIR@/lib
-endif
-
-# If the user specified a root location for SZLIB, use it.
-if USE_SZLIB_DIR
-AM_CPPFLAGS += -I at SZLIBDIR@/include
-AM_LDFLAGS += -L at SZLIBDIR@/lib
-endif
-
-
-
-
-
diff --git a/gridspec/shared/mosaic/constant.h b/gridspec/shared/mosaic/constant.h
deleted file mode 100644
index 7a6b5b5..0000000
--- a/gridspec/shared/mosaic/constant.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef CONSTANT_H_
-#define CONSTANT_H_
-#define RADIUS        (6371000.)
-#define STRING        255
-#define STRING_NAME        "string"
-#define MOSAIC_NAME        "mosaic"
-#define NTILES_NAME        "ntiles"
-#define NMOSAIC_NAME       "nmosaic"
-#define NCONTACT_NAME      "ncontact"
-#define TILE_FILES_NAME    "tile_files"
-#define MOSAIC_FILES_NAME  "mosaic_files"
-#define CONTACT_FILES_NAME "contact_files"
-#define OVERLAP_FILES_NAME "overlap_files"
-#define TILE_NAME          "tile"
-#define NX_NAME            "nx"
-#define NY_NAME            "ny"
-#define NXP_NAME           "nxp"
-#define NYP_NAME           "nyp"
-#define X_NAME             "x"
-#define Y_NAME             "y"
-#define DX_NAME            "dx"
-#define DY_NAME            "dy"
-#define ANGLE_DX_NAME      "angle_dx"
-#define ANGLE_DY_NAME      "angle_dy"
-#define ARCX_NAME          "arcx"
-#define DEPTH_NAME         "depth"
-#define MASK_NAME          "area_frac"
-#define NZV_NAME           "nzv"
-#define ZETA_NAME          "zeta"
-#define GRID_VERSION_NAME  "grid_version"
-#define CODE_VERSION_NAME  "code_version"
-#define HISTORY_NAME       "history"
-#define CONFORMAL_NAME     "isConformal"
-#define REGULAR_NAME       "isRegular"
-#define DISCRETIZATION_NAME "discretizationType"
-#define GEOMETRY_NAME       "geometryType"
-#define CONGRUCENCE_NAME    "congruentTiles"
-#endif
diff --git a/gridspec/shared/mosaic/create_xgrid.c b/gridspec/shared/mosaic/create_xgrid.c
deleted file mode 100644
index 9f0c409..0000000
--- a/gridspec/shared/mosaic/create_xgrid.c
+++ /dev/null
@@ -1,1106 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include "mosaic_util.h"
-#include "create_xgrid.h"
-#include "constant.h"
-
-#define AREA_RATIO_THRESH (1.e-6)  
-#define MASK_THRESH       (0.5)
-#define EPSLN             (1.0e-30)
-double grid_box_radius(const double *x, const double *y, const double *z, int n);
-double dist_between_boxes(const double *x1, const double *y1, const double *z1, int n1,
-			  const double *x2, const double *y2, const double *z2, int n2);
-int inside_edge(double x0, double y0, double x1, double y1, double x, double y);
-/*******************************************************************************
-  int get_maxxgrid
-  return constants MAXXGRID.
-*******************************************************************************/
-int get_maxxgrid(void)  
-{
-  return MAXXGRID;
-}
-
-int get_maxxgrid_(void)
-{
-  return get_maxxgrid();
-}
-
-/*******************************************************************************
-void get_grid_area(const int *nlon, const int *nlat, const double *lon, const double *lat, const double *area)
-  return the grid area.
-*******************************************************************************/
-void get_grid_area_(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area)
-{
-  get_grid_area(nlon, nlat, lon, lat, area);
-}
-
-void get_grid_area(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area)
-{
-  int nx, ny, nxp, i, j, n_in;
-  double x_in[20], y_in[20];
-  
-  nx = *nlon;
-  ny = *nlat;
-  nxp = nx + 1;
-
-  for(j=0; j<ny; j++) for(i=0; i < nx; i++) {
-    x_in[0] = lon[j*nxp+i];
-    x_in[1] = lon[j*nxp+i+1];
-    x_in[2] = lon[(j+1)*nxp+i+1];
-    x_in[3] = lon[(j+1)*nxp+i];
-    y_in[0] = lat[j*nxp+i];
-    y_in[1] = lat[j*nxp+i+1];
-    y_in[2] = lat[(j+1)*nxp+i+1];
-    y_in[3] = lat[(j+1)*nxp+i];
-    n_in = fix_lon(x_in, y_in, 4, M_PI);    
-    area[j*nx+i] = poly_area(x_in, y_in, n_in);
-  }
-
-};  /* get_grid_area */
-
-
-void get_grid_area_no_adjust(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area)
-{
-  int nx, ny, nxp, i, j, n_in;
-  double x_in[20], y_in[20];
-  
-  nx = *nlon;
-  ny = *nlat;
-  nxp = nx + 1;
-
-  for(j=0; j<ny; j++) for(i=0; i < nx; i++) {
-    x_in[0] = lon[j*nxp+i];
-    x_in[1] = lon[j*nxp+i+1];
-    x_in[2] = lon[(j+1)*nxp+i+1];
-    x_in[3] = lon[(j+1)*nxp+i];
-    y_in[0] = lat[j*nxp+i];
-    y_in[1] = lat[j*nxp+i+1];
-    y_in[2] = lat[(j+1)*nxp+i+1];
-    y_in[3] = lat[(j+1)*nxp+i];
-    n_in = 4;
-    area[j*nx+i] = poly_area_no_adjust(x_in, y_in, n_in);
-  }
-
-};  /* get_grid_area_no_adjust */
-
-/*******************************************************************************
-  void create_xgrid_1dx2d_order1
-  This routine generate exchange grids between two grids for the first order
-  conservative interpolation. nlon_in,nlat_in,nlon_out,nlat_out are the size of the grid cell
-  and lon_in,lat_in are 1-D grid bounds, lon_out,lat_out are geographic grid location of grid cell bounds. 
-*******************************************************************************/
-int create_xgrid_1dx2d_order1_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
-			       const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
-			       const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out, double *xgrid_area)
-{
-  int nxgrid;
-  
-  nxgrid = create_xgrid_1dx2d_order1(nlon_in, nlat_in, nlon_out, nlat_out, lon_in, lat_in, lon_out, lat_out, mask_in,
-			       i_in, j_in, i_out, j_out, xgrid_area);
-  return nxgrid;
-    
-};  
-
-int create_xgrid_1dx2d_order1(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in,
-			      const double *lat_in, const double *lon_out, const double *lat_out,
-			      const double *mask_in, int *i_in, int *j_in, int *i_out,
-			      int *j_out, double *xgrid_area)
-{
-
-  int nx1, ny1, nx2, ny2, nx1p, nx2p;
-  int i1, j1, i2, j2, nxgrid;
-  double ll_lon, ll_lat, ur_lon, ur_lat, x_in[MV], y_in[MV], x_out[MV], y_out[MV];
-  double *area_in, *area_out, min_area;
-  double *tmpx, *tmpy;
-  
-  nx1 = *nlon_in;
-  ny1 = *nlat_in;
-  nx2 = *nlon_out;
-  ny2 = *nlat_out;
-
-  nxgrid = 0;
-  nx1p = nx1 + 1;
-  nx2p = nx2 + 1;
-
-  area_in = (double *)malloc(nx1*ny1*sizeof(double));
-  area_out = (double *)malloc(nx2*ny2*sizeof(double));
-  tmpx = (double *)malloc((nx1+1)*(ny1+1)*sizeof(double));
-  tmpy = (double *)malloc((nx1+1)*(ny1+1)*sizeof(double));
-  for(j1=0; j1<=ny1; j1++) for(i1=0; i1<=nx1; i1++) {
-    tmpx[j1*nx1p+i1] = lon_in[i1];
-    tmpy[j1*nx1p+i1] = lat_in[j1];
-  }
-  /* This is just a temporary fix to solve the issue that there is one point in zonal direction */
-  if(nx1 > 1)
-     get_grid_area(nlon_in, nlat_in, tmpx, tmpy, area_in);
-  else
-    get_grid_area_no_adjust(nlon_in, nlat_in, tmpx, tmpy, area_in);
-  
-  get_grid_area(nlon_out, nlat_out, lon_out, lat_out, area_out);  
-  free(tmpx);
-  free(tmpy);  
-
-  for(j1=0; j1<ny1; j1++) for(i1=0; i1<nx1; i1++) if( mask_in[j1*nx1+i1] > MASK_THRESH ) {
-
-    ll_lon = lon_in[i1];   ll_lat = lat_in[j1];
-    ur_lon = lon_in[i1+1]; ur_lat = lat_in[j1+1];
-    for(j2=0; j2<ny2; j2++) for(i2=0; i2<nx2; i2++) {
-      int n_in, n_out;
-      double Xarea;
-      
-      y_in[0] = lat_out[j2*nx2p+i2];
-      y_in[1] = lat_out[j2*nx2p+i2+1];
-      y_in[2] = lat_out[(j2+1)*nx2p+i2+1];
-      y_in[3] = lat_out[(j2+1)*nx2p+i2];
-      if (  (y_in[0]<=ll_lat) && (y_in[1]<=ll_lat)
-	    && (y_in[2]<=ll_lat) && (y_in[3]<=ll_lat) ) continue;
-      if (  (y_in[0]>=ur_lat) && (y_in[1]>=ur_lat)
-	    && (y_in[2]>=ur_lat) && (y_in[3]>=ur_lat) ) continue;
-
-      x_in[0] = lon_out[j2*nx2p+i2];
-      x_in[1] = lon_out[j2*nx2p+i2+1];
-      x_in[2] = lon_out[(j2+1)*nx2p+i2+1];
-      x_in[3] = lon_out[(j2+1)*nx2p+i2];
-      n_in = fix_lon(x_in, y_in, 4, (ll_lon+ur_lon)/2);
-      
-      if ( (n_out = clip ( x_in, y_in, n_in, ll_lon, ll_lat, ur_lon, ur_lat, x_out, y_out )) > 0 ) {
-	Xarea = poly_area (x_out, y_out, n_out ) * mask_in[j1*nx1+i1];
-	min_area = min(area_in[j1*nx1+i1], area_out[j2*nx2+i2]);
-	if( Xarea/min_area > AREA_RATIO_THRESH ) {
-      	  xgrid_area[nxgrid] = Xarea;
-	  i_in[nxgrid]    = i1;
-	  j_in[nxgrid]    = j1;
-	  i_out[nxgrid]   = i2;
-	  j_out[nxgrid]   = j2;
-	  ++nxgrid;
-	  if(nxgrid > MAXXGRID) error_handler("nxgrid is greater than MAXXGRID, increase MAXXGRID");
-	}
-      }
-    }
-  }
-
-  free(area_in);
-  free(area_out);
-  
-  return nxgrid;
-  
-}; /* create_xgrid_1dx2d_order1 */
-
-
-/********************************************************************************
-  void create_xgrid_1dx2d_order2
-  This routine generate exchange grids between two grids for the second order
-  conservative interpolation. nlon_in,nlat_in,nlon_out,nlat_out are the size of the grid cell
-  and lon_in,lat_in are 1-D grid bounds, lon_out,lat_out are geographic grid location of grid cell bounds.
-********************************************************************************/
-int create_xgrid_1dx2d_order2_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
-			       const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
-			       const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
-			       double *xgrid_area, double *xgrid_clon, double *xgrid_clat)
-{
-  int nxgrid;
-  nxgrid = create_xgrid_1dx2d_order2(nlon_in, nlat_in, nlon_out, nlat_out, lon_in, lat_in, lon_out, lat_out, mask_in, i_in,
-                                     j_in, i_out, j_out, xgrid_area, xgrid_clon, xgrid_clat);
-  return nxgrid;
-
-};
-int create_xgrid_1dx2d_order2(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
-			      const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
-			      const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
-			      double *xgrid_area, double *xgrid_clon, double *xgrid_clat)
-{
-
-  int nx1, ny1, nx2, ny2, nx1p, nx2p;
-  int i1, j1, i2, j2, nxgrid, n;
-  double ll_lon, ll_lat, ur_lon, ur_lat, x_in[MV], y_in[MV], x_out[MV], y_out[MV];
-  double *area_in, *area_out, min_area;
-  double *tmpx, *tmpy;
-  
-  nx1 = *nlon_in;
-  ny1 = *nlat_in;
-  nx2 = *nlon_out;
-  ny2 = *nlat_out;
-
-  nxgrid = 0;
-  nx1p = nx1 + 1;
-  nx2p = nx2 + 1;
-
-  area_in      = (double *)malloc(nx1*ny1*sizeof(double));
-  area_out     = (double *)malloc(nx2*ny2*sizeof(double));
-  tmpx = (double *)malloc((nx1+1)*(ny1+1)*sizeof(double));
-  tmpy = (double *)malloc((nx1+1)*(ny1+1)*sizeof(double));
-  for(j1=0; j1<=ny1; j1++) for(i1=0; i1<=nx1; i1++) {
-    tmpx[j1*nx1p+i1] = lon_in[i1];
-    tmpy[j1*nx1p+i1] = lat_in[j1];
-  }
-  get_grid_area(nlon_in, nlat_in, tmpx, tmpy, area_in);     
-  get_grid_area(nlon_out, nlat_out, lon_out, lat_out, area_out);  
-  free(tmpx);
-  free(tmpy);    
-  
-  for(j1=0; j1<ny1; j1++) for(i1=0; i1<nx1; i1++) if( mask_in[j1*nx1+i1] > MASK_THRESH ) {
-
-    ll_lon = lon_in[i1];   ll_lat = lat_in[j1];
-    ur_lon = lon_in[i1+1]; ur_lat = lat_in[j1+1];
-    for(j2=0; j2<ny2; j2++) for(i2=0; i2<nx2; i2++) {
-      int n_in, n_out;
-      double xarea, lon_in_avg;
-      
-      y_in[0] = lat_out[j2*nx2p+i2];
-      y_in[1] = lat_out[j2*nx2p+i2+1];
-      y_in[2] = lat_out[(j2+1)*nx2p+i2+1];
-      y_in[3] = lat_out[(j2+1)*nx2p+i2];
-      if (  (y_in[0]<=ll_lat) && (y_in[1]<=ll_lat)
-	    && (y_in[2]<=ll_lat) && (y_in[3]<=ll_lat) ) continue;
-      if (  (y_in[0]>=ur_lat) && (y_in[1]>=ur_lat)
-	    && (y_in[2]>=ur_lat) && (y_in[3]>=ur_lat) ) continue;
-
-      x_in[0] = lon_out[j2*nx2p+i2];
-      x_in[1] = lon_out[j2*nx2p+i2+1];
-      x_in[2] = lon_out[(j2+1)*nx2p+i2+1];
-      x_in[3] = lon_out[(j2+1)*nx2p+i2];
-      n_in = fix_lon(x_in, y_in, 4, (ll_lon+ur_lon)/2);
-      lon_in_avg = avgval_double(n_in, x_in);
-      
-      if (  (n_out = clip ( x_in, y_in, n_in, ll_lon, ll_lat, ur_lon, ur_lat, x_out, y_out )) > 0 ) {
-	xarea = poly_area (x_out, y_out, n_out ) * mask_in[j1*nx1+i1];	
-        min_area = min(area_in[j1*nx1+i1], area_out[j2*nx2+i2]);
-	if(xarea/min_area > AREA_RATIO_THRESH ) {	  
-	  xgrid_area[nxgrid] = xarea;
-	  xgrid_clon[nxgrid] = poly_ctrlon(x_out, y_out, n_out, lon_in_avg);
-	  xgrid_clat[nxgrid] = poly_ctrlat (x_out, y_out, n_out );
-	  i_in[nxgrid]    = i1;
-	  j_in[nxgrid]    = j1;
-	  i_out[nxgrid]   = i2;
-	  j_out[nxgrid]   = j2;
-	  ++nxgrid;
-	  if(nxgrid > MAXXGRID) error_handler("nxgrid is greater than MAXXGRID, increase MAXXGRID");
-	}
-      }
-    }
-  }
-  free(area_in);
-  free(area_out);
-  
-  return nxgrid;
-  
-}; /* create_xgrid_1dx2d_order2 */
-
-/*******************************************************************************
-  void create_xgrid_2dx1d_order1
-  This routine generate exchange grids between two grids for the first order
-  conservative interpolation. nlon_in,nlat_in,nlon_out,nlat_out are the size of the grid cell
-  and lon_out,lat_out are 1-D grid bounds, lon_in,lat_in are geographic grid location of grid cell bounds.
-  mask is on grid lon_in/lat_in. 
-*******************************************************************************/
-int create_xgrid_2dx1d_order1_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
-			       const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
-			       const double *mask_in, int *i_in, int *j_in, int *i_out,
-			       int *j_out, double *xgrid_area)
-{
-  int nxgrid;
-  
-  nxgrid = create_xgrid_2dx1d_order1(nlon_in, nlat_in, nlon_out, nlat_out, lon_in, lat_in, lon_out, lat_out, mask_in,
-			       i_in, j_in, i_out, j_out, xgrid_area);
-  return nxgrid;
-    
-};  
-int create_xgrid_2dx1d_order1(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in,
-			      const double *lat_in, const double *lon_out, const double *lat_out,
-			      const double *mask_in, int *i_in, int *j_in, int *i_out,
-			      int *j_out, double *xgrid_area)
-{
-
-  int nx1, ny1, nx2, ny2, nx1p, nx2p;
-  int i1, j1, i2, j2, nxgrid;
-  double ll_lon, ll_lat, ur_lon, ur_lat, x_in[MV], y_in[MV], x_out[MV], y_out[MV];
-  double *area_in, *area_out, min_area;
-  double *tmpx, *tmpy;
-  
-  nx1 = *nlon_in;
-  ny1 = *nlat_in;
-  nx2 = *nlon_out;
-  ny2 = *nlat_out;
-
-  nxgrid = 0;
-  nx1p = nx1 + 1;
-  nx2p = nx2 + 1;
-  area_in = (double *)malloc(nx1*ny1*sizeof(double));
-  area_out = (double *)malloc(nx2*ny2*sizeof(double));
-  tmpx = (double *)malloc((nx2+1)*(ny2+1)*sizeof(double));
-  tmpy = (double *)malloc((nx2+1)*(ny2+1)*sizeof(double));
-  for(j2=0; j2<=ny2; j2++) for(i2=0; i2<=nx2; i2++) {
-    tmpx[j2*nx2p+i2] = lon_out[i2];
-    tmpy[j2*nx2p+i2] = lat_out[j2];
-  }
-  get_grid_area(nlon_in, nlat_in, lon_in, lat_in, area_in);     
-  get_grid_area(nlon_out, nlat_out, tmpx, tmpy, area_out);  
-
-  free(tmpx);
-  free(tmpy);
-  
-  for(j2=0; j2<ny2; j2++) for(i2=0; i2<nx2; i2++) {
-
-    ll_lon = lon_out[i2];   ll_lat = lat_out[j2];
-    ur_lon = lon_out[i2+1]; ur_lat = lat_out[j2+1];
-    for(j1=0; j1<ny1; j1++) for(i1=0; i1<nx1; i1++) if( mask_in[j1*nx1+i1] > MASK_THRESH ) {
-      int n_in, n_out;
-      double Xarea;
-      
-      y_in[0] = lat_in[j1*nx1p+i1];
-      y_in[1] = lat_in[j1*nx1p+i1+1];
-      y_in[2] = lat_in[(j1+1)*nx1p+i1+1];
-      y_in[3] = lat_in[(j1+1)*nx1p+i1];
-      if (  (y_in[0]<=ll_lat) && (y_in[1]<=ll_lat)
-	    && (y_in[2]<=ll_lat) && (y_in[3]<=ll_lat) ) continue;
-      if (  (y_in[0]>=ur_lat) && (y_in[1]>=ur_lat)
-	    && (y_in[2]>=ur_lat) && (y_in[3]>=ur_lat) ) continue;
-
-      x_in[0] = lon_in[j1*nx1p+i1];
-      x_in[1] = lon_in[j1*nx1p+i1+1];
-      x_in[2] = lon_in[(j1+1)*nx1p+i1+1];
-      x_in[3] = lon_in[(j1+1)*nx1p+i1];
-
-      n_in = fix_lon(x_in, y_in, 4, (ll_lon+ur_lon)/2);
-      
-      if ( (n_out = clip ( x_in, y_in, n_in, ll_lon, ll_lat, ur_lon, ur_lat, x_out, y_out )) > 0 ) {
-	Xarea = poly_area ( x_out, y_out, n_out ) * mask_in[j1*nx1+i1];
-	min_area = min(area_in[j1*nx1+i1], area_out[j2*nx2+i2]);
-	if( Xarea/min_area > AREA_RATIO_THRESH ) {
-      	  xgrid_area[nxgrid] = Xarea;
-	  i_in[nxgrid]    = i1;
-	  j_in[nxgrid]    = j1;
-	  i_out[nxgrid]   = i2;
-	  j_out[nxgrid]   = j2;
-	  ++nxgrid;
-	  if(nxgrid > MAXXGRID) error_handler("nxgrid is greater than MAXXGRID, increase MAXXGRID");
-	}
-      }
-    }
-  }
-
-  free(area_in);
-  free(area_out);
-  
-  return nxgrid;
-  
-}; /* create_xgrid_2dx1d_order1 */
-
-
-/********************************************************************************
-  void create_xgrid_2dx1d_order2
-  This routine generate exchange grids between two grids for the second order
-  conservative interpolation. nlon_in,nlat_in,nlon_out,nlat_out are the size of the grid cell
-  and lon_out,lat_out are 1-D grid bounds, lon_in,lat_in are geographic grid location of grid cell bounds.
-  mask is on grid lon_in/lat_in. 
-********************************************************************************/
-int create_xgrid_2dx1d_order2_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
-			       const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
-			       const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
-			       double *xgrid_area, double *xgrid_clon, double *xgrid_clat)
-{
-  int nxgrid;
-  nxgrid = create_xgrid_2dx1d_order2(nlon_in, nlat_in, nlon_out, nlat_out, lon_in, lat_in, lon_out, lat_out, mask_in, i_in,
-                                     j_in, i_out, j_out, xgrid_area, xgrid_clon, xgrid_clat);
-  return nxgrid;
-
-};
-
-int create_xgrid_2dx1d_order2(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
-			      const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
-			      const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
-			      double *xgrid_area, double *xgrid_clon, double *xgrid_clat)
-{
-
-  int nx1, ny1, nx2, ny2, nx1p, nx2p;
-  int i1, j1, i2, j2, nxgrid, n;
-  double ll_lon, ll_lat, ur_lon, ur_lat, x_in[MV], y_in[MV], x_out[MV], y_out[MV];
-  double *tmpx, *tmpy;
-  double *area_in, *area_out, min_area;
-  double  lon_in_avg;
-  
-  nx1 = *nlon_in;
-  ny1 = *nlat_in;
-  nx2 = *nlon_out;
-  ny2 = *nlat_out;
-
-  nxgrid = 0;
-  nx1p = nx1 + 1;
-  nx2p = nx2 + 1;
-
-  area_in      = (double *)malloc(nx1*ny1*sizeof(double));
-  area_out     = (double *)malloc(nx2*ny2*sizeof(double));
-  tmpx = (double *)malloc((nx2+1)*(ny2+1)*sizeof(double));
-  tmpy = (double *)malloc((nx2+1)*(ny2+1)*sizeof(double));
-  for(j2=0; j2<=ny2; j2++) for(i2=0; i2<=nx2; i2++) {
-    tmpx[j2*nx2p+i2] = lon_out[i2];
-    tmpy[j2*nx2p+i2] = lat_out[j2];
-  }
-  get_grid_area(nlon_in, nlat_in, lon_in, lat_in, area_in);     
-  get_grid_area(nlon_out, nlat_out, tmpx, tmpy, area_out);  
-
-  free(tmpx);
-  free(tmpy);  
-  
-  for(j2=0; j2<ny2; j2++) for(i2=0; i2<nx2; i2++) {
-
-    ll_lon = lon_out[i2];   ll_lat = lat_out[j2];
-    ur_lon = lon_out[i2+1]; ur_lat = lat_out[j2+1];
-    for(j1=0; j1<ny1; j1++) for(i1=0; i1<nx1; i1++) if( mask_in[j1*nx1+i1] > MASK_THRESH ) {
-      int n_in, n_out;
-      double xarea;
-      
-      y_in[0] = lat_in[j1*nx1p+i1];
-      y_in[1] = lat_in[j1*nx1p+i1+1];
-      y_in[2] = lat_in[(j1+1)*nx1p+i1+1];
-      y_in[3] = lat_in[(j1+1)*nx1p+i1];
-      if (  (y_in[0]<=ll_lat) && (y_in[1]<=ll_lat)
-	    && (y_in[2]<=ll_lat) && (y_in[3]<=ll_lat) ) continue;
-      if (  (y_in[0]>=ur_lat) && (y_in[1]>=ur_lat)
-	    && (y_in[2]>=ur_lat) && (y_in[3]>=ur_lat) ) continue;
-
-      x_in[0] = lon_in[j1*nx1p+i1];
-      x_in[1] = lon_in[j1*nx1p+i1+1];
-      x_in[2] = lon_in[(j1+1)*nx1p+i1+1];
-      x_in[3] = lon_in[(j1+1)*nx1p+i1];
-
-      n_in = fix_lon(x_in, y_in, 4, (ll_lon+ur_lon)/2);
-      lon_in_avg = avgval_double(n_in, x_in);
-      
-      if (  (n_out = clip ( x_in, y_in, n_in, ll_lon, ll_lat, ur_lon, ur_lat, x_out, y_out )) > 0 ) {
-	xarea = poly_area (x_out, y_out, n_out ) * mask_in[j1*nx1+i1];	
-	min_area = min(area_in[j1*nx1+i1], area_out[j2*nx2+i2]);
-	if(xarea/min_area > AREA_RATIO_THRESH ) {	  
-	  xgrid_area[nxgrid] = xarea;
-	  xgrid_clon[nxgrid] = poly_ctrlon(x_out, y_out, n_out, lon_in_avg);
-	  xgrid_clat[nxgrid] = poly_ctrlat (x_out, y_out, n_out );
-	  i_in[nxgrid]  = i1;
-	  j_in[nxgrid]  = j1;
-	  i_out[nxgrid] = i2;
-	  j_out[nxgrid] = j2;
-	  ++nxgrid;
-	  if(nxgrid > MAXXGRID) error_handler("nxgrid is greater than MAXXGRID, increase MAXXGRID");
-	}
-      }
-    }
-  }
-
-  free(area_in);
-  free(area_out);  
-  
-  return nxgrid;
-  
-}; /* create_xgrid_2dx1d_order2 */
-
-/*******************************************************************************
-  void create_xgrid_2DX2D_order1
-  This routine generate exchange grids between two grids for the first order
-  conservative interpolation. nlon_in,nlat_in,nlon_out,nlat_out are the size of the grid cell
-  and lon_in,lat_in, lon_out,lat_out are geographic grid location of grid cell bounds.
-  mask is on grid lon_in/lat_in.
-*******************************************************************************/
-#ifndef __AIX
-int create_xgrid_2dx2d_order1_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
-			       const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
-			       const double *mask_in, int *i_in, int *j_in, int *i_out,
-			       int *j_out, double *xgrid_area)
-{
-  int nxgrid;
-  
-  nxgrid = create_xgrid_2dx2d_order1(nlon_in, nlat_in, nlon_out, nlat_out, lon_in, lat_in, lon_out, lat_out, mask_in,
-			       i_in, j_in, i_out, j_out, xgrid_area);
-  return nxgrid;
-    
-};  
-#endif
-int create_xgrid_2dx2d_order1(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
-			      const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
-			      const double *mask_in, int *i_in, int *j_in, int *i_out,
-			      int *j_out, double *xgrid_area)
-{
-
-  int nx1, ny1, nx2, ny2, nx1p, nx2p, ny1p, ny2p, nxgrid, n1_in, n2_in;
-  int n0, n1, n2, n3, i1, j1, i2, j2, l;
-  double x1_in[MV], y1_in[MV], x2_in[MV], y2_in[MV], x_out[MV], y_out[MV];
-  double lon_in_min, lon_out_min, lon_in_max, lon_out_max, lat_in_min, lat_in_max, lat_out_min, lat_out_max;
-  double lon_in_avg;
-  double *area_in, *area_out, min_area;  
-
-  nx1 = *nlon_in;
-  ny1 = *nlat_in;
-  nx2 = *nlon_out;
-  ny2 = *nlat_out;
-
-  nxgrid = 0;
-  nx1p = nx1 + 1;
-  nx2p = nx2 + 1;
-
-  area_in = (double *)malloc(nx1*ny1*sizeof(double));
-  area_out = (double *)malloc(nx2*ny2*sizeof(double));
-  get_grid_area(nlon_in, nlat_in, lon_in, lat_in, area_in);     
-  get_grid_area(nlon_out, nlat_out, lon_out, lat_out, area_out);  
-
-  for(j1=0; j1<ny1; j1++) for(i1=0; i1<nx1; i1++) if( mask_in[j1*nx1+i1] > MASK_THRESH ) {
-    n0 = j1*nx1p+i1;       n1 = j1*nx1p+i1+1;
-    n2 = (j1+1)*nx1p+i1+1; n3 = (j1+1)*nx1p+i1;      
-    x1_in[0] = lon_in[n0]; y1_in[0] = lat_in[n0];
-    x1_in[1] = lon_in[n1]; y1_in[1] = lat_in[n1];
-    x1_in[2] = lon_in[n2]; y1_in[2] = lat_in[n2];
-    x1_in[3] = lon_in[n3]; y1_in[3] = lat_in[n3];
-    lat_in_min = minval_double(4, y1_in);
-    lat_in_max = maxval_double(4, y1_in);
-    n1_in = fix_lon(x1_in, y1_in, 4, M_PI);
-    lon_in_min = minval_double(n1_in, x1_in);
-    lon_in_max = maxval_double(n1_in, x1_in);
-    lon_in_avg = avgval_double(n1_in, x1_in);
-      
-    for(j2=0; j2<ny2; j2++) for(i2=0; i2<nx2; i2++) {
-      int n_in, n_out;
-      double Xarea;
-      n0 = j2*nx2p+i2; n1 = j2*nx2p+i2+1;
-      n2 = (j2+1)*nx2p+i2+1; n3 = (j2+1)*nx2p+i2;
-      x2_in[0] = lon_out[n0]; y2_in[0] = lat_out[n0];
-      x2_in[1] = lon_out[n1]; y2_in[1] = lat_out[n1];
-      x2_in[2] = lon_out[n2]; y2_in[2] = lat_out[n2];
-      x2_in[3] = lon_out[n3]; y2_in[3] = lat_out[n3];
-
-      lat_out_min = minval_double(4, y2_in);
-      lat_out_max = maxval_double(4, y2_in);
-      if(lat_out_min >= lat_in_max || lat_out_max <= lat_in_min ) continue;
-      n2_in = fix_lon(x2_in, y2_in, 4, lon_in_avg);
-      lon_out_min = minval_double(n2_in, x2_in);
-      lon_out_max = maxval_double(n2_in, x2_in);    
-      
-      /* x2_in should in the same range as lon_in_in after lon_fix, so no need to
-	 consider cyclic condition
-      */
-      if(lon_out_min >= lon_in_max || lon_out_max <= lon_in_min ) continue;
-
-      if ( (n_out = clip_2dx2d ( x1_in, y1_in, n1_in, x2_in, y2_in, n2_in, x_out, y_out )) > 0) {
-	Xarea = poly_area (x_out, y_out, n_out) * mask_in[j1*nx1+i1];
-	min_area = min(area_in[j1*nx1+i1], area_out[j2*nx2+i2]);
-	if( Xarea/min_area > AREA_RATIO_THRESH ) {
-	  xgrid_area[nxgrid] = Xarea;
-	  i_in[nxgrid]    = i1;
-	  j_in[nxgrid]    = j1;
-	  i_out[nxgrid]   = i2;
-	  j_out[nxgrid]   = j2;
-	  ++nxgrid;
-	  if(nxgrid > MAXXGRID) error_handler("nxgrid is greater than MAXXGRID, increase MAXXGRID");
-	}
-      }
-    }
-  }
-
-  free(area_in);
-  free(area_out);
-  return nxgrid;
-  
-};/* get_xgrid_2Dx2D_order1 */
-
-/********************************************************************************
-  void create_xgrid_2dx1d_order2
-  This routine generate exchange grids between two grids for the second order
-  conservative interpolation. nlon_in,nlat_in,nlon_out,nlat_out are the size of the grid cell
-  and lon_in,lat_in, lon_out,lat_out are geographic grid location of grid cell bounds.
-  mask is on grid lon_in/lat_in. 
-********************************************************************************/
-#ifndef __AIX
-int create_xgrid_2dx2d_order2_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
-			       const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
-			       const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
-			       double *xgrid_area, double *xgrid_clon, double *xgrid_clat)
-{
-  int nxgrid;
-  nxgrid = create_xgrid_2dx2d_order2(nlon_in, nlat_in, nlon_out, nlat_out, lon_in, lat_in, lon_out, lat_out, mask_in, i_in,
-                                     j_in, i_out, j_out, xgrid_area, xgrid_clon, xgrid_clat);
-  return nxgrid;
-
-};
-#endif
-int create_xgrid_2dx2d_order2(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
-			      const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
-			      const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
-			      double *xgrid_area, double *xgrid_clon, double *xgrid_clat)
-{
-
-  int nx1, nx2, ny1, ny2, nx1p, nx2p, ny1p, ny2p, nxgrid, n1_in, n2_in;
-  int n0, n1, n2, n3, i1, j1, i2, j2, l, n;
-  double x1_in[MV], y1_in[MV], x2_in[MV], y2_in[MV], x_out[MV], y_out[MV];
-  double lon_in_min, lon_out_min, lon_in_max, lon_out_max, lat_in_min, lat_in_max, lat_out_min, lat_out_max;
-  double lon_in_avg, xctrlon, xctrlat;
-  double *area_in, *area_out, min_area;
-  
-  nx1 = *nlon_in;
-  ny1 = *nlat_in;
-  nx2 = *nlon_out;
-  ny2 = *nlat_out;  
-  nxgrid = 0;
-  nx1p = nx1 + 1;
-  nx2p = nx2 + 1;
-  ny1p = ny1 + 1;
-  ny2p = ny2 + 1;
-
-  area_in  = (double *)malloc(nx1*ny1*sizeof(double));
-  area_out = (double *)malloc(nx2*ny2*sizeof(double));
-  get_grid_area(nlon_in, nlat_in, lon_in, lat_in, area_in);     
-  get_grid_area(nlon_out, nlat_out, lon_out, lat_out, area_out);
-  
-  for(j1=0; j1<ny1; j1++) for(i1=0; i1<nx1; i1++) if( mask_in[j1*nx1+i1] > MASK_THRESH ) {
-    n0 = j1*nx1p+i1;       n1 = j1*nx1p+i1+1;
-    n2 = (j1+1)*nx1p+i1+1; n3 = (j1+1)*nx1p+i1;      
-    x1_in[0] = lon_in[n0]; y1_in[0] = lat_in[n0];
-    x1_in[1] = lon_in[n1]; y1_in[1] = lat_in[n1];
-    x1_in[2] = lon_in[n2]; y1_in[2] = lat_in[n2];
-    x1_in[3] = lon_in[n3]; y1_in[3] = lat_in[n3];
-    lat_in_min = minval_double(4, y1_in);
-    lat_in_max = maxval_double(4, y1_in);
-    n1_in = fix_lon(x1_in, y1_in, 4, M_PI);
-    lon_in_min = minval_double(n1_in, x1_in);
-    lon_in_max = maxval_double(n1_in, x1_in);
-    lon_in_avg = avgval_double(n1_in, x1_in);
-      
-    for(j2=0; j2<ny2; j2++) for(i2=0; i2<nx2; i2++) {
-      int n_in, n_out;
-      double xarea;
-      n0 = j2*nx2p+i2; n1 = j2*nx2p+i2+1;
-      n2 = (j2+1)*nx2p+i2+1; n3 = (j2+1)*nx2p+i2;
-      x2_in[0] = lon_out[n0]; y2_in[0] = lat_out[n0];
-      x2_in[1] = lon_out[n1]; y2_in[1] = lat_out[n1];
-      x2_in[2] = lon_out[n2]; y2_in[2] = lat_out[n2];
-      x2_in[3] = lon_out[n3]; y2_in[3] = lat_out[n3];
-
-      lat_out_min = minval_double(4, y2_in);
-      lat_out_max = maxval_double(4, y2_in);
-      if(lat_out_min >= lat_in_max || lat_out_max <= lat_in_min ) continue;
-      n2_in = fix_lon(x2_in, y2_in, 4, lon_in_avg);
-      lon_out_min = minval_double(n2_in, x2_in);
-      lon_out_max = maxval_double(n2_in, x2_in);    
-
-      /* x2_in should in the same range as x1_in after lon_fix, so no need to
-	 consider cyclic condition
-      */
-      if(lon_out_min >= lon_in_max || lon_out_max <= lon_in_min ) continue;
-
-      if (  (n_out = clip_2dx2d( x1_in, y1_in, n1_in, x2_in, y2_in, n2_in, x_out, y_out )) > 0) {
-	xarea = poly_area (x_out, y_out, n_out ) * mask_in[j1*nx1+i1];	
-	min_area = min(area_in[j1*nx1+i1], area_out[j2*nx2+i2]);
-	if( xarea/min_area > AREA_RATIO_THRESH ) {
-	  xgrid_area[nxgrid] = xarea;
-	  xgrid_clon[nxgrid] = poly_ctrlon(x_out, y_out, n_out, lon_in_avg);
-	  xgrid_clat[nxgrid] = poly_ctrlat (x_out, y_out, n_out );
-	  i_in[nxgrid]       = i1;
-	  j_in[nxgrid]       = j1;
-	  i_out[nxgrid]      = i2;
-	  j_out[nxgrid]      = j2;
-	  ++nxgrid;
-	  if(nxgrid > MAXXGRID) error_handler("nxgrid is greater than MAXXGRID, increase MAXXGRID");
-	}
-      }
-    }
-  }
-
-  free(area_in);
-  free(area_out);  
-  
-  return nxgrid;
-  
-};/* get_xgrid_2Dx2D_order2 */
-
-/*******************************************************************************
-   Sutherland-Hodgeman algorithm sequentially clips parts outside 4 boundaries
-*******************************************************************************/
-
-int clip(const double lon_in[], const double lat_in[], int n_in, double ll_lon, double ll_lat,
-	 double ur_lon, double ur_lat, double lon_out[], double lat_out[])
-{
-  double x_tmp[MV], y_tmp[MV], x_last, y_last;
-  int i_in, i_out, n_out, inside_last, inside;
-
-  /* clip polygon with LEFT boundary - clip V_IN to V_TMP */
-  x_last = lon_in[n_in-1];
-  y_last = lat_in[n_in-1];
-  inside_last = (x_last >= ll_lon);
-  for (i_in=0,i_out=0;i_in<n_in;i_in++) {
- 
-    /* if crossing LEFT boundary - output intersection */
-    if ((inside=(lon_in[i_in] >= ll_lon))!=inside_last) {
-      x_tmp[i_out] = ll_lon;
-      y_tmp[i_out++] = y_last + (ll_lon - x_last) * (lat_in[i_in] - y_last) / (lon_in[i_in] - x_last);
-    }
-
-    /* if "to" point is right of LEFT boundary, output it */
-    if (inside) {
-      x_tmp[i_out]   = lon_in[i_in];
-      y_tmp[i_out++] = lat_in[i_in];
-    }
-    x_last = lon_in[i_in];
-    y_last = lat_in[i_in];
-    inside_last = inside;
-  }
-  if (!(n_out=i_out)) return(0);
-
-  /* clip polygon with RIGHT boundary - clip V_TMP to V_OUT */
-  x_last = x_tmp[n_out-1];
-  y_last = y_tmp[n_out-1];
-  inside_last = (x_last <= ur_lon);
-  for (i_in=0,i_out=0;i_in<n_out;i_in++) {
- 
-    /* if crossing RIGHT boundary - output intersection */
-    if ((inside=(x_tmp[i_in] <= ur_lon))!=inside_last) {
-      lon_out[i_out]   = ur_lon;
-      lat_out[i_out++] = y_last + (ur_lon - x_last) * (y_tmp[i_in] - y_last)
-                                                 / (x_tmp[i_in] - x_last);
-    }
-
-    /* if "to" point is left of RIGHT boundary, output it */
-    if (inside) {
-      lon_out[i_out]   = x_tmp[i_in];
-      lat_out[i_out++] = y_tmp[i_in];
-    }
-    
-    x_last = x_tmp[i_in];
-    y_last = y_tmp[i_in];
-    inside_last = inside;
-  }
-  if (!(n_out=i_out)) return(0);
-
-  /* clip polygon with BOTTOM boundary - clip V_OUT to V_TMP */
-  x_last = lon_out[n_out-1];
-  y_last = lat_out[n_out-1];
-  inside_last = (y_last >= ll_lat);
-  for (i_in=0,i_out=0;i_in<n_out;i_in++) {
- 
-    /* if crossing BOTTOM boundary - output intersection */
-    if ((inside=(lat_out[i_in] >= ll_lat))!=inside_last) {
-      y_tmp[i_out]   = ll_lat;
-      x_tmp[i_out++] = x_last + (ll_lat - y_last) * (lon_out[i_in] - x_last) / (lat_out[i_in] - y_last);
-    }
-
-    /* if "to" point is above BOTTOM boundary, output it */
-    if (inside) {
-      x_tmp[i_out]   = lon_out[i_in];
-      y_tmp[i_out++] = lat_out[i_in];
-    }
-    x_last = lon_out[i_in];
-    y_last = lat_out[i_in];
-    inside_last = inside;
-  }
-  if (!(n_out=i_out)) return(0);
-
-  /* clip polygon with TOP boundary - clip V_TMP to V_OUT */
-  x_last = x_tmp[n_out-1];
-  y_last = y_tmp[n_out-1];
-  inside_last = (y_last <= ur_lat);
-  for (i_in=0,i_out=0;i_in<n_out;i_in++) {
- 
-    /* if crossing TOP boundary - output intersection */
-    if ((inside=(y_tmp[i_in] <= ur_lat))!=inside_last) {
-      lat_out[i_out]   = ur_lat;
-      lon_out[i_out++] = x_last + (ur_lat - y_last) * (x_tmp[i_in] - x_last) / (y_tmp[i_in] - y_last);
-    }
-
-    /* if "to" point is below TOP boundary, output it */
-    if (inside) {
-      lon_out[i_out]   = x_tmp[i_in];
-      lat_out[i_out++] = y_tmp[i_in];
-    }
-    x_last = x_tmp[i_in];
-    y_last = y_tmp[i_in];
-    inside_last = inside;
-  }
-  return(i_out);
-}; /* clip */  
-
-
-/*******************************************************************************
-   Revise Sutherland-Hodgeman algorithm to find the vertices of the overlapping
-   between any two grid boxes. It return the number of vertices for the exchange grid.
-*******************************************************************************/
-
-int clip_2dx2d(const double lon1_in[], const double lat1_in[], int n1_in, 
-	 const double lon2_in[], const double lat2_in[], int n2_in, 
-	 double lon_out[], double lat_out[])
-{
-  double lon_tmp[MV], lat_tmp[MV];
-  double x1_0, y1_0, x1_1, y1_1, x2_0, y2_0, x2_1, y2_1;
-  double dx1, dy1, dx2, dy2, determ, ds1, ds2;
-  int i_out, n_out, inside_last, inside, i1, i2;
-
-  /* clip polygon with each boundary of the polygon */
-  /* We treat lon1_in/lat1_in as clip polygon and lon2_in/lat2_in as subject polygon */
-  n_out = n1_in;
-  for(i1=0; i1<n1_in; i1++) {
-    lon_tmp[i1] = lon1_in[i1];
-    lat_tmp[i1] = lat1_in[i1];
-  }
-  x2_0 = lon2_in[n2_in-1];
-  y2_0 = lat2_in[n2_in-1];
-  for(i2=0; i2<n2_in; i2++) {
-    x2_1 = lon2_in[i2];
-    y2_1 = lat2_in[i2];
-    x1_0 = lon_tmp[n_out-1];
-    y1_0 = lat_tmp[n_out-1];
-    inside_last = inside_edge( x2_0, y2_0, x2_1, y2_1, x1_0, y1_0);
-    for(i1=0, i_out=0; i1<n_out; i1++) {
-      x1_1 = lon_tmp[i1];
-      y1_1 = lat_tmp[i1];
-      if((inside = inside_edge(x2_0, y2_0, x2_1, y2_1, x1_1, y1_1)) != inside_last ) {
-        /* there is intersection, the line between <x1_0,y1_0> and  <x1_1,y1_1>
-           should not parallel to the line between <x2_0,y2_0> and  <x2_1,y2_1>
-           may need to consider truncation error */
-	dy1 = y1_1-y1_0;
-	dy2 = y2_1-y2_0;
-	dx1 = x1_1-x1_0;
-	dx2 = x2_1-x2_0;
-	ds1 = y1_0*x1_1 - y1_1*x1_0;
-	ds2 = y2_0*x2_1 - y2_1*x2_0;
-	determ = dy2*dx1 - dy1*dx2;
-        if(fabs(determ) < EPSLN) {
-	  error_handler("the line between <x1_0,y1_0> and  <x1_1,y1_1> should not parallel to "
-				     "the line between <x2_0,y2_0> and  <x2_1,y2_1>");
-	}
-	lon_out[i_out]   = (dx2*ds1 - dx1*ds2)/determ;
-	lat_out[i_out++] = (dy2*ds1 - dy1*ds2)/determ;
-	
-
-      }
-      if(inside) {
-	lon_out[i_out]   = x1_1;
-	lat_out[i_out++] = y1_1;	
-      }
-      x1_0 = x1_1;
-      y1_0 = y1_1;
-      inside_last = inside;
-    }
-    if(!(n_out=i_out)) return 0;
-    for(i1=0; i1<n_out; i1++) {
-      lon_tmp[i1] = lon_out[i1];
-      lat_tmp[i1] = lat_out[i1];
-    }
-    /* shift the starting point */
-    x2_0 = x2_1;
-    y2_0 = y2_1;
-  }
-  return(n_out);
-}; /* clip */
-    
-
-/*------------------------------------------------------------------------------
-  double poly_ctrlat(const double x[], const double y[], int n)
-  This routine is used to calculate the latitude of the centroid 
-   ---------------------------------------------------------------------------*/
-
-double poly_ctrlat(const double x[], const double y[], int n)
-{
-  double ctrlat = 0.0;
-  int    i;
-
-  for (i=0;i<n;i++) {
-    int ip = (i+1) % n;
-    double dx = (x[ip]-x[i]);
-    double dy, avg_y, hdy;
-    double lat1, lat2;
-    lat1 = y[ip];
-    lat2 = y[i];
-    dy = lat2 - lat1;
-    hdy = dy*0.5;
-    avg_y = (lat1+lat2)*0.5;
-    if      (dx==0.0) continue;
-    if(dx > M_PI)  dx = dx - 2.0*M_PI;
-    if(dx < -M_PI) dx = dx + 2.0*M_PI;
-
-    if ( fabs(hdy)< SMALL_VALUE ) /* cheap area calculation along latitude */
-      ctrlat -= dx*(2*cos(avg_y) + lat2*sin(avg_y) - cos(lat1) );
-    else 
-      ctrlat -= dx*( (sin(hdy)/hdy)*(2*cos(avg_y) + lat2*sin(avg_y)) - cos(lat1) );
-  }
-  return (ctrlat*RADIUS*RADIUS);
-}; /* poly_ctrlat */        
-
-/*------------------------------------------------------------------------------
-  double poly_ctrlon(const double x[], const double y[], int n, double clon)
-  This routine is used to calculate the lontitude of the centroid.
-   ---------------------------------------------------------------------------*/
-double poly_ctrlon(const double x[], const double y[], int n, double clon)
-{
-  double ctrlon = 0.0;
-  int    i;
-
-  clon = clon;
-  for (i=0;i<n;i++) {
-    int ip = (i+1) % n;
-    double phi1, phi2, dphi, lat1, lat2, dphi1, dphi2;
-    double f1, f2, fac, fint;
-    phi1   = x[ip];
-    phi2   = x[i];
-    lat1 = y[ip];
-    lat2 = y[i];    
-    dphi   = phi1 - phi2;
-    
-    if      (dphi==0.0) continue;
-
-    f1 = 0.5*(cos(lat1)*sin(lat1)+lat1);
-    f2 = 0.5*(cos(lat2)*sin(lat2)+lat2);
-
-     /* this will make sure longitude of centroid is at 
-        the same interval as the center of any grid */  
-    if(dphi > M_PI)  dphi = dphi - 2.0*M_PI;
-    if(dphi < -M_PI) dphi = dphi + 2.0*M_PI;
-    dphi1 = phi1 - clon;
-    if( dphi1 > M_PI) dphi1 -= 2.0*M_PI;
-    if( dphi1 <-M_PI) dphi1 += 2.0*M_PI;
-    dphi2 = phi2 -clon;
-    if( dphi2 > M_PI) dphi2 -= 2.0*M_PI;
-    if( dphi2 <-M_PI) dphi2 += 2.0*M_PI;    
-
-    if(abs(dphi2 -dphi1) < M_PI) {
-      ctrlon -= dphi * (dphi1*f1+dphi2*f2)/2.0;
-    }
-    else {
-      if(dphi1 > 0.0)
-	fac = M_PI;
-      else
-	fac = -M_PI;
-      fint = f1 + (f2-f1)*(fac-dphi1)/abs(dphi);
-      ctrlon -= 0.5*dphi1*(dphi1-fac)*f1 - 0.5*dphi2*(dphi2+fac)*f2
-	+ 0.5*fac*(dphi1+dphi2)*fint;
-	}
-    
-  }
-  return (ctrlon*RADIUS*RADIUS);
-};   /* poly_ctrlon */
-
-/* -----------------------------------------------------------------------------
-   double box_ctrlat(double ll_lon, double ll_lat, double ur_lon, double ur_lat)
-   This routine is used to calculate the latitude of the centroid.
-   ---------------------------------------------------------------------------*/
-double box_ctrlat(double ll_lon, double ll_lat, double ur_lon, double ur_lat)
-{
-  double dphi = ur_lon-ll_lon;
-  double ctrlat;
-  
-  if(dphi > M_PI)  dphi = dphi - 2.0*M_PI;
-  if(dphi < -M_PI) dphi = dphi + 2.0*M_PI;
-  ctrlat = dphi*(cos(ur_lat) + ur_lat*sin(ur_lat)-(cos(ll_lat) + ll_lat*sin(ll_lat)));
-  return (ctrlat*RADIUS*RADIUS); 
-}; /* box_ctrlat */
-
-/*------------------------------------------------------------------------------
-  double box_ctrlon(double ll_lon, double ll_lat, double ur_lon, double ur_lat, double clon)
-  This routine is used to calculate the lontitude of the centroid 
-   ----------------------------------------------------------------------------*/
-double box_ctrlon(double ll_lon, double ll_lat, double ur_lon, double ur_lat, double clon)
-{
-  double phi1, phi2, dphi, lat1, lat2, dphi1, dphi2;
-  double f1, f2, fac, fint;  
-  double ctrlon  = 0.0;
-  int i;
-  clon = clon;  
-  for( i =0; i<2; i++) {
-    if(i == 0) {
-      phi1 = ur_lon;
-      phi2 = ll_lon;
-      lat1 = lat2 = ll_lat;
-    }
-    else {
-      phi1 = ll_lon;
-      phi2 = ur_lon;
-      lat1 = lat2 = ur_lat;
-    }
-    dphi   = phi1 - phi2;
-    f1 = 0.5*(cos(lat1)*sin(lat1)+lat1);
-    f2 = 0.5*(cos(lat2)*sin(lat2)+lat2);
-
-    if(dphi > M_PI)  dphi = dphi - 2.0*M_PI;
-    if(dphi < -M_PI) dphi = dphi + 2.0*M_PI;
-    /* make sure the center is in the same grid box. */
-    dphi1 = phi1 - clon;
-    if( dphi1 > M_PI) dphi1 -= 2.0*M_PI;
-    if( dphi1 <-M_PI) dphi1 += 2.0*M_PI;
-    dphi2 = phi2 -clon;
-    if( dphi2 > M_PI) dphi2 -= 2.0*M_PI;
-    if( dphi2 <-M_PI) dphi2 += 2.0*M_PI;    
-
-    if(abs(dphi2 -dphi1) < M_PI) {
-      ctrlon -= dphi * (dphi1*f1+dphi2*f2)/2.0;
-    }
-    else {
-      if(dphi1 > 0.0)
-	fac = M_PI;
-      else
-	fac = -M_PI;
-      fint = f1 + (f2-f1)*(fac-dphi1)/abs(dphi);
-      ctrlon -= 0.5*dphi1*(dphi1-fac)*f1 - 0.5*dphi2*(dphi2+fac)*f2
-	+ 0.5*fac*(dphi1+dphi2)*fint;
-    }
-  }
-  return (ctrlon*RADIUS*RADIUS);    
-} /* box_ctrlon */
-
-/*******************************************************************************
-  double grid_box_radius(double *x, double *y, double *z, int n);
-  Find the radius of the grid box, the radius is defined the
-  maximum distance between any two vertices
-*******************************************************************************/ 
-double grid_box_radius(const double *x, const double *y, const double *z, int n)
-{
-  double radius;
-  int i, j;
-  
-  radius = 0;
-  for(i=0; i<n-1; i++) {
-    for(j=i+1; j<n; j++) {
-      radius = max(radius, pow(x[i]-x[j],2.)+pow(y[i]-y[j],2.)+pow(z[i]-z[j],2.));
-    }
-  }
-  
-  radius = sqrt(radius);
-
-  return (radius);
-  
-}; /* grid_box_radius */
-
-/*******************************************************************************
-  double dist_between_boxes(const double *x1, const double *y1, const double *z1, int n1,
-			    const double *x2, const double *y2, const double *z2, int n2);
-  Find the distance between any two grid boxes. The distance is defined by the maximum
-  distance between any vertices of these two box
-*******************************************************************************/
-double dist_between_boxes(const double *x1, const double *y1, const double *z1, int n1,
-			  const double *x2, const double *y2, const double *z2, int n2)
-{
-  double dist;
-  int i, j;
-
-  for(i=0; i<n1; i++) {
-    for(j=0; j<n2; j++) {   
-      dist = max(dist, pow(x1[i]-x2[j],2.)+pow(y1[i]-y2[j],2.)+pow(z1[i]-z2[j],2.));
-    }
-  }
-
-  dist = sqrt(dist);
-  return (dist);
-
-}; /* dist_between_boxes */
-
-/*******************************************************************************
- int inside_edge(double x0, double y0, double x1, double y1, double x, double y)
- determine a point(x,y) is inside or outside a given edge with vertex,
- (x0,y0) and (x1,y1). return 1 if inside and 0 if outside. <y1-y0, -(x1-x0)> is
- the outward edge normal from vertex <x0,y0> to <x1,y1>. <x-x0,y-y0> is the vector
- from <x0,y0> to <x,y>. 
- if Inner produce <x-x0,y-y0>*<y1-y0, -(x1-x0)> > 0, outside, otherwise inside.
- inner product value = 0 also treate as inside.
-*******************************************************************************/
- int inside_edge(double x0, double y0, double x1, double y1, double x, double y)
- {
-   const double SMALL = 1.e-12;
-   double product;
-   
-   product = ( x-x0 )*(y1-y0) + (x0-x1)*(y-y0);
-   return (product<=SMALL) ? 1:0;
-   
- }; /* inside_edge */
-
diff --git a/gridspec/shared/mosaic/create_xgrid.h b/gridspec/shared/mosaic/create_xgrid.h
deleted file mode 100644
index 629ea59..0000000
--- a/gridspec/shared/mosaic/create_xgrid.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef CREATE_XGRID_H_
-#define CREATE_XGRID_H_
-#define MAXXGRID 1e7
-#define MV 50
-/* this value is small compare to earth area */
-
-double poly_ctrlon(const double lon[], const double lat[], int n, double clon);
-double poly_ctrlat(const double lon[], const double lat[], int n);
-double box_ctrlon(double ll_lon, double ll_lat, double ur_lon, double ur_lat, double clon);
-double box_ctrlat(double ll_lon, double ll_lat, double ur_lon, double ur_lat);
-int get_maxxgrid(void);
-void get_grid_area(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area);
-void get_grid_area_no_adjust(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area);
-int clip(const double lon_in[], const double lat_in[], int n_in, double ll_lon, double ll_lat,
-	 double ur_lon, double ur_lat, double lon_out[], double lat_out[]);
-int clip_2dx2d(const double lon1_in[], const double lat1_in[], int n1_in, 
-	       const double lon2_in[], const double lat2_in[], int n2_in, 
-	       double lon_out[], double lat_out[]);
-int create_xgrid_1dx2d_order1(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in,
-			      const double *lat_in, const double *lon_out, const double *lat_out,
-			      const double *mask_in, int *i_in, int *j_in, int *i_out,
-			      int *j_out, double *xgrid_area);
-int create_xgrid_1dx2d_order2(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
-			      const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
-			      const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
-			      double *xgrid_area, double *xgrid_clon, double *xgrid_clat);
-int create_xgrid_2dx1d_order1(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in,
-			      const double *lat_in, const double *lon_out, const double *lat_out,
-			      const double *mask_in, int *i_in, int *j_in, int *i_out,
-			      int *j_out, double *xgrid_area);
-int create_xgrid_2dx1d_order2(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
-			      const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
-			      const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
-			      double *xgrid_area, double *xgrid_clon, double *xgrid_clat);
-int create_xgrid_2dx2d_order1(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
-			      const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
-			      const double *mask_in, int *i_in, int *j_in, int *i_out,
-			      int *j_out, double *xgrid_area);
-int create_xgrid_2dx2d_order2(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
-			      const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
-			      const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
-			      double *xgrid_area, double *xgrid_clon, double *xgrid_clat);
-#endif
diff --git a/gridspec/shared/mosaic/gradient_c2l.c b/gridspec/shared/mosaic/gradient_c2l.c
deleted file mode 100644
index b246fad..0000000
--- a/gridspec/shared/mosaic/gradient_c2l.c
+++ /dev/null
@@ -1,435 +0,0 @@
-#include <math.h>
-#include <stdlib.h>
-#include "constant.h"
-#include "mosaic_util.h"
-#include "gradient_c2l.h"
-#include <stdio.h>
-void a2b_ord2(int nx, int ny, const double *qin, const double *edge_w, const double *edge_e,
-	      const double *edge_s, const double *edge_n, double *qout,
-	      int on_west_edge, int on_east_edge, int on_south_edge, int on_north_edge);
-
-
-/*------------------------------------------------------------------------------
-  Routine to compute gradient terms for SCRIP:
-  SJL: Oct 5, 2007
-  NOTe: pin has halo size = 1.
-  the size of pin    will be (nx+2,ny+2), T-cell center, with halo = 1
-  the size of dx     will be (nx, ny+1),  N-cell center
-  the size of dy     will be (nx+1, ny),  E-cell center
-  the size of area   will be (nx, ny),    T-cell center.
-  The size of edge_w will be (ny+1),      C-cell center
-  The size of edge_e will be (ny+1),      C-cell center
-  The size of edge_s will be (nx+1),      C-cell center
-  The size of edge_n will be (nx+1),      C-cell center
-  The size of en_n   will be (nx, ny+1,3),N-cell center
-  The size of en_e   will be (nx+1,ny,3), E-cell center
-  The size of vlon   will be (nx, ny, 3)  T-cell center
-  The size of vlat   will be (nx, ny, 3), T-cell center
-  ----------------------------------------------------------------------------*/
-void grad_c2l_(const int *nlon, const int *nlat, const double *pin, const double *dx, const double *dy, const double *area,
-	       const double *edge_w, const double *edge_e, const double *edge_s, const double *edge_n,
-	       const double *en_n, const double *en_e, const double *vlon, const double *vlat,
-	       double *grad_x, double *grad_y, const int *on_west_edge, const int *on_east_edge,
-	       const int *on_south_edge, const int *on_north_edge)
-{
-  grad_c2l(nlon, nlat, pin, dx, dy, area, edge_w, edge_e, edge_s, edge_n, en_n, en_e, vlon, vlat, grad_x, grad_y,
-	   on_west_edge, on_east_edge, on_south_edge, on_north_edge);
-}
-  
-void grad_c2l(const int *nlon, const int *nlat, const double *pin, const double *dx, const double *dy, const double *area,
-	      const double *edge_w, const double *edge_e, const double *edge_s, const double *edge_n,
-	      const double *en_n, const double *en_e, const double *vlon, const double *vlat,
-	      double *grad_x, double *grad_y, const int *on_west_edge, const int *on_east_edge,
-	      const int *on_south_edge, const int *on_north_edge)
-{
-
-  double *pb, *pdx, *pdy, *grad3;
-  int nx, ny, nxp, nyp, i, j, m0, m1, m2, n;
-
-  nx    = *nlon;
-  ny    = *nlat;
-  nxp   = nx+1;
-  nyp   = ny+1;
-  pb    = (double *)malloc(nxp*nyp*sizeof(double));
-  pdx   = (double *)malloc(3*nx*(ny+1)*sizeof(double));
-  pdy   = (double *)malloc(3*(nx+1)*ny*sizeof(double));
-  grad3 = (double *)malloc(3*nx*ny*sizeof(double));
-  a2b_ord2(nx, ny, pin, edge_w, edge_e, edge_s, edge_n, pb, *on_west_edge, *on_east_edge,*on_south_edge, *on_north_edge);
-  
-  for(j=0; j<nyp; j++) for(i=0; i<nx; i++) {
-    m0 = j*nx+i;
-    m1 = j*nxp+i;
-    for(n=0; n<3; n++) {
-      pdx[3*m0+n] = 0.5*(pb[m1]+pb[m1+1])*dx[m0]*en_n[3*m0+n];
-    }
-  }
-
-  for(j=0; j<ny; j++) for(i=0; i<nxp; i++) {
-    m0 = j*nxp+i;
-    for(n=0; n<3; n++) {
-      pdy[3*m0+n] = 0.5*(pb[m0]+pb[m0+nxp])*dy[m0]*en_e[3*m0+n];
-    }
-  }
-
-  /* Compute 3D grad of the input scalar field  by Green's theorem */
-  for(j=0; j<ny; j++) for(i=0; i<nx; i++) {
-    m0 = 3*(j*nx+i);
-    for(n=0; n<3; n++) {
-      grad3[m0+n] = pdx[3*((j+1)*nx+i)+n]-pdx[m0+n]-pdy[3*(j*nxp+i)+n]+pdy[3*(j*nxp+i+1)+n];
-    }
-  }
-
-  /* Compute inner product: V3 * grad (pe) */
-  for(j=0; j<ny; j++) for(i=0; i<nx; i++) {
-    m0 = j*nx+i;
-    m1 = 3*m0;
-    /* dq / d(Lamda)*/
-    grad_x[m0] = (vlon[m1]*grad3[m1] + vlon[m1+1]*grad3[m1+1] + vlon[m1+2]*grad3[m1+2])/area[m0];
-    grad_x[m0] *= RADIUS;
-    /* dq / d(theta) */
-    grad_y[m0] = (vlat[m1]*grad3[m1] + vlat[m1+1]*grad3[m1+1] + vlat[m1+2]*grad3[m1+2] )/area[m0];
-    grad_y[m0] *= RADIUS;
-  }
-
-  free(pb);
-  free(pdx);
-  free(pdy);
-  free(grad3);
-  
-}; /* grad_c2l */
-
-/*------------------------------------------------------------------------------
-  qin:  A-grid field, size (nx+2, ny+2)
-  qout: B-grid field, size (nx+1, ny+1)
-  ----------------------------------------------------------------------------*/
-void a2b_ord2(int nx, int ny, const double *qin, const double *edge_w, const double *edge_e,
-	      const double *edge_s, const double *edge_n, double *qout,
-	      int on_west_edge, int on_east_edge, int on_south_edge, int on_north_edge)
-{
-  int    nxp, nyp, i, j;
-  int    istart, iend, jstart, jend;
-  double *q1, *q2;
-  const double r3 = 1./3.;
-
-  nxp = nx+1;
-  nyp = ny+1;
-  q1 = (double *)malloc((nx+2)*sizeof(double));
-  q2 = (double *)malloc((ny+2)*sizeof(double));
-
-  
-  if(on_west_edge)
-    istart = 1;
-  else
-    istart = 0;
-  if(on_east_edge)
-    iend = nx;
-  else
-    iend = nxp;
-  if(on_south_edge)
-    jstart = 1;
-  else
-    jstart = 0;
-  if(on_north_edge)
-    jend = ny;
-  else
-    jend = nyp;
-  
-  /* internal region ( 1: nx-1, 1:ny-1) */
-  for(j=jstart; j<jend; j++) for(i=istart; i<iend; i++) {
-    qout[j*nxp+i] = 0.25*(qin[j*(nx+2)+i] + qin[j*(nx+2)+i+1] +
-			  qin[(j+1)*(nx+2)+i] + qin[(j+1)*(nx+2)+i+1] );
-  }
-
-  /* Fix the 4 Corners */
-  if(on_west_edge && on_south_edge)qout[        0] = r3*(qin[1* (nx+2)+1 ]+qin[1* (nx+2)    ]+qin[             1]); /* sw_corner */
-  if(on_east_edge && on_south_edge)qout[       nx] = r3*(qin[1* (nx+2)+nx]+qin[          nx ]+qin[1*  (nx+2)+nxp]); /* se_corner */
-  if(on_east_edge && on_north_edge)qout[ny*nxp+nx] = r3*(qin[ny*(nx+2)+nx]+qin[ny*(nx+2)+nxp]+qin[nyp*(nx+2)+nx ]); /* ne_corner */
-  if(on_west_edge && on_north_edge)qout[ny*nxp   ] = r3*(qin[ny*(nx+2)+1 ]+qin[ny*(nx+2)    ]+qin[nyp*(nx+2)+1  ]); /* nw_corner */
-  
-  /* West Edges */
-  if(on_west_edge) {
-    for(j=jstart; j<=jend; j++) q2[j] = 0.5*(qin[j*(nx+2)] + qin[j*(nx+2)+1]);
-    for(j=jstart; j<jend; j++) qout[j*nxp] = edge_w[j]*q2[j] + (1-edge_w[j])*q2[j+1];
-  }
-  
-  /* East Edges */
-  if(on_east_edge) {  
-    for(j=jstart; j<=jend; j++)q2[j] = 0.5*(qin[j*(nx+2)+nx] + qin[j*(nx+2)+nxp]);
-    for(j=jstart; j<jend; j++) qout[j*nxp+nx] = edge_e[j]*q2[j] + (1-edge_e[j])*q2[j+1];
-  }
-  
-  /* south edge */
-  if(on_south_edge) {  
-    for(i=istart; i<=iend; i++) q1[i] = 0.5*(qin[i] + qin[(nx+2)+i]);
-    for(i=istart; i<iend; i++) qout[i] = edge_s[i]*q1[i] + (1 - edge_s[i])*q1[i+1];
-  }
-  
-  /* north edge */
-  if(on_north_edge) {  
-     for(i=istart; i<=iend; i++) q1[i] = 0.5*(qin[ny*(nx+2)+i] + qin[nyp*(nx+2)+i]);
-     for(i=istart; i<iend; i++) qout[ny*nxp+i] = edge_n[i]*q1[i] + (1 - edge_n[i])*q1[i+1];  
-  }
-  
-}; /* a2b_ord2 */
-
-
-void get_edge(int nx, int ny, const double *lont, const double *latt,
-	      const double *lonc, const double *latc, double *edge_w, double *edge_e, double *edge_s, double *edge_n,
-	      int on_west_edge, int on_east_edge, int on_south_edge, int on_north_edge)
-{
-  int i, j, nxp, nyp;
-  int istart, iend, jstart, jend;
-  double p1[2], p2[2];
-  double *py, *px;
-  double d1, d2;
-  
-  nxp = nx + 1;
-  nyp = ny + 1;
-
-  for(i=0; i<nxp; i++) {
-    edge_s[i] = 0.5; /* dummy value */
-    edge_n[i] = 0.5; /* dummy value */
-  }
-  for(j=0; j<nyp; j++) {
-    edge_w[j] = 0.5; /* dummy value */
-    edge_e[j] = 0.5; /* dummy value */
-  }  
-    
-  px = (double *)malloc(2*(nx+2)*sizeof(double));
-  py = (double *)malloc(2*(ny+2)*sizeof(double));
-
-  if(on_west_edge)
-    istart = 1;
-  else
-    istart = 0;
-  if(on_east_edge)
-    iend = nx;
-  else
-    iend = nxp;
-  if(on_south_edge)
-    jstart = 1;
-  else
-    jstart = 0;
-  if(on_north_edge)
-    jend = ny;
-  else
-    jend = nyp;  
-  /* west edge */
-
-  if(on_west_edge) {
-    i=0;
-    for(j=jstart; j<=jend; j++) {
-      /* get mid point sphere */
-      p1[0] = lont[j*(nx+2)+i  ]; p1[1] = latt[j*(nx+2)+i  ];
-      p2[0] = lont[j*(nx+2)+i+1]; p2[1] = latt[j*(nx+2)+i+1];
-      mid_pt_sphere(p1, p2, &(py[2*j]));
-    }    
-    
-    for(j=jstart; j<jend; j++) {
-      p1[0] = lonc[j*nxp+i];
-      p1[1] = latc[j*nxp+i];
-      d1 = great_circle_distance(py+2*j, p1);
-      d2 = great_circle_distance(py+2*(j+1), p1);
-      edge_w[j] = d2/(d1+d2);
-    }
-  }
-  /* east edge */
-  if(on_east_edge) {  
-    i=nx;
-    for(j=jstart; j<=jend; j++) {
-      /* get mid point sphere */
-      p1[0] = lont[j*(nx+2)+i  ]; p1[1] = latt[j*(nx+2)+i  ];
-      p2[0] = lont[j*(nx+2)+i+1]; p2[1] = latt[j*(nx+2)+i+1];
-      mid_pt_sphere(p1, p2, &(py[2*j]));
-    }    
-    
-    for(j=jstart; j<jend; j++) {
-      p1[0] = lonc[j*nxp+i];
-      p1[1] = latc[j*nxp+i];
-      d1 = great_circle_distance(&(py[2*j]), p1);
-      d2 = great_circle_distance(&(py[2*(j+1)]), p1);
-      edge_e[j] = d2/(d1+d2);
-    }  
-  }
-  
-  /* south edge */
-  if(on_south_edge) {
-    j=0;
-    for(i=istart; i<=iend; i++) {
-      p1[0] = lont[j    *(nx+2)+i]; p1[1] = latt[j    *(nx+2)+i];
-      p2[0] = lont[(j+1)*(nx+2)+i]; p2[1] = latt[(j+1)*(nx+2)+i];
-      mid_pt_sphere(p1, p2, &(px[2*i]));
-    }
-    for(i=istart; i<iend; i++) {
-      p1[0] = lonc[j*nxp+i];
-      p1[1] = latc[j*nxp+i];
-      d1 = great_circle_distance(&(px[2*i]), p1);
-      d2 = great_circle_distance(&(px[2*(i+1)]), p1);
-      edge_s[i] = d2/(d1+d2);
-    }
-  }
-  /* north edge */
-  if(on_north_edge) {
-    j=ny;
-    for(i=istart; i<=iend; i++) {
-      p1[0] = lont[j    *(nx+2)+i]; p1[1] = latt[j    *(nx+2)+i];
-      p2[0] = lont[(j+1)*(nx+2)+i]; p2[1] = latt[(j+1)*(nx+2)+i];
-      mid_pt_sphere(p1, p2, &(px[2*i]));
-    }
-    for(i=istart; i<iend; i++) {
-      p1[0] = lonc[j*nxp+i];
-      p1[1] = latc[j*nxp+i];
-      d1 = great_circle_distance(&(px[2*i]), p1);
-      d2 = great_circle_distance(&(px[2*(i+1)]), p1);
-      edge_n[i] = d2/(d1+d2);
-    }  
-  }
-  
-  free(px);
-  free(py);
-  
-}; /* get_edge */
-
-void mid_pt_sphere(const double *p1, const double *p2, double *pm)
-{
-  double e1[3], e2[3], e3[3];
-
-  latlon2xyz(1, p1, p1+1, e1, e1+1, e1+2);
-  latlon2xyz(1, p2, p2+1, e2, e2+1, e2+2);
-  mid_pt3_cart(e1, e2, e3);
-  xyz2latlon(1, e3, e3+1, e3+2, pm, pm+1);
-
-}
-
-void mid_pt3_cart(const double *p1, const double *p2, double *e)
-{
-  double dd;
-
-  e[0] = p1[0] + p2[0];
-  e[1] = p1[1] + p2[1];
-  e[2] = p1[2] + p2[2];
-  dd = sqrt( e[0]*e[0] + e[1]*e[1] + e[2]*e[2] );
-  e[0] /= dd;
-  e[1] /= dd;
-  e[2] /= dd;
-}
-
-/**********************************************************************************************
-  This routine is used to calculate grid information for second order conservative interpolation
-  from cubic grid to other grid
-  the size of xt     will be (nx+2,ny+2), T-cell center, with halo = 1
-  the size of yt     will be (nx+2,ny+2), T-cell center, with halo = 1
-  the size of xc     will be (nx+1,ny+1), C-cell center
-  the size of yc     will be (nx+1,ny+1), C-cell center
-  the size of dx     will be (nx, ny+1),  N-cell center
-  the size of dy     will be (nx+1, ny),  E-cell center
-  the size of area   will be (nx, ny),    T-cell center.
-  The size of edge_w will be (ny-1),      C-cell center, without two end point
-  The size of edge_e will be (ny-1),      C-cell center, without two end point
-  The size of edge_s will be (nx-1),      C-cell center, without two end point
-  The size of edge_n will be (nx-1),      C-cell center, without two end point
-  The size of en_n   will be (nx, ny+1,3),N-cell center
-  The size of en_e   will be (nx+1,ny,3), E-cell center
-  The size of vlon   will be (nx, ny)     T-cell center
-  The size of vlat   will be (nx, ny),    T-cell center
-**********************************************************************************************/
-void calc_c2l_grid_info_(int *nx_pt, int *ny_pt, const double *xt, const double *yt, const double *xc, const double *yc,
-		         double *dx, double *dy, double *area, double *edge_w, double *edge_e, double *edge_s,
-		         double *edge_n, double *en_n, double *en_e, double *vlon, double *vlat,
-			int *on_west_edge, int *on_east_edge, int *on_south_edge, int *on_north_edge)
-{
-    calc_c2l_grid_info(nx_pt, ny_pt, xt, yt, xc, yc, dx, dy, area, edge_w, edge_e, edge_s, edge_n,
-		       en_n, en_e, vlon, vlat, on_west_edge, on_east_edge, on_south_edge, on_north_edge);
-
-}
-
-void calc_c2l_grid_info(int *nx_pt, int *ny_pt, const double *xt, const double *yt, const double *xc, const double *yc,
-		        double *dx, double *dy, double *area, double *edge_w, double *edge_e, double *edge_s,
-		        double *edge_n, double *en_n, double *en_e, double *vlon, double *vlat,
-			int *on_west_edge, int *on_east_edge, int *on_south_edge, int *on_north_edge)
-{
-  double *x, *y, *z, *xt_tmp, *yt_tmp;
-  int    nx, ny, nxp, nyp, i, j;
-  double p1[3], p2[3], p3[3], p4[3];
-
-
-  nx  = *nx_pt;
-  ny  = *ny_pt;
-  nxp = nx+1;
-  nyp = ny+1;
-
-  for(j=0; j<nyp; j++) for(i=0; i<nx; i++) {
-    p1[0] = xc[j*nxp+i];
-    p1[1] = yc[j*nxp+i];
-    p2[0] = xc[j*nxp+i+1];
-    p2[1] = yc[j*nxp+i+1];
-    dx[j*nx+i] = great_circle_distance(p1, p2);
-  }
-
-  for(j=0; j<ny; j++) for(i=0; i<nxp; i++) {
-    p1[0] = xc[j*nxp+i];
-    p1[1] = yc[j*nxp+i];
-    p2[0] = xc[(j+1)*nxp+i];
-    p2[1] = yc[(j+1)*nxp+i];
-    dy[j*nxp+i] = great_circle_distance(p1, p2);
-  }
-  
-  for(j=0; j<ny; j++) for(i=0; i<nx; i++) {
-    p1[0] = xc[j*nxp+i];       /* ll lon */
-    p1[1] = yc[j*nxp+i];       /* ll lat */
-    p2[0] = xc[(j+1)*nxp+i];   /* ul lon */
-    p2[1] = yc[(j+1)*nxp+i];   /* ul lat */
-    p3[0] = xc[j*nxp+i+1];     /* lr lon */
-    p3[1] = yc[j*nxp+i+1];     /* lr lat */
-    p4[0] = xc[(j+1)*nxp+i+1]; /* ur lon */
-    p4[1] = yc[(j+1)*nxp+i+1]; /* ur lat */	
-    area[j*nx+i] = spherical_excess_area(p1, p2, p3, p4, RADIUS);
-  }
-
-  x = (double *)malloc(nxp*nyp*sizeof(double));
-  y = (double *)malloc(nxp*nyp*sizeof(double));
-  z = (double *)malloc(nxp*nyp*sizeof(double));
-  
-  latlon2xyz(nxp*nyp, xc, yc, x, y, z);
-  for(j=0; j<nyp; j++) for(i=0; i<nx; i++) {
-    p1[0] = x[j*nxp+i];
-    p1[1] = y[j*nxp+i];
-    p1[2] = z[j*nxp+i];
-    p2[0] = x[j*nxp+i+1];
-    p2[1] = y[j*nxp+i+1];
-    p2[2] = z[j*nxp+i+1];
-    vect_cross(p1, p2, en_n+3*(j*nx+i) );
-    normalize_vect(en_n+3*(j*nx+i));
-  }
-
-  for(j=0; j<ny; j++) for(i=0; i<nxp; i++) {
-    p2[0] = x[j*nxp+i];
-    p2[1] = y[j*nxp+i];
-    p2[2] = z[j*nxp+i];
-    p1[0] = x[(j+1)*nxp+i];
-    p1[1] = y[(j+1)*nxp+i];
-    p1[2] = z[(j+1)*nxp+i];
-    vect_cross(p1, p2, en_e+3*(j*nxp+i) );
-    normalize_vect(en_e+3*(j*nxp+i));
-  }  
-  
-  xt_tmp = (double *)malloc(nx*ny*sizeof(double));
-  yt_tmp = (double *)malloc(nx*ny*sizeof(double));
-  for(j=0; j<ny; j++)for(i=0; i<nx; i++) {
-    xt_tmp[j*nx+i] = xt[(j+1)*(nx+2)+i+1];
-    yt_tmp[j*nx+i] = yt[(j+1)*(nx+2)+i+1];
-  }  
-  unit_vect_latlon(nx*ny, xt_tmp, yt_tmp, vlon, vlat);
-  get_edge(nx, ny, xt, yt, xc, yc, edge_w, edge_e, edge_s, edge_n, *on_west_edge, *on_east_edge,
-	   *on_south_edge, *on_north_edge);
-
-  free(x);
-  free(y);
-  free(z);
-  free(xt_tmp);
-  free(yt_tmp);
-  
-}
-
-
-
diff --git a/gridspec/shared/mosaic/gradient_c2l.h b/gridspec/shared/mosaic/gradient_c2l.h
deleted file mode 100644
index e68440a..0000000
--- a/gridspec/shared/mosaic/gradient_c2l.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef GRADIENT_H_
-#define GRADIENT_H_
-void grad_c2l(const int *nlon, const int *nlat, const double *pin, const double *dx, const double *dy, const double *area,
-	      const double *edge_w, const double *edge_e, const double *edge_s, const double *edge_n,
-	      const double *en_n, const double *en_e, const double *vlon, const double *vlat,
-	      double *grad_x, double *grad_y, const int *on_west_edge, const int *on_east_edge,
-	      const int *on_south_edge, const int *on_north_edge);
-void calc_c2l_grid_info(int *nx_pt, int *ny_pt, const double *xt, const double *yt, const double *xc, const double *yc,
-		        double *dx, double *dy, double *area, double *edge_w, double *edge_e, double *edge_s,
-		        double *edge_n, double *en_n, double *en_e, double *vlon, double *vlat,
-                        int *on_west_edge, int *on_east_edge, int *on_south_edge, int *on_north_edge);
-void get_edge(int nx, int ny, const double *lont, const double *latt,
-	      const double *lonc, const double *latc, double *edge_w, double *edge_e, double *edge_s, double *edge_n,
-              int on_west_edge, int on_east_edge, int on_south_edge, int on_north_edge );
-void mid_pt_sphere(const double *p1, const double *p2, double *pm);
-void mid_pt3_cart(const double *p1, const double *p2, double *e);
-#endif
diff --git a/gridspec/shared/mosaic/interp.c b/gridspec/shared/mosaic/interp.c
deleted file mode 100644
index 97deb59..0000000
--- a/gridspec/shared/mosaic/interp.c
+++ /dev/null
@@ -1,152 +0,0 @@
-#include <stdlib.h>
-#include <math.h>
-#include "mosaic_util.h"
-#include "interp.h"
-#include "create_xgrid.h"
-
-/*********************************************************************
-   void cublic_spline(size1, size2, grid1, grid2, data1, data2, yp1, ypn  )
-
-   This alborithm is to get an interpolation formula that is smooth in the first
-   derivative, and continuous in the second derivative, both within an interval
-   and its boundaries. It will be used to interpolation data in 1-D space.
-
-   INPUT Arguments:
-    grid1:    grid for input data grid.          
-    grid2:    grid for output data grid.         
-    size1:    size of input grid.                
-    size2:    size of output grid.               
-    data1:    input data associated with grid1.
-    yp1:      first derivative of starting point.
-              Set to 0 to be "natural"           (INPUT)
-    ypn:      first derivative of ending point.
-              Set to 0 to be "natural"           (INPUT)
-
-   OUTPUT ARGUMENTS:
-    data2:    output data associated with grid2. (OUTPUT)
-
-*********************************************************************/
-
-void cubic_spline(int size1, int size2, const double *grid1, const double *grid2, const double *data1,
-		  double *data2, double yp1, double ypn  )
-{
-  double *y2=NULL, *u=NULL;
-  double p, sig, qn, un, h, a, b;
-  int i, k, n, klo, khi;
-  
-  for(i=1; i<size1; i++) {
-    if( grid1[i] <= grid1[i-1] ) error_handler("cubic_spline: grid1 is not monotonic increasing");
-  }
-
-  for(i=0; i<size2; i++) {
-    if( grid2[i] < grid1[0] || grid2[i] > grid1[size1-1]) error_handler("cubic_spline: grid2 lies outside grid1");
-  }  
-
-  if(size1 < 2) error_handler("cubic_spline: the size of input grid should be at least 2");
-  if(size1 == 2) {  /* when size1 is 2, it just reduced to a linear interpolation */
-    p = (data1[1]-data1[0])/(grid1[1]-grid1[0]);
-    for(i=0; i< size2; i++) data2[i] = p*(grid2[i] - grid1[0]) + data1[0];
-    return;
-  }
-  y2 = (double *)malloc(size1*sizeof(double));
-  u = (double *)malloc(size1*sizeof(double));
-  if (yp1 >.99e30) {
-    y2[0]=0.;
-    u[0]=0.;
-  }
-  else {
-    y2[0]=-0.5;
-    u[0]=(3./(grid1[1]-grid1[0]))*((data1[1]-data1[0])/(grid1[1]-grid1[0])-yp1);
-  }
-
-  for(i=1; i<size1-1; i++) {
-    sig=(grid1[i]-grid1[i-1])/(grid1[i+1]-grid1[i-1]);
-    p=sig*y2[i-1]+2.;
-    y2[i]=(sig-1.)/p;
-    u[i]=(6.*((data1[i+1]-data1[i])/(grid1[i+1]-grid1[i])-(data1[i]-data1[i-1])
-	      /(grid1[i]-grid1[i-1]))/(grid1[i+1]-grid1[i-1])-sig*u[i-1])/p;
-
-  }
-  
-  if (ypn > .99e30) {
-    qn=0.;
-    un=0.;
-  }
-  else {
-    qn=0.5;
-    un=(3./(grid1[size1-1]-grid1[size1-2]))*(ypn-(data1[size1-1]-data1[size1-2])/(grid1[size1-1]-grid1[size1-2]));
-  }
-
-  y2[size1-1]=(un-qn*u[size1-2])/(qn*y2[size1-2]+1.);
-
-  for(k=size1-2; k>=0; k--) y2[k] = y2[k]*y2[k+1]+u[k];
-
-  /* interpolate data onto grid2 */
-  for(k=0; k<size2; k++) {
-    n = nearest_index(grid2[k],grid1, size1);
-    if (grid1[n] < grid2[k]) {
-	 klo = n;
-    }
-    else {
-      if(n==0) {
-	klo = n;
-      }
-      else {
-	klo = n -1;
-      }
-    }
-    khi = klo+1;
-    h   = grid1[khi]-grid1[klo];
-    a   = (grid1[khi] - grid2[k])/h;
-    b   = (grid2[k] - grid1[klo])/h;
-    data2[k] = a*data1[klo] + b*data1[khi]+ ((pow(a,3.0)-a)*y2[klo] + (pow(b,3.0)-b)*y2[khi])*(pow(h,2.0))/6;
-  }
-
-  free(y2);
-  free(u);
-  
-};/* cubic spline */
-
-
-/*------------------------------------------------------------------------------
-  void conserve_interp()
-  conservative interpolation through exchange grid.
-  Currently only first order interpolation are implemented here.
-  ----------------------------------------------------------------------------*/
-void conserve_interp(int nx_src, int ny_src, int nx_dst, int ny_dst, const double *x_src,
-		     const double *y_src, const double *x_dst, const double *y_dst,
-		     const double *mask_src, const double *data_src, double *data_dst )
-{
-  int n, nxgrid;
-  int *xgrid_i1, *xgrid_j1, *xgrid_i2, *xgrid_j2;
-  double *xgrid_area, *dst_area, *area_frac; 
-  
-  /* get the exchange grid between source and destination grid. */
-  xgrid_i1   = (int    *)malloc(MAXXGRID*sizeof(int));
-  xgrid_j1   = (int    *)malloc(MAXXGRID*sizeof(int));
-  xgrid_i2   = (int    *)malloc(MAXXGRID*sizeof(int));
-  xgrid_j2   = (int    *)malloc(MAXXGRID*sizeof(int));
-  xgrid_area = (double *)malloc(MAXXGRID*sizeof(double));
-  dst_area   = (double *)malloc(nx_dst*ny_dst*sizeof(double));
-  nxgrid = create_xgrid_2dx2d_order1(&nx_src, &ny_src, &nx_dst, &ny_dst, x_src, y_src, x_dst, y_dst, mask_src,
-	                       xgrid_i1, xgrid_j1, xgrid_i2, xgrid_j2, xgrid_area );
-  get_grid_area(&nx_dst, &ny_dst, x_dst, y_dst, dst_area);
-  area_frac = (double *)malloc(nxgrid*sizeof(double));
-  for(n=0; n<nxgrid; n++) area_frac[n] = xgrid_area[n]/dst_area[xgrid_j2[n]*nx_dst+xgrid_i2[n]];
-  
-  for(n=0; n<nx_dst*ny_dst; n++) {
-    data_dst[n] = 0;
-  }
-  for(n=0; n<nxgrid; n++) {
-    data_dst[xgrid_j2[n]*nx_dst+xgrid_i2[n]] += data_src[xgrid_j1[n]*nx_src+xgrid_i1[n]]*area_frac[n];
-  }
-
-  free(xgrid_i1);
-  free(xgrid_j1);
-  free(xgrid_i2);
-  free(xgrid_j2);
-  free(xgrid_area);
-  free(dst_area);
-  free(area_frac);
-  
-}; /* conserve_interp */
diff --git a/gridspec/shared/mosaic/interp.h b/gridspec/shared/mosaic/interp.h
deleted file mode 100644
index 245dec8..0000000
--- a/gridspec/shared/mosaic/interp.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef INTERP_H_
-#define INTERP_H_
-/*********************************************************************
-                     interp.h
-   This header files contains defition of some interpolation routine  (1-D or 2-D).
-   contact: Zhi.Liang at noaa.gov
-*********************************************************************/
-
-void cubic_spline(int size1, int size2, const double *grid1, const double *grid2, const double *data1,
-		  double *data2, double yp1, double ypn  );
-void conserve_interp(int nx_src, int ny_src, int nx_dst, int ny_dst, const double *x_src,
-		     const double *y_src, const double *x_dst, const double *y_dst,
-		     const double *mask_src, const double *data_src, double *data_dst );
-#endif
diff --git a/gridspec/shared/mosaic/mosaic_util.c b/gridspec/shared/mosaic/mosaic_util.c
deleted file mode 100644
index 4634428..0000000
--- a/gridspec/shared/mosaic/mosaic_util.c
+++ /dev/null
@@ -1,531 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#ifdef use_libMPI 
-#include <mpi.h>
-#endif
-#include "mosaic_util.h"
-#include "constant.h"
-
-#define HPI (0.5*M_PI)
-#define TPI (2.0*M_PI)
-#define TOLORENCE (1.e-6)
-#define EPSLN (1.e-10)
-/***********************************************************
-    void error_handler(char *str)
-    error handler: will print out error message and then abort
-***********************************************************/
-
-void error_handler(const char *msg)
-{
-  fprintf(stderr, "FATAL Error: %s\n", msg );
-#ifdef use_libMPI      
-  MPI_Abort(MPI_COMM_WORLD, -1);
-#else
-  exit(1);
-#endif  
-}; /* error_handler */
-
-/*********************************************************************
-
-   int nearest_index(double value, const double *array, int ia)
-
-   return index of nearest data point within "array" corresponding to "value".
-   if "value" is outside the domain of "array" then nearest_index = 0
-   or = size(array)-1 depending on whether array(0) or array(ia-1) is
-   closest to "value"
-
-   Arguments:
-     value:  arbitrary data...same units as elements in "array"
-     array:  array of data points  (must be monotonically increasing)
-     ia   :  size of array.
-
- ********************************************************************/
-int nearest_index(double value, const double *array, int ia)
-{
-  int index, i;
-  int keep_going;
-
-  for(i=1; i<ia; i++){
-    if (array[i] < array[i-1]) 
-      error_handler("nearest_index: array must be monotonically increasing"); 
-  }
-  if (value < array[0] )
-    index = 0;
-  else if ( value > array[ia-1]) 
-    index = ia-1;
-  else
-    {
-      i=0;
-      keep_going = 1;
-      while (i < ia && keep_going) {
-	i = i+1;
-	if (value <= array[i]) {
-	  index = i;
-	  if (array[i]-value > value-array[i-1]) index = i-1;
-	  keep_going = 0;
-	}
-      }
-    }
-  return index;
-
-};
-
-/******************************************************************/
-
-void tokenize(const char * const string, const char *tokens, unsigned int varlen,
-	      unsigned int maxvar, char * pstring, unsigned int * const nstr)
-{
-  size_t i, j, nvar, len, ntoken;
-  int found, n;
-  
-  nvar = 0; j = 0;
-  len = strlen(string);
-  ntoken = strlen(tokens);
-  /* here we use the fact that C array [][] is contiguous in memory */
-  if(string[0] == 0)error_handler("Error from tokenize: to-be-parsed string is empty");
-  
-  for(i = 0; i < len; i ++){
-    if(string[i] != ' ' && string[i] != '\t'){
-      found = 0;
-      for(n=0; n<ntoken; n++) {
-	if(string[i] == tokens[n] ) {
-	  found = 1;
-	  break;
-	}
-      }
-      if(found) {
-	if( j != 0) { /* remove :: */
-	  *(pstring + (nvar++)*varlen + j) = 0;
-	  j = 0;
-	  if(nvar >= maxvar) error_handler("Error from tokenize: number of variables exceeds limit");
-	}
-      }
-      else {
-        *(pstring + nvar*varlen + j++) = string[i];
-        if(j >= varlen ) error_handler("error from tokenize: variable name length exceeds limit during tokenization");
-      }
-    }
-  }
-  *(pstring + nvar*varlen + j) = 0;
-  
-  *nstr = ++nvar;
-
-}
-
-/*******************************************************************************
-  double maxval_double(int size, double *data)
-  get the maximum value of double array
-*******************************************************************************/
-double maxval_double(int size, const double *data)
-{
-  int n;
-  double maxval;
-
-  maxval = data[0];
-  for(n=1; n<size; n++){
-    if( data[n] > maxval ) maxval = data[n];
-  }
-
-  return maxval;
-  
-}; /* maxval_double */
-
-
-/*******************************************************************************
-  double minval_double(int size, double *data)
-  get the minimum value of double array
-*******************************************************************************/
-double minval_double(int size, const double *data)
-{
-  int n;
-  double minval;
-
-  minval = data[0];
-  for(n=1; n<size; n++){
-    if( data[n] < minval ) minval = data[n];
-  }
-
-  return minval;
-  
-}; /* minval_double */
-
-/*******************************************************************************
-  double avgval_double(int size, double *data)
-  get the average value of double array
-*******************************************************************************/
-double avgval_double(int size, const double *data)
-{
-  int n;
-  double avgval;
-
-  avgval = 0;
-  for(n=0; n<size; n++) avgval += data[n];
-  avgval /= size;
-  
-  return avgval;
-  
-}; /* avgval_double */
-
-
-/*******************************************************************************
-  void latlon2xyz
-  Routine to map (lon, lat) to (x,y,z)
-******************************************************************************/
-void latlon2xyz(int size, const double *lon, const double *lat, double *x, double *y, double *z)
-{
-  int n;
-  
-  for(n=0; n<size; n++) {
-    x[n] = cos(lat[n])*cos(lon[n]);
-    y[n] = cos(lat[n])*sin(lon[n]);
-    z[n] = sin(lat[n]);
-  }
-
-} /* latlon2xyz */
-
-/*------------------------------------------------------------
-       void xyz2laton(np, p, xs, ys)
-   Transfer cartesian coordinates to spherical coordinates
-   ----------------------------------------------------------*/
-void xyz2latlon( int np, const double *x, const double *y, const double *z, double *lon, double *lat)
-{
-
-  double xx, yy, zz;
-  double dist, sinp;
-  int i;
-
-  for(i=0; i<np; i++) {
-    xx = x[i];
-    yy = y[i];
-    zz = z[i];
-    dist = sqrt(xx*xx+yy*yy+zz*zz);
-    xx /= dist;
-    yy /= dist;
-    zz /= dist;
-    
-    if ( fabs(xx)+fabs(yy)  < EPSLN ) 
-       lon[i] = 0;
-     else
-       lon[i] = atan2(yy, xx);
-     lat[i] = asin(zz);
-    
-     if ( lon[i] < 0.) lon[i] = 2.*M_PI + lon[i];
-  }
-
-} /* xyz2latlon */
-
-/*------------------------------------------------------------------------------
-  double box_area(double ll_lon, double ll_lat, double ur_lon, double ur_lat)
-  return the area of a lat-lon grid box. grid is in radians.
-  ----------------------------------------------------------------------------*/
-double box_area(double ll_lon, double ll_lat, double ur_lon, double ur_lat)
-{
-  double dx = ur_lon-ll_lon;
-  double area;
-  
-  if(dx > M_PI)  dx = dx - 2.0*M_PI;
-  if(dx < -M_PI) dx = dx + 2.0*M_PI;
-
-  return (dx*(sin(ur_lat)-sin(ll_lat))*RADIUS*RADIUS ) ;
-  
-}; /* box_area */
-
-
-/*------------------------------------------------------------------------------
-  double poly_area(const x[], const y[], int n)
-  obtains area of input polygon by line integrating -sin(lat)d(lon)
-  Vertex coordinates must be in degrees.
-  Vertices must be listed counter-clockwise around polygon.
-  grid is in radians.
-  ----------------------------------------------------------------------------*/
-double poly_area(const double x[], const double y[], int n)
-{
-  double area = 0.0;
-  int    i;
-
-  for (i=0;i<n;i++) {
-    int ip = (i+1) % n;
-    double dx = (x[ip]-x[i]);
-    double lat1, lat2;
-
-    lat1 = y[ip];
-    lat2 = y[i];
-    if(dx > M_PI)  dx = dx - 2.0*M_PI;
-    if(dx < -M_PI) dx = dx + 2.0*M_PI;
-    if (dx==0.0) continue;
-    
-    if ( fabs(lat1-lat2) < SMALL_VALUE) /* cheap area calculation along latitude */
-      area -= dx*sin(0.5*(lat1+lat2));
-    else
-      area += dx*(cos(lat1)-cos(lat2))/(lat1-lat2);
-  }
-  return area*RADIUS*RADIUS;
-
-}; /* poly_area */
-
-double poly_area_no_adjust(const double x[], const double y[], int n)
-{
-  double area = 0.0;
-  int    i;
-
-  for (i=0;i<n;i++) {
-    int ip = (i+1) % n;
-    double dx = (x[ip]-x[i]);
-    double lat1, lat2;
-
-    lat1 = y[ip];
-    lat2 = y[i];
-    if (dx==0.0) continue;
-    
-    if ( fabs(lat1-lat2) < SMALL_VALUE) /* cheap area calculation along latitude */
-      area -= dx*sin(0.5*(lat1+lat2));
-    else
-      area += dx*(cos(lat1)-cos(lat2))/(lat1-lat2);
-  }
-  return area*RADIUS*RADIUS;
-
-}; /* poly_area_no_adjust */
-
-int delete_vtx(double x[], double y[], int n, int n_del)
-{
-  for (;n_del<n-1;n_del++) {
-    x[n_del] = x[n_del+1];
-    y[n_del] = y[n_del+1];
-  }
-  
-  return (n-1);
-} /* delete_vtx */
-
-int insert_vtx(double x[], double y[], int n, int n_ins, double lon_in, double lat_in)
-{
-  int i;
-
-  for (i=n-1;i>=n_ins;i--) {
-    x[i+1] = x[i];
-    y[i+1] = y[i];
-  }
-  
-  x[n_ins] = lon_in;
-  y[n_ins] = lat_in;
-  return (n+1);
-} /* insert_vtx */
-
-void v_print(double x[], double y[], int n)
-{
-  int i;
-
-  for (i=0;i<n;i++) printf(" %20g   %20g\n", x[i], y[i]);
-} /* v_print */
-
-int fix_lon(double x[], double y[], int n, double tlon)
-{
-  double x_sum, dx;
-  int i, nn = n, pole = 0;
-
-  for (i=0;i<nn;i++) if (fabs(y[i])>=HPI-TOLORENCE) pole = 1;
-  if (0&&pole) {
-    printf("fixing pole cell\n");
-    v_print(x, y, nn);
-    printf("---------");
-  }
-
-  /* all pole points must be paired */
-  for (i=0;i<nn;i++) if (fabs(y[i])>=HPI-TOLORENCE) {
-    int im=(i+nn-1)%nn, ip=(i+1)%nn;
-
-    if (y[im]==y[i] && y[ip]==y[i]) {
-      nn = delete_vtx(x, y, nn, i);
-      i--;
-    } else if (y[im]!=y[i] && y[ip]!=y[i]) {
-      nn = insert_vtx(x, y, nn, i, x[i], y[i]);
-      i++;
-    }
-  }
-  /* first of pole pair has longitude of previous vertex */
-  /* second of pole pair has longitude of subsequent vertex */
-  for (i=0;i<nn;i++) if (fabs(y[i])>=HPI-TOLORENCE) {
-    int im=(i+nn-1)%nn, ip=(i+1)%nn;
-
-    if (y[im]!=y[i]) x[i] = x[im];
-    if (y[ip]!=y[i]) x[i] = x[ip];
-  }
-
-  if (nn) x_sum = x[0]; else return(0);
-  for (i=1;i<nn;i++) {
-    double dx = x[i]-x[i-1];
-
-    if      (dx < -M_PI) dx = dx + TPI;
-    else if (dx >  M_PI) dx = dx - TPI;
-    x_sum += (x[i] = x[i-1] + dx);
-  }
-
-  dx = (x_sum/nn)-tlon;
-  if      (dx < -M_PI) for (i=0;i<nn;i++) x[i] += TPI;
-  else if (dx >  M_PI) for (i=0;i<nn;i++) x[i] -= TPI;
-
-  if (0&&pole) {
-    printf("area=%g\n", poly_area(x, y,nn));
-    v_print(x, y, nn);
-    printf("---------");
-  }
-
-  return (nn);
-} /* fix_lon */
-
-
-/*------------------------------------------------------------------------------
-  double great_circle_distance()
-  computes distance between two points along a great circle
-  (the shortest distance between 2 points on a sphere)
-  returned in units of meter
-  ----------------------------------------------------------------------------*/
-double great_circle_distance(double *p1, double *p2)
-{
-  double dist, beta;
-  
-  /* This algorithm is not accurate for small distance 
-  dist = RADIUS*ACOS(SIN(p1[1])*SIN(p2[1]) + COS(p1[1])*COS(p2[1])*COS(p1[0]-p2[0]));
-  */
-  beta = 2.*asin( sqrt( sin((p1[1]-p2[1])/2.)*sin((p1[1]-p2[1])/2.) + 
-                               cos(p1[1])*cos(p2[1])*(sin((p1[0]-p2[0])/2.)*sin((p1[0]-p2[0])/2.)) ) );
-  dist = RADIUS*beta;
-  return dist;
-
-}; /* great_circle_distance */
-
-
-/*------------------------------------------------------------------------------
-  double spherical_angle(const double *p1, const double *p2, const double *p3)
-           p3
-         /
-        /
-       p1 ---> angle
-         \
-          \
-           p2
- -----------------------------------------------------------------------------*/
-double spherical_angle(const double *v1, const double *v2, const double *v3)
-{
-  double angle;
-  double px, py, pz, qx, qy, qz, ddd;
-
-  /* vector product between v1 and v2 */
-  px = v1[1]*v2[2] - v1[2]*v2[1];
-  py = v1[2]*v2[0] - v1[0]*v2[2];
-  pz = v1[0]*v2[1] - v1[1]*v2[0];
-  /* vector product between v1 and v3 */
-  qx = v1[1]*v3[2] - v1[2]*v3[1];
-  qy = v1[2]*v3[0] - v1[0]*v3[2];
-  qz = v1[0]*v3[1] - v1[1]*v3[0];
-    
-  /* angle between p and q */
-  ddd = sqrt( (px*px+py*py+pz*pz)*(qx*qx+qy*qy+qz*qz) );
-  if (ddd > 0) {
-    angle = acos((px*qx+py*qy+pz*qz)/ddd);
-  }
-  else
-    angle = 0.;
-
-  return angle;
-}; /* spherical_angle */
-
-/*------------------------------------------------------------------------------
-  double spherical_excess_area(p_lL, p_uL, p_lR, p_uR) 
-  get the surface area of a cell defined as a quadrilateral 
-  on the sphere. Area is computed as the spherical excess
-  [area units are m^2]
-  ----------------------------------------------------------------------------*/
-double spherical_excess_area(const double* p_ll, const double* p_ul,
-			     const double* p_lr, const double* p_ur, double radius)
-{
-  double area, ang1, ang2, ang3, ang4;
-  double v1[3], v2[3], v3[3];
-
-  /*   S-W: 1   */  
-  latlon2xyz(1, p_ll, p_ll+1, v1, v1+1, v1+2);
-  latlon2xyz(1, p_lr, p_lr+1, v2, v2+1, v2+2);
-  latlon2xyz(1, p_ul, p_ul+1, v3, v3+1, v3+2);
-  ang1 = spherical_angle(v1, v2, v3);
-
-  /*   S-E: 2   */  
-  latlon2xyz(1, p_lr, p_lr+1, v1, v1+1, v1+2);
-  latlon2xyz(1, p_ur, p_ur+1, v2, v2+1, v2+2);
-  latlon2xyz(1, p_ll, p_ll+1, v3, v3+1, v3+2);
-  ang2 = spherical_angle(v1, v2, v3);
-
-  /*   N-E: 3   */  
-  latlon2xyz(1, p_ur, p_ur+1, v1, v1+1, v1+2);
-  latlon2xyz(1, p_ul, p_ul+1, v2, v2+1, v2+2);
-  latlon2xyz(1, p_lr, p_lr+1, v3, v3+1, v3+2);
-  ang3 = spherical_angle(v1, v2, v3);
-  
-  /*   N-W: 4   */  
-  latlon2xyz(1, p_ul, p_ul+1, v1, v1+1, v1+2);
-  latlon2xyz(1, p_ur, p_ur+1, v2, v2+1, v2+2);
-  latlon2xyz(1, p_ll, p_ll+1, v3, v3+1, v3+2);
-  ang4 = spherical_angle(v1, v2, v3);
-
-  area = (ang1 + ang2 + ang3 + ang4 - 2.*M_PI) * radius* radius;
-
-  return area;
-  
-}; /* spherical_excess_area */
-
-
-/*----------------------------------------------------------------------
-    void vect_cross(e, p1, p2)
-    Perform cross products of 3D vectors: e = P1 X P2
-    -------------------------------------------------------------------*/
-    
-void vect_cross(const double *p1, const double *p2, double *e )
-{
-  
-  e[0] = p1[1]*p2[2] - p1[2]*p2[1];
-  e[1] = p1[2]*p2[0] - p1[0]*p2[2];
-  e[2] = p1[0]*p2[1] - p1[1]*p2[0];
-
-}; /* vect_cross */
-
-/* ----------------------------------------------------------------
-   make a unit vector
-   --------------------------------------------------------------*/
-void normalize_vect(double *e)
-{
-  double pdot;
-  int k;
-
-  pdot = e[0]*e[0] + e[1] * e[1] + e[2] * e[2];
-  pdot = sqrt( pdot ); 
-
-  for(k=0; k<3; k++) e[k] /= pdot;
-};
-
-
-/*------------------------------------------------------------------
-  void unit_vect_latlon(int size, lon, lat, vlon, vlat)
-
-  calculate unit vector for latlon in cartesian coordinates
-
-  ---------------------------------------------------------------------*/
-void unit_vect_latlon(int size, const double *lon, const double *lat, double *vlon, double *vlat)
-{
-  double sin_lon, cos_lon, sin_lat, cos_lat;
-  int n;
-  
-  for(n=0; n<size; n++) {
-    sin_lon = sin(lon[n]);
-    cos_lon = cos(lon[n]);
-    sin_lat = sin(lat[n]);
-    cos_lat = cos(lat[n]);
-    
-    vlon[3*n] = -sin_lon;
-    vlon[3*n+1] =  cos_lon;
-    vlon[3*n+2] =  0.;
-    
-    vlat[3*n]   = -sin_lat*cos_lon;
-    vlat[3*n+1] = -sin_lat*sin_lon;
-    vlat[3*n+2] =  cos_lat;
-  }
-}; /* unit_vect_latlon */
diff --git a/gridspec/shared/mosaic/mosaic_util.h b/gridspec/shared/mosaic/mosaic_util.h
deleted file mode 100644
index 7de4854..0000000
--- a/gridspec/shared/mosaic/mosaic_util.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/***********************************************************************
-                      mosaic_util.h
-    This header file provide some utilities routine that will be used in many tools.
-    
-    contact: Zhi.Liang at noaa.gov
-***********************************************************************/
-#ifndef MOSAIC_UTIL_H_
-#define MOSAIC_UTIL_H_
-
-#define min(a,b) (a<b ? a:b)
-#define max(a,b) (a>b ? a:b)
-#define SMALL_VALUE ( 1.e-10 )
-void error_handler(const char *msg);
-int nearest_index(double value, const double *array, int ia);
-int lon_fix(double *x, double *y, int n_in, double tlon);
-double minval_double(int size, const double *data);
-double maxval_double(int size, const double *data);
-double avgval_double(int size, const double *data);
-void latlon2xyz(int size, const double *lon, const double *lat, double *x, double *y, double *z); 
-void xyz2latlon(int size, const double *x, const double *y, const double *z, double *lon, double *lat);
-double box_area(double ll_lon, double ll_lat, double ur_lon, double ur_lat);
-double poly_area(const double lon[], const double lat[], int n);
-double poly_area_no_adjust(const double x[], const double y[], int n);
-int fix_lon(double lon[], double lat[], int n, double tlon);
-void tokenize(const char * const string, const char *tokens, unsigned int varlen,
-	      unsigned int maxvar, char * pstring, unsigned int * const nstr);
-double great_circle_distance(double *p1, double *p2);
-double spherical_excess_area(const double* p_ll, const double* p_ul,
-			     const double* p_lr, const double* p_ur, double radius);
-void vect_cross(const double *p1, const double *p2, double *e );
-double spherical_angle(const double *v1, const double *v2, const double *v3);
-void normalize_vect(double *e);
-void unit_vect_latlon(int size, const double *lon, const double *lat, double *vlon, double *vlat);
-#endif
diff --git a/gridspec/shared/mosaic/read_mosaic.c b/gridspec/shared/mosaic/read_mosaic.c
deleted file mode 100644
index e5ce4df..0000000
--- a/gridspec/shared/mosaic/read_mosaic.c
+++ /dev/null
@@ -1,700 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include "read_mosaic.h"
-#include "constant.h"
-#include "mosaic_util.h"
-#ifdef use_netCDF
-#include <netcdf.h>
-#endif
-/*********************************************************************
-    void netcdf_error( int status )
-    status is the returning value of netcdf call. this routine will
-    handle the error when status is not NC_NOERR.
-********************************************************************/
-void handle_netcdf_error(const char *msg, int status )
-{
-  char errmsg[512];
-
-  sprintf( errmsg, "%s: %s", msg, nc_strerror(status) );
-  error_handler(errmsg);
-
-}; /* handle_netcdf_error */
-
-/***************************************************************************
-  void get_file_dir(const char *file, char *dir)
-  get the directory where file is located. The dir will be the complate path
-  before the last "/". If no "/" exist in file, the path will be current ".".
-***************************************************************************/
-void get_file_dir(const char *file, char *dir)
-{
-  int len;
-  char *strptr = NULL;
-
-  /* get the diretory */
- 
-  strptr = strrchr(file, '/');
-  if(strptr) {
-    len = strptr - file;
-    strncpy(dir, file, len);
-  }
-  else {
-    len = 1;
-    strcpy(dir, ".");
-  }
-  dir[len] = 0;
-
-}; /* get_file_dir */
-
-
-int field_exist(const char* file, const char *name)
-{
-  int ncid, varid, status, existed;
-  char msg[512];  
-#ifdef use_netCDF
-  status = nc_open(file, NC_NOWRITE, &ncid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "field_exist: in opening file %s", file);
-    handle_netcdf_error(msg, status);
-  }
-  status = nc_inq_varid(ncid, name, &varid);  
-  if(status == NC_NOERR)
-    existed = 1;
-  else
-    existed = 0;
-    
-  status = nc_close(ncid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "field_exist: in closing file %s.", file);
-    handle_netcdf_error(msg, status);
-  }
-
-  return existed;
-#else
-  error_handler("read_mosaic: Add flag -Duse_netCDF when compiling");
-
-#endif
-  return 0; 
-}; /* field_exist */
-
-int get_dimlen(const char* file, const char *name)
-{
-  int ncid, dimid, status, len;
-  size_t size;
-  char msg[512];
-#ifdef use_netCDF  
-  status = nc_open(file, NC_NOWRITE, &ncid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in opening file %s", file);
-    handle_netcdf_error(msg, status);
-  }
-  
-  status = nc_inq_dimid(ncid, name, &dimid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in getting dimid of %s from file %s.", name, file);
-    handle_netcdf_error(msg, status);
-  }
-  
-  status = nc_inq_dimlen(ncid, dimid, &size);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in getting dimension size of %s from file %s.", name, file);
-    handle_netcdf_error(msg, status);
-  }
-  status = nc_close(ncid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in closing file %s.", file);
-    handle_netcdf_error(msg, status);
-  }
-  
-  len = size;
-  if(status != NC_NOERR) {
-    sprintf(msg, "in closing file %s", file);
-    handle_netcdf_error(msg, status);
-  }
-#else
-  error_handler("read_mosaic: Add flag -Duse_netCDF when compiling");
-#endif
-  
-  return len;
-  
-}; /* get_dimlen */
-
-/*******************************************************************************
-   void get_string_data(const char *file, const char *name, char *data)
-   get string data of field with "name" from "file".
-******************************************************************************/
-void get_string_data(const char *file, const char *name, char *data)
-{
-  int ncid, varid, status;
-  char msg[512];
-
-#ifdef use_netCDF    
-  status = nc_open(file, NC_NOWRITE, &ncid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in opening file %s", file);
-    handle_netcdf_error(msg, status);
-  }
-  status = nc_inq_varid(ncid, name, &varid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in getting varid of %s from file %s.", name, file);
-    handle_netcdf_error(msg, status);
-  }     
-  status = nc_get_var_text(ncid, varid, data);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in getting data of %s from file %s.", name, file);
-    handle_netcdf_error(msg, status);
-  }
-  status = nc_close(ncid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in closing file %s.", file);
-    handle_netcdf_error(msg, status);
-  }  
-#else
-  error_handler("read_mosaic: Add flag -Duse_netCDF when compiling");
-#endif
-  
-}; /* get_string_data */
-
-/*******************************************************************************
-   void get_string_data_level(const char *file, const char *name, const size_t *start, const size_t *nread, char *data)
-   get string data of field with "name" from "file".
-******************************************************************************/
-void get_string_data_level(const char *file, const char *name, char *data, const int *level)
-{
-  int ncid, varid, status, i;
-  size_t start[4], nread[4];
-  char msg[512];
-
-#ifdef use_netCDF  
-  status = nc_open(file, NC_NOWRITE, &ncid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in opening file %s", file);
-    handle_netcdf_error(msg, status);
-  }
-  status = nc_inq_varid(ncid, name, &varid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in getting varid of %s from file %s.", name, file);
-    handle_netcdf_error(msg, status);
-  }
-  for(i=0; i<4; i++) {
-    start[i] = 0; nread[i] = 1;
-  }
-  start[0] = *level; nread[1] = STRING;
-  status = nc_get_vara_text(ncid, varid, start, nread, data);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in getting data of %s from file %s.", name, file);
-    handle_netcdf_error(msg, status);
-  }
-  status = nc_close(ncid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in closing file %s.", file);
-    handle_netcdf_error(msg, status);
-  }  
-#else
-  error_handler("read_mosaic: Add flag -Duse_netCDF when compiling");
-#endif
-  
-}; /* get_string_data_level */
-
-
-/*******************************************************************************
-   void get_int_data(const char *file, const char *name, int *data)
-   get int data of field with "name" from "file".
-******************************************************************************/
-void get_int_data(const char *file, const char *name, int *data)
-{
-  int ncid, varid, status;
-  char msg[512];
-
-#ifdef use_netCDF    
-  status = nc_open(file, NC_NOWRITE, &ncid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in opening file %s", file);
-    handle_netcdf_error(msg, status);
-  }
-  status = nc_inq_varid(ncid, name, &varid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in getting varid of %s from file %s.", name, file);
-    handle_netcdf_error(msg, status);
-  }     
-  status = nc_get_var_int(ncid, varid, data);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in getting data of %s from file %s", name, file);
-    handle_netcdf_error(msg, status);
-  }
-  status = nc_close(ncid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in closing file %s.", file);
-    handle_netcdf_error(msg, status);
-  }  
-#else
-  error_handler("read_mosaic: Add flag -Duse_netCDF when compiling");
-#endif
-  
-}; /* get_int_data */
-
-/*******************************************************************************
-   void get_double_data(const char *file, const char *name, double *data)
-   get double data of field with "name" from "file".
-******************************************************************************/
-void get_double_data(const char *file, const char *name, double *data)
-{
-
-  int ncid, varid, status;  
-  char msg[512];
-
-#ifdef use_netCDF    
-  status = nc_open(file, NC_NOWRITE, &ncid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in opening file %s", file);
-    handle_netcdf_error(msg, status);
-  }
-  status = nc_inq_varid(ncid, name, &varid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in getting varid of %s from file %s.", name, file);
-    handle_netcdf_error(msg, status);
-  }     
-  status = nc_get_var_double(ncid, varid, data);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in getting data of %s from file %s.", name, file);
-    handle_netcdf_error(msg, status);
-  }
-  status = nc_close(ncid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in closing file %s.", file);
-    handle_netcdf_error(msg, status);
-  }  
-#else
-  error_handler("read_mosaic: Add flag -Duse_netCDF when compiling");
-#endif
-  
-}; /* get_double_data */
-
-/******************************************************************************
-   void get_var_text_att(const char *file, const char *name, const char *attname, char *att)
-   get text attribute of field 'name' from 'file
-******************************************************************************/
-void get_var_text_att(const char *file, const char *name, const char *attname, char *att)
-{
-  int ncid, varid, status;  
-  char msg[512];
-
-#ifdef use_netCDF    
-  status = nc_open(file, NC_NOWRITE, &ncid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in opening file %s", file);
-    handle_netcdf_error(msg, status);
-  }
-  status = nc_inq_varid(ncid, name, &varid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in getting varid of %s from file %s.", name, file);
-    handle_netcdf_error(msg, status);
-  }     
-  status = nc_get_att_text(ncid, varid, attname, att);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in getting attribute %s of %s from file %s.", attname, name, file);
-    handle_netcdf_error(msg, status);
-  }
-  status = nc_close(ncid);
-  if(status != NC_NOERR) {
-    sprintf(msg, "in closing file %s.", file);
-    handle_netcdf_error(msg, status);
-  }  
-#else
-  error_handler("read_mosaic: Add flag -Duse_netCDF when compiling");
-#endif
-  
-}; /* get_var_text_att */
-
-/***********************************************************************
-  return number of overlapping cells.
-***********************************************************************/
-#ifndef __AIX
-int read_mosaic_xgrid_size_( const char *xgrid_file )
-{
-  return read_mosaic_xgrid_size(xgrid_file);
-}
-#endif
-
-int read_mosaic_xgrid_size( const char *xgrid_file )
-{
-  int ncells;
-  
-  ncells = get_dimlen(xgrid_file, "ncells");
-  return ncells;
-}
-
-
-
-/****************************************************************************/
-#ifndef __AIX
-void read_mosaic_xgrid_order1_(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area )
-{
-  read_mosaic_xgrid_order1(xgrid_file, i1, j1, i2, j2, area);
-  
-};
-#endif
-
-void read_mosaic_xgrid_order1(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area )
-{
-  int    ncells, n;
-  int    *tile1_cell, *tile2_cell;
-  double garea;
-  
-  ncells = get_dimlen(xgrid_file, "ncells");
-
-  tile1_cell       = (int *)malloc(ncells*2*sizeof(int));
-  tile2_cell       = (int *)malloc(ncells*2*sizeof(int));
-  get_int_data(xgrid_file, "tile1_cell", tile1_cell);
-  get_int_data(xgrid_file, "tile2_cell", tile2_cell);
-  get_double_data(xgrid_file, "xgrid_area", area);
-  garea = 4*M_PI*RADIUS*RADIUS;
-  
-  for(n=0; n<ncells; n++) {
-    i1[n] = tile1_cell[n*2] - 1;
-    j1[n] = tile1_cell[n*2+1] - 1;
-    i2[n] = tile2_cell[n*2] - 1;
-    j2[n] = tile2_cell[n*2+1] - 1;
-    area[n] /= garea; /* rescale the exchange grid area to unit earth area */
-  }
-
-  free(tile1_cell);
-  free(tile2_cell);
-  
-}; /* read_mosaic_xgrid_order1 */
-
-/* NOTE: di, dj is for tile1, */
-/****************************************************************************/
-#ifndef __AIX
-void read_mosaic_xgrid_order2_(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area, double *di, double *dj )
-{
-  read_mosaic_xgrid_order2(xgrid_file, i1, j1, i2, j2, area, di, dj);
-  
-};
-#endif
-
-void read_mosaic_xgrid_order2(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area, double *di, double *dj )
-{
-  int    ncells, n;
-  int    *tile1_cell, *tile2_cell;
-  double *tile1_distance;
-  double garea;
-  
-  ncells = get_dimlen(xgrid_file, "ncells");
-
-  tile1_cell       = (int    *)malloc(ncells*2*sizeof(int   ));
-  tile2_cell       = (int    *)malloc(ncells*2*sizeof(int   ));
-  tile1_distance   = (double *)malloc(ncells*2*sizeof(double));
-  get_int_data(xgrid_file, "tile1_cell", tile1_cell);
-  get_int_data(xgrid_file, "tile2_cell", tile2_cell);
-  get_double_data(xgrid_file, "xgrid_area", area);
-  get_double_data(xgrid_file, "tile1_distance", tile1_distance);
-  garea = 4*M_PI*RADIUS*RADIUS;
-  
-  for(n=0; n<ncells; n++) {
-    i1[n] = tile1_cell[n*2] - 1;
-    j1[n] = tile1_cell[n*2+1] - 1;
-    i2[n] = tile2_cell[n*2] - 1;
-    j2[n] = tile2_cell[n*2+1] - 1;
-    di[n] = tile1_distance[n*2];
-    dj[n] = tile1_distance[n*2+1];
-    area[n] /= garea; /* rescale the exchange grid area to unit earth area */
-  }
-
-  free(tile1_cell);
-  free(tile2_cell);
-  free(tile1_distance);
-  
-}; /* read_mosaic_xgrid_order2 */
-
-/******************************************************************************
-  int read_mosaic_ntiles(const char *mosaic_file)
-  return number tiles in mosaic_file
-******************************************************************************/
-#ifndef __AIX
-int read_mosaic_ntiles_(const char *mosaic_file)
-{
-  return read_mosaic_ntiles(mosaic_file);
-}
-#endif
-int read_mosaic_ntiles(const char *mosaic_file)
-{
-
-  int ntiles;
-
-  ntiles = get_dimlen(mosaic_file, "ntiles");
-
-  return ntiles;
-  
-}; /* read_mosaic_ntiles */
-
-/******************************************************************************
-  int read_mosaic_ncontacts(const char *mosaic_file)
-  return number of contacts in mosaic_file
-******************************************************************************/
-#ifndef __AIX
-int read_mosaic_ncontacts_(const char *mosaic_file)
-{
-  return read_mosaic_ncontacts(mosaic_file);
-}
-#endif
-int read_mosaic_ncontacts(const char *mosaic_file)
-{
-  char contact_file[STRING], file[STRING], dir[STRING];
-  int ncontacts;
-
-  if(field_exist(mosaic_file, CONTACT_FILES_NAME) ) {
-    get_file_dir(mosaic_file, dir);
-    get_string_data(mosaic_file, CONTACT_FILES_NAME, file);
-    sprintf(contact_file, "%s/%s", dir, file);
-    ncontacts = get_dimlen(contact_file, NCONTACT_NAME);
-  }
-  else
-    ncontacts = 0;
-  
-  return ncontacts;
-  
-}; /* read_mosaic_ncontacts */
-
-
-/*****************************************************************************
-  void read_mosaic_grid_sizes(const char *mosaic_file, int *nx, int *ny)
-  read mosaic grid size of each tile, currently we are assuming the refinement is 2.
-  We assume the grid files are located at the same directory as mosaic_file.
-*****************************************************************************/
-#ifndef __AIX
-void read_mosaic_grid_sizes_(const char *mosaic_file, int *nx, int *ny)
-{
-  read_mosaic_grid_sizes(mosaic_file, nx, ny);
-}
-#endif
-void read_mosaic_grid_sizes(const char *mosaic_file, int *nx, int *ny)
-{
-  int ntiles, n;
-  char gridfile[STRING], tilefile[2*STRING];
-  char dir[STRING];
-  const int x_refine = 2, y_refine = 2;
-
-  get_file_dir(mosaic_file, dir);  
-  ntiles = get_dimlen(mosaic_file, "ntiles");
-  for(n = 0; n < ntiles; n++) {
-    get_string_data_level(mosaic_file, "gridfiles", gridfile, &n);
-    sprintf(tilefile, "%s/%s", dir, gridfile);
-    nx[n] = get_dimlen(tilefile, "nx");
-    ny[n] = get_dimlen(tilefile, "ny");
-    if(nx[n]%x_refine != 0) error_handler("Error from read_mosaic_grid_sizes: nx is not divided by x_refine");
-    if(ny[n]%y_refine != 0) error_handler("Error from read_mosaic_grid_sizes: ny is not divided by y_refine");
-    nx[n] /= x_refine;
-    ny[n] /= y_refine;
-  }
-  
-}; /* read_mosaic_grid_sizes */
-  
-
-/******************************************************************************
-  void read_mosaic_contact(const char *mosaic_file)
-  read mosaic contact information
-******************************************************************************/
-#ifndef __AIX
-void read_mosaic_contact_(const char *mosaic_file, int *tile1, int *tile2, int *istart1, int *iend1,
-			 int *jstart1, int *jend1, int *istart2, int *iend2, int *jstart2, int *jend2)
-{
-  read_mosaic_contact(mosaic_file, tile1, tile2, istart1, iend1, jstart1, jend1, istart2, iend2, jstart2, jend2);
-}
-#endif
-
-void read_mosaic_contact(const char *mosaic_file, int *tile1, int *tile2, int *istart1, int *iend1,
-			 int *jstart1, int *jend1, int *istart2, int *iend2, int *jstart2, int *jend2)
-{
-  char contacts[STRING], tilefile[STRING], tilepath[STRING];
-  char **gridtiles;
-#define MAXVAR 40
-  char pstring[MAXVAR][STRING];
-  int ntiles, ncontacts, n, m, l, nstr, found;
-  const int x_refine = 2, y_refine = 2;
-  char contact_file[STRING], file[STRING], dir[STRING];
-
-  get_file_dir(mosaic_file, dir);  
-  ntiles = get_dimlen(mosaic_file, "ntiles");
-  gridtiles = (char **)malloc(ntiles*sizeof(char *));
-  for(n=0; n<ntiles; n++) {
-    gridtiles[n] = (char *)malloc(STRING*sizeof(char));
-    get_string_data_level(mosaic_file,  TILE_FILES_NAME, tilefile, &n);
-    sprintf(tilepath,"%s/%s", dir, tilefile);
-    get_string_data(tilepath, TILE_NAME, gridtiles[n]);
-  }
-
-  get_string_data(mosaic_file, CONTACT_FILES_NAME, file);
-  sprintf(contact_file, "%s/%s", dir, file);    
-  ncontacts = get_dimlen(contact_file, NCONTACT_NAME);
-  for(n = 0; n < ncontacts; n++) {
-    get_string_data_level(contact_file, "contacts", contacts, &n);
-    /* parse the string contacts to get tile number */
-    tokenize( contacts, ":", STRING, MAXVAR, pstring, &nstr);
-    if(nstr != 4) error_handler("Error from read_mosaic: number of elements "
-				 "in contact seperated by :/:: should be 4");
-    found = 0;
-    for(m=0; m<ntiles; m++) {
-      if(strcmp(gridtiles[m], pstring[1]) == 0) { /*found the tile name */
-	found = 1;
-	tile1[n] = m+1;
-	break;
-      }
-    }
-    if(!found) error_handler("error from read_mosaic: the first tile name specified "
-			     "in contact is not found in tile list");
-    found = 0;
-    for(m=0; m<ntiles; m++) {
-      if(strcmp(gridtiles[m], pstring[3]) == 0) { /*found the tile name */
-	found = 1;
-	tile2[n] = m+1;
-	break;
-      }
-    }
-    if(!found) error_handler("error from read_mosaic: the second tile name specified "
-			     "in contact is not found in tile list");    
-    get_string_data_level(contact_file, "contact_index", contacts, &n);
-    /* parse the string to get contact index */
-    tokenize( contacts, ":,", STRING, MAXVAR, pstring, &nstr);
-    if(nstr != 8) error_handler("Error from read_mosaic: number of elements "
-				 "in contact_index seperated by :/, should be 8");
-    /* make sure the string is only composed of numbers */
-    for(m=0; m<nstr; m++) for(l=0; l<strlen(pstring[m]); l++) {
-      if(pstring[m][l] > '9' ||  pstring[m][l] < '0' ) {
-	error_handler("Error from read_mosaic: some of the character in "
-		      "contact_indices except token is not digit number");
-      }
-    }
-    istart1[n] = atoi(pstring[0]);
-    iend1[n]   = atoi(pstring[1]);
-    jstart1[n] = atoi(pstring[2]);
-    jend1[n]   = atoi(pstring[3]);
-    istart2[n] = atoi(pstring[4]);
-    iend2[n]   = atoi(pstring[5]);
-    jstart2[n] = atoi(pstring[6]);
-    jend2[n]   = atoi(pstring[7]);
-    if(istart1[n] == iend1[n] ) {
-      istart1[n] = (istart1[n]+1)/x_refine-1;
-      iend1[n]   = istart1[n];
-      if( jend1[n] > jstart1[n] ) {
-	jstart1[n] -= 1;
-	jend1[n]   -= y_refine;
-      }
-      else if( jend1[n] < jstart1[n] ) {
-	jstart1[n] -= y_refine;
-	jend1[n]   -= 1;
-      }
-      else
-	error_handler("Error from read_mosaic_contact: jstart1 and jend1 should not be equal when istart1=iend1");
-
-      if(jstart1[n]%y_refine || jend1[n]%y_refine)
-	error_handler("Error from read_mosaic_contact: mismatch between y_refine and jstart1/jend1 when istart1=iend1");
-      jstart1[n] /= y_refine;
-      jend1[n]   /= y_refine;
-    }
-    else if( jstart1[n] == jend1[n] ) {
-      jstart1[n] = (jstart1[n]+1)/y_refine-1;
-      jend1[n]   = jstart1[n];      
-      if(iend1[n] > istart1[n] ) {
-	istart1[n] -= 1;
-	iend1[n]   -= x_refine;
-      }
-      else if(istart1[n] > iend1[n] ) {
-	istart1[n] -= x_refine;
-	iend1[n]   -= 1;	
-      }
-      else
-	error_handler("Error from read_mosaic_contact: istart1 and iend1 should not be equal when jstart1=jend1");
-      
-      if(istart1[n]%x_refine || iend1[n]%x_refine)
-	error_handler("Error from read_mosaic_contact: mismatch between x_refine and istart1/iend1 when jstart1=jend1");
-      istart1[n] /= x_refine;
-      iend1[n]   /= x_refine;
-    }
-    else {
-      error_handler("Error from read_mosaic_contact: only line contact is supported now, contact developer");
-    }
-    if(istart2[n] == iend2[n] ) {
-      istart2[n] = (istart2[n]+1)/x_refine-1;
-      iend2[n]   = istart2[n];
-      if( jend2[n] > jstart2[n] ) {
-	jstart2[n] -= 1;
-	jend2[n]   -= y_refine;
-      }
-      else if( jstart2[n] > jend2[n] ) {
-	jstart2[n] -= y_refine;
-	jend2[n]   -= 1;
-      }
-      else
-	error_handler("Error from read_mosaic_contact: jstart2 and jend2 should not be equal when istart2=iend2");
-      
-      if(jstart2[n]%y_refine || jend2[n]%y_refine )
-	error_handler("Error from read_mosaic_contact: mismatch between y_refine and jstart2/jend2 when istart2=iend2");
-
-      jstart2[n] /= y_refine;
-      jend2[n]   /= y_refine;
-    }
-    else if( jstart2[n] == jend2[n] ) {
-      jstart2[n] = (jstart2[n]+1)/y_refine-1;
-      jend2[n]   = jstart2[n];
-      if(iend2[n] > istart2[n] ) {
-	istart2[n] -= 1;
-	iend2[n]   -= x_refine;
-      }
-      else if(istart2[n] > iend2[n] ) {
-	istart2[n] -= x_refine;
-	iend2[n]   -= 1;
-      }
-      else
-	error_handler("Error from read_mosaic_contact: istart2 and iend2 should not be equal when jstart2=jend2");
-      
-      if(istart2[n]%x_refine || iend2[n]%x_refine)
-	error_handler("Error from read_mosaic_contact: mismatch between x_refine and istart2/iend2 when jstart2=jend2");
-      istart2[n] /= x_refine;
-      iend2[n]   /= x_refine;
-    }
-    else {
-      error_handler("Error from read_mosaic_contact: only line contact is supported now, contact developer");
-    }
-
-  }
-
-}; /* read_mosaic_contact */
-
-
-/******************************************************************************
-  void read_mosaic_grid_data(const char *mosaic_file, const char *name, int nx, int ny,
-                             double *data, int level, int ioff, int joff)
-  read mosaic grid information onto model grid. We assume the refinement is 2 right now.
-  We may remove this restriction in the future. nx and ny are model grid size. level
-  is the tile number. ioff and joff to indicate grid location. ioff =0 and joff = 0
-  for C-cell. ioff=0 and joff=1 for E-cell, ioff=1 and joff=0 for N-cell,
-  ioff=1 and joff=1 for T-cell
-******************************************************************************/
-void read_mosaic_grid_data(const char *mosaic_file, const char *name, int nx, int ny,
-                           double *data, int level, int ioff, int joff)
-{
-  char   tilefile[STRING], gridfile[STRING], dir[STRING];
-  double *tmp;
-  int    ni, nj, nxp, nyp, i, j;
-
-  get_file_dir(mosaic_file, dir);
-  
-  get_string_data_level(mosaic_file, "gridfiles", gridfile, &level);
-  sprintf(tilefile, "%s/%s", dir, gridfile);
-  
-  ni = get_dimlen(tilefile, "nx");
-  nj = get_dimlen(tilefile, "ny");
-
-  if( ni != nx*2 || nj != ny*2) error_handler("supergrid size should be double of the model grid size");
-  tmp = (double *)malloc((ni+1)*(nj+1)*sizeof(double));
-  get_double_data( tilefile, name, tmp);
-  nxp = nx + 1 - ioff;
-  nyp = ny + 1 - joff;
-  for(j=0; j<nyp; j++) for(i=0; i<nxp; i++) data[j*nxp+i] = tmp[(2*j+joff)*(ni+1)+2*i+ioff];
-  free(tmp);
-   
-}; /* read_mosaic_grid_data */
-
-
diff --git a/gridspec/shared/mosaic/read_mosaic.h b/gridspec/shared/mosaic/read_mosaic.h
deleted file mode 100644
index b698cc6..0000000
--- a/gridspec/shared/mosaic/read_mosaic.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef READ_MOSAIC_H_
-#define READ_MOSAIC_H_
-
-int read_mosaic_xgrid_size( const char *xgrid_file );
-void read_mosaic_xgrid_order1(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, double *area );
-void read_mosaic_xgrid_order2(const char *xgrid_file, int *i1, int *j1, int *i2, int *j2, 
-                              double *area, double *di, double *dj );
-int read_mosaic_ntiles(const char *mosaic_file);
-int read_mosaic_ncontacts(const char *mosaic_file);
-void read_mosaic_grid_sizes(const char *mosaic_file, int *nx, int *ny);
-void read_mosaic_contact(const char *mosaic_file, int *tile1, int *tile2, int *istart1, int *iend1,
-			 int *jstart1, int *jend1, int *istart2, int *iend2, int *jstart2, int *jend2);
-void read_mosaic_grid_data(const char *mosaic_file, const char *name, int nx, int ny,
-                           double *data, int level, int ioff, int joff);
-#endif
diff --git a/gridspec/tools/Makefile.am b/gridspec/tools/Makefile.am
deleted file mode 100644
index 7e4387a..0000000
--- a/gridspec/tools/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-SUBDIRS = shared make_hgrid make_vgrid make_mosaic fregrid make_topog	\
-make_coupler_mosaic
-
-# These tests must be turned on with --enable-gridspec-file-tests.
-if BUILD_GRIDSPEC_FILE_TESTS
-TESTS = get_data.sh test.sh test_all.sh
-endif
-
-EXTRA_DIST = test.sh test_all.sh get_data.sh
-CLEANFILES = *.nc
-
-
diff --git a/gridspec/tools/Makefile.in b/gridspec/tools/Makefile.in
deleted file mode 100644
index 85ebdec..0000000
--- a/gridspec/tools/Makefile.in
+++ /dev/null
@@ -1,672 +0,0 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = gridspec/tools
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-SOURCES =
-DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
-	html-recursive info-recursive install-data-recursive \
-	install-dvi-recursive install-exec-recursive \
-	install-html-recursive install-info-recursive \
-	install-pdf-recursive install-ps-recursive install-recursive \
-	installcheck-recursive installdirs-recursive pdf-recursive \
-	ps-recursive uninstall-recursive
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
-  distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
-	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
-	distdir
-ETAGS = etags
-CTAGS = ctags
-am__tty_colors = \
-red=; grn=; lgn=; blu=; std=
-DIST_SUBDIRS = $(SUBDIRS)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-am__relativize = \
-  dir0=`pwd`; \
-  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
-  sed_rest='s,^[^/]*/*,,'; \
-  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
-  sed_butlast='s,/*[^/]*$$,,'; \
-  while test -n "$$dir1"; do \
-    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
-    if test "$$first" != "."; then \
-      if test "$$first" = ".."; then \
-        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
-        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
-      else \
-        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
-        if test "$$first2" = "$$first"; then \
-          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
-        else \
-          dir2="../$$dir2"; \
-        fi; \
-        dir0="$$dir0"/"$$first"; \
-      fi; \
-    fi; \
-    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
-  done; \
-  reldir="$$dir2"
-ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
-AMTAR = @AMTAR@
-AR = @AR@
-AS = @AS@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-F77 = @F77@
-FC = @FC@
-FCFLAGS = @FCFLAGS@
-FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
-FGREP = @FGREP@
-GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-MOD_FLAG = @MOD_FLAG@
-NCDUMPDIR = @NCDUMPDIR@
-NETCDFDIR = @NETCDFDIR@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
-VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
-ac_ct_FC = @ac_ct_FC@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-SUBDIRS = shared make_hgrid make_vgrid make_mosaic fregrid make_topog	\
-make_coupler_mosaic
-
-
-# These tests must be turned on with --enable-gridspec-file-tests.
- at BUILD_GRIDSPEC_FILE_TESTS_TRUE@TESTS = get_data.sh test.sh test_all.sh
-EXTRA_DIST = test.sh test_all.sh get_data.sh
-CLEANFILES = *.nc
-all: all-recursive
-
-.SUFFIXES:
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-	        && { if test -f $@; then exit 0; else break; fi; }; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec/tools/Makefile'; \
-	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign gridspec/tools/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-
-# 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,
-# (1) if the variable is set in `config.status', edit `config.status'
-#     (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
-	dot_seen=no; \
-	target=`echo $@ | sed s/-recursive//`; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    dot_seen=yes; \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done; \
-	if test "$$dot_seen" = "no"; then \
-	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
-	fi; test -z "$$fail"
-
-$(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
-	dot_seen=no; \
-	case "$@" in \
-	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-	  *) list='$(SUBDIRS)' ;; \
-	esac; \
-	rev=''; for subdir in $$list; do \
-	  if test "$$subdir" = "."; then :; else \
-	    rev="$$subdir $$rev"; \
-	  fi; \
-	done; \
-	rev="$$rev ."; \
-	target=`echo $@ | sed s/-recursive//`; \
-	for subdir in $$rev; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done && test -z "$$fail"
-tags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
-	done
-ctags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
-	done
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	set x; \
-	here=`pwd`; \
-	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
-	  include_option=--etags-include; \
-	  empty_fix=.; \
-	else \
-	  include_option=--include; \
-	  empty_fix=; \
-	fi; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    test ! -f $$subdir/TAGS || \
-	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
-	  fi; \
-	done; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	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
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	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"
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-check-TESTS: $(TESTS)
-	@failed=0; all=0; xfail=0; xpass=0; skip=0; \
-	srcdir=$(srcdir); export srcdir; \
-	list=' $(TESTS) '; \
-	$(am__tty_colors); \
-	if test -n "$$list"; then \
-	  for tst in $$list; do \
-	    if test -f ./$$tst; then dir=./; \
-	    elif test -f $$tst; then dir=; \
-	    else dir="$(srcdir)/"; fi; \
-	    if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
-	      all=`expr $$all + 1`; \
-	      case " $(XFAIL_TESTS) " in \
-	      *[\ \	]$$tst[\ \	]*) \
-		xpass=`expr $$xpass + 1`; \
-		failed=`expr $$failed + 1`; \
-		col=$$red; res=XPASS; \
-	      ;; \
-	      *) \
-		col=$$grn; res=PASS; \
-	      ;; \
-	      esac; \
-	    elif test $$? -ne 77; then \
-	      all=`expr $$all + 1`; \
-	      case " $(XFAIL_TESTS) " in \
-	      *[\ \	]$$tst[\ \	]*) \
-		xfail=`expr $$xfail + 1`; \
-		col=$$lgn; res=XFAIL; \
-	      ;; \
-	      *) \
-		failed=`expr $$failed + 1`; \
-		col=$$red; res=FAIL; \
-	      ;; \
-	      esac; \
-	    else \
-	      skip=`expr $$skip + 1`; \
-	      col=$$blu; res=SKIP; \
-	    fi; \
-	    echo "$${col}$$res$${std}: $$tst"; \
-	  done; \
-	  if test "$$all" -eq 1; then \
-	    tests="test"; \
-	    All=""; \
-	  else \
-	    tests="tests"; \
-	    All="All "; \
-	  fi; \
-	  if test "$$failed" -eq 0; then \
-	    if test "$$xfail" -eq 0; then \
-	      banner="$$All$$all $$tests passed"; \
-	    else \
-	      if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
-	      banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
-	    fi; \
-	  else \
-	    if test "$$xpass" -eq 0; then \
-	      banner="$$failed of $$all $$tests failed"; \
-	    else \
-	      if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
-	      banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
-	    fi; \
-	  fi; \
-	  dashes="$$banner"; \
-	  skipped=""; \
-	  if test "$$skip" -ne 0; then \
-	    if test "$$skip" -eq 1; then \
-	      skipped="($$skip test was not run)"; \
-	    else \
-	      skipped="($$skip tests were not run)"; \
-	    fi; \
-	    test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
-	      dashes="$$skipped"; \
-	  fi; \
-	  report=""; \
-	  if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
-	    report="Please report to $(PACKAGE_BUGREPORT)"; \
-	    test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
-	      dashes="$$report"; \
-	  fi; \
-	  dashes=`echo "$$dashes" | sed s/./=/g`; \
-	  if test "$$failed" -eq 0; then \
-	    echo "$$grn$$dashes"; \
-	  else \
-	    echo "$$red$$dashes"; \
-	  fi; \
-	  echo "$$banner"; \
-	  test -z "$$skipped" || echo "$$skipped"; \
-	  test -z "$$report" || echo "$$report"; \
-	  echo "$$dashes$$std"; \
-	  test "$$failed" -eq 0; \
-	else :; fi
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d "$(distdir)/$$file"; then \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-	  else \
-	    test -f "$(distdir)/$$file" \
-	    || cp -p $$d/$$file "$(distdir)/$$file" \
-	    || exit 1; \
-	  fi; \
-	done
-	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	  fi; \
-	done
-	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
-	    $(am__relativize); \
-	    new_distdir=$$reldir; \
-	    dir1=$$subdir; dir2="$(top_distdir)"; \
-	    $(am__relativize); \
-	    new_top_distdir=$$reldir; \
-	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
-	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
-	    ($(am__cd) $$subdir && \
-	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$new_top_distdir" \
-	        distdir="$$new_distdir" \
-		am__remove_distdir=: \
-		am__skip_length_check=: \
-		am__skip_mode_fix=: \
-	        distdir) \
-	      || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
-check: check-recursive
-all-am: Makefile
-installdirs: installdirs-recursive
-installdirs-am:
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-recursive
-install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-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)
-
-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
-
-distclean: distclean-recursive
-	-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-tags
-
-dvi: dvi-recursive
-
-dvi-am:
-
-html: html-recursive
-
-html-am:
-
-info: info-recursive
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-recursive
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-recursive
-
-install-html-am:
-
-install-info: install-info-recursive
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-recursive
-
-install-pdf-am:
-
-install-ps: install-ps-recursive
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-recursive
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-recursive
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-recursive
-
-pdf-am:
-
-ps: ps-recursive
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \
-	ctags-recursive install-am install-strip tags-recursive
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
-	all all-am check check-TESTS check-am clean clean-generic \
-	clean-libtool ctags ctags-recursive 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 pdf pdf-am ps ps-am \
-	tags tags-recursive uninstall uninstall-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.
-.NOEXPORT:
diff --git a/gridspec/tools/fregrid/Makefile.am b/gridspec/tools/fregrid/Makefile.am
deleted file mode 100644
index 5549fbc..0000000
--- a/gridspec/tools/fregrid/Makefile.am
+++ /dev/null
@@ -1,66 +0,0 @@
-## This is an automake file, part of Unidata's NetCDF CF Library
-## package. Copyright 2009, see the COPYRIGHT file for more
-## information.
-
-# This automake file is in charge of building the gridspec
-# fregrid tool.
-
-# $Id: Makefile.am,v 1.4 2009/11/16 14:07:35 zhi Exp $
-
-bin_PROGRAMS = fregrid
-fregrid_SOURCES = fregrid.c
-
-# Initalize these.
-AM_CPPFLAGS = -I$(top_srcdir)/gridspec/tools/shared	\
--I$(top_srcdir)/gridspec/shared/mosaic
-AM_LDFLAGS = -L../shared -L../../shared/mosaic
-LDADD = -ltoolsshared -lshared -lnetcdf -lm
-
-if USE_NETCDF_DIR
-AM_CPPFLAGS += -I at NETCDFDIR@/include
-AM_LDFLAGS += -L at NETCDFDIR@/lib
-LDADD += -lnetcdf
-else
-if USE_NETCDF4
-LDADD += ../../../../libsrc4/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc4
-AM_LDFLAGS += -L../../../../libsrc4
-else
-LDADD += ../../../../libsrc/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc
-AM_LDFLAGS += -L../../../../libsrc
-endif # USE_NETCDF4
-endif # USE_NETCDF_DIR
-
-if USE_NETCDF4
-LDADD += -lhdf5_hl -lhdf5 -lz 
-endif
-
-if USE_HDF4
-LDADD += -lmfhdf -ldf -ljpeg
-endif # USE_HDF4
-
-# If the user specified a root for HDF5, use it.
-if USE_HDF5_DIR
-AM_CPPFLAGS += -I at HDF5DIR@/include
-AM_LDFLAGS += -L at HDF5DIR@/lib
-endif
-
-# If the user specified a prefix for the HDF4 library location, use it.
-if USE_HDF4_DIR
-AM_CPPFLAGS += -I at HDF4DIR@/include
-AM_LDFLAGS += -L at HDF4DIR@/lib
-endif
-
-# If the user specified a root location for ZLIB, use it.
-if USE_ZLIB_DIR
-AM_CPPFLAGS += -I at ZLIBDIR@/include
-AM_LDFLAGS += -L at ZLIBDIR@/lib
-endif
-
-# If the user specified a root location for SZLIB, use it.
-if USE_SZLIB_DIR
-AM_CPPFLAGS += -I at SZLIBDIR@/include
-AM_LDFLAGS += -L at SZLIBDIR@/lib
-endif
-
diff --git a/gridspec/tools/fregrid/Makefile.in b/gridspec/tools/fregrid/Makefile.in
deleted file mode 100644
index 3784c9f..0000000
--- a/gridspec/tools/fregrid/Makefile.in
+++ /dev/null
@@ -1,571 +0,0 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-
-# This automake file is in charge of building the gridspec
-# fregrid tool.
-
-# $Id: Makefile.am,v 1.4 2009/11/16 14:07:35 zhi Exp $
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-bin_PROGRAMS = fregrid$(EXEEXT)
- at USE_NETCDF_DIR_TRUE@am__append_1 = -I at NETCDFDIR@/include
- at USE_NETCDF_DIR_TRUE@am__append_2 = -L at NETCDFDIR@/lib
- at USE_NETCDF_DIR_TRUE@am__append_3 = -lnetcdf
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_4 = ../../../../libsrc4/libnetcdf.la 
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_5 = -I$(top_srcdir)/../libsrc4
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_6 = -L../../../../libsrc4
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_7 = ../../../../libsrc/libnetcdf.la 
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_8 = -I$(top_srcdir)/../libsrc
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_9 = -L../../../../libsrc
- at USE_NETCDF4_TRUE@am__append_10 = -lhdf5_hl -lhdf5 -lz 
- at USE_HDF4_TRUE@am__append_11 = -lmfhdf -ldf -ljpeg
-
-# If the user specified a root for HDF5, use it.
- at USE_HDF5_DIR_TRUE@am__append_12 = -I at HDF5DIR@/include
- at USE_HDF5_DIR_TRUE@am__append_13 = -L at HDF5DIR@/lib
-
-# If the user specified a prefix for the HDF4 library location, use it.
- at USE_HDF4_DIR_TRUE@am__append_14 = -I at HDF4DIR@/include
- at USE_HDF4_DIR_TRUE@am__append_15 = -L at HDF4DIR@/lib
-
-# If the user specified a root location for ZLIB, use it.
- at USE_ZLIB_DIR_TRUE@am__append_16 = -I at ZLIBDIR@/include
- at USE_ZLIB_DIR_TRUE@am__append_17 = -L at ZLIBDIR@/lib
-
-# If the user specified a root location for SZLIB, use it.
- at USE_SZLIB_DIR_TRUE@am__append_18 = -I at SZLIBDIR@/include
- at USE_SZLIB_DIR_TRUE@am__append_19 = -L at SZLIBDIR@/lib
-subdir = gridspec/tools/fregrid
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = "$(DESTDIR)$(bindir)"
-PROGRAMS = $(bin_PROGRAMS)
-am_fregrid_OBJECTS = fregrid.$(OBJEXT)
-fregrid_OBJECTS = $(am_fregrid_OBJECTS)
-fregrid_LDADD = $(LDADD)
-am__DEPENDENCIES_1 =
-fregrid_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__append_4) \
-	$(am__append_7) $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
-SOURCES = $(fregrid_SOURCES)
-DIST_SOURCES = $(fregrid_SOURCES)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
-AMTAR = @AMTAR@
-AR = @AR@
-AS = @AS@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-F77 = @F77@
-FC = @FC@
-FCFLAGS = @FCFLAGS@
-FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
-FGREP = @FGREP@
-GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-MOD_FLAG = @MOD_FLAG@
-NCDUMPDIR = @NCDUMPDIR@
-NETCDFDIR = @NETCDFDIR@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
-VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
-ac_ct_FC = @ac_ct_FC@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-fregrid_SOURCES = fregrid.c
-
-# Initalize these.
-AM_CPPFLAGS = -I$(top_srcdir)/gridspec/tools/shared \
-	-I$(top_srcdir)/gridspec/shared/mosaic $(am__append_1) \
-	$(am__append_5) $(am__append_8) $(am__append_12) \
-	$(am__append_14) $(am__append_16) $(am__append_18)
-AM_LDFLAGS = -L../shared -L../../shared/mosaic $(am__append_2) \
-	$(am__append_6) $(am__append_9) $(am__append_13) \
-	$(am__append_15) $(am__append_17) $(am__append_19)
-LDADD = -ltoolsshared -lshared -lnetcdf -lm $(am__append_3) \
-	$(am__append_4) $(am__append_7) $(am__append_10) \
-	$(am__append_11)
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-	        && { if test -f $@; then exit 0; else break; fi; }; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec/tools/fregrid/Makefile'; \
-	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign gridspec/tools/fregrid/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-install-binPROGRAMS: $(bin_PROGRAMS)
-	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	for p in $$list; do echo "$$p $$p"; done | \
-	sed 's/$(EXEEXT)$$//' | \
-	while read p p1; do if test -f $$p || test -f $$p1; \
-	  then echo "$$p"; echo "$$p"; else :; fi; \
-	done | \
-	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
-	sed 'N;N;N;s,\n, ,g' | \
-	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
-	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
-	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
-	    else { print "f", $$3 "/" $$4, $$1; } } \
-	  END { for (d in files) print "f", d, files[d] }' | \
-	while read type dir files; do \
-	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
-	    test -z "$$files" || { \
-	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
-	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
-	    } \
-	; done
-
-uninstall-binPROGRAMS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	files=`for p in $$list; do echo "$$p"; done | \
-	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-	      -e 's/$$/$(EXEEXT)/' `; \
-	test -n "$$list" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(bindir)" && rm -f $$files
-
-clean-binPROGRAMS:
-	@list='$(bin_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
-fregrid$(EXEEXT): $(fregrid_OBJECTS) $(fregrid_DEPENDENCIES) 
-	@rm -f fregrid$(EXEEXT)
-	$(LINK) $(fregrid_OBJECTS) $(fregrid_LDADD) $(LIBS)
-
-mostlyclean-compile:
-	-rm -f *.$(OBJEXT)
-
-distclean-compile:
-	-rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fregrid.Po at am__quote@
-
-.c.o:
- at am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
- at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
- at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ $<
-
-.c.obj:
- at am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
- at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
- at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
- at am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
- at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
- at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	set x; \
-	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	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
-CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	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"
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d "$(distdir)/$$file"; then \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-	  else \
-	    test -f "$(distdir)/$$file" \
-	    || cp -p $$d/$$file "$(distdir)/$$file" \
-	    || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-check: check-am
-all-am: Makefile $(PROGRAMS)
-installdirs:
-	for dir in "$(DESTDIR)$(bindir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-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)
-
-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-binPROGRAMS clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-	distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am: install-binPROGRAMS
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-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
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-binPROGRAMS
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
-	clean-generic clean-libtool ctags distclean distclean-compile \
-	distclean-generic distclean-libtool distclean-tags distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-binPROGRAMS 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 \
-	pdf pdf-am ps ps-am tags uninstall uninstall-am \
-	uninstall-binPROGRAMS
-
-
-# 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.
-.NOEXPORT:
diff --git a/gridspec/tools/fregrid/fregrid.c b/gridspec/tools/fregrid/fregrid.c
deleted file mode 100644
index 1ccc37a..0000000
--- a/gridspec/tools/fregrid/fregrid.c
+++ /dev/null
@@ -1,410 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <getopt.h>
-#include <math.h>
-#include "mpp.h"
-#include "globals.h"
-#include "tool_util.h"
-#include "mosaic_util.h"
-
-char *usage[] = {
-  "",
-  "  fregrid --input_mosaic input_mosaic --input_file input_file                         ",
-  "          [--scalar_field scalar_fld] [--u_field u_fld]  [--v_field v_fld]            ",
-  "          [--output_mosaic output_mosaic] [--lonBegin #decimal] [--lonEnd #decimal]   ",
-  "          [--latBegin #decimal] [--latEnd #decimal] [--nlon #integer]                 ",
-  "          [--nlat #integer] [--KlevelBegin #integer] [--KlevelEnd #integer]           ",
-  "          [--LstepBegin #integer] [--LstepEnd #integer]                               ",
-  "          [--output_file output_file] [--input_dir input_dir]                         ",
-  "          [--output_dir output_dir] [--remap_file remap_file]                         ",
-  "          [--interp_method method] [--grid_type grid_type] [--test_case test_case]    ",
-  "          [--symmetry] [--target_grid] [--finer_step #] [--fill_missing]              ",
-  "          [--center_y] [--check_conserve]                                             ",
-  "fregrid remap data (scalar or vector) from input_mosaic onto output_mosaic (The       ",
-  "target grid also could be specified through lonBegin, lonEnd, latBegin, latEnd, nlon  ",
-  "and nlat). Currently only T-cell scalar regridding and AGRID vector regridding (only  ",
-  "bilinear interpolation is implemented for cubic grid vector interpolation). The       ",
-  "interpolation algorithm used is controlled by --interp_method with default            ",
-  "'conserve_order1'. Currently only 'conserve_order1', 'conserve_order2' and 'bilinear' ",
-  "remapping scheme are implemented. 'bilinear' is only used to remap data from cubic    ",
-  "grid to latlon grid. We will add more scheme in the future if needed. fregrid expects ",
-  "NetCDF format input. scalar_field and/or u_field/v_field must be specified. u_fld and ",
-  "v_fld must be paired together.    ",
-  "                                                                                      ",
-  "fregrid takes the following flags:                                                    ",
-  "                                                                                      ",
-  "REQUIRED:                                                                             ",
-  "                                                                                      ",
-  "--input_mosaic  input_mosaic  specify the input mosaic information. This file         ",
-  "                              contains list of tile files which specify the grid      ",
-  "                              information for each tile.                              ",
-  "                                                                                      ",
-  "OPTIONAL FLAGS                                                                        ",
-  "                                                                                      ",  
-  "--input_file    input_file    specify the input file name. The suffix '.nc' can be    ",
-  "                              omitted. The suffix 'tile#' should not present for      ",
-  "                              multiple-tile files. The number of files must be 1 for  ",
-  "                              scalar regridding and can be 1 or 2 for vector          ",
-  "                              regridding. File path should not be includes.           ",
-  "                                                                                      ",
-  "--scalar_field    scalar_fld  specify the scalar field name to be regridded. The      ",
-  "                              multiple entry field names are seperated by comma.      ",
-  "                                                                                      ",    
-  "--u_field         u_fld       specify the vector field u-componentname to be          ",
-  "                              regridded. The multiple entry field names are seperated ",
-  "                              by comma. u_field must be paired together with v_field. ",
-  "                                                                                      ",    
-  "--v_field         v_fld       specify the vector field v-componentname to be          ",
-  "                              regridded. The multiple entry field names are seperated ",
-  "                              by comma. v_field must be paired together with u_field. ",
-  "                                                                                      ",  
-  "--output_mosaic output_mosaic specify the output mosaic information. This file        ",
-  "                              contains list of tile files which specify the grid      ",
-  "                              information for each tile. If output_mosaic is not      ",
-  "                              specified, nlon and nlat must be specified.             ",
-  "                                                                                      ",
-  "--lonBegin  #decimal          specify the starting longitude(in degree) of the        ",
-  "                              geographical region of the target grid on which the     ",
-  "                              output is desired. The default value is 0.              ",
-  "                                                                                      ",
-  "--lonEnd   #decimal           specify the ending longitude(in degree) of the          ",
-  "                              geographical region of the target grid on which the     ",
-  "                              output is desired. The default value is 360.            ",
-  "                                                                                      ",
-  "--latBegin  #decimal          specify the starting latitude(in degree) of the         ",
-  "                              geographical region of the target grid on which the     ",
-  "                              output is desired. The default value is -90.            ",
-  "                                                                                      ",
-  "--latEnd   #decimal           specify the ending latitude(in degree) of the           ",
-  "                              geographical region of the target grid on which the     ",
-  "                              output is desired. The default value is 90.             ",  
-  "                                                                                      ",
-  "--nlon #integer               specify number of grid box cells in x-direction for a   ",
-  "                              regular lat-lon grid.                                   ",
-  "                                                                                      ",
-  "--nlat #integer               specify number of grid box cells in y-direction for a   ",
-  "                              regular lat-lon grid.                                   ",
-  "                                                                                      ",  
-  "--KlevelBegin #integer        specify begin index of the k-level (depth axis) that    ",
-  "                              to be regridded.                                        ",
-  "                                                                                      ",
-  "--KlevelEnd #integer          specify end index of the k-level (depth axis) that      ",
-  "                              to be regridded.                                        ",  
-  "                                                                                      ",
-  "--LstepBegin #integer         specify the begin index of L-step (time axis) that      ",
-  "                              to be regridded.                                        ",
-  "                                                                                      ",
-  "--LstepEnd #integer           specify the end index of L-step (time axis) that        ",
-  "                              to be regridded.                                        ",  
-  "                                                                                      ",  
-  "--output_file   output_file   specify the output file name. If not presented,         ",
-  "                              output_file will take the value of input_file. The      ",
-  "                              suffix '.nc' can be omitted. The suffix 'tile#' should  ",
-  "                              not present for multiple-tile files. The number of      ",
-  "                              files must be 1 for scalar regridding and can be 1 or 2 ",
-  "                              for vector regridding. File path should not be includes.",  
-  "                                                                                      ",
-  "--input_dir     input_dir     specify the path that stores input_file. If not         ",
-  "                              presented, the input file is assumed to be stored in    ",
-  "                              current diretory.                                       ",
-  "                                                                                      ",
-  "--output_dir   output_dir     specify the path that will store output file. If not    ",
-  "                              presented, the output file will be stored in current    ",
-  "                              diretory.                                               ",
-  "                                                                                      ",
-  "--remap_file   remap_file     specify the file name that saves remapping information. ",
-  "                              If remap_file is specified and the file does not exist, ",
-  "                              remapping information will be calculated ans stored in  ",
-  "                              remap_file. If remap_file is specified and the file     ",
-  "                              exists, remapping information will be read from         ",
-  "                              remap_file.                                             ",
-  "                                                                                      ",
-  "--interp_method interp_method specify the remapping algorithm to be used. Default is  ",
-  "                              'conserve_order1'. Currently only 'conserve_order1',    ",
-  "                              'conserve_order2' and 'bilinear' remapping scheme are   ",
-  "                              implemented in this tool. The bilinear scheme can only  ",
-  "                              be used to remap data from cubic grid to regular latlon ",
-  "                              grid. When interp_method is 'bilinear', nlon and nlat   ",
-  "                              must be specified and the output data in y-direction    ",
-  "                              will be located at the center of cell or bound of the   ",
-  "                              cell depending on the setting of y_center.              ",
-  "                                                                                      ",
-  "--test_case test_case         specify the test function to be used for testing.       ",
-  "                                                                                      ",
-  "--grid_type     grid_type     specify the vector field grid location. default is      ",
-  "                              AGRID and only AGRID is implemented yet.                ",
-  "                                                                                      ",
-  "--symmetry                    indicate the grid is symmetry or not.                   ",
-  "                                                                                      ",
-  "--target_grid                 use input cell area instead of calculating based on     ",
-  "                              exchange grid area. default is off.                     ",
-  "                                                                                      ",
-  "---finer_step #integer        This is used only for bilinear interpolation. Set       ",
-  "                              finer_step to a positive integer to reduce noise in     ",
-  "                              interpolation and get a relatively smooth output. The   ",
-  "                              default value is 0. When finer_step is greater than 0,  ",
-  "                              fregrid will first remap data from source grid onto a   ",
-  "                              finer grid with resolution that is power of 2 of        ",
-  "                              destination grid resolution using bilinear              ",
-  "                              interpolation, then using volume averaging to remap     ",
-  "                              data from finer grid onto destination grid.             ",
-  "                                                                                      ",
-  "--center_y                    output latitude will locate at cell center, i.e., the   ",
-  "                              starting latitude will be -89 when nlat = 90. when      ",
-  "                              center_y is not set, starting latitude will be -90. for ",
-  "                              bilinear interpolation. For conservative interpolation, ",
-  "                              center_y is assumed.                                    ",
-  "                                                                                      ",
-  "--check_conserve              check the conservation of conservative interpolation.   ",
-  "                              The area sum will be printed out for input and output   ",
-  "                              mosaic.                                                 ",
-  "                                                                                      ",
-  "  fregrid --input_mosaic input_mosaic.nc --output_mosaic output_mosaic.nc             ",
-  "          --input_dir input_dir --input_file input_file --scalar_field temp,salt      ",
-  "                                                                                      ",
-  NULL};
-
-const double D2R = M_PI/180.;
-
-int main(int argc, char* argv[])
-{
-  unsigned int opcode = 0;
-  char    *mosaic_in=NULL;            /* input mosaic file name */
-  char    *mosaic_out=NULL;           /* input mosaic file name */
-  char    *dir_in=NULL;               /* input file location */
-  char    *dir_out=NULL;              /* output file location */
-  unsigned int nfiles     = 0;        /* number of input file */
-  unsigned int nfiles_out = 0;             /* number of output file */
-  char    input_file [NFILE][STRING];
-  char    output_file[NFILE][STRING];
-  char    scalar_name[NVAR] [STRING];
-  char    u_name     [NVAR] [STRING];
-  char    v_name     [NVAR] [STRING];
-  char    *test_case = NULL;
-  double  test_param = 1;
-  int     check_conserve = 0; /* 0 means no check */
-  double  lonbegin = 0, lonend = 360;
-  double  latbegin = -90, latend = 90;			  
-  int     nlon = 0, nlat = 0;
-  int     kbegin = 0, kend = -1; 
-  int     lbegin = 0, lend = -1;
-  char    *remap_file = NULL;
-  char    interp_method[STRING] = "conserve_order1";
-  int     y_at_center = 0;
-  int     grid_type = AGRID;
-  unsigned int nscalar=0, nvector=0, nvector2=0;
-  int     option_index, c, i, n, m, l;
-  char    entry[MAXSTRING];  /* should be long enough */
-  char    txt[STRING];
-  char    history[MAXATT];
-  int     fill_missing = 0;
-  unsigned int  finer_step = 0;
-
-  Grid_config   *grid_in    = NULL;   /* store input grid  */
-  Grid_config   *grid_out   = NULL;   /* store output grid */
-  Field_config  *scalar_in  = NULL;   /* store input scalar data */
-  Field_config  *scalar_out = NULL;   /* store output scalar data */
-  Field_config  *u_in       = NULL;   /* store input vector u-component */
-  Field_config  *v_in       = NULL;   /* store input vector v-component */
-  Field_config  *u_out      = NULL;   /* store input vector u-component */
-  Field_config  *v_out      = NULL;   /* store input vector v-component */
-  File_config   *file_in    = NULL;   /* store input file information */
-  File_config   *file_out   = NULL;   /* store output file information */
-  File_config   *file2_in   = NULL;   /* store input file information */
-  File_config   *file2_out  = NULL;   /* store output file information */
-  Bound_config  *bound_T    = NULL;   /* store halo update information for T-cell*/
-  Interp_config *interp     = NULL;   /* store remapping information */
-  int save_weight_only      = 0;
-  
-  int errflg = (argc == 1);
-  int fid;
-   int ret;
-  
-  static struct option long_options[] = {
-    {"input_mosaic",     required_argument, NULL, 'a'},
-    {"output_mosaic",    required_argument, NULL, 'b'},
-    {"input_dir",        required_argument, NULL, 'c'},
-    {"output_dir",       required_argument, NULL, 'd'},
-    {"input_file",       required_argument, NULL, 'e'},
-    {"output_file",      required_argument, NULL, 'f'},
-    {"remap_file",       required_argument, NULL, 'g'},
-    {"test_case",        required_argument, NULL, 'i'},
-    {"interp_method",    required_argument, NULL, 'j'},
-    {"test_parameter",   required_argument, NULL, 'k'},
-    {"symmetry",         no_argument,       NULL, 'l'},
-    {"grid_type",        required_argument, NULL, 'm'},
-    {"target_grid",      no_argument,       NULL, 'n'},
-    {"finer_step",       required_argument, NULL, 'o'},
-    {"fill_missing",     no_argument,       NULL, 'p'},
-    {"nlon",             required_argument, NULL, 'q'},
-    {"nlat",             required_argument, NULL, 'r'},
-    {"scalar_field",     required_argument, NULL, 's'},
-    {"check_conserve",   no_argument,       NULL, 't'},
-    {"u_field",          required_argument, NULL, 'u'},
-    {"v_field",          required_argument, NULL, 'v'},
-    {"center_y",         no_argument,       NULL, 'y'},
-    {"lonBegin",         required_argument, NULL, 'A'},
-    {"lonEnd",           required_argument, NULL, 'B'},
-    {"latBegin",         required_argument, NULL, 'C'},
-    {"latEnd",           required_argument, NULL, 'D'},
-    {"KlevelBegin",      required_argument, NULL, 'E'},
-    {"KlevelEnd",        required_argument, NULL, 'F'},
-    {"LstepBegin",       required_argument, NULL, 'G'},
-    {"LstepEnd",         required_argument, NULL, 'H'},
-    {"help",             no_argument,       NULL, 'h'},
-    {0, 0, 0, 0},
-  };  
-  
-  /* start parallel */
-  mpp_init(&argc, &argv);
-  mpp_domain_init();
-  
-  while ((c = getopt_long(argc, argv, "", long_options, &option_index)) != -1) {
-    switch (c) {
-    case 'a':
-      mosaic_in  = optarg;
-      break;
-    case 'b':
-      mosaic_out = optarg;
-      break;
-    case 'c':
-      dir_in = optarg;
-      break;
-    case 'd':
-      dir_out = optarg;
-      break;
-    case 'e':
-      if(strlen(optarg) >= MAXSTRING) mpp_error("fregrid: the entry is not long for option -e");
-      strcpy(entry, optarg);
-      tokenize(entry, ",", STRING, NFILE, (char *)input_file, &nfiles);
-      break;
-    case 'f':
-      if(strlen(optarg) >= MAXSTRING)  mpp_error("fregrid: the entry is not long for option -f");      
-      strcpy(entry, optarg);
-      tokenize(entry, ",", STRING, NFILE, (char *)output_file, &nfiles_out);
-      break;
-    case 'g':
-      remap_file = optarg;
-      break;
-    case 's':
-      if(strlen(optarg) >= MAXSTRING) mpp_error("fregrid: the entry is not long for option -s");      
-      strcpy(entry, optarg);
-      tokenize(entry, ",", STRING, NVAR, (char *)scalar_name, &nscalar);
-      break;
-    case 'u':
-      if(strlen(optarg) >= MAXSTRING) mpp_error("fregrid: the entry is not long for option -u");      
-      strcpy(entry, optarg);
-      tokenize(entry, ",", STRING, NVAR, (char *)u_name, &nvector);
-      break;        
-    case 'v':
-      if(strlen(optarg) >= MAXSTRING) mpp_error("fregrid: the entry is not long for option -v");      
-      strcpy(entry, optarg);
-      tokenize(entry, ",", STRING, NVAR, (char *)v_name, &nvector2);
-      break;      
-    case 'j':
-      strcpy(interp_method, optarg);
-      break;
-    case 'i':
-      test_case = optarg;
-      break;
-    case 'k':
-      test_param = atof(optarg);
-      break;      
-    case 'l':
-      opcode |= SYMMETRY;
-      break;
-    case 'm':
-      if(strcmp(optarg, "AGRID") == 0)
-	grid_type = AGRID;
-      else if(strcmp(optarg, "BGRID") == 0)
-	grid_type = BGRID;
-      else
-	mpp_error("fregrid: only AGRID and BGRID vector regridding are implmented, contact developer");
-      break;
-    case 'n':
-      opcode |= TARGET;
-      break;
-    case 'o':
-      finer_step = atoi(optarg);
-      break;
-    case 'p':
-      fill_missing = 1;
-      break;
-    case 'q':
-      nlon = atoi(optarg);
-      break;
-    case 'r':
-      nlat = atoi(optarg);
-      break;
-    case 't':
-      check_conserve = 1;
-      break;
-    case 'y':
-      y_at_center = 1;
-      break;
-    case 'A':
-      lonbegin = atof(optarg);
-      break;
-    case 'B':
-      lonend = atof(optarg);
-      break;
-    case 'C':
-      latbegin = atof(optarg);
-      break;
-    case 'D':
-      latend = atof(optarg);
-      break;
-    case 'E':
-      kbegin = atoi(optarg);
-      break;
-    case 'F':
-      kend = atoi(optarg);
-      break;
-    case 'G':
-      lbegin = atoi(optarg);
-      break;
-    case 'H':
-      lend = atoi(optarg);
-      break;
-    case '?':
-      errflg++;
-      break;
-    }
-  }
-
-  if (errflg) {
-    char **u = usage;
-    while (*u) { fprintf(stderr, "%s\n", *u); u++; }
-    exit(2);
-  }      
-  
-  /* define history to be the history in the grid file */
-  strcpy(history,argv[0]);
-  for(i=1;i<argc;i++) {
-    strcat(history, " ");
-    if(strlen(argv[i]) > MAXENTRY) { /* limit the size of each entry, here we are assume the only entry that is longer than
-					MAXENTRY= 256 is the option --scalar_field --u_field and v_field */
-      if(strcmp(argv[i-1], "--scalar_field") && strcmp(argv[i-1], "--u_field") && strcmp(argv[i-1], "--v_field") )
-	mpp_error("fregrid: the entry ( is not scalar_field, u_field, v_field ) is too long, need to increase parameter MAXENTRY");
-      strcat(history, "(**please see the field list in this file**)" );
-    }
-    else
-      strcat(history, argv[i]);
-  }
-  
-
-   if ((ret = gs_fregrid(history, mosaic_in, mosaic_out, dir_in, 
-                         dir_out, input_file, nfiles, output_file, nfiles_out, 
-                         remap_file, scalar_name, nscalar, u_name, nvector, 
-                         v_name, nvector2, interp_method, test_case, test_param, 
-                         opcode, grid_type, finer_step, fill_missing, nlon, nlat, check_conserve, 
-                         y_at_center, lonbegin, lonend, latbegin, latend, 
-                         lbegin, kend, lbegin, lend)))
-      return ret;
-      
-  mpp_end();
-  return 0;
-  
-} /* end of main */
-  
diff --git a/gridspec/tools/get_data.sh b/gridspec/tools/get_data.sh
deleted file mode 100755
index 50e70c7..0000000
--- a/gridspec/tools/get_data.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-# This shell script runs the ncdump tests.
-# $Id: get_data.sh,v 1.2 2009/09/08 17:14:52 ed Exp $
-
-set -e
-echo ""
-#!/bin/sh
-
-# This shell file runs benchmarks on the 2D radar data on parallel platforms.
-
-# $Id: get_data.sh,v 1.2 2009/09/08 17:14:52 ed Exp $
-
-set -e
-echo ""
-echo "Getting GRIDSPEC test input data from Unidata FTP site..."
-
-file_list='19800101.atmos_daily.tile1.nc  19800101.atmos_daily.tile4.nc  get_data.sh OCCAM_p5degree.nc 19800101.atmos_daily.tile2.nc  19800101.atmos_daily.tile5.nc 19800101.atmos_daily.tile3.nc 19800101.atmos_daily.tile6.nc'
-for file in $file_list; do
-    if test -f $file; then
-	echo "we already have $file..."
-    else
-	wget ftp://ftp.unidata.ucar.edu/pub/libcf/sample_data/gridspec/$file
-    fi
-done
-
-exit 0
-
diff --git a/gridspec/tools/make_coupler_mosaic/Makefile.am b/gridspec/tools/make_coupler_mosaic/Makefile.am
deleted file mode 100644
index 2359a93..0000000
--- a/gridspec/tools/make_coupler_mosaic/Makefile.am
+++ /dev/null
@@ -1,67 +0,0 @@
-## This is an automake file, part of Unidata's NetCDF CF Library
-## package. Copyright 2009, see the COPYRIGHT file for more
-## information.
-
-# This automake file is in charge of building the gridspec
-# make_coupler_mosaic tool.
-
-# $Id: Makefile.am,v 1.4 2009/11/16 14:11:31 zhi Exp $
-
-bin_PROGRAMS = make_coupler_mosaic
-make_coupler_mosaic_SOURCES = make_coupler_mosaic.c
-
-# Initalize these.
-AM_CPPFLAGS = -I$(top_srcdir)/gridspec/tools/shared	\
--I$(top_srcdir)/gridspec/shared/mosaic
-AM_LDFLAGS = -L../shared -L../../shared/mosaic
-LDADD = -ltoolsshared -lshared -lnetcdf -lm
-
-if USE_NETCDF_DIR
-AM_CPPFLAGS += -I at NETCDFDIR@/include
-AM_LDFLAGS += -L at NETCDFDIR@/lib
-LDADD += -lnetcdf
-else
-if USE_NETCDF4
-LDADD += ../../../../libsrc4/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc4
-AM_LDFLAGS += -L../../../../libsrc4
-else
-LDADD += ../../../../libsrc/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc
-AM_LDFLAGS += -L../../../../libsrc
-endif # USE_NETCDF4
-endif # USE_NETCDF_DIR
-
-if USE_NETCDF4
-LDADD += -lhdf5_hl -lhdf5 -lz 
-endif
-
-if USE_HDF4
-LDADD += -lmfhdf -ldf -ljpeg
-endif # USE_HDF4
-
-# If the user specified a root for HDF5, use it.
-if USE_HDF5_DIR
-AM_CPPFLAGS += -I at HDF5DIR@/include
-AM_LDFLAGS += -L at HDF5DIR@/lib
-endif
-
-# If the user specified a prefix for the HDF4 library location, use it.
-if USE_HDF4_DIR
-AM_CPPFLAGS += -I at HDF4DIR@/include
-AM_LDFLAGS += -L at HDF4DIR@/lib
-endif
-
-# If the user specified a root location for ZLIB, use it.
-if USE_ZLIB_DIR
-AM_CPPFLAGS += -I at ZLIBDIR@/include
-AM_LDFLAGS += -L at ZLIBDIR@/lib
-endif
-
-# If the user specified a root location for SZLIB, use it.
-if USE_SZLIB_DIR
-AM_CPPFLAGS += -I at SZLIBDIR@/include
-AM_LDFLAGS += -L at SZLIBDIR@/lib
-endif
-
-
diff --git a/gridspec/tools/make_coupler_mosaic/Makefile.in b/gridspec/tools/make_coupler_mosaic/Makefile.in
deleted file mode 100644
index c0162a5..0000000
--- a/gridspec/tools/make_coupler_mosaic/Makefile.in
+++ /dev/null
@@ -1,572 +0,0 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-
-# This automake file is in charge of building the gridspec
-# make_coupler_mosaic tool.
-
-# $Id: Makefile.am,v 1.4 2009/11/16 14:11:31 zhi Exp $
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-bin_PROGRAMS = make_coupler_mosaic$(EXEEXT)
- at USE_NETCDF_DIR_TRUE@am__append_1 = -I at NETCDFDIR@/include
- at USE_NETCDF_DIR_TRUE@am__append_2 = -L at NETCDFDIR@/lib
- at USE_NETCDF_DIR_TRUE@am__append_3 = -lnetcdf
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_4 = ../../../../libsrc4/libnetcdf.la 
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_5 = -I$(top_srcdir)/../libsrc4
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_6 = -L../../../../libsrc4
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_7 = ../../../../libsrc/libnetcdf.la 
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_8 = -I$(top_srcdir)/../libsrc
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_9 = -L../../../../libsrc
- at USE_NETCDF4_TRUE@am__append_10 = -lhdf5_hl -lhdf5 -lz 
- at USE_HDF4_TRUE@am__append_11 = -lmfhdf -ldf -ljpeg
-
-# If the user specified a root for HDF5, use it.
- at USE_HDF5_DIR_TRUE@am__append_12 = -I at HDF5DIR@/include
- at USE_HDF5_DIR_TRUE@am__append_13 = -L at HDF5DIR@/lib
-
-# If the user specified a prefix for the HDF4 library location, use it.
- at USE_HDF4_DIR_TRUE@am__append_14 = -I at HDF4DIR@/include
- at USE_HDF4_DIR_TRUE@am__append_15 = -L at HDF4DIR@/lib
-
-# If the user specified a root location for ZLIB, use it.
- at USE_ZLIB_DIR_TRUE@am__append_16 = -I at ZLIBDIR@/include
- at USE_ZLIB_DIR_TRUE@am__append_17 = -L at ZLIBDIR@/lib
-
-# If the user specified a root location for SZLIB, use it.
- at USE_SZLIB_DIR_TRUE@am__append_18 = -I at SZLIBDIR@/include
- at USE_SZLIB_DIR_TRUE@am__append_19 = -L at SZLIBDIR@/lib
-subdir = gridspec/tools/make_coupler_mosaic
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = "$(DESTDIR)$(bindir)"
-PROGRAMS = $(bin_PROGRAMS)
-am_make_coupler_mosaic_OBJECTS = make_coupler_mosaic.$(OBJEXT)
-make_coupler_mosaic_OBJECTS = $(am_make_coupler_mosaic_OBJECTS)
-make_coupler_mosaic_LDADD = $(LDADD)
-am__DEPENDENCIES_1 =
-make_coupler_mosaic_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	$(am__append_4) $(am__append_7) $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1)
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
-SOURCES = $(make_coupler_mosaic_SOURCES)
-DIST_SOURCES = $(make_coupler_mosaic_SOURCES)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
-AMTAR = @AMTAR@
-AR = @AR@
-AS = @AS@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-F77 = @F77@
-FC = @FC@
-FCFLAGS = @FCFLAGS@
-FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
-FGREP = @FGREP@
-GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-MOD_FLAG = @MOD_FLAG@
-NCDUMPDIR = @NCDUMPDIR@
-NETCDFDIR = @NETCDFDIR@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
-VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
-ac_ct_FC = @ac_ct_FC@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-make_coupler_mosaic_SOURCES = make_coupler_mosaic.c
-
-# Initalize these.
-AM_CPPFLAGS = -I$(top_srcdir)/gridspec/tools/shared \
-	-I$(top_srcdir)/gridspec/shared/mosaic $(am__append_1) \
-	$(am__append_5) $(am__append_8) $(am__append_12) \
-	$(am__append_14) $(am__append_16) $(am__append_18)
-AM_LDFLAGS = -L../shared -L../../shared/mosaic $(am__append_2) \
-	$(am__append_6) $(am__append_9) $(am__append_13) \
-	$(am__append_15) $(am__append_17) $(am__append_19)
-LDADD = -ltoolsshared -lshared -lnetcdf -lm $(am__append_3) \
-	$(am__append_4) $(am__append_7) $(am__append_10) \
-	$(am__append_11)
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-	        && { if test -f $@; then exit 0; else break; fi; }; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec/tools/make_coupler_mosaic/Makefile'; \
-	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign gridspec/tools/make_coupler_mosaic/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-install-binPROGRAMS: $(bin_PROGRAMS)
-	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	for p in $$list; do echo "$$p $$p"; done | \
-	sed 's/$(EXEEXT)$$//' | \
-	while read p p1; do if test -f $$p || test -f $$p1; \
-	  then echo "$$p"; echo "$$p"; else :; fi; \
-	done | \
-	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
-	sed 'N;N;N;s,\n, ,g' | \
-	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
-	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
-	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
-	    else { print "f", $$3 "/" $$4, $$1; } } \
-	  END { for (d in files) print "f", d, files[d] }' | \
-	while read type dir files; do \
-	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
-	    test -z "$$files" || { \
-	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
-	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
-	    } \
-	; done
-
-uninstall-binPROGRAMS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	files=`for p in $$list; do echo "$$p"; done | \
-	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-	      -e 's/$$/$(EXEEXT)/' `; \
-	test -n "$$list" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(bindir)" && rm -f $$files
-
-clean-binPROGRAMS:
-	@list='$(bin_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
-make_coupler_mosaic$(EXEEXT): $(make_coupler_mosaic_OBJECTS) $(make_coupler_mosaic_DEPENDENCIES) 
-	@rm -f make_coupler_mosaic$(EXEEXT)
-	$(LINK) $(make_coupler_mosaic_OBJECTS) $(make_coupler_mosaic_LDADD) $(LIBS)
-
-mostlyclean-compile:
-	-rm -f *.$(OBJEXT)
-
-distclean-compile:
-	-rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/make_coupler_mosaic.Po at am__quote@
-
-.c.o:
- at am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
- at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
- at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ $<
-
-.c.obj:
- at am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
- at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
- at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
- at am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
- at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
- at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	set x; \
-	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	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
-CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	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"
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d "$(distdir)/$$file"; then \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-	  else \
-	    test -f "$(distdir)/$$file" \
-	    || cp -p $$d/$$file "$(distdir)/$$file" \
-	    || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-check: check-am
-all-am: Makefile $(PROGRAMS)
-installdirs:
-	for dir in "$(DESTDIR)$(bindir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-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)
-
-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-binPROGRAMS clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-	distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am: install-binPROGRAMS
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-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
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-binPROGRAMS
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
-	clean-generic clean-libtool ctags distclean distclean-compile \
-	distclean-generic distclean-libtool distclean-tags distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-binPROGRAMS 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 \
-	pdf pdf-am ps ps-am tags uninstall uninstall-am \
-	uninstall-binPROGRAMS
-
-
-# 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.
-.NOEXPORT:
diff --git a/gridspec/tools/make_coupler_mosaic/make_coupler_mosaic.c b/gridspec/tools/make_coupler_mosaic/make_coupler_mosaic.c
deleted file mode 100644
index a2f1633..0000000
--- a/gridspec/tools/make_coupler_mosaic/make_coupler_mosaic.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Modify land grid to match ocean grid at coast and calculate atmos/land,
- * atmos/ocean, and land/ocean overlaps using the Sutherland-Hodgeman polygon
- * clipping algorithm (Sutherland, I. E. and G. W. Hodgeman, 1974:  Reentrant
- * polygon clipping, CACM, 17(1), 32-42).
- *  Warning, when the atmos grid is cubic grid, the number of model points should be
- *  even to avoid tiling error. I will come back to solve this issue in the future.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <string.h>
-#include <math.h>
-#include "constant.h"
-#include "mpp.h"
-#include "tool_util.h"
-#include "mpp_domain.h"
-
-
-char *usage[] = {
-  "",
-  "  make_coupler_mosaic --atmos_mosaic atmos_mosaic.nc --ice_mosaic ice_mosaic.nc ",
-  "              --ice_topog_mosaic ice_topog_mosaic.nc [--land_mosaic land_mosaic.nc] ",
-  "              [--ocean_topog_mosaic ocean_topog_mosaic.nc] [--sea_level #]  ",
-  "              [--interp_method #] [--mosaic_name mosaic_name] [--check ] ",
-  " ",
-  "make_coupler_mosaic generates three exchange grids for the FMS coupler. The output ",
-  "file includes exchange grid files for fluxes between atmosphere and surface (sea ice ",
-  "and land), exchange grid files for runoff between land and sea ice. There might be more ",
-  "than one exchange grid files between two model solo mosaic because there might be ",
-  "multiple tiles in a solo mosaic. All the exchange grid information are between model ",
-  "grid, not between supergrid. We assume the refinement ratio between model grid and ",
-  "supergrid is 2. Currently we only output the exchange grid on T-cell. ",
-  "Besides generate the exchange grid files, make_coupler_mosaic also generate the ",
-  "coupler mosaic file (the file name will be mosaic_name.nc) which contains the atmos, ",
-  "land and ocean mosaic path, ocean mosaic topog path and exchange grid file path. ",
-  "make_coupler_mosaic expects NetCDF format input.",
-  " ",
-  "make_coupler_mosaic takes the following flags:",
-  "",
-  "REQUIRED:",
-  "",
-  "--atmos_mosaic atmos_mosaic.nc specify the atmosphere mosaic information. This file",
-  "                               contains list of tile files which specify the grid ",
-  "                               information for each tile. Each grid is required to be ",
-  "                               regular lon/lat grid. The file name can not be 'mosaic.nc' ",
-  "",
-  "--ice_mosaic ice_mosaic.nc     specify the ice mosaic information. This file",
-  "                               contains list of tile files which specify the grid ",
-  "                               information for each tile. The file name can not be 'mosaic.nc' ",
-  " ",
-  "--ice_topog_mosaic filename    specify the ice topography mosaic file name, which contains link to",
-  "                               topography data on each tile. The topography data is positive down. ",
-  " ",
-  "OPTIONAL FLAGS",
-  "",
-  "--land_mosaic land_mosaic.nc   specify the land mosaic information. This file",
-  "                               contains list of tile files which specify the grid ",
-  "                               information for each tile. Each grid is required to be ",
-  "                               regular lon/lat grid. When land_mosaic is not specified,",
-  "                               atmosphere mosaic will be used to specify land mosaic.",
-  "                               The file name can not be 'mosaic.nc'.",
-  " ",
-  "--ocean_mosaic ocean_mosaic.nc specify the ocean mosaic information. This file",
-  "                               contains list of tile files which specify the grid ",
-  "                               information for each tile. The file name can not be 'mosaic.nc' ",
-  " ",  
-  "--interp_order #               specify the order of conservative interplation. Its value ",
-  "                               can be 1 ( linear order ) or 2 ( second order ) with default ",
-  "                               value 2.                                                     ",
-  "                                                                                            ",
-  "--sea_level #                  specify the sea level ( in meters ) and its value will be used",
-  "                               to determine land/sea mask. When topography of  ",
-  "                               a grid cell is less than sea level, this grid cell will be land,",
-  "                               otherwise it will be ocean. Default value is 0",
-  " ",
-  "--mosaic_name mosaic_name      coupler mosaic name. The output coupler mosaic file will be ",
-  "                               mosaic_name.nc. default value is 'mosaic'. ",
-  " ",  
-  "--check                        check the tiling error",
-    "", 
-  "A sample call to make_coupler_mosaic that makes exchange grids for atmosphere, land and ocean ",
-  "mosaic (atmosphere and land are coincident) is: ",
-  "",
-  "  make_coupler_mosaic --atmos_mosaic atmos_mosaic.nc --ocean_mosaic ocean_mosaic.nc ",
-  "                  --ocean_topog_mosaic ocean_topog_mosaic.nc",
-  "",
-  NULL };
-
-
-int main (int argc, char *argv[])
-{
-  int c, i, same_mosaic;
-  extern char *optarg;
-  char *imosaic  = NULL;
-  char *omosaic  = NULL;
-  char *amosaic  = NULL;
-  char *lmosaic  = NULL;
-  char *itopog   = NULL;
-  char mosaic_name[STRING] = "mosaic", mosaic_file[STRING];
-  char imosaic_name[STRING], amosaic_name[STRING], lmosaic_name[STRING];
-  char **otile_name=NULL, **atile_name=NULL, **ltile_name=NULL;
-  int x_refine = 2, y_refine = 2;
-  int  interp_order = 2;
-  int check = 0;
-  int errflg = (argc == 1);
-  char history[512];
-  int nfile_lxo=0, nfile_axo=0, nfile_axl=0;
-  int    ntile_ocn, ntile_atm, ntile_lnd;
-  int    *nxo = NULL, *nyo = NULL, *nxa = NULL, *nya = NULL, *nxl = NULL, *nyl = NULL;
-  double **xocn = NULL, **yocn = NULL, **xatm = NULL, **yatm = NULL, **xlnd = NULL, **ylnd = NULL;
-  double **area_ocn = NULL, **area_lnd = NULL, **area_atm = NULL;
-  double **omask = NULL;
-  double sea_level = 0.;
-  int    lnd_same_as_atm = 0;
-  int    option_index = 0;
-  double axo_area_sum = 0, axl_area_sum = 0;
-  int    ocn_south_ext = 0;
-   int ret;
-    
-  static struct option long_options[] = {
-    {"atmos_mosaic",       required_argument, NULL, 'a'},
-    {"land_mosaic",        required_argument, NULL, 'l'},
-    {"ice_mosaic",         required_argument, NULL, 'i'},
-    {"ocean_mosaic",       required_argument, NULL, 'o'},
-    {"ice_topog_mosaic",   required_argument, NULL, 't'},
-    {"sea_level",          required_argument, NULL, 's'},
-    {"interp_order",       required_argument, NULL, 'r'},
-    {"mosaic_name",        required_argument, NULL, 'm'},
-    {"check",              no_argument,       NULL, 'n'},
-    {NULL, 0, NULL, 0}
-  };
-
-  mpp_init(&argc, &argv);
-  mpp_domain_init();
-  
-  /*
-   * process command line
-   */
-
-  while ((c = getopt_long(argc, argv, "i:", long_options, &option_index) ) != -1)
-    switch (c) {
-    case 'a': 
-      amosaic = optarg;
-      break;
-    case 'l': 
-      lmosaic = optarg;
-      break;
-    case 'i':
-      imosaic = optarg;
-      break;
-    case 'o':
-      omosaic = optarg;
-      break;
-    case 't':
-      itopog = optarg;
-      break;
-    case 'r':
-      interp_order = atoi(optarg);
-      break;
-    case 's':
-      sea_level = atof(optarg);
-      break;
-    case 'm':
-      strcpy(mosaic_name,optarg);
-      break;
-    case 'n':
-      check = 1;
-      break;
-    case '?':
-      errflg++;
-    }
-  if (errflg || !amosaic || !imosaic || !itopog) {
-    char **u = usage;
-    while (*u) { fprintf(stderr, "%s\n", *u); u++; }
-    exit(2);
-  }
-
-  /* interp_order should be 1 or 2 */
-  if(interp_order != 1 && interp_order !=2 )mpp_error("make_coupler_mosaic: interp_order should be 1 or 2");
-  
-  strcpy(history,argv[0]);
-
-  for(i=1;i<argc;i++) {
-    strcat(history, " ");
-    strcat(history, argv[i]);
-  }
-
-  /*if lmosaic is not specifiied, assign amosaic value to it */
-  if(!lmosaic) lmosaic = amosaic;
-  if(!omosaic) omosaic = imosaic;
-  
-  if ((ret = gs_make_coupler_mosaic(history, amosaic, lmosaic, omosaic, imosaic, itopog, 
-                                     interp_order, sea_level, mosaic_name, check)))
-      return ret;
-  
-  if(mpp_pe()== mpp_root_pe())printf("\n***** Congratulation! You have successfully run make_coupler_mosaic\n");
-  mpp_end();
-
-  return 0;
-  
-} /* main */
-
-
diff --git a/gridspec/tools/make_hgrid/Makefile.am b/gridspec/tools/make_hgrid/Makefile.am
deleted file mode 100644
index e4068a4..0000000
--- a/gridspec/tools/make_hgrid/Makefile.am
+++ /dev/null
@@ -1,75 +0,0 @@
-## This is an automake file, part of Unidata's NetCDF CF Library
-## package. Copyright 2009, see the COPYRIGHT file for more
-## information.
-
-# This automake file is in charge of building the gridspec make_hgrid
-# tools.
-
-# $Id: Makefile.am,v 1.4 2009/11/16 14:14:02 zhi Exp $
-
-bin_PROGRAMS = make_hgrid
-make_hgrid_SOURCES = make_hgrid.c
-
-# Initalize these.
-AM_CPPFLAGS = -I../shared -I$(top_srcdir)/gridspec/tools/shared	\
--I../../shared/mosaic -I$(top_srcdir)/gridspec/shared/mosaic
-
-AM_LDFLAGS = -L../shared -L../../shared/mosaic
-
-LDADD = -ltoolsshared -lshared -lm
-
-if USE_NETCDF_DIR
-AM_CPPFLAGS += -I at NETCDFDIR@/include
-AM_LDFLAGS += -L at NETCDFDIR@/lib
-LDADD += -lnetcdf
-else
-if USE_NETCDF4
-LDADD += ../../../../libsrc4/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc4
-AM_LDFLAGS += -L../../../../libsrc4
-else
-LDADD += ../../../../libsrc/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc
-AM_LDFLAGS += -L../../../../libsrc
-endif # USE_NETCDF4
-endif # USE_NETCDF_DIR
-
-if USE_NETCDF4
-LDADD += -lhdf5_hl -lhdf5 -lz 
-endif
-
-if USE_HDF4
-LDADD += -lmfhdf -ldf -ljpeg
-endif # USE_HDF4
-
-# If the user specified a root for HDF5, use it.
-if USE_HDF5_DIR
-AM_CPPFLAGS += -I at HDF5DIR@/include
-AM_LDFLAGS += -L at HDF5DIR@/lib
-endif
-
-# If the user specified a prefix for the HDF4 library location, use it.
-if USE_HDF4_DIR
-AM_CPPFLAGS += -I at HDF4DIR@/include
-AM_LDFLAGS += -L at HDF4DIR@/lib
-endif
-
-# If the user specified a root location for ZLIB, use it.
-if USE_ZLIB_DIR
-AM_CPPFLAGS += -I at ZLIBDIR@/include
-AM_LDFLAGS += -L at ZLIBDIR@/lib
-endif
-
-# If the user specified a root location for SZLIB, use it.
-if USE_SZLIB_DIR
-AM_CPPFLAGS += -I at SZLIBDIR@/include
-AM_LDFLAGS += -L at SZLIBDIR@/lib
-endif
-
-TESTS = run_tests
-EXTRA_DIST = run_tests.in
-CLEANFILES = horizontal_grid.nc gs_horizontal_grid.nc	\
-horizontal_grid.cdl gs_horizontal_grid.cdl
-DISTCLEANFILES = run_tests
-
-
diff --git a/gridspec/tools/make_hgrid/make_hgrid.c b/gridspec/tools/make_hgrid/make_hgrid.c
deleted file mode 100644
index 5c85e7b..0000000
--- a/gridspec/tools/make_hgrid/make_hgrid.c
+++ /dev/null
@@ -1,340 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <getopt.h>
-#include <netcdf.h>
-#include "create_hgrid.h"
-#include "mpp.h"
-#include "mpp_domain.h"
-#include "tool_util.h"
-#include "mosaic_util.h"
-
-
-#define MAXBOUNDS 100
-#define STRINGLEN 255
-  
-/* char grid_version[] = "0.2"; */
-/* char tagname[] = "$Name:  $"; */
-
-char *usage[] = {
-   "",
-   "                                                                                 ",
-   "                                                                                 ",
-   "                    Usage of gs_make_hgrid                                       ",
-   "                                                                                 ",
-   "   gs_make_hgrid --grid_type grid_type --my_grid_file my_grid_file               ",
-   "                  --nxbnds nxbnds --nybnds nybnds                                ",
-   "                  --xbnds x(1),...,x(nxbnds) --ybnds y(1),...,y(nybnds)          ",
-   "                  --nlon nlon(1),...nlon(nxbnds-1)                               ",
-   "                  --nlat nlat(1),...nlat(nybnds-1)                               ",
-   "                  --lat_join lat_join --num_lon num_lon --nratio nratio          ",
-   "                  --simple_dx simple_dx --simple_dy simple_dy                    ",
-   "                  --ndivx ndivx --ndivy ndivy --grid_name gridname               ",
-   "                  --center center                                                ",
-   "                                                                                 ",
-   "   NOTE: This program can generate different types of horizontal grid. The       ",
-   "         output data is on supergrid ( model grid size x refinement(=2) ).       ",
-   "         For 'cubic_grid', six grid files which contain the grid information     ",
-   "         for each tile will be generate, otherwise one file will be generated    ",
-   "         you can specify the grid type through --grid_type. The value of         ",
-   "         grid_type can be 'from_file', 'spectral_grid', 'spherical_grid',        ",
-   "         'conformal_cubic_grid', 'gnomonic_ed' or 'simple_cartesian_grid',       ",
-   "         with default value 'spherical_grid'. --nlon and --nlat                  ",
-   "         must be specified to indicate supergrid size ( for cubic_grid,          ",
-   "         --nlat is not needed because nlat has the same value as nlon.           ",
-   "         --ndivx and --ndivy are optional arguments with default value 1.        ",
-   "         Besides --nlon, --nlat, --ndivx and --ndivy, other optional and         ",
-   "         requirement arguments for each type are,                                ",
-   "                                                                                 ",
-   "   1. 'from_file':              --my_grid_file must be specified. The grid    ",
-   "                                specified in my_grid_file should be super grid   ",
-   "                                vertex.                                          ",
-   "   2. 'spectral_grid':          no other optional or required arguments.         ",
-   "   3. 'regular_lonlat_grid':    --nxbnds, --nybnds --xbnds, --ybnds, must be     ",
-   "                                specified to define the grid bounds.             ",
-   "   4. 'tripolar_grid':          --nxbnds, --nybnds, --xbnds, --ybnds, must be    ",
-   "                                specified to define the grid bounds. --lat_join  ",
-   "                                is optional with default value 65.               ",
-   "   5  'conformal_cubic_grid':   --nratio is optional argument.                   ",
-   "   6  'gnomonic_ed'          :  equal distance gnomonic cubic grid.              ",
-   "   6. 'simple_cartesian_grid':  --xbnds, --ybnds must be specified to define     ",
-   "                                the grid bounds location and grid size. number   ",
-   "                                of bounds must be 2 in both and x and            ",
-   "                                y-direction. --simple_dx and --simple_dy must be ",
-   "                                specified to specify uniform cell length.        ",
-   "                                                                                 ",
-   "   make_hgrid take the following flags                                           ",
-   "                                                                                 ",
-   "   --grid_type grid_type      specify type of topography. See above for          ",
-   "                              grid type option.                                  "
-   "                                                                                 ",
-   "   --my_grid_file file        when this flag is present, the program will read   ",
-   "                              grid information from 'my_grid_file'. The file     ",
-   "                              format can be ascii file or netcdf file. Multiple  ",
-   "                              file entry are allowed but the number should be    ",
-   "                              less than MAXBOUNDS.                                ",
-   "                                                                                 ",
-   "   --nxbnds nxbnds            Specify number of zonal regions for varying        ",
-   "                              resolution.                                        ",
-   "                                                                                 ",
-   "   --nybnds nybnds            Specify number of meridinal regions for varying    ",
-   "                              resolution.                                        ",
-   "                                                                                 ",
-   "   --xbnds x(1),.,x(nxbnds)   Specify boundaries for defining zonal regions of   ",
-   "                              varying resolution. When --tripolar is present,    ",
-   "                              x also defines the longitude of the two new poles. ",
-   "                              nxbnds must be 2 and lon_start = x(1),             ",
-   "                              lon_end = x(nxbnds) are longitude of the two       ",
-   "                              new poles.                                         ",
-   "                                                                                 ",
-   "   --ybnds y(1),.,y(nybnds)   Specify boundaries for defining meridional         ",
-   "                              regions of varying resolution                      ",
-   "                                                                                 ",
-   "   --nlon nlon(1),..,nlon(nxbnds-1) Number of model grid points(supergrid) for   ",
-   "                                    each zonal regions of varying resolution.    ",
-   "                                                                                 ",  
-   "   --nlat nlat(1),..,nlat(nybnds-1) Number of model grid points(supergid) for    ",
-   "                                    each meridinal regions of varying resolution.",
-   "                                                                                 ",
-   "   --lat_join lat_join        Specify latitude for joining spherical and rotated ",
-   "                              bipolar grid. Default value is 65 degree.          ",
-   "                                                                                 ",
-   "   --nratio nratio            Speicify the refinement ratio when calculating     ",
-   "                              cell length and area of supergrid.                 ",
-   "                                                                                 ",
-   "   --simple_dx dimple_dx      Specify the uniform cell length in x-direction for ",
-   "                              simple cartesian grid.                             ",
-   "                                                                                 ",
-   "   --simple_dy dimple_dy      Specify the uniform cell length in y-direction for ",
-   "                              simple cartesian grid.                             ",  
-   "                                                                                 ",
-   "   --ndivx ndivx              Specify number division in x-direction for each    ",
-   "                              face, default value is 1.                          ",
-   "                                                                                 ",
-   "   --ndivy ndivy              Specify number division in y-direction for each    ",
-   "                              face, default value is 1.                          ",
-   "                                                                                 ",
-   "   --grid_name grid_name      Specify the grid name. The output grid file name   ",
-   "                              will be grid_name.nc if there is one tile and      ",
-   "                              grid_name.tile#.nc if there is more than one tile. ",
-   "                              The default value will be horizontal_grid.         ",
-   "                                                                                 ",
-   "   --center center            Specify the center location of grid. The valid     ",
-   "                              entry will be 'none', 't_cell' or 'c_cell' with    ",
-   "                              default value 'none'. The grid refinement is       ",
-   "                              assumed to be 2 in x and y-direction when center   ",
-   "                              is not 'none'. 'c_cell' should be used for the grid",
-   "                              used in MOM4.                                      ",     
-   "                                                                                 ",
-   "   Example                                                                       ",      
-   "                                                                                 ",
-   "                                                                                 ",
-   "   1. generating regular lon-lat grid (supergrid size 60x20)                     ",
-   "      > make_hgrid --grid_type regular_lonlat_grid --nxbnd 2 --nybnd 2           ",
-   "        --xbnd 0,30 --ybnd 50,60  --nlon 60 --nlat 20                            ",
-   "                                                                                 ",
-   "   2. generating tripolar grid with various grid resolution and C-cell centered  ",
-   "      > make_hgrid --grid_type tripolar_grid --nxbnd 2 --nybnd 7 --xbnd -280,80  ",
-   "                   --ybnd -82,-30,-10,0,10,30,90 --nlon 720                      ",
-   "                   --nlat 104,48,40,40,48,120 --grid_name om3_grid               ",
-   "                   --center c_cell  --periodx 360                                ",
-   "                                                                                 ",  
-   "   3. generating simple cartesian grid(supergrid size 20x20)                     ",
-   "      > make_hgrid --grid_type simple_cartesian_grid --xbnd 0,30 --ybnd 50,60    ",
-   "                   --nlon 20 --nlat 20  --simple_dx 1000 --simple_dy 1000        ",
-   "                                                                                 ",
-   "   4. generating conformal cubic grid. (supergrid size 60x60 for each tile)      ",
-   "      > make_hgrid --grid_type conformal_cubic_grid --nlon 60 --nratio 2         ",
-   "                                                                                 ",
-   "   5. generating gnomonic cubic grid with equal_dist_face_edge                   ",
-   "      > make_hgrid --grid_type gnomonic_ed --nlon 60                             ",
-   "                                                                                 ",
-   "   7. generating spectral grid. (supergrid size 128x64)                          ",
-   "      > make_hgrid --grid_type spectral_grid --nlon 128 --nlat 64                ",
-   "                                                                                 ",
-   "   7. Through    user-defined grids                                              ",
-   "      > make_hgrid --grid_type from_file --my_grid_file my_grid_file          ",
-   "                   --nlon 4 --nlat 4                                             ",
-   "                                                                                 ",
-   "       contents of sample my_grid_file                                           ",
-   "         The first line of my_grid_file will be text ( will be ignored)          ",     
-   "         followed by nlon+1 lines of real value of x-direction supergrid bound   ",
-   "         location. Then another line of text ( will be ignored), followed by     ",
-   "         nlat+1 lines of real value of y-direction supergrid bound location.     ",
-   "                                                                                 " ,     
-   "         For example:                                                            ",
-   "                                                                                 ",
-   "            x-grid                                                               ",
-   "            0.0                                                                  ",
-   "            5.0                                                                  ",
-   "            10.0                                                                 ",
-   "            15.0                                                                 ",
-   "            20.0                                                                 ",
-   "            y-grid                                                               ",
-   "            -10                                                                  ",
-   "            10                                                                   ",
-   "            20                                                                   ",
-   "            30                                                                   ",
-   "            40                                                                   ", 
-   "                                                                                 ",
-   "                                                                                 ",
-   "",
-   NULL };
-
-int main(int argc, char* argv[])
-{
-   int  nratio = 1;
-   int  ndivx[] = {1,1,1,1,1,1};
-   int  ndivy[] = {1,1,1,1,1,1};
-   char method[32] = "conformal";
-   char orientation[32] = "center_pole";
-   int  nxbnds=2, nybnds=2, nxbnds0=0, nybnds0=0, nxbnds1=0, nybnds1=0, nxbnds2=0, nybnds2=0;
-   double xbnds[MAXBOUNDS], ybnds[MAXBOUNDS];
-   int nlon[MAXBOUNDS-1], nlat[MAXBOUNDS-1];
-   char grid_type[128]="regular_lonlat_grid";
-   char my_grid_file[MAXBOUNDS][STRINGLEN];
-   double lat_join=65.;
-   double simple_dx=0, simple_dy=0;
-   int nx, ny, nxp, nyp, ntiles=1, ntilex=0, ntiley=0;
-   unsigned int ntiles_file;
-   double *x=NULL, *y=NULL, *dx=NULL, *dy=NULL, *angle_dx=NULL, *angle_dy=NULL, *area=NULL;
-  
-   char history[2560];
-   char gridname[32] = "horizontal_grid";
-   char center[32] = "none";
-   char mesg[256], str[128];
-   char entry[MAXBOUNDS*STRINGLEN];
-   int isc, iec, jsc, jec, nxc, nyc, layout[2];
-   int errflg, c, i;  
-   int option_index;
-   int ret;
-
-   static struct option long_options[] = {
-      {"grid_type",       required_argument, NULL, 'a'},
-      {"my_grid_file",    required_argument, NULL, 'b'},
-      {"nxbnds",          required_argument, NULL, 'c'},
-      {"nybnds",          required_argument, NULL, 'd'},
-      {"xbnds",           required_argument, NULL, 'e'},
-      {"ybnds",           required_argument, NULL, 'f'},
-      {"nlon",            required_argument, NULL, 'g'},
-      {"nlat",            required_argument, NULL, 'i'},
-      {"lat_join",        required_argument, NULL, 'j'},
-      {"nratio",          required_argument, NULL, 'k'},
-      {"simple_dx",       required_argument, NULL, 'l'},
-      {"simple_dy",       required_argument, NULL, 'm'},
-      {"ndivx",           required_argument, NULL, 'o'},
-      {"ndivy",           required_argument, NULL, 'p'},
-      {"grid_name",       required_argument, NULL, 'q'},
-      {"center",          required_argument, NULL, 'r'},
-      {"help",            no_argument,       NULL, 'h'},    
-      {0, 0, 0, 0},
-   };
-
-   /* start parallel */
-   mpp_init(&argc, &argv);
-   mpp_domain_init();  
-
-   /* process command line */
-   errflg = argc <3;
-
-   while ((c = getopt_long(argc, argv, "", long_options, &option_index)) != -1) {
-      switch (c) {
-	 case 'a':
-	    strcpy(grid_type, optarg);
-	    break;
-	 case 'b':
-	    strcpy(entry, optarg);
-	    tokenize(entry, ",", STRINGLEN, MAXBOUNDS, (char *)my_grid_file, &ntiles_file);
-	    break;
-	 case 'c':
-	    nxbnds0 = atoi(optarg);
-	    break;
-	 case 'd':
-	    nybnds0 = atoi(optarg);
-	    break;        
-	 case 'e':
-	    strcpy(entry, optarg);
-	    nxbnds1 = get_double_entry(entry, xbnds);
-	    break;
-	 case 'f':
-	    strcpy(entry, optarg);
-	    nybnds1 = get_double_entry(entry, ybnds);
-	    break;
-	 case 'g':
-	    strcpy(entry, optarg);
-	    nxbnds2 = get_int_entry(entry, nlon);
-	    break;
-	 case 'i':
-	    strcpy(entry, optarg);
-	    nybnds2 = get_int_entry(entry, nlat);
-	    break;
-	 case 'j':
-	    lat_join = atof(optarg);
-	    break; 
-	 case 'k':
-	    nratio = atoi(optarg);
-	    break;      
-	 case 'l':
-	    simple_dx = atof(optarg);
-	    break;
-	 case 'm':
-	    simple_dy = atof(optarg);
-	    break;
-	 case 'o':
-	    strcpy(entry, optarg);
-	    ntilex = get_int_entry(entry, ndivx);
-	    break;
-	 case 'p':
-	    strcpy(entry, optarg);
-	    ntiley = get_int_entry(entry, ndivy);
-	    break;      
-	 case 'q':
-	    strcpy(gridname, optarg);
-	    break;
-	 case 'r':
-	    strcpy(center, optarg);
-	    break;
-	 case 'h':
-	    errflg++;
-	    break;
-	 case '?':
-	    errflg++;      
-      }      
-   }
-  
-   if (errflg ) {
-      char **u = usage;
-      while (*u) { fprintf(stderr, "%s\n", *u); u++; }
-      exit(2);
-   }  
-
-   /* define history to be the history in the grid file */
-   strcpy(history,argv[0]);
-
-   for(i=1;i<argc;i++) {
-      strcat(history, " ");
-      strcat(history, argv[i]);
-   }
-
-   if( strcmp(grid_type,"from_file") ==0 ) {   
-     if(ntiles_file == 0) mpp_error("make_hgrid: grid_type is 'from_file', but my_grid_file is not specified");
-     ntiles = ntiles_file;
-   }
-   
-   if(mpp_pe() == mpp_root_pe() ) printf("==>NOTE: the grid type is %s\n",grid_type);
-
-   /* Do everything. */
-   if ((ret = gs_make_hgrid(grid_type, nlat, nlon, nxbnds0, nybnds0, nxbnds1, 
-                            nybnds1, nxbnds2, nybnds2, lat_join, nratio, simple_dx, 
-                            simple_dy, ntilex, ndivx, ntiley, ndivy, gridname, center, history, xbnds, ybnds)))
-      return ret;
-
-   if(mpp_pe() == mpp_root_pe()) printf("generate_grid is run successfully. \n");
-
-   mpp_end();
-
-   return 0;
-  
-};  /* end of main */
-
-
diff --git a/gridspec/tools/make_hgrid/run_tests.in b/gridspec/tools/make_hgrid/run_tests.in
deleted file mode 100644
index ce96421..0000000
--- a/gridspec/tools/make_hgrid/run_tests.in
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# This shell script runs the ncdump tests.
-# $Id: run_tests.in,v 1.4 2009/11/16 14:19:21 zhi Exp $
-
-set -e
-echo ""
-echo "*** Testing gridspec hgrids."
-
-echo "*** generating regular lon-lat grid (supergrid size 60x20)..."
-./make_hgrid --grid_type regular_lonlat_grid --nxbnd 2 --nybnd 2  \
-    --xbnd 0,30 --ybnd 50,60  --nlon 60 --nlat 20
-
-#echo "*** generating tripolar grid with various grid resolution and C-cell centered..."
-#./make_hgrid --grid_type tripolar_grid --nxbnd 2 --nybnd 7 --xbnd -280,80 \
-#    --ybnd -82,-30,-10,0,10,30,90 --nlon 720 --nlat 104,48,40,40,48,120 --grid_name om3_grid \
-#    --center c_cell  --periodx 360 
-
-# echo "*** generating simple cartesian grid(supergrid size 20x20)..."
-# ./make_hgrid --grid_type simple_cartesian_grid --xbnds 0,30 --ybnds 50,60 \
-#     --nlon 20 --nlat 20  --simple_dx 1000 --simple_dy 1000
-
-# echo "*** generating conformal cubic grid. (supergrid size 60x60 for each tile)..."
-# ./make_hgrid --grid_type simple_cartesian_grid --xbnd 0,30 --ybnd 50,60 \
-#     --nlon 20 --nlat 20  --simple_dx 1000 --simple_dy 1000
-
-# echo "*** generating conformal cubic grid. (supergrid size 60x60 for each tile)..."
-# ./make_hgrid --grid_type conformal_cubic_grid --nlon 60 --nratio 2
-
-# echo "*** generating gnomonic cubic grid with equal_dist_face_edge..."
-# ./make_hgrid  --grid_type gnomonic_ed --nlon 60
-
-# echo "*** generating spectral grid. (supergrid size 128x64)..."
-# ./make_hgrid --grid_type spectral_grid --nlon 128 --nlat 64
-
-echo "*** All gridspec hgrid tests passed!"
-exit 0
diff --git a/gridspec/tools/make_mosaic/Makefile.am b/gridspec/tools/make_mosaic/Makefile.am
deleted file mode 100644
index 8f66c89..0000000
--- a/gridspec/tools/make_mosaic/Makefile.am
+++ /dev/null
@@ -1,73 +0,0 @@
-## This is an automake file, part of Unidata's NetCDF CF Library
-## package. Copyright 2009, see the COPYRIGHT file for more
-## information.
-
-# This automake file is in charge of building the gridspec make_hgrid
-# tools.
-
-# $Id: Makefile.am,v 1.2 2009/11/16 16:38:32 zhi Exp $
-
-bin_PROGRAMS = make_mosaic
-make_mosaic_SOURCES = make_mosaic.c
-
-# Initalize these.
-AM_CPPFLAGS = -I../shared -I../../shared/mosaic
-AM_LDFLAGS = -L../shared -L../../shared/mosaic
-
-LDADD = -ltoolsshared -lshared -lm
-
-if USE_NETCDF_DIR
-AM_CPPFLAGS += -I at NETCDFDIR@/include
-AM_LDFLAGS += -L at NETCDFDIR@/lib
-LDADD += -lnetcdf
-else
-if USE_NETCDF4
-LDADD += ../../../../libsrc4/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc4
-AM_LDFLAGS += -L../../../../libsrc4
-else
-LDADD += ../../../../libsrc/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc
-AM_LDFLAGS += -L../../../../libsrc
-endif # USE_NETCDF4
-endif # USE_NETCDF_DIR
-
-if USE_NETCDF4
-LDADD += -lhdf5_hl -lhdf5 -lz 
-endif
-
-if USE_HDF4
-LDADD += -lmfhdf -ldf -ljpeg
-endif # USE_HDF4
-
-# If the user specified a root for HDF5, use it.
-if USE_HDF5_DIR
-AM_CPPFLAGS += -I at HDF5DIR@/include
-AM_LDFLAGS += -L at HDF5DIR@/lib
-endif
-
-# If the user specified a prefix for the HDF4 library location, use it.
-if USE_HDF4_DIR
-AM_CPPFLAGS += -I at HDF4DIR@/include
-AM_LDFLAGS += -L at HDF4DIR@/lib
-endif
-
-# If the user specified a root location for ZLIB, use it.
-if USE_ZLIB_DIR
-AM_CPPFLAGS += -I at ZLIBDIR@/include
-AM_LDFLAGS += -L at ZLIBDIR@/lib
-endif
-
-# If the user specified a root location for SZLIB, use it.
-if USE_SZLIB_DIR
-AM_CPPFLAGS += -I at SZLIBDIR@/include
-AM_LDFLAGS += -L at SZLIBDIR@/lib
-endif
-
-#TESTS = run_tests
-#EXTRA_DIST = run_tests.in
-#CLEANFILES = horizontal_grid.nc gs_horizontal_grid.nc	\
-#horizontal_grid.cdl gs_horizontal_grid.cdl
-#DISTCLEANFILES = run_tests
-
-
diff --git a/gridspec/tools/make_mosaic/Makefile.in b/gridspec/tools/make_mosaic/Makefile.in
deleted file mode 100644
index 76572f2..0000000
--- a/gridspec/tools/make_mosaic/Makefile.in
+++ /dev/null
@@ -1,575 +0,0 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-
-# This automake file is in charge of building the gridspec make_hgrid
-# tools.
-
-# $Id: Makefile.am,v 1.2 2009/11/16 16:38:32 zhi Exp $
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-bin_PROGRAMS = make_mosaic$(EXEEXT)
- at USE_NETCDF_DIR_TRUE@am__append_1 = -I at NETCDFDIR@/include
- at USE_NETCDF_DIR_TRUE@am__append_2 = -L at NETCDFDIR@/lib
- at USE_NETCDF_DIR_TRUE@am__append_3 = -lnetcdf
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_4 = ../../../../libsrc4/libnetcdf.la 
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_5 = -I$(top_srcdir)/../libsrc4
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_6 = -L../../../../libsrc4
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_7 = ../../../../libsrc/libnetcdf.la 
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_8 = -I$(top_srcdir)/../libsrc
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_9 = -L../../../../libsrc
- at USE_NETCDF4_TRUE@am__append_10 = -lhdf5_hl -lhdf5 -lz 
- at USE_HDF4_TRUE@am__append_11 = -lmfhdf -ldf -ljpeg
-
-# If the user specified a root for HDF5, use it.
- at USE_HDF5_DIR_TRUE@am__append_12 = -I at HDF5DIR@/include
- at USE_HDF5_DIR_TRUE@am__append_13 = -L at HDF5DIR@/lib
-
-# If the user specified a prefix for the HDF4 library location, use it.
- at USE_HDF4_DIR_TRUE@am__append_14 = -I at HDF4DIR@/include
- at USE_HDF4_DIR_TRUE@am__append_15 = -L at HDF4DIR@/lib
-
-# If the user specified a root location for ZLIB, use it.
- at USE_ZLIB_DIR_TRUE@am__append_16 = -I at ZLIBDIR@/include
- at USE_ZLIB_DIR_TRUE@am__append_17 = -L at ZLIBDIR@/lib
-
-# If the user specified a root location for SZLIB, use it.
- at USE_SZLIB_DIR_TRUE@am__append_18 = -I at SZLIBDIR@/include
- at USE_SZLIB_DIR_TRUE@am__append_19 = -L at SZLIBDIR@/lib
-subdir = gridspec/tools/make_mosaic
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = "$(DESTDIR)$(bindir)"
-PROGRAMS = $(bin_PROGRAMS)
-am_make_mosaic_OBJECTS = make_mosaic.$(OBJEXT)
-make_mosaic_OBJECTS = $(am_make_mosaic_OBJECTS)
-make_mosaic_LDADD = $(LDADD)
-am__DEPENDENCIES_1 =
-make_mosaic_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__append_4) \
-	$(am__append_7) $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
-SOURCES = $(make_mosaic_SOURCES)
-DIST_SOURCES = $(make_mosaic_SOURCES)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
-AMTAR = @AMTAR@
-AR = @AR@
-AS = @AS@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-F77 = @F77@
-FC = @FC@
-FCFLAGS = @FCFLAGS@
-FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
-FGREP = @FGREP@
-GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-MOD_FLAG = @MOD_FLAG@
-NCDUMPDIR = @NCDUMPDIR@
-NETCDFDIR = @NETCDFDIR@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
-VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
-ac_ct_FC = @ac_ct_FC@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-make_mosaic_SOURCES = make_mosaic.c
-
-# Initalize these.
-AM_CPPFLAGS = -I../shared -I../../shared/mosaic $(am__append_1) \
-	$(am__append_5) $(am__append_8) $(am__append_12) \
-	$(am__append_14) $(am__append_16) $(am__append_18)
-AM_LDFLAGS = -L../shared -L../../shared/mosaic $(am__append_2) \
-	$(am__append_6) $(am__append_9) $(am__append_13) \
-	$(am__append_15) $(am__append_17) $(am__append_19)
-LDADD = -ltoolsshared -lshared -lm $(am__append_3) $(am__append_4) \
-	$(am__append_7) $(am__append_10) $(am__append_11)
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-	        && { if test -f $@; then exit 0; else break; fi; }; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec/tools/make_mosaic/Makefile'; \
-	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign gridspec/tools/make_mosaic/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-install-binPROGRAMS: $(bin_PROGRAMS)
-	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	for p in $$list; do echo "$$p $$p"; done | \
-	sed 's/$(EXEEXT)$$//' | \
-	while read p p1; do if test -f $$p || test -f $$p1; \
-	  then echo "$$p"; echo "$$p"; else :; fi; \
-	done | \
-	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
-	sed 'N;N;N;s,\n, ,g' | \
-	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
-	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
-	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
-	    else { print "f", $$3 "/" $$4, $$1; } } \
-	  END { for (d in files) print "f", d, files[d] }' | \
-	while read type dir files; do \
-	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
-	    test -z "$$files" || { \
-	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
-	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
-	    } \
-	; done
-
-uninstall-binPROGRAMS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	files=`for p in $$list; do echo "$$p"; done | \
-	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-	      -e 's/$$/$(EXEEXT)/' `; \
-	test -n "$$list" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(bindir)" && rm -f $$files
-
-clean-binPROGRAMS:
-	@list='$(bin_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
-make_mosaic$(EXEEXT): $(make_mosaic_OBJECTS) $(make_mosaic_DEPENDENCIES) 
-	@rm -f make_mosaic$(EXEEXT)
-	$(LINK) $(make_mosaic_OBJECTS) $(make_mosaic_LDADD) $(LIBS)
-
-mostlyclean-compile:
-	-rm -f *.$(OBJEXT)
-
-distclean-compile:
-	-rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/make_mosaic.Po at am__quote@
-
-.c.o:
- at am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
- at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
- at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ $<
-
-.c.obj:
- at am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
- at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
- at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
- at am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
- at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
- at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	set x; \
-	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	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
-CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	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"
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d "$(distdir)/$$file"; then \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-	  else \
-	    test -f "$(distdir)/$$file" \
-	    || cp -p $$d/$$file "$(distdir)/$$file" \
-	    || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-check: check-am
-all-am: Makefile $(PROGRAMS)
-installdirs:
-	for dir in "$(DESTDIR)$(bindir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-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)
-
-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-binPROGRAMS clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-	distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am: install-binPROGRAMS
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-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
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-binPROGRAMS
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
-	clean-generic clean-libtool ctags distclean distclean-compile \
-	distclean-generic distclean-libtool distclean-tags distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-binPROGRAMS 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 \
-	pdf pdf-am ps ps-am tags uninstall uninstall-am \
-	uninstall-binPROGRAMS
-
-
-#TESTS = run_tests
-#EXTRA_DIST = run_tests.in
-#CLEANFILES = horizontal_grid.nc gs_horizontal_grid.nc	\
-#horizontal_grid.cdl gs_horizontal_grid.cdl
-#DISTCLEANFILES = run_tests
-
-# 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.
-.NOEXPORT:
diff --git a/gridspec/tools/make_mosaic/make_mosaic.c b/gridspec/tools/make_mosaic/make_mosaic.c
deleted file mode 100644
index f380de5..0000000
--- a/gridspec/tools/make_mosaic/make_mosaic.c
+++ /dev/null
@@ -1,177 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <getopt.h>
-#include "constant.h"
-#include "mpp.h"
-#include "tool_util.h"
-
-char *usage[] = {
-  "",
-  " make_mosaic --num_tiles num_tiles --tile_file tile_file [--dir directory]       ",
-  "             [--num_mosaic num_mosaic] [--mosaic_file mosaic_file]               ",
-  "             [--mosaic_name mosaic_name] [--periodx #] [--periody #]             ",
-  "             [--generate_contact]                                                ",
-  "                                                                                 ",
-  "make_mosaic generates Mosaic of tile grid files. If generate_overlap is          ",
-  "specified, it also contains a link to the mosaic file that contains contact      ",
-  "information of child files, specified by index, contact type.                    ",
-  "                                                                                 ",
-  "make_solo_mosaic takes the following flags:                                      ",
-  "                                                                                 ",
-  "REQUIRED:                                                                        ",
-  "                                                                                 ",
-  "--num_tiles num_tiles    Number of grid tiles.                                   ",
-  "                                                                                 ",
-  "--tile_file tile_file    File name of all grid tiles. The number of entry must   ",
-  "be ntiles (The file name should be full file name) or 1 (The file name will be   ",
-  "base file name, which does not include tile name).                               ",
-  "                                                                                 ",    
-  "OPTIONAL FLAGS                                                                   ",
-  "                                                                                 ",  
-  "--num_mosaic #     Number of child mosaic file.                                  ",
-  "                                                                                 ",
-  "--mosaic_file mosaic_file File name of child mosaic file. The number of entry    ",
-  "                          must be num_mosaic.                                    ",
-  "                                                                                 ",    
-  "--dir directory          The directory that contains all the child files. If dir ",
-  "                         is not specified, the file path should be contained in  ",
-  "                         child_file.                                             ",
-  "                                                                                 ",  
-  "--mosaic_name name       mosaic name. The output file will be mosaic_name.nc.    ",
-  "                         default is 'mosaic'.                                    ",
-  "                                                                                 ",
-  "--periodx #              Specify the period in x-direction of mosaic. Default    ",
-  "                         value is 0 (not periodic). This is needed only when     ",
-  "                         child_file are tile grid files.                         ",
-  "                                                                                 ",
-  "--periody #              Specify the period in y-direction of mosaic. Default    ",
-  "                         value is 0 (not periodic).  This is needed only when    ",
-  "                         child_file are tile grid files.                         ",
-  "                                                                                 ",
-  "--generate_contact       Specify whether to generate the contact between mosaic  ",
-  "                         when num_mosaic is greater than 1                       ",
-  "                                                                                 ",
-  NULL};
-  
-const int MAXCHILD = 100;
-
-main (int argc, char *argv[])
-{
-
-  extern char *optarg;
-  char *pch=NULL, *tile_dir=NULL, history[512], entry[1280];
-  char tilefile[MAXCHILD][STRING];
-  char mosaicfile[MAXCHILD][STRING];
-  int  ntile=0, ntile2=0;
-  int  nmosaic=0, nmosaic2=0;
-  int  generate_contact = 0;
-
-  double periodx=0, periody=0;
-
-  char mosaic_name[128] = "mosaic";
-  char grid_descriptor[128] = "";
-  int c, i, n, m, l, errflg;
-  int ret;
-  
-  int option_index = 0;
-  static struct option long_options[] = {
-    {"mosaic_name",       required_argument, NULL, 'm'},
-    {"num_tiles",         required_argument, NULL, 'n'},
-    {"grid_descriptor",   required_argument, NULL, 'g'},
-    {"tile_file",         required_argument, NULL, 'f'},
-    {"num_mosaic",  required_argument, NULL, 'l'},
-    {"mosaic_file", required_argument, NULL, 'k'},
-    {"periodx",           required_argument, NULL, 'x'},
-    {"periody",           required_argument, NULL, 'y'},
-    {"tile_directory",    required_argument, NULL, 'd'},
-    {"generate_contact",  no_argument,       NULL, 'c'},
-    {NULL, 0, NULL, 0}
-  };
-
-  mpp_init(&argc, &argv);
-  /* this tool must be run one processor */
-  if(mpp_npes()>1) mpp_error("make_mosaic: this tool must be run on one processor");
-  
-  errflg = (argc == 1);
-  /* First read command line arguments. */
-
-  while ((c = getopt_long(argc, argv, "h", long_options, &option_index)) != -1) {
-    switch (c) {
-    case 'n':
-      ntile = atoi(optarg);
-      break;
-    case 'm':
-      strcpy(mosaic_name, optarg);
-      break;
-    case 'g':
-      strcpy(grid_descriptor, optarg);
-      break;
-    case 'f':
-      strcpy(entry, optarg); 
-      pch = strtok(entry, ", ");
-      while( pch != NULL) {
-        strcpy(tilefile[ntile2++], pch);
-	pch = strtok(NULL, ", ");
-      }
-      break;
-    case 'l':
-      nmosaic = atoi(optarg);
-      break;
-    case 'k':
-      strcpy(entry, optarg); 
-      pch = strtok(entry, ", ");
-      while( pch != NULL) {
-        strcpy(mosaicfile[nmosaic2++], pch);
-	pch = strtok(NULL, ", ");
-      }
-      break;
-    case 'x':
-      periodx = atof(optarg);
-      break;
-    case 'y':
-      periody = atof(optarg);
-      break; 
-    case 'd':  // path of the simple grid file.
-      tile_dir = optarg;
-      break;
-    case 'c':
-      generate_contact = 1;
-      break;
-    case '?':
-      errflg++;
-    }
-  }
-
-  if (errflg || ntile < 1) {
-    char **u = usage;
-    while (*u) { fprintf(stderr, "%s\n", *u); u++; }
-    exit(2);      
-  }
-
-  if(nmosaic>0) {
-    if(nmosaic != nmosaic2) mpp_error("make_mosaic: then number of entry specified through --mosaic_file "
-				      "must equal to num_mosaic" );
-  }
-  
-  strcpy(history,argv[0]);
-
-  for(i=1;i<argc;i++) {
-    strcat(history, " ");
-    strcat(history, argv[i]);
-  }
-
-
-  if ((ret = gs_make_mosaic(history, ntile, mosaic_name, nmosaic, mosaicfile, grid_descriptor,
-			    ntile2, tilefile, periodx, periody, generate_contact, tile_dir )))
-     return ret;
-
-  mpp_end();
-
-  return 0;
-  
-  
-}; // end of main
-
-
-
diff --git a/gridspec/tools/make_topog/Makefile.am b/gridspec/tools/make_topog/Makefile.am
deleted file mode 100644
index a872fa5..0000000
--- a/gridspec/tools/make_topog/Makefile.am
+++ /dev/null
@@ -1,70 +0,0 @@
-## This is an automake file, part of Unidata's NetCDF CF Library
-## package. Copyright 2009, see the COPYRIGHT file for more
-## information.
-
-# This automake file is in charge of building the gridspec
-# make_topog tool.
-
-# $Id: Makefile.am,v 1.4 2009/11/16 14:15:43 zhi Exp $
-
-bin_PROGRAMS = make_topog
-make_topog_SOURCES = make_topog.c
-
-# Initalize these.
-AM_CPPFLAGS = -I$(top_srcdir)/gridspec/tools/shared	\
--I$(top_srcdir)/gridspec/shared/mosaic
-AM_LDFLAGS = -L../shared -L../../shared/mosaic
-LDADD = -ltoolsshared -lshared -lnetcdf -lm
-
-if USE_NETCDF_DIR
-AM_CPPFLAGS += -I at NETCDFDIR@/include
-AM_LDFLAGS += -L at NETCDFDIR@/lib
-LDADD += -lnetcdf
-else
-if USE_NETCDF4
-LDADD += ../../../../libsrc4/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc4
-AM_LDFLAGS += -L../../../../libsrc4
-else
-LDADD += ../../../../libsrc/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc
-AM_LDFLAGS += -L../../../../libsrc
-endif # USE_NETCDF4
-endif # USE_NETCDF_DIR
-
-if USE_NETCDF4
-LDADD += -lhdf5_hl -lhdf5 -lz 
-endif
-
-if USE_HDF4
-LDADD += -lmfhdf -ldf -ljpeg
-endif # USE_HDF4
-
-# If the user specified a root for HDF5, use it.
-if USE_HDF5_DIR
-AM_CPPFLAGS += -I at HDF5DIR@/include
-AM_LDFLAGS += -L at HDF5DIR@/lib
-endif
-
-# If the user specified a prefix for the HDF4 library location, use it.
-if USE_HDF4_DIR
-AM_CPPFLAGS += -I at HDF4DIR@/include
-AM_LDFLAGS += -L at HDF4DIR@/lib
-endif
-
-# If the user specified a root location for ZLIB, use it.
-if USE_ZLIB_DIR
-AM_CPPFLAGS += -I at ZLIBDIR@/include
-AM_LDFLAGS += -L at ZLIBDIR@/lib
-endif
-
-# If the user specified a root location for SZLIB, use it.
-if USE_SZLIB_DIR
-AM_CPPFLAGS += -I at SZLIBDIR@/include
-AM_LDFLAGS += -L at SZLIBDIR@/lib
-endif
-
-TESTS = run_tests
-EXTRA_DIST = run_tests.in
-CLEANFILES = topog.nc gs_topog.nc topog.cdl gs_topog.cdl
-DISTCLEANFILES = run_tests
\ No newline at end of file
diff --git a/gridspec/tools/make_topog/make_topog.c b/gridspec/tools/make_topog/make_topog.c
deleted file mode 100644
index 54ac11d..0000000
--- a/gridspec/tools/make_topog/make_topog.c
+++ /dev/null
@@ -1,324 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <getopt.h>
-#include <string.h>
-#include "topog.h"
-#include "mpp.h"
-#include "mpp_domain.h"
-#include "mpp_io.h"
-#include "tool_util.h"
-#include "constant.h"
-
-char *usage[] = {
-  "",
-  "                                                                                         ",
-  "                                                                                         ",
-  "                    Usage of make_topog                                                  ",
-  "                                                                                         ",
-  "   make_topog --mosaic mosaic_file [--topog_type topog_type]  [x_refine #] [y_refine #]  ",
-  "              [--basin_depth #] [--bottom_depth #] [--min_depth #]                       ",
-  "              [--topog_file topog_file]  [--topog_field topog_field]                     ",
-  "              [--scale_factor #] [--num_filter_pass #] [--gauss_amp #]                   ",
-  "              [--gauss_scale #] [--slope_x #] [--slope_y #] [--bowl_south #]             ",
-  "              [--bowl_north #] [--bowl_west #] [--bowl_east #]                           ",
-  "              [--fill_first_row] [--filter_topog] [--round_shallow]                      ",
-  "              [--fill_shallow] [--deepen_shallow] [--smooth_topo_allow_deepening]        ",
-  "              [--topog_mosaic topog_mosaic] [--help]                                             ",
-  "                                                                                         ",
-  "   make_topog can generate topography for any Mosaic. The output file                    ",
-  "   will contains the topography for each tile in the Mosaic. The field name in           ",
-  "   the output topography file will be depth_tile# and it is positive down.               ",
-  "   The topography data will be defined on model grid, the model grid size will be        ",
-  "   supergrid grid size divided by refinement (x_refine, y_refine, default is 2).         ",
-  "   --mosaic is a required option and all other options are optional, but                 ",
-  "   some options are required depending on the choice of topog_type.                      ",
-  "   Below specify the option (required or non-required) needed for every kind             ",
-  "   of topog_type. when topog_type (--topog_type) is                                      ",
-  "                                                                                         ",
-  "     1. 'realistic':          --topog_file and --topog_field must be specified,          ",
-  "                              --bottom_depth, --min_depth, --scale_factor,               ",
-  "                              --num_filter_pass, --flat_bottom                           ",
-  "                              --fill_first_row --adjust_topo --filter_topog              ",
-  "                              --round_shallow] --fill_shallow --deepen_shallow]          ",
-  "                              --smooth_topo_allow_deepening are optional arguments.      ",
-  "     2.  'rectangular_basin': --basin_depth are optional arguments. Set basin_depth      ",
-  "                                to 0 to get all land topography.                         ",
-  "     3.  'gaussian':          --bottom_depth, --min_depth --gauss_amp, --gauss_scale,    ",
-  "                              --slope_x, --slope_y are optional arguments.               ",
-  "     4.. 'bowl':              --bottom_depth, --min_depth, --bowl_south, --bowl_north,   ",
-  "                              --bowl_west, --bowl_east are optional arguments.           ",
-  "     5. 'idealized':          --bottom_depth, --min_depth are optional arguments.        ",
-  "                                                                                         ",      
-  "   generate_mosaic_topo take the following flags                                         ",
-  "                                                                                         ",
-  "   --mosaic mosaic_file          Specify the mosaic file where topography data located.  ",
-  "                                                                                         ",
-  "   --topog_type topog_type       Specify type of topography. Its value can be            ",
-  "                                 'realistic', 'rectangular_basin', 'gaussian', 'bowl'    ",
-  "                                 or 'idealized'. The default value is 'realistic'.       ",
-  "                                                                                         ",
-  "   --x_refine #                  specify the refinement ratio of model grid vs supergrid ",
-  "                                 ins x-directin. default value 2.                        ",
-  "                                                                                         ",
-  "   --y_refine #                  specify the refinement ratio of model grid vs supergrid ",
-  "                                 ins y-directin. default value 2.                        ",
-  "                                                                                         ",
-  "   --basin_depth #               Specify the basin depth when topog_type is              ",
-  "                                 'rectangular_basin'. Default value is 5000 meter.       ",
-  "                                                                                         ",
-  "   --topog_file topog_file       Specify name of topograhy file (e.g. scripps,           ",
-  "                                 navy_topo, ...)                                         ",
-  "                                                                                         ",
-  "   --topog_field topog_field     Specify name of topography field name in topog_file.    ",
-  "                                                                                         ",
-  "   --bottom_depth #              Specify maximum depth (or bottom depth) of ocean.       ",
-  "                                 default value is 5000 meter.                            ",
-  "                                                                                         ",
-  "   --min_depth #                 Specify minimum depth of ocean.                         ",
-  "                                 default value is 10 meter.                              ",
-  "                                                                                         ",  
-  "   --scale_factor #              Specify scaling factor for topography data (e.g. -1 to  ",
-  "                                 flip sign or 0.01 to convert from centimeters).         ",
-  "                                 default value is 1.                                     ",
-  "                                                                                         ",
-  "   --num_filter_pass #           Specify number of passes of spatial filter              ",
-  "                                 default value is 1.                                     ",  
-  "                                                                                         ",
-  "   --gauss_amp #                 specify height of gaussian bump as percentage of ocean  ",
-  "                                 depth. default value is 0.5.                            ",
-  "                                                                                         ",
-  "   --gauss_scale #               Specify width of gaussian bump as percentag e of        ",
-  "                                 basin width. Default value is 0.25.                     ",
-  "                                                                                         ",
-  "   --slope_x #                   Specify rise of the ocean floor to the east for         ",
-  "                                 the gaussian bump. Default value is 0.                  ",
-  "                                                                                         ",
-  "   --slope_y #                   Specify rise of the ocean floor to the north for        ",
-  "                                 the gaussian bump. Default value is 0.                  ",
-  "                                                                                         ",
-  "   --bowl_south #                Specify southern boundary of Winton bowl.               ",
-  "                                 Default value is 60.                                    ",
-  "                                                                                         ",
-  "   --bowl_north #                Specify northern boundary of Winton bowl.               ",
-  "                                 Default value is 70.                                    ",  
-  "                                                                                         ",
-  "   --bowl_west #                 Specify western boundary of Winton bowl.                ",
-  "                                 Default value is 0.                                     ",
-  "                                                                                         ",  
-  "   --bowl_east #                 Specify eastern boundary of Winton bowl.                ",
-  "                                 Default value is 20.                                    ",
-  "                                                                                         ",
-  "   --fill_first_row              when specified, make first row of ocean model all       ",
-  "                                 land points for ice model.                              ",
-  "                                                                                         ",
-  "   --filter_topog                When specified, apply filter to topography.             ",
-  "                                                                                         ",
-  "   --round_shallow               When specified, Make cells land if depth is less        ",
-  "                                 than 1/2 mimumim depth, otherwise make ocean.           ",
-  "                                                                                         ",
-  "   --fill_shallow                When specified, Make cells less than minimum            ",
-  "                                 depth land.                                             ",
-  "                                                                                         ",
-  "   --deepen_shallow              When specified, Make cells less than minimum            ",
-  "                                 depth equal to minimum depth.                           ",
-  "                                                                                         ",
-  "   --smooth_topo_allow_deepening when specified, allow filter to deepen cells.           ",
-  "                                                                                         ",
-  "   --topog_mosaic topog_mosaic   Specify the name of the topog mosaic. The topog mosaic  ",
-  "                                 file name will be topog_mosaic.nc. Default value is     ",
-  "                                 'topog_mosaic'. The topography data file on each tile   ",
-  "                                 will be topog_mosaic.tile#.nc                           ",
-  "   --help                        Print out this message and then exit.                   ",
-  "                                                                                         ",   
-  "   Example                                                                               ", 
-  "                                                                                         ",
-  "   1. Generate 'realistic' topography                                                    ",
-  "   > make_topog --mosaic mosaic.nc --topog_type realistic                                ",
-  "                           --topog_file /archive/fms/mom4/input_data/OCCAM_p5degree.nc   ",
-  "                              --topog_field TOPO --scale_factor -1                       ",
-  "                                                                                         ",
-  "   2. Generate 'rectangular_basin' topography (with uniform topography 200 meters).      ",
-  "   > make_topog --mosaic mosaic.nc --topog_type  rectangular_basin            ",
-  "                           --basin_depth 200                                             ",
-  "                                                                                         ",
-  "                                                                                         "
-  "",
-  NULL };
-
-int main(int argc, char* argv[])
-{
-  char   *mosaic_file = NULL, *topog_file = NULL, *topog_field = NULL;
-  char   topog_type[32] = "realistic", topog_mosaic[128] = "topog_mosaic";
-  char   history[512];
-  int    num_filter_pass = 1;
-  int    x_refine = 2, y_refine = 2;
-  double basin_depth = 5000, bottom_depth = 5000, min_depth = 10, scale_factor = 1;
-  double gauss_amp = 0.5, gauss_scale = 0.25, slope_x = 0, slope_y = 0;
-  double bowl_south = 60, bowl_north = 70, bowl_west = 0, bowl_east = 20;
-  int    flat_bottom = 0, fill_first_row = 0;
-  int    filter_topog = 0, round_shallow = 0, fill_shallow = 0;
-  int    deepen_shallow = 0, smooth_topo_allow_deepening = 0;
-  int    errflg = (argc == 1);
-  int    option_index, i, c;
-  int    ret;
-  
-  /*
-   * process command line
-   */
-
-  static struct option long_options[] = {
-    {"mosaic",                      required_argument, NULL, 'a'},
-    {"topog_type",                  required_argument, NULL, 'b'},
-    {"x_refine",                    required_argument, NULL, 'X'},
-    {"y_refine",                    required_argument, NULL, 'Y'},
-    {"basin_depth",                 required_argument, NULL, 'c'},
-    {"topog_file",                  required_argument, NULL, 'd'},
-    {"topog_field",                 required_argument, NULL, 'e'},
-    {"bottom_depth",                required_argument, NULL, 'f'},
-    {"min_depth",                   required_argument, NULL, 'g'},
-    {"scale_factor",                required_argument, NULL, 'i'},
-    {"num_filter_pass",             required_argument, NULL, 'j'},
-    {"gauss_amp",                   required_argument, NULL, 'k'},
-    {"gauss_scale",                 required_argument, NULL, 'l'},
-    {"slope_x",                     required_argument, NULL, 'm'},    
-    {"slope_y",                     required_argument, NULL, 'n'},
-    {"bowl_south",                  required_argument, NULL, 'p'},
-    {"bowl_north",                  required_argument, NULL, 'q'},
-    {"bowl_west",                   required_argument, NULL, 'r'},
-    {"bowl_east",                   required_argument, NULL, 's'},
-    {"fill_first_row",              no_argument,       NULL, 't'},
-    {"filter_topog",                no_argument,       NULL, 'u'},    
-    {"round_shallow",               no_argument,       NULL, 'v'},
-    {"fill_shallow",                no_argument,       NULL, 'w'},
-    {"deepen_shallow",              no_argument,       NULL, 'x'},
-    {"smooth_topo_allow_deepening", no_argument,       NULL, 'y'},
-    {"topog_mosaic",                required_argument, NULL, 'o'},
-    {"help",                        no_argument,       NULL, 'h'},
-    {0, 0, 0, 0},
-  };
-
-  /* start parallel */
-
-  mpp_init(&argc, &argv);
-
-  mpp_domain_init();  
-   
-  while ((c = getopt_long(argc, argv, "", long_options, &option_index)) != -1)
-    switch (c) {
-    case 'a':
-      mosaic_file = optarg;
-      break;      
-    case 'b':
-      strcpy(topog_type, optarg);
-      break;
-    case 'X':
-      x_refine = atoi(optarg);
-      break;
-    case 'Y':
-      y_refine = atoi(optarg);
-      break;      
-    case 'c':
-      basin_depth = atof(optarg);
-      break;
-    case 'd':
-      topog_file = optarg;
-      break;
-    case 'e':
-      topog_field = optarg;
-      break;
-    case 'f':
-      bottom_depth = atof(optarg);
-      break; 
-    case 'g':
-      min_depth = atof(optarg);
-      break;
-    case 'i':
-      scale_factor = atof(optarg);
-      break;
-    case 'j':
-      num_filter_pass = atoi(optarg);
-      break; 
-    case 'k':
-      gauss_amp = atof(optarg);
-      break;
-    case 'l':
-      gauss_scale = atof(optarg);
-      break;
-    case 'm':
-      slope_x = atof(optarg);
-      break;
-    case 'n':
-      slope_y = atof(optarg);
-      break;
-    case 'p':
-      bowl_south = atof(optarg);
-      break;
-    case 'q':
-      bowl_north = atof(optarg);
-      break;
-    case 'r':
-      bowl_west  = atof(optarg);
-      break;
-    case 's':
-      bowl_east  = atof(optarg);
-      break;
-    case 't':
-      fill_first_row = 1;
-      break;
-    case 'u':
-      filter_topog = 1;
-      break;
-    case 'v':
-      round_shallow = 1;
-      break;
-    case 'w':
-      fill_shallow = 1;
-      break;
-    case 'x':
-      deepen_shallow = 1;
-      break;
-    case 'y':
-      smooth_topo_allow_deepening = 1;
-      break;
-    case 'o':
-      strcpy(topog_mosaic,optarg);
-      break; 
-    case '?':
-      errflg++;
-      break;
-    }
-
-  if (errflg || !mosaic_file ) {
-    char **u = usage;
-    while (*u) { fprintf(stderr, "%s\n", *u); u++; }
-    exit(2);
-  }
-
-  /* history will be write out as global attribute
-     in output file to specify the command line arguments
-  */
-
-  strcpy(history,argv[0]);
-
-  for(i=1;i<argc;i++) {
-    strcat(history, " ");
-    strcat(history, argv[i]);
-  }
-    
-  
-  /* Write out arguments value  */
-  if(mpp_pe() == mpp_root_pe()) printf("NOTE from make_topog ==> the topog_type is: %s\n",topog_type);
-  if ((ret = gs_make_topog(history, mosaic_file, topog_type, x_refine, y_refine, basin_depth, topog_file, topog_field,
-			   bottom_depth, min_depth, scale_factor, num_filter_pass, gauss_amp, gauss_scale,
-			   slope_x, slope_y, bowl_south, bowl_north, bowl_west, bowl_east, fill_first_row, 
-                           filter_topog, round_shallow, fill_shallow, deepen_shallow,
-			   smooth_topo_allow_deepening, topog_mosaic) ) )
-      return ret;
-
-  
-  if(mpp_pe() == mpp_root_pe() ) printf("Successfully generate %s\n",topog_mosaic);
-
-  mpp_end();
-
-  return 0;
-}; //main
diff --git a/gridspec/tools/make_topog/run_tests.in b/gridspec/tools/make_topog/run_tests.in
deleted file mode 100644
index 437e56f..0000000
--- a/gridspec/tools/make_topog/run_tests.in
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-# This shell script runs the GRIDSPEC make_topog tests.
-# $Id: run_tests.in,v 1.2 2009/09/08 17:14:52 ed Exp $
-
-set -e
-echo ""
-echo "*** Testing gridspec topog."
-
-# echo "*** generating realistic topography..."
-# ./make_topog --mosaic mosaic.nc --topog_type realistic \
-#     --topog_file /archive/fms/mom4/input_data/OCCAM_p5degree.nc --topog_field TOPO \
-#     --scale_factor -1 
-# ./gs_make_topog --mosaic mosaic.nc --topog_type realistic \
-#     --topog_file /archive/fms/mom4/input_data/OCCAM_p5degree.nc --topog_field TOPO \
-#     --scale_factor -1 --grid_name gs_topog_grid
-# @NCDUMPDIR@/ncdump topog.nc > topog.cdl
-# @NCDUMPDIR@/ncdump -n topog gs_topog.nc > gs_topog.cdl
-# #diff -w topog.cdl gs_topog.cdl 
-
-echo "*** All gridspec topog tests passed!"
-exit 0
diff --git a/gridspec/tools/make_vgrid/Makefile.am b/gridspec/tools/make_vgrid/Makefile.am
deleted file mode 100644
index 052d23a..0000000
--- a/gridspec/tools/make_vgrid/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-## This is an automake file, part of Unidata's NetCDF CF Library
-## package. Copyright 2009, see the COPYRIGHT file for more
-## information.
-
-# This automake file is in charge of building the gridspec
-# make_vgrid tool.
-
-# $Id: Makefile.am,v 1.4 2009/11/16 14:17:46 zhi Exp $
-
-bin_PROGRAMS = make_vgrid
-make_vgrid_SOURCES = make_vgrid.c
-
-# Initalize these.
-AM_CPPFLAGS = -I$(top_srcdir)/gridspec/tools/shared	\
--I$(top_srcdir)/gridspec/shared/mosaic
-AM_LDFLAGS = -L../shared -L../../shared/mosaic
-LDADD = -ltoolsshared -lshared -lnetcdf -lm
-
-if USE_NETCDF_DIR
-AM_CPPFLAGS += -I at NETCDFDIR@/include
-AM_LDFLAGS += -L at NETCDFDIR@/lib
-LDADD += -lnetcdf
-else
-if USE_NETCDF4
-LDADD += ../../../../libsrc4/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc4
-AM_LDFLAGS += -L../../../../libsrc4
-else
-LDADD += ../../../../libsrc/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc
-AM_LDFLAGS += -L../../../../libsrc
-endif # USE_NETCDF4
-endif # USE_NETCDF_DIR
-
-if USE_NETCDF4
-LDADD += -lhdf5_hl -lhdf5 -lz 
-endif
-
-if USE_HDF4
-LDADD += -lmfhdf -ldf -ljpeg
-endif # USE_HDF4
-
-# If the user specified a root for HDF5, use it.
-if USE_HDF5_DIR
-AM_CPPFLAGS += -I at HDF5DIR@/include
-AM_LDFLAGS += -L at HDF5DIR@/lib
-endif
-
-# If the user specified a prefix for the HDF4 library location, use it.
-if USE_HDF4_DIR
-AM_CPPFLAGS += -I at HDF4DIR@/include
-AM_LDFLAGS += -L at HDF4DIR@/lib
-endif
-
-# If the user specified a root location for ZLIB, use it.
-if USE_ZLIB_DIR
-AM_CPPFLAGS += -I at ZLIBDIR@/include
-AM_LDFLAGS += -L at ZLIBDIR@/lib
-endif
-
-# If the user specified a root location for SZLIB, use it.
-if USE_SZLIB_DIR
-AM_CPPFLAGS += -I at SZLIBDIR@/include
-AM_LDFLAGS += -L at SZLIBDIR@/lib
-endif
-
-TESTS = run_tests
-EXTRA_DIST = run_tests.in
-CLEANFILES = horizontal_grid.nc gs_horizontal_grid.nc		\
-horizontal_grid.cdl gs_horizontal_grid.cdl vertical_grid.nc	\
-gs_vertical_grid.nc vertical_grid.cdl gs_vertical_grid.cdl
-DISTCLEANFILES = run_tests
\ No newline at end of file
diff --git a/gridspec/tools/make_vgrid/make_vgrid.c b/gridspec/tools/make_vgrid/make_vgrid.c
deleted file mode 100644
index 8f5daea..0000000
--- a/gridspec/tools/make_vgrid/make_vgrid.c
+++ /dev/null
@@ -1,133 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <getopt.h>
-#include "tool_util.h"
-#include "mpp.h"
-
-
-#define MAXBOUNDS 100
-
-char *usage[] = {
-  "",
-  "                                                                                 ",
-  "                                                                                 ",
-  "                    Usage of make_vgrid                                          ",
-  "                                                                                 ",
-  "   make_vgrid --nbnds nbnds --bnds z(1),...,z(nbnds) --nz nz                     ",
-  "              [--grid_name gridname]    [--center center]                        ",
-  "                                                                                 ",
-  "   NOTE: This program call be used to make vertical grid for FMS model.          ",
-  "         It uses cubic-spline algorithm to calculate the grid cell location.     ",
-  "         The output netcdf will contains information on supergrid with grid      ",
-  "         size equal model grid size multipling refinement ( always 2 ).          ",
-  "         make_vgrid takes the following flags                                    ",
-  "                                                                                 ",
-  "   Required Flags:                                                               ",
-  "                                                                                 ",
-  "   --nbnds nbnds             Specify number of vertical regions for varying      ",
-  "                             resolution.                                         ",
-  "                                                                                 ",  
-  "   --bnds z(1),.,z(nbnds)    Specify boundaries for defining vertical regions of ",
-  "                             varying resolution.                                 ",
-  "                                                                                 ",
-  "   --nz nz(1),..,nz(nbnds-1) Number of model grid points for each vertical       ",
-  "                             regions of varying resolution.                       "
-  "                                                                                 ",  
-  "   Optional Flags:                                                               ",
-  "                                                                                 ",
-  " --grid_name gridname        Specify the grid name. The output grid file name    ",
-  "                             will be grid_name.nc. The default value is          ",
-  "                             vertical_grid.                                      ",
-  "                                                                                 ",  
-  " --center   center           Specify the center location of grid. The valid      ",
-  "                             entry will be 'none', 't_cell' or 'c_cell' with     ",
-  "                             default value 'none'. The grid refinement is        ",
-  "                             assumed to be 2 in x and y-direction when center    ",
-  "                             is not 'none'. 'c_cell' should be used for the grid ",
-  "                             used in MOM4.                                       ",
-  "                                                                                 ",
-  "                                                                                 ",
-  "   Example                                                                       ",      
-  "                                                                                 ",
-  "                                                                                 ",
-  " make_vgrid --nbnds 3 --bnds 10,200,1000 --nz 10,20                             ",
-  "       will make a grid file with 60 supergrid cells, 30 model grid cells        ",
-  "       with refinement is 2.                                                     ",
-  "",
-  NULL };  
-
-/*char tagname[] = "$Name:  $"; */
-
-int main(int argc, char* argv[])
-{
-  int nbnds, n1, n2, i, nk;
-  double bnds[MAXBOUNDS];
-  int    nz[MAXBOUNDS-1];
-  char gridname[128]= "vertical_grid";
-  char filename[128];
-  char center[32] = "none";
-  char entry[512];
-  char history[256];
-  int errflg, c, option_index = 0;
-  int ret;
-
-  static struct option long_options[]= {  
-    {"nbnds",    required_argument, NULL, 'n'},
-    {"bnds",     required_argument, NULL, 'b'},
-    {"nz",       required_argument, NULL, 'z'},
-    {"grid_name",required_argument, NULL, 'o'},        
-    {"center",   required_argument, NULL, 'c'},    
-    {0, 0, 0, 0}
-  };
-  
-  /* process command line */
-  errflg = argc <4;
-  nbnds = 0;
-  n1 = 0;
-  n2 = 0;
-  while ((c = getopt_long(argc, argv, "", long_options, &option_index)) != -1)
-    switch (c) {
-    case 'n':
-      nbnds = atoi(optarg);
-      break;
-    case 'b':
-      strcpy(entry, optarg);
-      n1 = get_double_entry(entry, bnds);
-      break;
-    case 'z':
-      strcpy(entry, optarg);
-      n2 = get_int_entry(entry, nz);
-      break;
-    case 'o':
-      strcpy(gridname, optarg);
-      break;
-    case 'c':
-      strcpy(center, optarg);
-      break;
-    case '?':
-      errflg++;      
-    }
-
-  if (errflg ) {
-    char **u = usage;
-    while (*u) { fprintf(stderr, "%s\n", *u); u++; }
-    mpp_error("Wrong usage of this program, check arguments") ;
-  }    
-
-  /* define history to be the history in the grid file */
-  strcpy(history,argv[0]);
-
-  for(i=1;i<argc;i++) {
-    strcat(history, " ");
-    strcat(history, argv[i]);
-  }
-
-  if ((ret = gs_make_vgrid(history, nbnds, bnds, n1, n2, 
-			   nz, gridname, center)))
-     return ret;
-
-  mpp_end();
-
-  return 0;
-}    
diff --git a/gridspec/tools/make_vgrid/run_tests.in b/gridspec/tools/make_vgrid/run_tests.in
deleted file mode 100644
index 873f9e5..0000000
--- a/gridspec/tools/make_vgrid/run_tests.in
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-# This shell script runs the GRIDSPEC make_vgrid tests.
-# $Id: run_tests.in,v 1.3 2009/11/16 14:17:46 zhi Exp $
-
-set -e
-echo ""
-echo "*** Testing gridspec vgrids."
-
-echo "*** generating regular lon-lat grid (supergrid size 60x20)..."
-./make_vgrid --nbnds 3 --bnds 10,200,1000 --nz 10,20
-
-echo "*** All gridspec vgrid tests passed!"
-exit 0
diff --git a/gridspec/tools/shared/Makefile.am b/gridspec/tools/shared/Makefile.am
deleted file mode 100644
index c70dcee..0000000
--- a/gridspec/tools/shared/Makefile.am
+++ /dev/null
@@ -1,76 +0,0 @@
-## This is an automake file, part of Unidata's NetCDF CF Library
-## package. Copyright 2009, see the COPYRIGHT file for more
-## information.
-
-# This automake file is in charge of building the gridspec
-# tools/shared convenience library.
-
-# $Id: Makefile.am,v 1.4 2009/11/16 14:31:30 zhi Exp $
-
-noinst_LTLIBRARIES = libtoolsshared.la
-libtoolsshared_la_SOURCES = mpp.c mpp_domain.c mpp_domain.h mpp.h	\
-mpp_io.c mpp_io.h tool_util.c tool_util.h create_lonlat_grid.c		\
-create_gnomonic_cubic_grid.c create_grid_from_file.c			\
-create_conformal_cubic_grid.c create_hgrid.h fregrid_util.c fregrid_util.h \
-conserve_interp.c conserve_interp.h bilinear_interp.c bilinear_interp.h \
-topog.c topog.h create_vgrid.c create_vgrid.h \
-make_boundary_contact.c make_boundary_contact.h \
-make_xgrid_contact.c make_xgrid_contact.h
-
-AM_CPPFLAGS = -I../shared -I$(top_srcdir)/gridspec/shared/mosaic 
-
-AM_LDFLAGS =
-LDADD =
-
-if USE_NETCDF_DIR
-AM_CPPFLAGS += -I at NETCDFDIR@/include
-AM_LDFLAGS += -L at NETCDFDIR@/lib
-LDADD += -lnetcdf
-else
-if USE_NETCDF4
-LDADD += ../../../../libsrc4/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc4
-AM_LDFLAGS += -L../../../../libsrc4
-else
-LDADD += ../../../../libsrc/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc
-AM_LDFLAGS += -L../../../../libsrc
-endif # USE_NETCDF4
-endif # USE_NETCDF_DIR
-
-if USE_NETCDF4
-LDADD += -lhdf5_hl -lhdf5 -lz 
-endif
-
-if USE_HDF4
-LDADD += -lmfhdf -ldf -ljpeg
-endif # USE_HDF4
-
-# If the user specified a root for HDF5, use it.
-if USE_HDF5_DIR
-AM_CPPFLAGS += -I at HDF5DIR@/include
-AM_LDFLAGS += -L at HDF5DIR@/lib
-endif
-
-# If the user specified a prefix for the HDF4 library location, use it.
-if USE_HDF4_DIR
-AM_CPPFLAGS += -I at HDF4DIR@/include
-AM_LDFLAGS += -L at HDF4DIR@/lib
-endif
-
-# If the user specified a root location for ZLIB, use it.
-if USE_ZLIB_DIR
-AM_CPPFLAGS += -I at ZLIBDIR@/include
-AM_LDFLAGS += -L at ZLIBDIR@/lib
-endif
-
-# If the user specified a root location for SZLIB, use it.
-if USE_SZLIB_DIR
-AM_CPPFLAGS += -I at SZLIBDIR@/include
-AM_LDFLAGS += -L at SZLIBDIR@/lib
-endif
-
-
-
-
-
diff --git a/gridspec/tools/shared/bilinear_interp.c b/gridspec/tools/shared/bilinear_interp.c
deleted file mode 100644
index 1c99cf2..0000000
--- a/gridspec/tools/shared/bilinear_interp.c
+++ /dev/null
@@ -1,1137 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include "globals.h"
-#include "mosaic_util.h"
-#include "bilinear_interp.h"
-#include "mpp_io.h"
-#include "mpp.h"
-
-#define min(a,b) (a<b ? a:b)
-#define max(a,b) (a>b ? a:b)
-#define sign(a,b)(b<0 ? -fabs(a):fabs(a))
-
-
-int max_weight_index( double *var, int nvar);
-double normalize_great_circle_distance(const double *v1, const double *v2);
-/*double spherical_angle(double *v1, double *v2, double *v3);*/
-double dist2side(const double *v1, const double *v2, const double *point);
-void redu2x(const double *varfin, const double *yfin, int nxfin, int nyfin, double *varcrs,
-	    int nxcrs, int nycrs, int nz, int has_missing, double missvalue);
-void do_latlon_coarsening(const double *var_latlon, const double *ylat, int nlon, int nlat, int nz,    
-			  double *var_latlon_crs, int finer_steps, int has_missing, double missvalue);
-void do_c2l_interp(const Interp_config *interp, int nx_in, int ny_in, int nz, const Field_config *field_in,
-		   int nx_out, int ny_out, double *data_out, int has_missing, double missing, int fill_missing );
-void sort_index(int ntiles, int *index, double *shortest);
-int get_index(const Grid_config *grid_in, const Grid_config *grid_out, int *index,
-	       int i_in, int j_in, int l_in, int i_out, int j_out);
-int get_closest_index(const Grid_config *grid_in, const Grid_config *grid_out, int *index,
-		      int i_in, int j_in, int l_in, int i_out, int j_out);
-
-/*******************************************************************************
-  void setup_bilinear_interp( )
-    !------------------------------------------------------------------!
-    ! calculate weights for bilinear interpolation                     !
-    ! from cubed sphere to latlon grid                                 !
-    !                                                                  !
-    ! input:                                                           !
-    ! sph_corner      cubed sphere corner location in spherical coor   !
-    ! npx, npy        number of corners per tile                       !
-    ! ntiles          number of tiles                                  !
-    ! xlon, ylat      latlon grid coor                                 !
-    ! nlon, nlat      latlon grid dimension                            !
-    !                                                                  !
-    ! output:                                                          !
-    ! c2l_index       cubed sphere index for latlon interpolation      !
-    ! c2l_weight      weights for cubsph_to_latlon interpolation       !
-    ! elon_cubsph     lon unit vector for cubed sphere center          !
-    ! elat_cubsph     lat unit vector for cubed sphere center          !
-    ! elon_latlon     lon unit vector for latlon grid                  !
-    ! elat_latlon     lat unit vector for latlon grid                  !
-    !------------------------------------------------------------------!
-*******************************************************************************/
-void setup_bilinear_interp(int ntiles_in, const Grid_config *grid_in, int ntiles_out, const Grid_config *grid_out, 
-                      Interp_config *interp, unsigned int opcode)
-{
-  const int max_iter = 10;
-  double abs_center, dcub, dlon, dlat, coslat, distance;
-  double dist1, dist2, dist3, dist4, sum;
-  double *shortest;
-  int    i, j, n, l, ic, jc, lc, icc, jcc, i_min, i_max, j_min, j_max, iter;
-  int    n0, n1, n2, n3, n4, m0, m1;
-  int    nx_in, ny_in, nx_out, ny_out, nxd, nyd;
-  double v0[3], v1[3], v2[3], v3[3], v4[3];
-  int    all_done;
-  int    *found, *index;
-  
-  /* ntiles_in must be six and ntiles_out must be one */
-  if(ntiles_in != 6) mpp_error("Error from bilinear_interp: source mosaic should be cubic mosaic "
-			       "and have six tiles when using bilinear option");
-  if(ntiles_out != 1) mpp_error("Error from bilinear_interp: destination mosaic should be "
-				"one tile lat-lon grid when using bilinear option"); 
-  /*-----------------------------------------------------------------!
-    ! cubed sphere: cartesian coordinates of cell corners,             !
-    !               cell lenghts between corners,                      !
-    !               cartesian and spherical coordinates of cell centers! 
-    !               calculate latlon unit vector                       !
-    !-----------------------------------------------------------------*/
-
-  /* calculation is done on the fine grid */
-  nx_out   = grid_out->nx_fine;
-  ny_out   = grid_out->ny_fine;
-  nx_in    = grid_in->nx;       /* the cubic grid has same resolution on each face */
-  ny_in    = grid_in->ny;
-  nxd      = nx_in + 2;
-  nyd      = ny_in + 2;
-
-  interp->index  = (int    *)malloc(3*nx_out*ny_out*sizeof(int   ));
-  interp->weight = (double *)malloc(4*nx_out*ny_out*sizeof(double));
-
-  if( (opcode & READ) && interp->file_exist ) { /* reading from file */
-    int nx2, ny2, fid, vid;
-
-    /* check the size of the grid matching the size in remapping file */
-    printf("NOTE: reading index and weight for bilinear interpolation from file.\n");
-    fid = mpp_open(interp->remap_file, MPP_READ);
-    nx2 = mpp_get_dimlen(fid, "nlon");
-    ny2 = mpp_get_dimlen(fid, "nlat");
-    printf("grid size is nx=%d, ny=%d, remap file size is nx=%d, ny=%d.\n", nx_out, ny_out, nx2, ny2);
-    if(nx2 != nx_out || ny2 != ny_out ) mpp_error("bilinear_interp: size mismatch between grid size and remap file size");
-    vid = mpp_get_varid(fid, "index");
-    mpp_get_var_value(fid, vid, interp->index);
-    vid = mpp_get_varid(fid, "weight");
-    mpp_get_var_value(fid, vid, interp->weight);
-    mpp_close(fid);
-    return;
-  }
-  
-  /*------------------------------------------------------------------
-    find lower left corner on cubed sphere for given latlon location 
-    ------------------------------------------------------------------*/
-  found    = (int *)malloc(nx_out*ny_out*sizeof(int));
-  index    = (int *)malloc(ntiles_in*3*sizeof(int));
-  shortest = (double *)malloc(ntiles_in*sizeof(double));
-  for(i=0; i<nx_out*ny_out; i++) found[i] = 0;
-    
-  dlon=(M_PI+M_PI)/nx_out;
-  dlat=M_PI/(ny_out-1);
-
-  for(iter=1; iter<=max_iter; iter++) {
-    for(l=0; l<ntiles_in; l++) {
-      for(jc=1; jc<=ny_in; jc++) for(ic=1; ic<=nx_in; ic++) {
-	/*------------------------------------------------------
-	  guess latlon indexes for given cubed sphere cell     
-	  ------------------------------------------------------*/
-	n1 = jc*nxd+ic;
-	n2 = (jc+1)*nxd+ic+1;
-	v1[0] = grid_in[l].xt[n1];
-	v1[1] = grid_in[l].yt[n1];
-	v1[2] = grid_in[l].zt[n1];
-	v2[0] = grid_in[l].xt[n2];
-	v2[1] = grid_in[l].yt[n2];
-	v2[2] = grid_in[l].zt[n2];
-	dcub=iter*normalize_great_circle_distance(v1, v2);
-	j_min=max(   1,  floor((grid_in[l].latt[n1]-dcub+0.5*M_PI)/dlat)-iter+1);
-	j_max=min(ny_out,ceil((grid_in[l].latt[n1]+dcub+0.5*M_PI)/dlat)+iter-1);
-	if (j_min==1 || j_max==ny_out) {
-	  i_min=1;
-	  i_max=nx_out;
-	}
-        else {
-	  i_min=max(   1,  floor((grid_in[l].lont[n1]-dcub)/dlon-iter+1));
-	  i_max=min(nx_out,ceil((grid_in[l].lont[n1]+dcub)/dlon+iter-1));
-	}
-	for(j=j_min-1; j<j_max; j++) for(i=i_min-1; i<i_max; i++) {
-	  n0 = j*nx_out + i;
-	  /*--------------------------------------------------------------------
-            for latlon cell find nearest cubed sphere cell 
-            ------------------------------------------------------------------*/
-	  if (!found[n0]) {
-	    shortest[l]=M_PI+M_PI;
-	    for(jcc=jc; jcc<=min(ny_in, jc+1); jcc++) for(icc=ic; icc<=min(nx_in, ic+1); icc++) {
-	      n1 = jcc*nxd + icc;
-	      n2 = j*nx_out + i;
-	      v1[0] = grid_in[l].xt[n1];
-	      v1[1] = grid_in[l].yt[n1];
-	      v1[2] = grid_in[l].zt[n1];
-	      v2[0] = grid_out->xt[n2];
-	      v2[1] = grid_out->yt[n2];
-	      v2[2] = grid_out->zt[n2];	      
-	      distance=normalize_great_circle_distance(v1, v2);
-	      if (distance < shortest[l]) {
-		shortest[l]=distance;
-		index[3*l]  =icc;
-		index[3*l+1]=jcc;
-		index[3*l+2]=l;
-	      }
-	    }
-	    /*------------------------------------------------
-              determine lower left corner                    
-              ------------------------------------------------*/
-	    found[n0] = get_closest_index(&(grid_in[l]), grid_out, &(interp->index[3*(j*nx_out+i)]), index[3*l],
-			      index[3*l+1], index[3*l+2], i, j);
-	  }
-	}
-      }
-    }
-    if (iter>1) {
-      all_done = 1;
-      for(i=0; i<nx_out*ny_out; i++) {
-	if( !found[i]) {
-	  all_done = 0;
-	  break;
-	}
-      };
-      if (all_done) break;
-    }
-  }
-  
-  /*------------------------------------------------------------------
-    double check if lower left corner was found                      
-    calculate weights for interpolation                              
-    ------------------------------------------------------------------*/
-  for(j=0; j<ny_out; j++) for(i=0; i<nx_out; i++) {
-    n0 = j*nx_out + i;
-    m0 = 3*n0;
-    m1 = 4*n0;
-    if (!found[n0]) {
-      printf("**************************************************************\n");
-      printf("WARNING: didn't find lower left corner for (ilon,jlat) = (%d,%d)\n", i,j);
-      printf("will perform expensive global sweep\n");
-      printf("**************************************************************\n");
-      /*---------------------------------------------------------
-	for latlon cell find nearby cubed sphere cell           
-	---------------------------------------------------------*/
-      for(l=0; l<3*ntiles_in; l++) index[l] = 0;	
-      for(l=0; l<ntiles_in; l++) shortest[l] = M_PI + M_PI;
-      for(l=0; l<ntiles_in; l++) {
-	for(jc=0; jc<ny_in; j++) for(ic=0; ic<nx_in; ic++) {
-	  n1 = jc*nxd+ic;
-	  v1[0] = grid_in[l].xt[n1];
-	  v1[1] = grid_in[l].yt[n1];
-	  v1[2] = grid_in[l].zt[n1];
-	  v0[0] = grid_out[l].xt[n0];
-	  v0[1] = grid_out[l].yt[n0];
-	  v0[2] = grid_out[l].zt[n0];	    
-	  distance=normalize_great_circle_distance(v1, v2);
-	  if (distance<shortest[l]) {
-	    shortest[l]=distance;
-	    index[3*l  ]=ic;
-	    index[3*l+1]=jc;
-	    index[3*l+2]=l;
-	  }
-	}
-      }
-
-      /*---------------------------------------------------------
-	determine lower left corner                             
-	---------------------------------------------------------*/
-      sort_index(ntiles_in, index, shortest);
-      found[n0]=0;
-      for(l=0; l<ntiles_in; l++) {
-	if (!found[n0]) {
-	  found[n0]=get_index(&(grid_in[l]), grid_out, &(interp->index[3*(j*nx_out+i)]), index[3*l],
-			      index[3*l+1], index[3*l+2], i, j);
-	  if (found[n0]) break;
-	}
-      }
-      if (! found[n0] ) mpp_error("error from bilinear_interp: couldn't find lower left corner");
-    }
-    /*------------------------------------------------------------
-      calculate shortest distance to each side of rectangle      
-      formed by cubed sphere cell centers                        
-      special corner treatment                                   
-      ------------------------------------------------------------*/
-    ic=interp->index[m0];
-    jc=interp->index[m0+1];
-    l =interp->index[m0+2];
-    if (ic==nx_in && jc==ny_in) {
-      /*------------------------------------------------------------
-	calculate weights for bilinear interpolation near corner   
-	------------------------------------------------------------*/
-      n1 = jc*nxd+ic;
-      n2 = jc*nxd+ic+1;
-      n3 = (jc+1)*nxd+ic;
-      v1[0] = grid_in[l].xt[n1];
-      v1[1] = grid_in[l].yt[n1];
-      v1[2] = grid_in[l].zt[n1];
-      v2[0] = grid_in[l].xt[n2];
-      v2[1] = grid_in[l].yt[n2];
-      v2[2] = grid_in[l].zt[n2];
-      v3[0] = grid_in[l].xt[n3];
-      v3[1] = grid_in[l].yt[n3];
-      v3[2] = grid_in[l].zt[n3];
-      v0[0] = grid_out->xt[n0];
-      v0[1] = grid_out->yt[n0];
-      v0[2] = grid_out->zt[n0];	  
-      dist1=dist2side(v2, v3, v0);
-      dist2=dist2side(v2, v1, v0);
-      dist3=dist2side(v1, v3, v0);
-      interp->weight[m1]  =dist1;      /* ic,   jc    weight */
-      interp->weight[m1+1]=dist2;      /* ic,   jc+1  weight */
-      interp->weight[m1+2]=0.;         /* ic+1, jc+1  weight */
-      interp->weight[m1+3]=dist3;      /* ic+1, jc    weight */
-             
-      sum=interp->weight[m1]+interp->weight[m1+1]+interp->weight[m1+3];
-      interp->weight[m1]  /=sum;
-      interp->weight[m1+1]/=sum;
-      interp->weight[m1+3]/=sum;
-    }
-    else if (ic==0 && jc==ny_in) {
-      /*------------------------------------------------------------
-	calculate weights for bilinear interpolation near corner   
-	------------------------------------------------------------*/
-	
-      n1 = jc*nxd+ic;
-      n2 = jc*nxd+ic+1;
-      n3 = (jc+1)*nxd+ic+1;
-      v1[0] = grid_in[l].xt[n1];
-      v1[1] = grid_in[l].yt[n1];
-      v1[2] = grid_in[l].zt[n1];
-      v2[0] = grid_in[l].xt[n2];
-      v2[1] = grid_in[l].yt[n2];
-      v2[2] = grid_in[l].zt[n2];
-      v3[0] = grid_in[l].xt[n3];
-      v3[1] = grid_in[l].yt[n3];
-      v3[2] = grid_in[l].zt[n3];
-      v0[0] = grid_out->xt[n0];
-      v0[1] = grid_out->yt[n0];
-      v0[2] = grid_out->zt[n0];	  
-      dist1=dist2side(v3, v2, v0);
-      dist2=dist2side(v2, v1, v0);
-      dist3=dist2side(v3, v1, v0);             
-      interp->weight[m1]  =dist1;      /* ic,   jc    weight */
-      interp->weight[m1+1]=0.;         /* ic,   jc+1  weight */
-      interp->weight[m1+2]=dist2;      /* ic+1, jc+1  weight */
-      interp->weight[m1+3]=dist3;      /* ic+1, jc    weight */
-             
-      sum=interp->weight[m1]+interp->weight[m1+2]+interp->weight[m1+3];
-      interp->weight[m1]  /=sum;
-      interp->weight[m1+2]/=sum;
-      interp->weight[m1+3]/=sum;
-    }
-    else if (jc==0 && ic==nx_in) {
-      /*------------------------------------------------------------
-	calculate weights for bilinear interpolation near corner   
-	------------------------------------------------------------*/
-      n1 = jc*nxd+ic;
-      n2 = (jc+1)*nxd+ic;
-      n3 = (jc+1)*nxd+ic+1;
-      v1[0] = grid_in[l].xt[n1];
-      v1[1] = grid_in[l].yt[n1];
-      v1[2] = grid_in[l].zt[n1];
-      v2[0] = grid_in[l].xt[n2];
-      v2[1] = grid_in[l].yt[n2];
-      v2[2] = grid_in[l].zt[n2];
-      v3[0] = grid_in[l].xt[n3];
-      v3[1] = grid_in[l].yt[n3];
-      v3[2] = grid_in[l].zt[n3];
-      v0[0] = grid_out->xt[n0];
-      v0[1] = grid_out->yt[n0];
-      v0[2] = grid_out->zt[n0];	  
-      dist1=dist2side(v2, v3, v0);
-      dist2=dist2side(v1, v3, v0);
-      dist3=dist2side(v1, v2, v0);             	     
-             
-      interp->weight[m1]  =dist1;      /* ic,   jc    weight */
-      interp->weight[m1+1]=dist2;      /* ic,   jc+1  weight */
-      interp->weight[m1+2]=dist3;      /* ic+1, jc+1  weight */
-      interp->weight[m1+3]=0.;         /* ic+1, jc    weight */
-             
-      sum=interp->weight[m1]+interp->weight[m1+1]+interp->weight[m1+2];
-      interp->weight[m1]  /=sum;
-      interp->weight[m1+1]/=sum;
-      interp->weight[m1+2]/=sum;
-    }
-    else {
-      /*------------------------------------------------------------
-	calculate weights for bilinear interpolation if no corner  
-	------------------------------------------------------------*/
-      n1 = jc*nxd+ic;
-      n2 = jc*nxd+ic+1;
-      n3 = (jc+1)*nxd+ic;
-      n4 = (jc+1)*nxd+ic+1;
-      v1[0] = grid_in[l].xt[n1];
-      v1[1] = grid_in[l].yt[n1];
-      v1[2] = grid_in[l].zt[n1];
-      v2[0] = grid_in[l].xt[n2];
-      v2[1] = grid_in[l].yt[n2];
-      v2[2] = grid_in[l].zt[n2];
-      v3[0] = grid_in[l].xt[n3];
-      v3[1] = grid_in[l].yt[n3];
-      v3[2] = grid_in[l].zt[n3];
-      v4[0] = grid_in[l].xt[n4];
-      v4[1] = grid_in[l].yt[n4];
-      v4[2] = grid_in[l].zt[n4];	
-      v0[0] = grid_out->xt[n0];
-      v0[1] = grid_out->yt[n0];
-      v0[2] = grid_out->zt[n0];	  
-      dist1=dist2side(v1, v3, v0);
-      dist2=dist2side(v3, v4, v0);
-      dist3=dist2side(v4, v2, v0);
-      dist4=dist2side(v2, v1, v0);
-	
-      interp->weight[m1]  =dist2*dist3;      /* ic,   jc    weight */
-      interp->weight[m1+1]=dist3*dist4;      /* ic,   jc+1  weight */
-      interp->weight[m1+2]=dist4*dist1;      /* ic+1, jc+1  weight */
-      interp->weight[m1+3]=dist1*dist2;      /* ic+1, jc    weight */
-             
-      sum=interp->weight[m1]+interp->weight[m1+1]+interp->weight[m1+2]+interp->weight[m1+3];
-      interp->weight[m1]  /=sum;
-      interp->weight[m1+1]/=sum;
-      interp->weight[m1+2]/=sum;
-      interp->weight[m1+3]/=sum;
-    }
-  }
-
-  /* write out weight information if needed */
-  if( opcode & WRITE ) {
-    int fid, dim_three, dim_four, dim_nlon, dim_nlat, dims[3];
-    int fld_index, fld_weight;
-    
-    fid = mpp_open( interp->remap_file, MPP_WRITE);
-    dim_nlon = mpp_def_dim(fid, "nlon", nx_out);
-    dim_nlat = mpp_def_dim(fid, "nlat", ny_out);
-    dim_three = mpp_def_dim(fid, "three", 3);
-    dim_four  = mpp_def_dim(fid, "four", 4);
-    
-    dims[0] = dim_three; dims[1] = dim_nlat; dims[2] = dim_nlon;
-    fld_index = mpp_def_var(fid, "index", NC_INT, 3, dims, 0);
-    dims[0] = dim_four; dims[1] = dim_nlat; dims[2] = dim_nlon;
-    fld_weight = mpp_def_var(fid, "weight", NC_DOUBLE, 3, dims, 0);
-    mpp_end_def(fid);
-    mpp_put_var_value(fid, fld_index, interp->index);
-    mpp_put_var_value(fid, fld_weight, interp->weight);
-    mpp_close(fid);
-  }
-
-  /* release the memory */
-  free(found);
-  free(shortest);
-  free(index);
-  
-  printf("\n done calculating interp_index and interp_weight\n");
-}; /* setup_bilinear_interp */
-
-/*----------------------------------------------------------------------------
-   void do_scalar_bilinear_interp(Mosaic_config *input, Mosaic_config *output, int varid )
-   interpolate scalar data to latlon,                               !
-   --------------------------------------------------------------------------*/
-void do_scalar_bilinear_interp(const Interp_config *interp, int vid, int ntiles_in, const Grid_config *grid_in, const Grid_config *grid_out,
-			  const Field_config *field_in, Field_config *field_out, int finer_step, int fill_missing)
-{
-  int    nx_in, ny_in, nx_out, ny_out, nz;
-  int    n, ts, tn, tw, te;
-  int    has_missing;
-  double missing;
-  double *data_fine;
-  
-  /*------------------------------------------------------------------
-    determine target grid resolution                                 
-    ------------------------------------------------------------------*/
-  nx_out     = grid_out->nx_fine;
-  ny_out     = grid_out->ny_fine;
-  nx_in       = grid_in->nx;
-  ny_in       = grid_in->ny;
-  /* currently we are regridding one vertical level for each call to reduce the memory usage */
-  nz = 1;  
-  missing     = field_in[0].var[vid].missing;
-  has_missing = field_in[0].var[vid].has_missing;
-
-  data_fine = (double *)malloc(nx_out*ny_out*nz*sizeof(double));
-  
-  do_c2l_interp(interp, nx_in, ny_in, nz, field_in, nx_out, ny_out, data_fine, has_missing, missing, fill_missing);
-  do_latlon_coarsening(data_fine, grid_out->latt1D_fine, nx_out, ny_out, nz, field_out->data,
-		       finer_step, has_missing, missing);
-  free(data_fine);
-  
-}; /* do_c2l_scalar_interp */
-
-
-   
-/*----------------------------------------------------------------------------
-   void do_vector_bilinear_interp()
-   interpolate vector data to latlon,                               !
-   --------------------------------------------------------------------------*/
-void do_vector_bilinear_interp(Interp_config *interp, int vid, int ntiles_in, const Grid_config *grid_in, int ntiles_out, 
-			  const Grid_config *grid_out, const Field_config *u_in,  const Field_config *v_in,
-			  Field_config *u_out, Field_config *v_out, int finer_step, int fill_missing)
-{
-  Field_config *var_cubsph;
-  int          nx_in, ny_in, nx_out, ny_out, nxd, nyd, nz, has_missing;
-  int          i, j, k, n, n1, n2, ts, tn, tw, te;
-  double       missing;
-  double       *x_latlon, *y_latlon, *z_latlon, *var_latlon;
-  
-  nx_out      = grid_out->nx_fine;
-  ny_out      = grid_out->ny_fine;
-  nx_in       = grid_in->nx;
-  ny_in       = grid_in->ny;
-  nxd         = nx_in + 2;
-  nyd         = ny_in + 2;
-  /* currently we are regridding one vertical level for each call to reduce the memory usage */
-  nz = 1;  
-  missing     = u_in[0].var[vid].missing;
-  has_missing = u_in[0].var[vid].has_missing;
-
-  
-  x_latlon   = (double *)malloc(nx_out*ny_out*nz*sizeof(double));
-  y_latlon   = (double *)malloc(nx_out*ny_out*nz*sizeof(double));
-  z_latlon   = (double *)malloc(nx_out*ny_out*nz*sizeof(double));
-  var_latlon = (double *)malloc(nx_out*ny_out*nz*sizeof(double));
-  var_cubsph = (Field_config *)malloc(ntiles_in*sizeof(Field_config));
-  for(n=0; n<ntiles_in; n++) var_cubsph[n].data = (double *)malloc((nx_in+2)*(ny_in+2)*nz*sizeof(double));
-
-  for(n=0; n<ntiles_in; n++) {
-    for(k=0; k<nz; k++) for(j=0; j<nyd; j++) for(i=0; i<nxd; i++) {
-      n1 = k*nxd*nyd + j*nxd + i;
-      n2 = j*nxd + i;
-      var_cubsph[n].data[n1] = u_in[n].data[n1]*grid_in[n].vlon_t[3*n2]+v_in[n].data[n1]*grid_in[n].vlat_t[3*n2];
-    }
-  }
-
-  do_c2l_interp(interp, nx_in, ny_in, nz, var_cubsph, nx_out, ny_out, x_latlon, has_missing, missing, fill_missing);  
-
-  for(n=0; n<ntiles_in; n++) {
-    for(k=0; k<nz; k++) for(j=0; j<nyd; j++) for(i=0; i<nxd; i++) {
-      n1 = k*nxd*nyd + j*nxd + i;
-      n2 = j*nxd + i;
-      var_cubsph[n].data[n1] = u_in[n].data[n1]*grid_in[n].vlon_t[3*n2+1]+v_in[n].data[n1]*grid_in[n].vlat_t[3*n2+1];
-    }
-  }
-  do_c2l_interp(interp, nx_in, ny_in, nz, var_cubsph, nx_out, ny_out, y_latlon, has_missing, missing, fill_missing);  
-  
-  for(n=0; n<ntiles_in; n++) {
-    for(k=0; k<nz; k++) for(j=0; j<nyd; j++) for(i=0; i<nxd; i++) {
-      n1 = k*nxd*nyd + j*nxd + i;
-      n2 = j*nxd + i;
-      var_cubsph[n].data[n1] = u_in[n].data[n1]*grid_in[n].vlon_t[3*n2+2]+v_in[n].data[n1]*grid_in[n].vlat_t[3*n2+2];
-    }
-  }
-
-  do_c2l_interp(interp, nx_in, ny_in, nz, var_cubsph, nx_out, ny_out, z_latlon, has_missing, missing, fill_missing);  
-
-  for(n=0; n<ntiles_in; n++) free(var_cubsph[n].data);
-  free(var_cubsph);
-
-  
-  for(k=0; k<nz; k++) for(j=0; j<ny_out; j++) for(i=0; i<nx_out; i++) {
-    n1 = k*nx_out*ny_out + j*nx_out + i;
-    n2 = j*nx_out + i;
-    var_latlon[n1] = x_latlon[n1]*grid_out->vlon_t[3*n2] +  y_latlon[n1]*grid_out->vlon_t[3*n2+1] +  z_latlon[n1]*grid_out->vlon_t[3*n2+2];
-  }
-  do_latlon_coarsening(var_latlon, grid_out->latt1D_fine, nx_out, ny_out, nz, u_out->data,
-		       finer_step, has_missing, missing);
-
-  for(k=0; k<nz; k++) for(j=0; j<ny_out; j++) for(i=0; i<nx_out; i++) {
-    n1 = k*nx_out*ny_out + j*nx_out + i;
-    n2 = j*nx_out + i;
-    var_latlon[n1] = x_latlon[n1]*grid_out->vlat_t[3*n2] +  y_latlon[n1]*grid_out->vlat_t[3*n2+1] +  z_latlon[n1]*grid_out->vlat_t[3*n2+2];
-  }
-
-  do_latlon_coarsening(var_latlon, grid_out->latt1D_fine, nx_out, ny_out, nz, v_out->data,
-		       finer_step, has_missing, missing);
-
-  free(x_latlon);
-  free(y_latlon);
-  free(z_latlon);
-    
-}; /* do_vector_bilinear_interp */
-
-
-void do_c2l_interp(const Interp_config *interp, int nx_in, int ny_in, int nz, const Field_config *field_in,
-		   int nx_out, int ny_out, double *data_out, int has_missing, double missing, int fill_missing )
-{
-  int i, j, k, nxd, nyd, ic, jc, ind, n1, tile;
-  double d_in[4];
-  
-  nxd = nx_in + 2;
-  nyd = ny_in + 2;
-  
-  if (has_missing) {
-    for(k=0; k<nz; k++) for(j=0; j<ny_out; j++) for(i=0; i<nx_out; i++) {
-      n1      = j*nx_out+i;
-      ic      = interp->index[3*n1];
-      jc      = interp->index[3*n1+1];
-      tile    = interp->index[3*n1+2];
-      d_in[0] = field_in[tile].data[k*nxd*nyd+jc    *nxd+ic];
-      d_in[1] = field_in[tile].data[k*nxd*nyd+(jc+1)*nxd+ic];
-      d_in[2] = field_in[tile].data[k*nxd*nyd+(jc+1)*nxd+ic+1];
-      d_in[3] = field_in[tile].data[k*nxd*nyd+jc    *nxd+ic+1];
-      if (d_in[0] == missing || d_in[1] == missing || d_in[2] == missing || d_in[3] == missing ) {
-	if (fill_missing) {
-	  ind = max_weight_index( &(interp->weight[4*n1]), 4);
-	  data_out[k*nx_out*ny_out+n1] = d_in[ind];
-	}
-	else {
-	  data_out[k*nx_out*ny_out+n1] = missing;
-	}
-      }
-      else {
-	data_out[k*nx_out*ny_out+n1] = d_in[0]*interp->weight[4*n1] + d_in[1]*interp->weight[4*n1+1]
-	  + d_in[2]*interp->weight[4*n1+2] + d_in[3]*interp->weight[4*n1+3];
-      }
-    }
-  }
-  else {
-    for(k=0; k<nz; k++) for(j=0; j<ny_out; j++) for(i=0; i<nx_out; i++) {
-      n1      = j*nx_out+i;
-      ic      = interp->index[3*n1];
-      jc      = interp->index[3*n1+1];
-      tile    = interp->index[3*n1+2];
-      d_in[0] = field_in[tile].data[k*nxd*nyd+jc    *nxd+ic];
-      d_in[1] = field_in[tile].data[k*nxd*nyd+(jc+1)*nxd+ic];
-      d_in[2] = field_in[tile].data[k*nxd*nyd+(jc+1)*nxd+ic+1];
-      d_in[3] = field_in[tile].data[k*nxd*nyd+jc    *nxd+ic+1];
-      data_out[k*nx_out*ny_out+n1] = d_in[0]*interp->weight[4*n1] + d_in[1]*interp->weight[4*n1+1]
-	+ d_in[2]*interp->weight[4*n1+2] + d_in[3]*interp->weight[4*n1+3];
-    }
-  }
-  
-}; /* do_c2l_interp */
-
-   
-/*------------------------------------------------------------------
-  void sort_index()
-  sort index by shortest                                         
-  ----------------------------------------------------------------*/
-void sort_index(int ntiles, int *index, double *shortest)
-{
-  int l, ll, lll, i;
-  double *shortest_sort;
-  int    *index_sort;
-
-  shortest_sort = (double *)malloc(3*ntiles*sizeof(double));
-  index_sort    = (int    *)malloc(  ntiles*sizeof(int   ));
-  
-  for(l=0; l<3*ntiles; l++)index_sort[l] = 0;
-  for(l=0; l<ntiles; l++)shortest_sort[l] = M_PI+M_PI;
-  for(l=0; l<ntiles; l++) {
-    for(ll=0; ll<ntiles; ll++) {
-      if (shortest[l]<shortest_sort[ll]) {
-	for(lll=ntiles-2; lll>=ll; lll--) {
-	  index_sort[3*lll+1]=index_sort[3*lll];
-	  shortest_sort[lll+1]=shortest_sort[lll];
-	}
-	for(i=0; i<3; i++) index_sort[3*ll+i]=index[3*l+i];
-	shortest_sort[ll]=shortest[l];
-	break;
-      }
-    }
-  }
-
-  for(l=0; l<3*ntiles; l++) index[l]    = index_sort[l];
-  for(l=0; l<  ntiles; l++) shortest[l] = shortest_sort[l];
-
-  free(shortest_sort);
-  free(index_sort);
-  
-}; /* sort_index */
-
-
-/*------------------------------------------------------------------
-  void get_index(ig, jg, lg)
-  determine lower left corner                                    
-  ----------------------------------------------------------------*/
-int get_index(const Grid_config *grid_in, const Grid_config *grid_out, int *index,
-	       int i_in, int j_in, int l_in, int i_out, int j_out)
-{
-  int    ok, n0, n1, n2, n3, n4, n5;
-  int    nx_in, ny_in, nx_out, ny_out;
-  double v0[3], v1[3], v2[3], v3[3], v4[3], v5[3];
-  double angle_1, angle_1a, angle_1b, angle_2, angle_2a, angle_2b;
-  double angle_3, angle_3a, angle_3b, angle_4, angle_4a, angle_4b;
-  
-  ok=1;
-  nx_in  = grid_in->nx_fine;
-  ny_in  = grid_in->nx_fine;
-  nx_out = grid_out->nx;
-  ny_out = grid_out->nx;
-  n0 = j_out*nx_out + i_out;
-  n1 = j_in*nx_in + i_in;
-  n2 = j_in*nx_in + i_in+1;
-  n3 = (j_in+1)*nx_in + i_in;
-  v0[0] = grid_out->xt[n1];
-  v0[1] = grid_out->yt[n1];
-  v0[2] = grid_out->zt[n1];
-  v1[0] = grid_in->xt[n1];
-  v1[1] = grid_in->yt[n1];
-  v1[2] = grid_in->zt[n1];
-  v2[0] = grid_in->xt[n2];
-  v2[1] = grid_in->yt[n2];
-  v2[2] = grid_in->zt[n2];
-  v3[0] = grid_in->xt[n3];
-  v3[1] = grid_in->yt[n3];
-  v3[2] = grid_in->zt[n3];
-  angle_1 = spherical_angle(v1, v2, v3);
-  angle_1a= spherical_angle(v1, v2, v0); 
-  angle_1b= spherical_angle(v1, v3, v0);
-  
-  if (max(angle_1a,angle_1b)<angle_1) {
-    index[0]=i_in;
-    index[1]=j_in;
-    index[2]=l_in;
-  }
-  else {
-    n4 = j_in*nx_in + i_in-1;
-    v4[0] = grid_in->xt[n4];
-    v4[1] = grid_in->yt[n4];
-    v4[2] = grid_in->zt[n4];
-    angle_2 =spherical_angle(v1, v3, v4);
-    angle_2a=angle_1b;
-    angle_2b=spherical_angle(v1, v4, v0);
-    if (max(angle_2a,angle_2b)<angle_2) {
-      index[0]=i_in-1;
-      index[1]=j_in;
-      index[2]=l_in;
-    }
-    else {
-      n5 = (j_in-1)*nx_in + i_in;
-      v5[0] = grid_in->xt[n5];
-      v5[1] = grid_in->yt[n5];
-      v5[2] = grid_in->zt[n5];      
-      angle_3 =spherical_angle(v1, v4, v5);
-      angle_3a=angle_2b;
-      angle_3b=spherical_angle(v1, v5, v0);
-      if (max(angle_3a,angle_3b)<angle_3 && i_in>1 && j_in>1) {
-	index[0]=i_in-1;
-	index[1]=j_in-1;
-	index[2]=l_in;
-      }
-      else {
-	angle_4 =spherical_angle(v1, v5, v2);
-	angle_4a=angle_3b;
-	angle_4b=spherical_angle(v1, v2, v0);
-	if (max(angle_4a,angle_4b)<angle_4) {
-	  index[0]=i_in;
-	  index[1]=j_in-1;
-	  index[2]=l_in;
-	}
-        else {
-	  ok=0;
-	}
-      }
-    }
-  }
-  return ok;
-  
-}; /* get_index */
-
-
-/*-------------------------------------------------------------
-  determine lower left corner
-  void get_closest_index(int ig, int jg, int lg, int ok)
-  --------------------------------------------------------------*/
-int get_closest_index(const Grid_config *grid_in, const Grid_config *grid_out, int *index,
-		      int i_in, int j_in, int l_in, int i_out, int j_out)
-{
-  int found;
-  double angle_11, angle_11a, angle_11b;
-  double angle_22, angle_22a, angle_22b;
-  double angle_33, angle_33a, angle_33b;
-  double angle_44, angle_44a, angle_44b;
-  double angle_1,  angle_1a,  angle_1b;
-  double angle_2,  angle_2a,  angle_2b;
-  double angle_3,  angle_3a,  angle_3b;
-  double angle_4,  angle_4a,  angle_4b;  
-  int    n0, n1, n2, n3, n4, n5, n6, n7, n8;
-  int    nx_in, ny_in, nx_out, ny_out, nxd;
-  double v0[3], v1[3], v2[3], v3[3], v4[3], v5[3], v6[3], v7[3], v8[3];
-
-  found = 0;
-  nx_in  = grid_in->nx;
-  ny_in  = grid_in->ny;
-  nxd    = nx_in + 2;
-  nx_out = grid_out->nx_fine;
-  ny_out = grid_out->ny_fine;
-  n0     = j_out*nx_out+i_out;
-  n1     = j_in*nxd+i_in;
-  n2     = j_in*nxd+i_in+1;
-  n3     = (j_in+1)*nxd+i_in;
-  v1[0]  = grid_in->xt[n1];
-  v1[1]  = grid_in->yt[n1];
-  v1[2]  = grid_in->zt[n1];
-  v2[0]  = grid_in->xt[n2];
-  v2[1]  = grid_in->yt[n2];
-  v2[2]  = grid_in->zt[n2];
-  v3[0]  = grid_in->xt[n3];
-  v3[1]  = grid_in->yt[n3];
-  v3[2]  = grid_in->zt[n3];
-  v0[0]  = grid_out->xt[n0];
-  v0[1]  = grid_out->yt[n0];
-  v0[2]  = grid_out->zt[n0];
-  angle_1 =spherical_angle(v1, v2, v3);
-  angle_1a=spherical_angle(v1, v2, v0);
-  angle_1b=spherical_angle(v1, v3, v0);
-  if (max(angle_1a,angle_1b) <= angle_1) {
-    if (i_in==nx_in && j_in==ny_in) {
-      angle_11 =spherical_angle(v2, v3, v1);
-      angle_11a=spherical_angle(v2, v1, v0);
-      angle_11b=spherical_angle(v2, v3, v0);
-    }
-    else {
-      n4 = (j_in+1)*nxd+i_in+1;
-      v4[0]  = grid_in->xt[n4];
-      v4[1]  = grid_in->yt[n4];
-      v4[2]  = grid_in->zt[n4];
-      angle_11 =spherical_angle(v4, v3, v2);
-      angle_11a=spherical_angle(v4, v2, v0);
-      angle_11b=spherical_angle(v4, v3, v0);
-    }
-    if (max(angle_11a,angle_11b)<=angle_11) {
-      found = 1;
-      index[0]=i_in;
-      index[1]=j_in;
-      index[2]=l_in;
-    }
-  }
-  else {
-    n4 = j_in*nxd+i_in-1;
-    v4[0]  = grid_in->xt[n4];
-    v4[1]  = grid_in->yt[n4];
-    v4[2]  = grid_in->zt[n4]; 
-    angle_2 =spherical_angle(v1,v3,v4);
-    angle_2a=angle_1b;
-    angle_2b=spherical_angle(v1,v4,v0);
-    if (max(angle_2a,angle_2b)<=angle_2) {
-      if (i_in==1 && j_in==ny_in) {
-	angle_22 =spherical_angle(v3, v1, v4);
-	angle_22a=spherical_angle(v3, v4, v0);
-	angle_22b=spherical_angle(v3, v1, v0);
-      }
-      else {
-	n5 = (j_in+1)*nxd+i_in-1;
-	n6 = j_in    *nxd+i_in-1;
-	v5[0]  = grid_in->xt[n5];
-	v5[1]  = grid_in->yt[n5];
-	v5[2]  = grid_in->zt[n5];
-	v6[0]  = grid_in->xt[n6];
-	v6[1]  = grid_in->yt[n6];
-	v6[2]  = grid_in->zt[n6];
-	angle_22 =spherical_angle(v5, v3, v6);
-	angle_22a=spherical_angle(v5, v6, v0);
-	angle_22b=spherical_angle(v5, v3, v0);
-      }
-      if (max(angle_22a,angle_22b)<=angle_22) {
-	found=1;
-	index[0]=i_in-1;
-	index[1]=j_in;
-	index[2]=l_in;
-      }
-    }
-    else {
-      n5 = j_in*nxd+i_in-1;
-      n6 = (j_in-1)*nxd+i_in;
-      v5[0]  = grid_in->xt[n5];
-      v5[1]  = grid_in->yt[n5];
-      v5[2]  = grid_in->zt[n5];
-      v6[0]  = grid_in->xt[n6];
-      v6[1]  = grid_in->yt[n6];
-      v6[2]  = grid_in->zt[n6];	  
-      angle_3 =spherical_angle(v1, v5, v6);
-      angle_3a=angle_2b;
-      angle_3b=spherical_angle(v1, v6, v0);
-      if (max(angle_3a,angle_3b)<=angle_3 && i_in>1 && j_in>1) {
-	n7 = (j_in-1)*nxd+i_in-1;
-	v7[0]  = grid_in->xt[n7];
-	v7[1]  = grid_in->yt[n7];
-	v7[2]  = grid_in->zt[n7];    
-	angle_33 =spherical_angle(v7, v6, v5);
-	angle_33a=spherical_angle(v7, v5, v0);
-	angle_33b=spherical_angle(v7, v6, v0);
-	if (max(angle_33a,angle_33b)<=angle_33) {
-	  found=1;
-	  index[0]=i_in-1;
-	  index[1]=j_in-1;
-	  index[2]=l_in;
-	}
-      }
-      else {
-	angle_4 =spherical_angle(v1, v6, v2);
-	angle_4a=angle_3b;
-	angle_4b=spherical_angle(v1, v2, v0);
-	if (max(angle_4a,angle_4b)<=angle_4) {
-	  if (i_in==nx_in && j_in==1) {
-	    angle_44 =spherical_angle(v2, v1, v6);
-	    angle_44a=spherical_angle(v2, v6, v0);
-	    angle_44b=spherical_angle(v2, v1, v0);
-	  }
-	  else {
-	    n8 = (j_in-1)*nxd+i_in+1;
-	    v8[0]  = grid_in->xt[n8];
-	    v8[1]  = grid_in->yt[n8];
-	    v8[2]  = grid_in->zt[n8];   
-	    angle_44 =spherical_angle(v8, v2, v6);
-	    angle_44a=spherical_angle(v8, v6, v0);
-	    angle_44b=spherical_angle(v8, v2, v0);
-	  }
-	  if (max(angle_44a,angle_44b)<=angle_44) {
-	    found=1;
-	    index[0]=i_in;
-	    index[1]=j_in-1;
-	    index[2]=l_in;
-	  }
-	}
-      }
-    }
-  }
-  return found;
-  
-}; /* get_closest_index */
-	      
-
-
-/*--------------------------------------------------------------------------
-
-calculate normalized great circle distance between v1 and v2 
-double normalize_great_circle_distance(v1, v2)
----------------------------------------------------------------------------*/
-double normalize_great_circle_distance(const double *v1, const double *v2)
-{
-  double dist;
-
-  dist=(v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2])
-    /sqrt((v1[0]*v1[0]+v1[1]*v1[1]+v1[2]*v1[2])                 
-	  *(v2[0]*v2[0]+v2[1]*v2[1]+v2[2]*v2[2]));
-  dist = sign(min(1.,fabs(dist)),dist);
-  dist = acos(dist);
-  return dist;
-  
-}; /* normalize_great_circle_distance */
-
-/*------------------------------------------------------------------
-  double spherical_angle(v1, v2, v3)
-
-  calculate spherical angle of a triangle formed by v1, v2 and v3 at v1                                                            
-  ------------------------------------------------------------------*/
-/* double spherical_angle(double *v1, double *v2, double *v3) */
-/* { */
-/*   double angle; */
-/*   double px, py, pz, qx, qy, qz, abs_p, abs_q; */
-
-/*   /* vector product between v1 and v2 */
-/*   px = v1[1]*v2[2] - v1[2]*v2[1]; */
-/*   py = v1[2]*v2[0] - v1[0]*v2[2]; */
-/*   pz = v1[0]*v2[1] - v1[1]*v2[0]; */
-/*   /* vector product between v1 and v3  */
-/*   qx = v1[1]*v3[2] - v1[2]*v3[1]; */
-/*   qy = v1[2]*v3[0] - v1[0]*v3[2]; */
-/*   qz = v1[0]*v3[1] - v1[1]*v3[0]; */
-    
-/*   /* angle between p and q */ 
-/*   abs_p=px*px+py*py+pz*pz; */
-/*   abs_q=qx*qx+qy*qy+qz*qz; */
-/*   if (abs_p*abs_q==0.) */
-/*     angle=0.; */
-/*   else { */
-/*     angle = (px*qx+py*qy+pz*qz)/sqrt(abs_p*abs_q); */
-/*     angle = sign(min(1.,fabs(angle)),angle); */
-/*     angle = acos(angle); */
-/*   } */
-
-/*   return angle; */
-/* }; /* spherical_angle */
-
-/*---------------------------------------------------------------------
-  double dist2side(v1, v2, point)
-  calculate shortest normalized distance on sphere                 
-  from point to straight line defined by v1 and v2                 
-  ------------------------------------------------------------------*/
-double dist2side(const double *v1, const double *v2, const double *point)
-{
-  double angle, side;
-
-  angle = spherical_angle(v1, v2, point);
-  side  = normalize_great_circle_distance(v1, point);
-
-  return (asin(sin(side)*sin(angle)));
-
-};/* dist2side */
-
-  
-int max_weight_index( double *var, int nvar)
-{
-
-  int ind, i;
-
-  ind = 0;
-
-  for(i=1; i<nvar; i++) {
-    if(var[i]>var[ind]) ind = i;
-  }
-
-  return ind;
-}
-
-/*------------------------------------------------------------------------------
-  void do_latlon_coarsening(var_latlon, ylat, nlon, nlat, nz,     
-                            var_latlon_crs, nlon_crs, nlat_crs,   
-                            finer_steps, misval, varmisval)
-
-  calculate variable on coarser latlon grid                        
-  by doubling spatial resolution and preserving volume means       
-  ---------------------------------------------------------------------------*/
-void do_latlon_coarsening(const double *var_latlon, const double *ylat, int nlon, int nlat, int nz,    
-			  double *var_latlon_crs, int finer_steps, int has_missing, double missvalue)
-{
-
-  double  *var_latlon_old, *ylat_old, *var_latlon_new;
-  double  dlat;
-  int     nlon_old, nlat_old, nlon_new, nlat_new, steps, i, j;
-  int     nlon_crs, nlat_crs;
-  
-  nlon_crs=nlon/pow(2,finer_steps);
-  nlat_crs=(nlat-1)/pow(2,finer_steps)+1;
-  switch (finer_steps) {
-  case 0:
-    if (nlon_crs !=nlon || nlat_crs != nlat) mpp_error("bilinear_interp(do_latlon_coarsening): grid dimensions don't match");
-    for(i=0; i<nlon*nlat*nz; i++) var_latlon_crs[i] = var_latlon[i];
-    break;
-  case 1:
-    redu2x(var_latlon, ylat, nlon, nlat, var_latlon_crs, nlon_crs, nlat_crs, nz, has_missing, missvalue);
-    break;
-  default:
-    nlon_new=nlon;
-    nlat_new=nlat;
-    for(steps=1; steps<=finer_steps; steps++) {
-      nlon_old=nlon_new;
-      nlat_old=nlat_new;
-      var_latlon_old = (double *)malloc(nlon_old*nlat_old*nz*sizeof(double));
-      ylat_old       = (double *)malloc(nlat_old*sizeof(double));
-      if (steps==1) {
-	for(i=0; i<nlat; i++) ylat_old[i] = ylat[i]; 
-	for(i=0; i<nlon_old*nlat_old*nz; i++) var_latlon_old[i] = var_latlon[i];
-      }
-      else {
-	dlat=M_PI/(nlat_old-1);
-	ylat_old[0]=-0.5*M_PI;
-	ylat_old[nlat_old-1]= 0.5*M_PI;
-	for(j=1; j<nlat_old-1; j++) ylat_old[j] = ylat_old[0] + j*dlat;
-	for(i=0; i<nlon_old*nlat_old*nz; i++) var_latlon_old[i] = var_latlon_new[i];
-	free(var_latlon_new);
-      }
-          
-      nlon_new=nlon_new/2;
-      nlat_new=(nlat_new-1)/2+1;
-      var_latlon_new = (double *)malloc(nlon_new*nlat_new*nz*sizeof(double));
-      redu2x(var_latlon_old, ylat_old, nlon_old, nlat_old, var_latlon_new, nlon_new, nlat_new, nz, has_missing, missvalue);
-      free(var_latlon_old);
-      free(ylat_old);
-    }
-    for(i=0; i<nlon_new*nlat_new*nz; i++) var_latlon_crs[i] = var_latlon_new[i];
-    free(var_latlon_new);
-  }
-}; /* do_latlon_coarsening */
-
-/*------------------------------------------------------------------------------
-  void redu2x(varfin, yfin, nxfin, nyfin, varcrs, nxcrs, nycrs)
-  this routine is for reducing fvccm data by a factor of 2       
-  volume averaging for all data except at the poles              
-  original developer: S.-J. Lin                                  
-  ----------------------------------------------------------------------------*/
-void redu2x(const double *varfin, const double *yfin, int nxfin, int nyfin, double *varcrs,
-	    int nxcrs, int nycrs, int nz, int has_missing, double missvalue)
-{
-  double  *cosp, *acosp, *vartmp;
-  int     i, j, k, i2, j2, n1, n2;
-
-  /*------------------------------------------------------------------
-    calculate cosine of latitude                                   
-    trick in cosp needed to maintain a constant field              
-    ----------------------------------------------------------------*/
-  cosp  = (double *)malloc(nyfin*sizeof(double));
-  acosp = (double *)malloc(nyfin*sizeof(double));
-  vartmp = (double *)malloc(nxcrs*nyfin*nz*sizeof(double));
-  cosp[0]=0.;
-  cosp[nyfin-1]=0.;
-  for(j=1; j<nyfin-1; j++) cosp[j]  = cos(yfin[j]);
-  for(j=1; j<nyfin-1; j++) acosp[j] = 1./(cosp[j]+0.5*(cosp[j-1]+cosp[j+1]));
-
-  /*----------------------------------------------------------------
-    x-sweep                                                        
-    ----------------------------------------------------------------*/
-  if(has_missing) {
-    for(k=0; k<nz; k++) for(j=1; j<nyfin-1; j++) {
-      n1 = k*nxfin*nyfin+j*nxfin;
-      n2 = k*nxcrs*nyfin+j*nxcrs;
-      if (varfin[n1+nxfin-1] == missvalue || varfin[n1] == missvalue || varfin[n1+1] == missvalue)
-	vartmp[n2] = missvalue;
-      else
-	vartmp[n2] = 0.25*(varfin[n1+nxfin-1]+2.*varfin[n1]+varfin[n1+1]);
-      for(i=2; i<nxfin-1; i+=2) {
-	i2 = i/2;
-	if (varfin[n1+i-1] == missvalue || varfin[n1+i] == missvalue || varfin[n1+i+1] == missvalue) 
-	  vartmp[n2+i2] = missvalue;
-        else
-	  vartmp[n2+i2] = 0.25*(varfin[n1+i-1]+2.*varfin[n1+i]+varfin[n1+i+1]);
-      }
-    }
-  }
-  else {
-    for(k=0; k<nz; k++) for(j=1; j<nyfin-1; j++) {
-      n1 = k*nxfin*nyfin+j*nxfin;
-      n2 = k*nxcrs*nyfin+j*nxcrs;
-      vartmp[n2] = 0.25*(varfin[n1+nxfin-1]+2.*varfin[n1]+varfin[n1+1]);
-      for(i=2; i<nxfin-1; i+=2) {
-	i2 = i/2;
-	vartmp[n2+i2] = 0.25*(varfin[n1+i-1]+2.*varfin[n1+i]+varfin[n1+i+1]);
-      }
-    }
-  }
-  /*---------------------------------------------------------------------
-    poles:                                                         
-    this code segment works for both the scalar and vector fields. 
-    Winds at poles are wave-1; the follwoing is quick & dirty yet the correct way
-    The skipping method. A more rigorous way is to                 
-    recompute the wave-1 components for the coarser grid.          
-    --------------------------------------------------------------------*/
-  for(k=0; k<nz; k++) for(i=0; i<nxcrs; i++) {
-    i2 = i*2;
-    n1 = k*nxcrs*nycrs;
-    n2 = k*nxfin*nyfin; 
-    varcrs[n1+i] = varfin[n2+i2];
-    varcrs[n1+(nycrs-1)*nxcrs+i] = varfin[n1+(nyfin-1)*nxfin+i2];
-  }
-  /*----------------------------------------------------------------
-    y-sweep                                                        
-    ----------------------------------------------------------------*/
-  if (has_missing) {
-    for(k=0; k<nz; k++) for(j=1; j<nyfin-1; j++) for(i=0; i<nxcrs; i++) {
-      n1 = k*nxcrs*nyfin+j*nxcrs+i;
-      if (vartmp[n1] /= missvalue) vartmp[n1] *= cosp[j];
-    }
-    for(k=0; k<nz; k++) for(j=2; j<nyfin-2; j+=2) {
-      j2 = j/2;
-      for(i=0; i<nxcrs; i++) {
-	n1 = k*nxcrs*nyfin + i;
-	n2 = k*nxcrs*nycrs + i;
-	if (vartmp[n1+j*nxcrs] == missvalue || vartmp[n1+(j-1)*nxcrs] == missvalue
-	    || vartmp[n1+(j+1)*nxcrs] == missvalue )
-	  varcrs[n2+j2*nxcrs] = missvalue;
-	else
-	  varcrs[n2+j2*nxcrs] = acosp[j]*(vartmp[n1+j*nxcrs] + 0.5*(vartmp[n1+(j-1)*nxcrs]+ vartmp[n1+(j+1)*nxcrs]));
-      }
-    }
-  }
-  else {
-    for(k=0; k<nz; k++) for(j=1; j<nyfin-1; j++) for(i=0; i<nxcrs; i++) {
-      n1 = k*nxcrs*nyfin+j*nxcrs+i;
-      vartmp[n1] *= cosp[j];
-    }
-    for(k=0; k<nz; k++) for(j=2; j<nyfin-2; j+=2) {
-      j2 = j/2;
-      for(i=0; i<nxcrs; i++) {
-	n1 = k*nxcrs*nyfin + i;
-	n2 = k*nxcrs*nycrs + i;
-	varcrs[n2+j2*nxcrs] = acosp[j]*(vartmp[n1+j*nxcrs] + 0.5*(vartmp[n1+(j-1)*nxcrs]+ vartmp[n1+(j+1)*nxcrs]));
-      }
-    }
-  }
-
-  free(cosp);
-  free(acosp);
-  free(vartmp);
-  
-}; /*redu2x*/
-
-
diff --git a/gridspec/tools/shared/bilinear_interp.h b/gridspec/tools/shared/bilinear_interp.h
deleted file mode 100644
index faead20..0000000
--- a/gridspec/tools/shared/bilinear_interp.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef BILINEAR_INTERP_H_
-#define BILINEAR_INTERP_H_
-void setup_bilinear_interp(int ntiles_in, const Grid_config *grid_in, int ntiles_out, const Grid_config *grid_out, 
-                      Interp_config *interp, unsigned int opcode);
-void do_scalar_bilinear_interp(const Interp_config *interp, int vid, int ntiles_in, const Grid_config *grid_in, const Grid_config *grid_out,
-                          const Field_config *field_in, Field_config *field_out, int finer_step, int fill_missing);
-void do_vector_bilinear_interp(Interp_config *interp, int vid, int ntiles_in, const Grid_config *grid_in, int ntiles_out, 
-			  const Grid_config *grid_out, const Field_config *u_in,  const Field_config *v_in,
-			  Field_config *u_out, Field_config *v_out, int finer_step, int fill_missing);
-#endif
diff --git a/gridspec/tools/shared/conserve_interp.c b/gridspec/tools/shared/conserve_interp.c
deleted file mode 100644
index 7639ad2..0000000
--- a/gridspec/tools/shared/conserve_interp.c
+++ /dev/null
@@ -1,675 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <netcdf.h>
-#include <math.h>
-#include "constant.h"
-#include "globals.h"
-#include "create_xgrid.h"
-#include "mosaic_util.h"
-#include "conserve_interp.h"
-#include "fregrid_util.h"
-#include "mpp.h"
-#include "mpp_io.h"
-#include "read_mosaic.h"
-
-#define  AREA_RATIO (1.e-3)
-
-/*******************************************************************************
-  void setup_conserve_interp
-  Setup the interpolation weight for conservative interpolation 
-*******************************************************************************/
-void setup_conserve_interp(int ntiles_in, const Grid_config *grid_in, int ntiles_out,
-			   Grid_config *grid_out, Interp_config *interp, unsigned int opcode) 
-{
-  int    n, m, i, ii, jj, nx_in, ny_in, nx_out, ny_out, tile;
-  size_t nxgrid, nxgrid2, nxgrid_prev;
-  int    *i_in, *j_in, *i_out, *j_out;
-  int   *tmp_t_in, *tmp_i_in, *tmp_j_in, *tmp_i_out, *tmp_j_out;
-  double *tmp_di_in, *tmp_dj_in;
-  double *xgrid_area, *tmp_area, *xgrid_clon, *xgrid_clat;
-  
-  double garea;
-  typedef struct{
-    double *area;
-    double *clon;
-    double *clat;
-  } CellStruct;
-  CellStruct *cell_in;
-  
-  i_in       = (int    *)malloc(MAXXGRID   * sizeof(int   ));
-  j_in       = (int    *)malloc(MAXXGRID   * sizeof(int   ));
-  i_out      = (int    *)malloc(MAXXGRID   * sizeof(int   ));
-  j_out      = (int    *)malloc(MAXXGRID   * sizeof(int   ));
-  xgrid_area = (double *)malloc(MAXXGRID   * sizeof(double));
-  if(opcode & CONSERVE_ORDER2) {
-    xgrid_clon = (double *)malloc(MAXXGRID   * sizeof(double));
-    xgrid_clat = (double *)malloc(MAXXGRID   * sizeof(double));
-  }
-  garea = 4*M_PI*RADIUS*RADIUS;
-
-  if( opcode & READ) {
-    for(n=0; n<ntiles_out; n++) {
-      if( interp[n].file_exist ) { /* reading from file */
-	int *t_in, *ind;
-	int fid, vid;
-	
-	nxgrid     = read_mosaic_xgrid_size(interp[n].remap_file);
-	t_in       = (int    *)malloc(nxgrid*sizeof(int   ));
-	ind        = (int    *)malloc(nxgrid*sizeof(int   ));
-	if(opcode & CONSERVE_ORDER1)
-	  read_mosaic_xgrid_order1(interp[n].remap_file, i_in, j_in, i_out, j_out, xgrid_area);
-	else
-	  read_mosaic_xgrid_order2(interp[n].remap_file, i_in, j_in, i_out, j_out, xgrid_area, xgrid_clon, xgrid_clat);
-	
-	/*--- rescale the xgrid area */
-	for(i=0; i<nxgrid; i++) xgrid_area[i] *= garea;
-	fid = mpp_open(interp[n].remap_file, MPP_READ);
-	vid = mpp_get_varid(fid, "tile1");
-      	mpp_get_var_value(fid, vid, t_in);
-	mpp_close(fid);
-	/*distribute the exchange grid on each pe according to target grid index*/
-	interp[n].nxgrid = 0;
-	for(i=0; i<nxgrid; i++) {
-	  if( i_out[i] <= grid_out[n].iec && i_out[i] >= grid_out[n].isc &&
-	      j_out[i] <= grid_out[n].jec && j_out[i] >= grid_out[n].jsc )
-	    ind[interp[n].nxgrid++] = i;
-	}
-	interp[n].i_in   = (int    *)malloc(interp[n].nxgrid*sizeof(int   ));
-	interp[n].j_in   = (int    *)malloc(interp[n].nxgrid*sizeof(int   ));
-	interp[n].i_out  = (int    *)malloc(interp[n].nxgrid*sizeof(int   ));
-	interp[n].j_out  = (int    *)malloc(interp[n].nxgrid*sizeof(int   ));
-	interp[n].area   = (double *)malloc(interp[n].nxgrid*sizeof(double));
-	interp[n].t_in   = (int    *)malloc(interp[n].nxgrid*sizeof(int   ));
-
-	for(i=0; i< interp[n].nxgrid; i++) {
-	  interp[n].i_in [i] = i_in [ind[i]];
-	  interp[n].j_in [i] = j_in [ind[i]];
-	  interp[n].t_in [i] = t_in [ind[i]] - 1;
-	  interp[n].i_out[i] = i_out[ind[i]] - grid_out[n].isc;
-	  interp[n].j_out[i] = j_out[ind[i]] - grid_out[n].jsc;
-	  interp[n].area [i] = xgrid_area[ind[i]];
-     	}
-	if(opcode & CONSERVE_ORDER2) {
-	  interp[n].di_in   = (double *)malloc(interp[n].nxgrid*sizeof(double));
-	  interp[n].dj_in   = (double *)malloc(interp[n].nxgrid*sizeof(double));
-	  for(i=0; i< interp[n].nxgrid; i++) {
-	    interp[n].di_in[i] = xgrid_clon[ind[i]];
-	    interp[n].dj_in[i] = xgrid_clat[ind[i]];
-	  }
-	}	
-	free(t_in);
-	free(ind);
-      }
-    }
-    if(mpp_pe() == mpp_root_pe())printf("NOTE: Finish reading index and weight for conservative interpolation from file.\n");
-  }
-  else {
-    cell_in    = (CellStruct *)malloc(ntiles_in * sizeof(CellStruct));
-    for(m=0; m<ntiles_in; m++) {
-      nx_in = grid_in[m].nx;
-      ny_in = grid_in[m].ny;
-      cell_in[m].area = (double *)malloc(nx_in*ny_in*sizeof(double));
-      cell_in[m].clon = (double *)malloc(nx_in*ny_in*sizeof(double));
-      cell_in[m].clat = (double *)malloc(nx_in*ny_in*sizeof(double));
-      for(n=0; n<nx_in*ny_in; n++) {
-	cell_in[m].area[n] = 0;
-	cell_in[m].clon[n] = 0;
-        cell_in[m].clat[n] = 0;
-      }
-    }
-    for(n=0; n<ntiles_out; n++) {
-      nx_out    = grid_out[n].nxc;
-      ny_out    = grid_out[n].nyc;      
-      interp[n].nxgrid = 0;
-      for(m=0; m<ntiles_in; m++) {
-	double *mask;
-        nx_in = grid_in[m].nx;
-	ny_in = grid_in[m].ny;
-
-	mask = (double *)malloc(nx_in*ny_in*sizeof(double));
-	for(i=0; i<nx_in*ny_in; i++) mask[i] = 1.0; 
-	
-	if(opcode & CONSERVE_ORDER1) {
-	  nxgrid = create_xgrid_2dx2d_order1(&nx_in, &ny_in, &nx_out, &ny_out, grid_in[m].lonc,
-					     grid_in[m].latc,  grid_out[n].lonc,  grid_out[n].latc,
-					     mask, i_in, j_in, i_out, j_out, xgrid_area);
-	}
-	else if(opcode & CONSERVE_ORDER2) {
-	  int g_nxgrid;
-	  int    *g_i_in, *g_j_in;
-	  double *g_area, *g_clon, *g_clat;
-	  
-	  nxgrid = create_xgrid_2dx2d_order2(&nx_in, &ny_in, &nx_out, &ny_out, grid_in[m].lonc,
-					     grid_in[m].latc,  grid_out[n].lonc,  grid_out[n].latc,
-					     mask, i_in, j_in, i_out, j_out, xgrid_area, xgrid_clon, xgrid_clat);
-	  /* For the purpose of bitiwise reproducing, the following operation is needed. */
-      	  g_nxgrid = nxgrid;
-	  mpp_sum_int(1, &g_nxgrid);
-	  if(g_nxgrid > 0) {
-	    g_i_in = (int    *)malloc(g_nxgrid*sizeof(int   ));
-	    g_j_in = (int    *)malloc(g_nxgrid*sizeof(int   ));			   
-	    g_area = (double *)malloc(g_nxgrid*sizeof(double));
-	    g_clon = (double *)malloc(g_nxgrid*sizeof(double));
-	    g_clat = (double *)malloc(g_nxgrid*sizeof(double));
-	    mpp_gather_field_int   (nxgrid, i_in,       g_i_in);
-	    mpp_gather_field_int   (nxgrid, j_in,       g_j_in);
-	    mpp_gather_field_double(nxgrid, xgrid_area, g_area);
-	    mpp_gather_field_double(nxgrid, xgrid_clon, g_clon);
-	    mpp_gather_field_double(nxgrid, xgrid_clat, g_clat);
-	    for(i=0; i<g_nxgrid; i++) {
-	      ii = g_j_in[i]*nx_in+g_i_in[i];
-	      cell_in[m].area[ii] += g_area[i];
-	      cell_in[m].clon[ii] += g_clon[i];
-	      cell_in[m].clat[ii] += g_clat[i];
-	    }
-	    free(g_i_in);
-	    free(g_j_in);
-	    free(g_area);
-	    free(g_clon);
-	    free(g_clat);
-	  }
-	}
-	else
-	  mpp_error("conserve_interp: interp_method should be CONSERVE_ORDER1 or CONSERVE_ORDER2");
-
-	free(mask);
-	if(nxgrid > 0) {
-	  nxgrid_prev = interp[n].nxgrid;
-	  interp[n].nxgrid += nxgrid;
-	  if(nxgrid_prev == 0 ) {
-	    interp[n].i_in   = (int    *)malloc(interp[n].nxgrid*sizeof(int   ));
-	    interp[n].j_in   = (int    *)malloc(interp[n].nxgrid*sizeof(int   ));
-	    interp[n].i_out  = (int    *)malloc(interp[n].nxgrid*sizeof(int   ));
-	    interp[n].j_out  = (int    *)malloc(interp[n].nxgrid*sizeof(int   ));
-	    interp[n].area   = (double *)malloc(interp[n].nxgrid*sizeof(double));
-	    interp[n].t_in   = (int    *)malloc(interp[n].nxgrid*sizeof(int   ));
-	    for(i=0; i<interp[n].nxgrid; i++) {
-	      interp[n].t_in [i] = m;
-	      interp[n].i_in [i] = i_in [i];
-	      interp[n].j_in [i] = j_in [i];
-	      interp[n].i_out[i] = i_out[i];
-	      interp[n].j_out[i] = j_out[i];
-	      interp[n].area[i]  = xgrid_area[i];
-	    }
-	    if(opcode & CONSERVE_ORDER2) {
-	      interp[n].di_in   = (double *)malloc(interp[n].nxgrid*sizeof(double));
-	      interp[n].dj_in   = (double *)malloc(interp[n].nxgrid*sizeof(double));
-	      for(i=0; i<interp[n].nxgrid; i++) {
-		jj = j_in [i]*nx_in+i_in [i];
-		interp[n].di_in [i] = xgrid_clon[i]/xgrid_area[i];
-		interp[n].dj_in [i] = xgrid_clat[i]/xgrid_area[i];
-	      }
-	    }
-	  }
-	  else {
-	    tmp_i_in  = interp[n].i_in;
-	    tmp_j_in  = interp[n].j_in;
-	    tmp_i_out = interp[n].i_out;
-	    tmp_j_out = interp[n].j_out;
-	    tmp_area  = interp[n].area;
-	    tmp_t_in  = interp[n].t_in;
-	    interp[n].i_in   = (int    *)malloc(interp[n].nxgrid*sizeof(int   ));
-	    interp[n].j_in   = (int    *)malloc(interp[n].nxgrid*sizeof(int   ));
-	    interp[n].i_out  = (int    *)malloc(interp[n].nxgrid*sizeof(int   ));
-	    interp[n].j_out  = (int    *)malloc(interp[n].nxgrid*sizeof(int   ));
-	    interp[n].area   = (double *)malloc(interp[n].nxgrid*sizeof(double));
-	    interp[n].t_in   = (int    *)malloc(interp[n].nxgrid*sizeof(int   ));
-	    for(i=0; i<nxgrid_prev; i++) {
-	      interp[n].t_in [i] = tmp_t_in [i];
-	      interp[n].i_in [i] = tmp_i_in [i];
-	      interp[n].j_in [i] = tmp_j_in [i];
-	      interp[n].i_out[i] = tmp_i_out[i];
-	      interp[n].j_out[i] = tmp_j_out[i];
-	      interp[n].area [i] = tmp_area [i];
-	    }
-	    for(i=0; i<nxgrid; i++) {
-	      ii = i + nxgrid_prev;
-	      interp[n].t_in [ii] = m;
-	      interp[n].i_in [ii] = i_in [i];
-	      interp[n].j_in [ii] = j_in [i];
-	      interp[n].i_out[ii] = i_out[i];
-	      interp[n].j_out[ii] = j_out[i];
-	      interp[n].area [ii] = xgrid_area[i];
-	    }
-	    if(opcode & CONSERVE_ORDER2) {
-	      tmp_di_in  = interp[n].di_in;
-	      tmp_dj_in  = interp[n].dj_in;
-	      interp[n].di_in   = (double *)malloc(interp[n].nxgrid*sizeof(double));
-	      interp[n].dj_in   = (double *)malloc(interp[n].nxgrid*sizeof(double));
-	      for(i=0; i<nxgrid_prev; i++) { 
-		interp[n].di_in [i] = tmp_di_in [i];
-		interp[n].dj_in [i] = tmp_dj_in [i];
-	      }
-	      for(i=0; i<nxgrid; i++) {
-		ii = i + nxgrid_prev;
-		jj = j_in [i]*nx_in+i_in [i];
-		interp[n].di_in [ii] = xgrid_clon[i]/xgrid_area[i];
-		interp[n].dj_in [ii] = xgrid_clat[i]/xgrid_area[i];
-	      }
-	      free(tmp_di_in);
-	      free(tmp_dj_in);
-	    }
-	    free(tmp_t_in);
-	    free(tmp_i_in);
-	    free(tmp_j_in);
-	    free(tmp_i_out);
-	    free(tmp_j_out);
-	    free(tmp_area);
-	  }
-	}  /* if(nxgrid>0) */
-      }
-    }
-    if(opcode & CONSERVE_ORDER2) {
-      /* subtrack the grid_in clon and clat to get the distance between xgrid and grid_in */
-      for(n=0; n<ntiles_in; n++) {
-	double *area_in;
-	double x1_in[50], y1_in[50], lon_in_avg, clon, clat;
-	int    j, n0, n1, n2, n3, n1_in;
-	/* calcualte cell area */
-     	nx_in = grid_in[n].nx;
-	ny_in = grid_in[n].ny;
-	area_in = (double *)malloc(nx_in*ny_in*sizeof(double));
-	get_grid_area(&nx_in, &ny_in, grid_in[n].lonc, grid_in[n].latc, area_in);	
-	for(j=0; j<ny_in; j++) for(i=0; i<nx_in; i++) {
-	  ii = j*nx_in + i;
-	  if(cell_in[n].area[ii] > 0) {
-	    if( fabs(cell_in[n].area[ii]-area_in[ii])/area_in[ii] < AREA_RATIO ) {
-	      cell_in[n].clon[ii] /= cell_in[n].area[ii];
-	      cell_in[n].clat[ii] /= cell_in[n].area[ii];
-	    }
-	    else {
-	      n0 = j*(nx_in+1)+i;       n1 = j*(nx_in+1)+i+1;
-	      n2 = (j+1)*(nx_in+1)+i+1; n3 = (j+1)*(nx_in+1)+i;
-	      x1_in[0] = grid_in[n].lonc[n0]; y1_in[0] = grid_in[n].latc[n0];
-	      x1_in[1] = grid_in[n].lonc[n1]; y1_in[1] = grid_in[n].latc[n1];
-	      x1_in[2] = grid_in[n].lonc[n2]; y1_in[2] = grid_in[n].latc[n2];
-	      x1_in[3] = grid_in[n].lonc[n3]; y1_in[3] = grid_in[n].latc[n3];
-	      n1_in = fix_lon(x1_in, y1_in, 4, M_PI);
-	      lon_in_avg = avgval_double(n1_in, x1_in);
-              clon = poly_ctrlon(x1_in, y1_in, n1_in, lon_in_avg);
-	      clat = poly_ctrlat (x1_in, y1_in, n1_in );
-	      cell_in[n].clon[ii] = clon/area_in[ii];
-	      cell_in[n].clat[ii] = clat/area_in[ii];
-	    }
-	  } 
-	}
-	free(area_in);
-      }
-      for(n=0; n<ntiles_out; n++) {
-	for(i=0; i<interp[n].nxgrid; i++) {
-	  tile = interp[n].t_in[i];
-	  ii   = interp[n].j_in[i] * grid_in[tile].nx + interp[n].i_in[i];
-          interp[n].di_in[i] -= cell_in[tile].clon[ii];
-	  interp[n].dj_in[i] -= cell_in[tile].clat[ii];
-	}
-      }
-
-      /* free the memory */
-      for(n=0; n<ntiles_in; n++) {
-	free(cell_in[n].area);
-	free(cell_in[n].clon);
-	free(cell_in[n].clat);
-      }
-      free(cell_in);
-    }
-    if( opcode & WRITE) { /* write out remapping information */
-      for(n=0; n<ntiles_out; n++) {
-	int nxgrid;
-	
-	nxgrid = interp[n].nxgrid;
-	mpp_sum_int(1, &nxgrid);
-	if(nxgrid > 0) {
-	  size_t start[4], nwrite[4];
-	  int    fid, dim_string, dim_ncells, dim_two, dims[4];
-	  int    id_xgrid_area, id_tile1_dist;
-	  int    id_tile1_cell, id_tile2_cell, id_tile1;
-	  int    *gdata_int, *ldata_int;	  
-	  double *gdata_dbl;
-	  
-	  fid = mpp_open( interp[n].remap_file, MPP_WRITE);
-	  dim_string = mpp_def_dim(fid, "string", STRING);
-	  dim_ncells = mpp_def_dim(fid, "ncells", nxgrid);
-	  dim_two    = mpp_def_dim(fid, "two", 2);
-	  dims[0] = dim_ncells; dims[1] = dim_two;
-	  id_tile1      = mpp_def_var(fid, "tile1",      NC_INT, 1, &dim_ncells, 1,
-				      "standard_name", "tile_number_in_mosaic1");
-	  id_tile1_cell = mpp_def_var(fid, "tile1_cell", NC_INT, 2, dims, 1,
-				      "standard_name", "parent_cell_indices_in_mosaic1");
-	  id_tile2_cell = mpp_def_var(fid, "tile2_cell", NC_INT, 2, dims, 1,
-				      "standard_name", "parent_cell_indices_in_mosaic2");
-	  id_xgrid_area = mpp_def_var(fid, "xgrid_area", NC_DOUBLE, 1, &dim_ncells, 2,
-				      "standard_name", "exchange_grid_area", "units", "m2");
-	  if(opcode & CONSERVE_ORDER2) id_tile1_dist = mpp_def_var(fid, "tile1_distance", NC_DOUBLE, 2, dims, 1,
-								   "standard_name", "distance_from_parent1_cell_centroid");
-	  mpp_end_def(fid);
-	  for(i=0; i<4; i++) {
-	    start[i] = 0; nwrite[i] = 1;
-	  }
-	  nwrite[0] = nxgrid;
-	  gdata_int = (int *)malloc(nxgrid*sizeof(int));
-	  if(interp[n].nxgrid>0) ldata_int = (int *)malloc(interp[n].nxgrid*sizeof(int));
-	  gdata_dbl = (double *)malloc(nxgrid*sizeof(double));
-	  mpp_gather_field_double(interp[n].nxgrid, interp[n].area, gdata_dbl);
-	  mpp_put_var_value(fid, id_xgrid_area, gdata_dbl);
-	  mpp_gather_field_int(interp[n].nxgrid, interp[n].t_in, gdata_int);
-	  for(i=0; i<nxgrid; i++) gdata_int[i]++;
-	  mpp_put_var_value(fid, id_tile1, gdata_int);
-	  mpp_gather_field_int(interp[n].nxgrid, interp[n].i_in, gdata_int);
-	  for(i=0; i<nxgrid; i++) gdata_int[i]++;
-	  mpp_put_var_value_block(fid, id_tile1_cell, start, nwrite, gdata_int);
-	  if(opcode & CONSERVE_ORDER2) {
-	    mpp_gather_field_double(interp[n].nxgrid, interp[n].di_in, gdata_dbl);
-	    mpp_put_var_value_block(fid, id_tile1_dist, start, nwrite, gdata_dbl);
-	  }
-	  for(i=0; i<interp[n].nxgrid; i++) ldata_int[i] = interp[n].i_out[i] + grid_out[n].isc + 1; 
-	  mpp_gather_field_int(interp[n].nxgrid, ldata_int, gdata_int);
-	  mpp_put_var_value_block(fid, id_tile2_cell, start, nwrite, gdata_int);
-	  mpp_gather_field_int(interp[n].nxgrid, interp[n].j_in, gdata_int);
-	  for(i=0; i<nxgrid; i++) gdata_int[i]++;
-	  start[1] = 1;
-	  mpp_put_var_value_block(fid, id_tile1_cell, start, nwrite, gdata_int);
-	  if(opcode & CONSERVE_ORDER2) {
-	    mpp_gather_field_double(interp[n].nxgrid, interp[n].dj_in, gdata_dbl);
-	    mpp_put_var_value_block(fid, id_tile1_dist, start, nwrite, gdata_dbl);
-	  }
-	  for(i=0; i<interp[n].nxgrid; i++) ldata_int[i] = interp[n].j_out[i] + grid_out[n].jsc + 1; 	  
-	  mpp_gather_field_int(interp[n].nxgrid, ldata_int, gdata_int);
-	  mpp_put_var_value_block(fid, id_tile2_cell, start, nwrite, gdata_int);
-	  free(gdata_int);
-	  free(gdata_dbl);
-	  if(interp[n].nxgrid>0)free(ldata_int);
-	  mpp_close(fid);
-	}
-      }
-    }
-    if(mpp_pe() == mpp_root_pe())printf("NOTE: done calculating index and weight for conservative interpolation\n");
-  }
-  /* get target grid area if needed */
-  if( opcode & TARGET ) {
-    for(n=0; n<ntiles_out; n++) {
-      nx_out    = grid_out[n].nxc;
-      ny_out    = grid_out[n].nyc; 
-      grid_out[n].area = (double *)malloc(nx_out*ny_out*sizeof(double));
-      get_grid_area(&nx_out,&ny_out, grid_out[n].lonc,  grid_out[n].latc, grid_out[n].area);
-    }
-  }
-  free(i_in);
-  free(j_in);
-  free(i_out);
-  free(j_out);
-  free(xgrid_area);
-  if(opcode & CONSERVE_ORDER2) {
-    free(xgrid_clon);
-    free(xgrid_clat);
-  }
-  
-}; /* setup_conserve_interp */
-
-
-/*******************************************************************************
- void do_scalar_conserve_interp( )
- doing conservative interpolation
-*******************************************************************************/
-void do_scalar_conserve_interp(Interp_config *interp, int varid, int ntiles_in, const Grid_config *grid_in,
-			       int ntiles_out, const Grid_config *grid_out, const Field_config *field_in,
-			       Field_config *field_out, unsigned int opcode)
-{
-  int nx1, ny1, nx2, ny2, i1, j1, i2, j2, tile, n, m, i, j, n1, n2;
-  int has_missing, halo, interp_method;
-  double area, missing, di, dj;
-  double *out_area;
-
-  interp_method = field_in->var[varid].interp_method;
-  halo = 0;
-  if(interp_method == CONSERVE_ORDER2) halo = 1;
-  
-  missing = field_in->var[varid].missing;
-  has_missing = field_in->var[varid].has_missing;
-  
-  for(m=0; m<ntiles_out; m++) {
-    nx2 = grid_out[m].nxc;
-    ny2 = grid_out[m].nyc;
-    out_area = (double *)malloc(nx2*ny2*sizeof(double));
-    
-    for(i=0; i<nx2*ny2; i++) field_out[m].data[i] = 0.0;
-    
-    for(i=0; i<nx2*ny2; i++) out_area[i] = 0.0;
-    if(interp_method == CONSERVE_ORDER1) {
-      if(has_missing) {
-	for(n=0; n<interp[m].nxgrid; n++) {
-	  i2   = interp[m].i_out[n];
-	  j2   = interp[m].j_out[n];
-	  i1   = interp[m].i_in [n];
-	  j1   = interp[m].j_in [n];    
-	  tile = interp[m].t_in [n];
-	  area = interp[m].area [n];
-	  nx1  = grid_in[tile].nx;
-	  ny1  = grid_in[tile].ny;
-	  if( field_in[tile].data[j1*nx1+i1] != missing ) {
-	    field_out[m].data[j2*nx2+i2] += field_in[tile].data[j1*nx1+i1]*area;
-	    out_area[j2*nx2+i2] += area;
-	  }
-	}
-      }
-      else {
-	for(n=0; n<interp[m].nxgrid; n++) {
-	  i2   = interp[m].i_out[n];
-	  j2   = interp[m].j_out[n];
-	  i1   = interp[m].i_in [n];
-	  j1   = interp[m].j_in [n];    
-	  tile = interp[m].t_in [n];
-	  area = interp[m].area [n];
-	  nx1  = grid_in[tile].nx;
-	  ny1  = grid_in[tile].ny;
-	  field_out[m].data[j2*nx2+i2] += field_in[tile].data[j1*nx1+i1]*area;
-	  out_area[j2*nx2+i2] += area;
-	}
-      }	  
-    }
-    else {
-      if(has_missing) {
-	for(n=0; n<interp[m].nxgrid; n++) {
-	  i2   = interp[m].i_out[n];
-	  j2   = interp[m].j_out[n];
-	  i1   = interp[m].i_in [n];
-	  j1   = interp[m].j_in [n];
-	  di   = interp[m].di_in[n];
-	  dj   = interp[m].dj_in[n];
-	  tile = interp[m].t_in [n];
-	  area = interp[m].area [n];
-	  nx1  = grid_in[tile].nx;
-	  ny1  = grid_in[tile].ny;
-	  n2 = (j1+1)*(nx1+2)+i1+1;
-	  if( field_in[tile].data[n2] != missing ) {
-	    n1 = j1*nx1+i1;
-	    if(field_in[tile].grad_mask[n1]) { /* use zero gradient */
-	      field_out[m].data[j2*nx2+i2] += field_in[tile].data[n2]*area;
-	    }
-	    else {
-	      field_out[m].data[j2*nx2+i2] += (field_in[tile].data[n2]+field_in[tile].grad_x[n1]*di
-						  +field_in[tile].grad_y[n1]*dj)*area;
-	    }
-	    out_area[j2*nx2+i2] += area;
-	  }
-	}
-      }
-      else {
-	for(n=0; n<interp[m].nxgrid; n++) {
-	  i2   = interp[m].i_out[n];
-	  j2   = interp[m].j_out[n];
-	  i1   = interp[m].i_in [n];
-	  j1   = interp[m].j_in [n];
-	  di   = interp[m].di_in[n];
-	  dj   = interp[m].dj_in[n];
-	  tile = interp[m].t_in [n];
-	  area = interp[m].area [n];
-	  nx1  = grid_in[tile].nx;
-	  ny1  = grid_in[tile].ny;
-	  n1 = j1*nx1+i1;
-	  n2 = (j1+1)*(nx1+2)+i1+1;
-	  field_out[m].data[j2*nx2+i2] += (field_in[tile].data[n2]+field_in[tile].grad_x[n1]*di
-					      +field_in[tile].grad_y[n1]*dj)*area;
-	  out_area[j2*nx2+i2] += area;
-	}
-      }
-    }
-    if(opcode & TARGET) {
-      for(i=0; i<nx2*ny2; i++) {
-	if(out_area[i] > 0)
-	  field_out[m].data[i] /= grid_out[m].area[i];
-	else
-	  field_out[m].data[i] = missing;
-      }
-    }
-    else {
-      for(i=0; i<nx2*ny2; i++) {
-	if(out_area[i] > 0)
-	  field_out[m].data[i] /= out_area[i];
-	else
-	  field_out[m].data[i] = missing;
-      }      
-    }
-  }
-
-  free(out_area);
-
-  /* conservation check if needed */
-  if(opcode & CHECK_CONSERVE) {
-    double gsum_in, gsum_out, dd;
-    double *area;
-    gsum_in = 0;
-    gsum_out = 0;
-    for(n=0; n<ntiles_in; n++) {
-      nx1  = grid_in[n].nx;
-      ny1  = grid_in[n].ny;
-      area = (double *)malloc(nx1*ny1*sizeof(double));
-      get_grid_area(&nx1, &ny1, grid_in[n].lonc, grid_in[n].latc, area);
-      
-      for(j=0; j<ny1; j++) for(i=0; i<nx1; i++) {
-	dd = field_in[n].data[(j+halo)*(nx1+2*halo)+i+halo];
-	if(dd != missing) gsum_in += dd*area[j*nx1+i];
-      }
-      free(area);
-    }
-    for(n=0; n<ntiles_out; n++) {
-      nx2  = grid_out[n].nxc;
-      ny2  = grid_out[n].nyc;
-      area = (double *)malloc(nx2*ny2*sizeof(double));
-      get_grid_area(&nx2, &ny2, grid_out[n].lonc, grid_out[n].latc, area);
-      
-      for(j=0; j<ny2; j++) for(i=0; i<nx2; i++) {
-	dd = field_out[n].data[j*nx2+i];
-	if(dd != missing) gsum_out += dd*area[j*nx2+i];
-      }
-      free(area);
-    }
-    mpp_sum_double(1, &gsum_out);
-    
-    if(mpp_pe() == mpp_root_pe()) printf("the flux(data*area) sum of %s: input = %g, output = %g, diff = %g. \n",
-					 field_in->var[varid].name, gsum_in, gsum_out, gsum_out-gsum_in);
-        
-
-    
-  }
-  
-  
-}; /* do_scalar_conserve_interp */
-
-
-/*******************************************************************************
- void do_vector_conserve_interp( )
- doing conservative interpolation
-*******************************************************************************/
-void do_vector_conserve_interp(Interp_config *interp, int varid, int ntiles_in, const Grid_config *grid_in, int ntiles_out, 
-                               const Grid_config *grid_out, const Field_config *u_in,  const Field_config *v_in,
-                               Field_config *u_out, Field_config *v_out, unsigned int opcode)  
-{
-  int          nx1, ny1, nx2, ny2, i1, j1, i2, j2, tile, n, m, i;
-  double       area, missing, tmp_x, tmp_y;
-  double       *out_area;
-
-  missing = u_in->var[varid].missing;  
-  /* first rotate input data */
-  for(n = 0; n < ntiles_in; n++) {
-    if(grid_in[n].rotate) {
-      nx1 = grid_in[n].nx;
-      ny1 = grid_in[n].ny;
-      for(i=0; i<nx1*ny1; i++) {
-	tmp_x = u_in[n].data[i];
-	tmp_y = v_in[n].data[i];
-	if( tmp_x != missing && tmp_y != missing) {
-	  u_in[n].data[i] = tmp_x * grid_in[n].cosrot[i] - tmp_y * grid_in[n].sinrot[i];
-	  v_in[n].data[i] = tmp_x * grid_in[n].sinrot[i] + tmp_y * grid_in[n].cosrot[i];
-	}
-      }
-    }
-  }
-  
-  for(m=0; m<ntiles_out; m++) {
-    nx2 = grid_out[m].nxc;
-    ny2 = grid_out[m].nyc;
-    out_area = (double *)malloc(nx2*ny2*sizeof(double));
-    
-    for(i=0; i<nx2*ny2; i++) {
-      u_out[m].data[i] = 0.0;
-      v_out[m].data[i] = 0.0;
-    }
-    for(i=0; i<nx2*ny2; i++) out_area[i] = 0.0;
-    
-    for(n=0; n<interp[m].nxgrid; n++) {
-      i2   = interp[m].i_out[n];
-      j2   = interp[m].j_out[n];
-      i1   = interp[m].i_in [n];
-      j1   = interp[m].j_in [n];    
-      tile = interp[m].t_in [n];
-      area = interp[m].area [n];
-      nx1  = grid_in[tile].nx;
-      ny1  = grid_in[tile].ny;
-      tmp_x = u_in[tile].data[j1*nx1+i1];
-      tmp_y = v_in[tile].data[j1*nx1+i1];
-      if( tmp_x != missing && tmp_y != missing ) {
-	u_out[m].data[j2*nx2+i2] += u_in[tile].data[j1*nx1+i1]*area;
-	v_out[m].data[j2*nx2+i2] += v_in[tile].data[j1*nx1+i1]*area;
-	out_area[j2*nx2+i2] += area;
-      }
-    }
-    if(opcode & TARGET) {
-      for(i=0; i<nx2*ny2; i++) {
-	if(out_area[i] > 0) {
-	  u_out[m].data[i] /= grid_out[m].area[i];
-	  v_out[m].data[i] /= grid_out[m].area[i];
-	}
-	else {
-	  u_out[m].data[i] = missing;
-	  v_out[m].data[i] = missing;
-	}
-      }
-    }
-    else {
-      for(i=0; i<nx2*ny2; i++) {
-	if(out_area[i] > 0) {
-	  u_out[m].data[i] /= out_area[i];
-	  v_out[m].data[i] /= out_area[i];
-	}
-	else {
-	  u_out[m].data[i] = missing;
-	  v_out[m].data[i] = missing;
-	}
-      }      
-    }
-    /* rotate the data if needed */
-    if(grid_out[m].rotate) {
-      for(i=0; i<nx2*ny2; i++) {
-	tmp_x = u_out[m].data[i];
-	tmp_y = v_out[m].data[i];
-	if( tmp_x != missing && tmp_y != missing) {
-	  u_out[m].data[i] =  tmp_x * grid_out[m].cosrot[i] + tmp_y * grid_out[m].sinrot[i];
-	  v_out[m].data[i] = -tmp_x * grid_out[m].sinrot[i] + tmp_y * grid_out[m].cosrot[i];
-	}
-      }
-    }
-    free(out_area);
-  }
-  
-}; /* do_vector_conserve_interp */
diff --git a/gridspec/tools/shared/conserve_interp.h b/gridspec/tools/shared/conserve_interp.h
deleted file mode 100644
index 3e61df5..0000000
--- a/gridspec/tools/shared/conserve_interp.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef CONSERVE_INTERP_H_
-#define CONSERVE_INTERP_H_
-#include "globals.h"
-
-void setup_conserve_interp(int ntiles_in, const Grid_config *grid_in, int ntiles_out,
-			   Grid_config *grid_out, Interp_config *interp, unsigned int opcode);
-void do_scalar_conserve_interp(Interp_config *interp, int varid, int ntiles_in, const Grid_config *grid_in,
-			       int ntiles_out, const Grid_config *grid_out, const Field_config *field_in,
-			       Field_config *field_out, unsigned int opcode);
-void do_vector_conserve_interp(Interp_config *interp, int varid, int ntiles_in, const Grid_config *grid_in, int ntiles_out, 
-                               const Grid_config *grid_out, const Field_config *u_in,  const Field_config *v_in,
-                               Field_config *u_out, Field_config *v_out, unsigned int opcode);  
-#endif
diff --git a/gridspec/tools/shared/create_conformal_cubic_grid.c b/gridspec/tools/shared/create_conformal_cubic_grid.c
deleted file mode 100644
index 4809157..0000000
--- a/gridspec/tools/shared/create_conformal_cubic_grid.c
+++ /dev/null
@@ -1,816 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <complex.h>
-#include <math.h>
-#include <string.h>
-#include "mpp.h"
-#include "mosaic_util.h"
-#include "tool_util.h"
-#include "constant.h"
-#include "create_hgrid.h"
-#define  D2R (M_PI/180.)
-#define  R2D (180./M_PI)
-/*********************************************************************************
-   some private routines used in this file
-*********************************************************************************/
-void calc_geocoords_centerpole(int nx, int ny, double *x, double *y);
-void conformal_map_coords2xyz ( int ni, int nj, double *lx, double *ly, double *X, double *Y, double *Z );
-void map_xyz2lonlat(int ni, int nj, double *X, double *Y, double *Z, double *lon, double *lat );
-void rotate_about_xaxis(int ni, int nj, double *X, double *Y, double *Z, double angle);
-void permutiles(int ni, int nj, double *b, int num);
-void calc_fvgrid(int nx, int ny, int nratio, double *dx, double *dy, double *area);
-double* angle_between_vectors(int ni, int nj, double *vec1, double *vec2);
-double* excess_of_quad(int ni, int nj, double *vec1, double *vec2, double *vec3, double *vec4 );
-double* plane_normal(int ni, int nj, double *P1, double *P2);
-void calc_rotation_angle(int nxp, int nyp, double *x, double *y, double *angle_dx, double *angle_dy);
-
-
-/*******************************************************************************
-  void create_conformal_cubic_grid( int *npoints, int *nratio, char *method, char *orientation, double *x,
-                          double *y, double *dx, double *dy, double *area, double *angle_dx,
-                          double *angle_dy )
-  create cubic grid. All six tiles grid will be generated.
-*******************************************************************************/
-void create_conformal_cubic_grid( int *npts, int *nratio, char *method, char *orientation, double *x,
-			double *y, double *dx, double *dy, double *area, double *angle_dx,
-			double *angle_dy )
-{
-  int nx, ny, nxp, nyp;
-
-  nx  = *npts;
-  ny  = nx;
-  nxp = nx+1;
-  nyp = nxp;
-  
-  /*calculate geographic coordinates. */
-  if(strcmp(orientation, "center_pole") == 0)
-    calc_geocoords_centerpole(nx, ny, x, y);
-  else
-    mpp_error("create_cubic_grid: only center pole orientation is implemented");  
-
-  /* calculate cell length and area */
-  calc_fvgrid(nx, ny, *nratio, dx, dy, area);  
-
-  /*calculate rotation angle, just some workaround, will modify this in the future. */
-  calc_rotation_angle(nxp, nyp, x, y, angle_dx, angle_dy );
-  
-}; /* create_conformal_cubic_grid */
-
-/***********************************************************************
-   calc_geoocoords_centerpole(int nx, int ny, double *x, double *y);
-calculate geographic coordinates for all six tiles.
-
-***********************************************************************/
-void calc_geocoords_centerpole(int nx, int ny, double *x, double *y)
-{
-  int i, j, n, m, nxp, nyp, nxh, nyh;
-  double *lx, *ly, *X, *Y, *Z, *lonP, *latP, *lonE, *latE, *tmp;
-
-  nxp = nx+1;
-  nyp = ny+1;
-  nxh = (nxp+1)/2;
-  nyh = (nyp+1)/2;  
-  
-  lx = (double *)malloc(nxh*nyh*sizeof(double));
-  ly = (double *)malloc(nxh*nyh*sizeof(double));
-
-  n = 0;
-  for(j=0; j<nyh; j++) {
-    for(i=0; i<nxh; i++) {
-      lx[n] = -1. + 2.0*i/(nxp-1);
-      ly[n++] = -1. + 2.0*j/(nyp-1);
-    }
-  } 
-
-  X = (double *)malloc(nxh*nyh*sizeof(double));
-  Y = (double *)malloc(nxh*nyh*sizeof(double));
-  Z = (double *)malloc(nxh*nyh*sizeof(double));
-
-  /* calculating 3D coordinates on unit sphere */
-  conformal_map_coords2xyz( nxh, nyh, lx, ly, X, Y, Z);
-
-  lonP = (double *) malloc(nxp*nyp*sizeof(double));
-  latP = (double *) malloc(nxp*nyp*sizeof(double));
-  lonE = (double *) malloc(nxp*nyp*sizeof(double));
-  latE = (double *) malloc(nxp*nyp*sizeof(double));
-  
-  /* map 3D coordinates to geographical coordinates. */
-  map_xyz2lonlat( nxh, nyh, X, Y, Z, lx, ly );
-
-  /* coyy data from lx, ly to lonP and latP */
-  for(j=0;j<nyh;j++) {
-    for(i=0; i<nxh; i++) {
-      lonP[j*nxp+i] = lx[j*nxh+i];
-      latP[j*nxp+i] = ly[j*nxh+i];
-    }
-  }
-
-  /* enforce symmetry */
-  for(j=0;j<nyh;j++) {
-    for(i=0; i<nxh; i++) {
-      if( i<j )
-	latP[j*nxp+i] = 0.5*(latP[j*nxp+i] + latP[i*nxp+j]);
-      else
-	latP[j*nxp+i] = latP[i*nxp+j];       
-      if(lonP[j*nxp+i] >= M_PI ) lonP[j*nxp+i] -= 2*M_PI;
-    }
-  }
-
-  tmp = (double *) malloc(nxh*nyh*sizeof(double));
-  n = 0;
-  for(j=0; j<nyh; j++)
-    for(i=0; i<nxh; i++) tmp[n++] = lonP[j*nxp+i];
-
-  for(j=0;j<nyh;j++) {  
-    for(i=0; i<nxh; i++) {
-      lonP[j*nxp+i] = (tmp[j*nxh+i]-3./2.*M_PI-tmp[i*nxh+j])*0.5;
-      if(i==j) lonP[j*nxp+i] = -3.0/4.0*M_PI;
-    }
-  }
-
-  free(tmp);
-  
-  /*use symmetry to expand to full cubic */
-  for(j=0;j<nyh;j++) {
-    for(i=nxh;i<nxp; i++) {
-      lonP[j*nxp+i] = -M_PI-lonP[j*nxp+nxp-i-1];
-      latP[j*nxp+i] = latP[j*nxp+nxp-i-1];
-    }
-  }
-
-  for(j=nyh; j<nyp; j++) {
-    for(i=0; i<nxp; i++) {
-      lonP[j*nxp+i] = -lonP[(nyp-j-1)*nxp+i];
-      latP[j*nxp+i] = latP[(nyp-j-1)*nxp+i];
-    }
-  }       
-
-  rotate_about_xaxis(nxh, nyh, X, Y, Z, M_PI/2);   
-
-  map_xyz2lonlat( nxh, nyh, X, Y, Z, lx, ly );
-
-  /* coyy data from lx, ly to lonE and latE */
-  for(j=0;j<nyh;j++) {
-    for(i=0; i<nxh; i++) {
-      lonE[j*nxp+i] = lx[j*nxh+i];
-      latE[j*nxp+i] = ly[j*nxh+i];
-    }
-  }
-  
-  free(lx);
-  free(ly);
-  
-  /* enforce symmetry */
-  for(j=0;j<nyh;j++) lonE[j*nxp] = -3./4.*M_PI;
-  for(i=0;i<nxh;i++) {
-    latE[(nyh-1)*nxp+i] = 0;
-    latE[i]    = -latP[i];
-  }
-  /*use symmetry to expand to full cube. */
-  for(j=0;j<nxh; j++) {
-    for(i=nxh;i<nxp;i++) {
-      lonE[j*nxp+i] = -M_PI-lonE[j*nxp+nxp-i-1];
-      latE[j*nxp+i] = latE[j*nxp+nxp-i-1];
-    }
-  }
-
-  for(j=nyh; j<nyp; j++) {
-    for(i=0; i<nxp; i++) {
-      lonE[j*nxp+i] = lonE[(nyp-j-1)*nxp+i];
-      latE[j*nxp+i] = -latE[(nyp-j-1)*nxp+i];
-    }
-  }      
-
-  /*convert to geographic grid */
-  n = 0;
-  /* tile 1 */
-  for(m = 0; m < nxp*nyp; m++) { 
-    x[n] = lonE[m]*R2D-90.;
-    if(x[n]<=-180.) x[n] += 360.;
-    y[n++] = latE[m]*R2D;
-  }
-
-  /* tile 2 */
-  for(m = 0; m < nxp*nyp; m++) {
-    x[n] = lonE[m]*R2D;
-    y[n++] = latE[m]*R2D;
-  }
-
-  /* tile 3 */
-  for(m = 0; m < nxp*nyp; m++) {
-    x[n] = lonP[m]*R2D;
-    y[n++] = latP[m]*R2D;
-  }
-    
-  /* tile 4 */
-  for(j=0; j<nyp; j++) {
-    for(i=0; i<nxp; i++) {
-      x[n] = lonE[i*nxp+j]*R2D+90.;
-      y[n++] = latE[(nxp-i-1)*nxp+j]*R2D;
-    }
-  }
-
-  /* tile 5 */
-  for(j=0; j<nyp; j++) {
-    for(i=0; i<nxp; i++) {
-      x[n] = lonE[i*nxp+j]*R2D+180.;
-      y[n++] = latE[(nxp-i-1)*nxp+j]*R2D;
-    }
-  }
-
-  /* tile 6 */
-  for(j=0; j<nyp; j++) {
-    for(i=0; i<nxp; i++) {
-      x[n] = lonP[(nxp-i-1)*nxp+nyp-j-1]*R2D;
-      y[n++] = -latP[j*nxp+i]*R2D;
-    }
-  }
-
-  permutiles(nxp, nyp, x,2);
-  permutiles(nxp, nyp, y,2);
-
-}; /*calc_geocords_centerpole */
-
-/*************************************************************************
-  void conformal_map_coords2xyz ( double *lx, double * ly, double *X, double *Y, double *Z )
-  Conformal mapping of a cube onto a sphere maps (lx, ly) on the north-pole face of a cube
-  to (X,Y,Z) coordinates in physical space. 
-  Face is oriented normal to Z-axis with  X and Y increasing with lx and ly
-  valid ranges:  -1 < lx < 1   -1 < ly < 1
-  Based on matlab scripts from Alistair  ???? 
-**************************************************************************/
-  
-void conformal_map_coords2xyz ( int ni, int nj, double *lx, double *ly,
-     				   double *X, double *Y, double *Z )
-{
-  const double RA = sqrt(3.)-1;
-  const double THRD = 1./3.;
-  const double complex CB = -1. + I;
-  const double complex CC = RA*CB/2.;
-  const int order = 29;
-  const double A[] = { 1.47713057321600,
-		       -0.38183513110512,
-		       -0.05573055466344,
-		       -0.01895884801823,
-		       -0.00791314396396,
-		       -0.00486626515498,
-		       -0.00329250387158,
-		       -0.00235482619663,
-		       -0.00175869000970,
-		       -0.00135682443774,
-		       -0.00107458043205,
-		       -0.00086946107050,
-		       -0.00071604933286,
-		       -0.00059869243613,
-		       -0.00050696402446,
-		       -0.00043418115349,
-		       -0.00037537743098,
-		       -0.00032745130951,
-		       -0.00028769063795,
-		       -0.00025464473946,
-		       -0.00022659577923,
-		       -0.00020297175587,
-		       -0.00018247947703,
-		       -0.00016510295548,
-		       -0.00014967258633,
-		       -0.00013660647356,
-		       -0.00012466390509,
-		       -0.00011468147908,
-		       -0.00010518717478,
-		       -0.00009749136078,
-  };
-  double complex w, zc,a,b;
-  int i, j, n, m;
-  double xc, yc, h, t;
-  size_t *dims;
-
-  for(n=0; n< ni*nj; n++) {
-    xc = fabs(lx[n]);
-    yc = fabs(ly[n]);
-    X[n] = xc;
-    Y[n] = yc;
-    xc   = 1 - xc;
-    yc   = 1 - yc;
-    if(fabs(ly[n]) > fabs(lx[n]) ) {
-      xc = 1-Y[n];
-      yc = 1-X[n];
-    }
-    zc  = cpow((xc+I*yc)/2.,4);
-    /*Evaluate the Taylor series.  */
-    w = 0;
-
-    for(m=order; m>=0; m--) w = ( w + A[m] ) * zc;
-    if( w != 0. ) w =  cpow(I,THRD) * cpow( w*I, THRD);
-    w = (w-RA)/(CB+CC*w);
-    X[n] = creal(w);  
-    Y[n] = cimag(w);
-    h    = 2./(1+cpow(X[n],2)+cpow(Y[n],2));
-    X[n] = X[n]*h;
-    Y[n] = Y[n]*h;
-    Z[n] = h-1;
-  }
-
-  for(n=0; n< ni*nj; n++) {
-    if(fabs(ly[n]) > fabs(lx[n]) ) {
-      t = X[n];
-      X[n] = Y[n];
-      Y[n] = t;
-    }
-
-    if(lx[n]<0)  X[n] = -X[n];
-    if(lx[n]==0) X[n] = 0;
-    if(ly[n]<0)  Y[n] = -Y[n];
-    if(ly[n]==0) Y[n] = 0;
-  }
-
-}; /* conformal_map_coords2xyz */
-
-
-
-/**********************************************************
-  Convert 3-D coordinates (x,y,z) to (lon,lat)
-  Assumes "lat" is positive with "z", equatorial plane
-  falls at z=0  and "lon" is measured anti-clockwise (eastward)
-  from x-axis (y=0) about z-axis.
-
-************************************************************/
-
-void map_xyz2lonlat(int ni, int nj, double *X, double *Y, double *Z, 
-		    double *lon, double *lat )
-{
-  int i, j, n;
-  double req;
-
-  for(n=0; n<ni*nj; n++) {
-    /*latitude */
-    req = sqrt(X[n]*X[n]+Y[n]*Y[n]);
-    if( req == 0)
-      if(Z[n] == 0 )
-	lat[n] = 0.;
-      else
-        lat[n] = M_PI*0.5;
-    else
-      lat[n] = atan( Z[n]/req );
-
-    /*longitude */
-    if(X[n] == 0)
-      lon[n] = M_PI*0.5;
-    else
-      lon[n] = atan(Y[n]/X[n]);
-
-    if(X[n]<0 && Y[n] >=0) lon[n] += M_PI;
-    if(X[n]<=0 && Y[n] < 0) lon[n] -= M_PI;
-  }
-  
-};  /* map_xyz2lonlat */
-
-
-/**************************************************************
-   void rotate_about_xaxis(int ni, int nj, double *X, double *Y, 
-	              	   double *Z, double angle)
-
-   Rotate about X axis by "angle"
-
-***************************************************************/
-
-void rotate_about_xaxis(int ni, int nj, double *X, double *Y, 
-	          	double *Z, double angle) {
-  int i, j, n;
-  double s,c,old;
-  const double tolerance = 1.e-9;
-
-  s=sin(angle);
-  c=cos(angle);
-
-  if (c<tolerance) {
-    c=0;
-    if(s>0)
-      s = 1;
-    else
-      s = -1;
-  }
-
-  for(n=0; n<ni*nj; n++) {
-    old = Y[n];
-    Y[n] = c*Y[n]-s*Z[n];
-    Z[n] = s*old+c*Z[n];
-  }
-
-}; /* rotate_about_xaxis */
-
-
-/*************************************************************************
-   void permutetiles(int ni, int nj, double *b, int n)
-
-   shifts the tile data left by n places around the equator
-   n=1, tile 2->1, 4->2, 5->4, 1->5, the tiles 3 and 6 get rotated 90 degs.
-
-*************************************************************************/
-
-void permutiles(int ni, int nj, double *b, int num) {
-
-  int i, j, k, n;
-  int ntiles = 6;
-  double *c=NULL;
-  
-  c = (double *)malloc(ni*nj*ntiles*sizeof(double));
-
-  for(k=0; k<num; k++) {
-    for(j=0;j<nj;j++) {
-      for(i=0;i<ni;i++) {
-	n = j*ni+i;
-	c[n]         = b[ni*nj+n];
-	c[ni*nj+n]   = b[3*ni*nj+i*ni+nj-j-1];
-	c[2*ni*nj+n] = b[2*ni*nj+i*ni+nj-j-1];
-	c[3*ni*nj+n] = b[4*ni*nj+n];
-	c[4*ni*nj+n] = b[(ni-i-1)*ni+j];
-	c[5*ni*nj+n] = b[5*ni*nj+(ni-i-1)*ni+j];
-      }
-    }
-    for(n=0; n<ni*nj*ntiles; n++) b[n] = c[n];
-  }
-
-  free(c);
-};  /* permutiles */
-
-/*************************************************************************
-
-     calc_fvgrid( lx, vector ly, vector dxl, vector dyl, vector areal)
-
-     Calculates finite volume grid info (dxl,dyl,areal) for conformal cubic grid 
-     with 3-D coordinates (X, Y, Z)
-     Meant to be used for single quadrant of tile but does work for full tile
-
-**************************************************************************/
-
-void calc_fvgrid(int nx, int ny, int nratio, double *dx, double *dy, double *area)
-{
-  int nxf, nyf, nif, njf, nxp, nyp, nxh, nyh, i, j, n, m;
-  double ar;
-  double *lx, *ly, *X, *Y, *Z, *vec1, *vec2, *vec3, *vec4, *dxl, *dyl, *areal;
-  size_t *dims;
-  
-  nxp = nx+1;
-  nyp = ny+1;
-  nxh = (nxp+1)/2;
-  nyh = (nyp+1)/2;
-
-  nxf = nx*nratio+1;
-  nyf = nxf; 
-  nif = (nxf+1)/2;
-  njf = nif;
-
-  lx = (double *)malloc(nif*njf*sizeof(double));
-  ly = (double *)malloc(nif*njf*sizeof(double));
-
-  n = 0;
-  for(j=0; j<njf; j++) {
-    for(i=0; i<nif; i++) {
-      lx[n] = -1. + 2.0*i/(nxf-1);
-      ly[n++] = -1. + 2.0*j/(nyf-1);
-    }
-  } 
-
-  X = (double *)malloc(nif*njf*sizeof(double));
-  Y = (double *)malloc(nif*njf*sizeof(double));
-  Z = (double *)malloc(nif*njf*sizeof(double));
-
- /* calculating 3D coordinates on unit sphere */
-  conformal_map_coords2xyz( nif, njf, lx, ly, X, Y, Z);
-
-  vec1  = (double *)malloc((nif-1)*njf*3*sizeof(double));
-  vec2  = (double *)malloc((nif-1)*njf*3*sizeof(double));
-
-  for(j=0;j<njf;j++) {
-    for(i=0;i<nif-1;i++) {
-      n = j*(nif-1)+i;
-      vec1[n] = X[j*nif+i];
-      vec2[n] = X[j*nif+i+1];
-      vec1[(nif-1)*njf+n] = Y[j*nif+i];
-      vec2[(nif-1)*njf+n] = Y[j*nif+i+1];
-      vec1[2*(nif-1)*njf+n] = Z[j*nif+i];
-      vec2[2*(nif-1)*njf+n] = Z[j*nif+i+1];
-    }
-  }
-  
-  dxl = angle_between_vectors( nif-1, njf, vec1, vec2);
-
-  free(vec1);
-  free(vec2);
-
-  vec1  = (double *)malloc(nif*(njf-1)*3*sizeof(double));
-  vec2  = (double *)malloc(nif*(njf-1)*3*sizeof(double));
-
-  for(j=0;j<njf-1;j++) {
-    for(i=0;i<nif;i++) {
-      n = j*nif+i;
-      vec1[n] = X[j*nif+i];
-      vec2[n] = X[(j+1)*nif+i];
-      vec1[nif*(njf-1)+n] = Y[j*nif+i];
-      vec2[nif*(njf-1)+n] = Y[(j+1)*nif+i];
-      vec1[2*nif*(njf-1)+n] = Z[j*nif+i];
-      vec2[2*nif*(njf-1)+n] = Z[(j+1)*nif+i];
-    }
-  }  
-
-  dyl = angle_between_vectors( nif, njf-1, vec1, vec2);
-  
-  free(vec1);
-  free(vec2);
-
-  vec1  = (double *)malloc((nif-1)*(njf-1)*3*sizeof(double));
-  vec2  = (double *)malloc((nif-1)*(njf-1)*3*sizeof(double)); 
-  vec3  = (double *)malloc((nif-1)*(njf-1)*3*sizeof(double));
-  vec4  = (double *)malloc((nif-1)*(njf-1)*3*sizeof(double)); 
-
-  for(j=0;j<njf-1;j++) {
-    for(i=0;i<nif-1;i++) {
-      n = j*(nif-1)+i;
-      vec1[n] = X[j*nif+i];
-      vec2[n] = X[j*nif+i+1];
-      vec3[n] = X[(j+1)*nif+i+1];
-      vec4[n] = X[(j+1)*nif+i];
-      vec1[(nif-1)*(njf-1)+n] = Y[j*nif+i];
-      vec2[(nif-1)*(njf-1)+n] = Y[j*nif+i+1];
-      vec3[(nif-1)*(njf-1)+n] = Y[(j+1)*nif+i+1];
-      vec4[(nif-1)*(njf-1)+n] = Y[(j+1)*nif+i];
-      vec1[2*(nif-1)*(njf-1)+n] = Z[j*nif+i];
-      vec2[2*(nif-1)*(njf-1)+n] = Z[j*nif+i+1];
-      vec3[2*(nif-1)*(njf-1)+n] = Z[(j+1)*nif+i+1];
-      vec4[2*(nif-1)*(njf-1)+n] = Z[(j+1)*nif+i];
-    }
-  }  
-
-  areal = excess_of_quad( nif-1, njf-1, vec1, vec2, vec3, vec4);
-  free(vec1);
-  free(vec2);
-  free(vec3);
-  free(vec4);  
-
-  /*Force some symmetry (probably does nothing) */
-  for(j=0; j<njf; j++) {
-    for(i=0; i<nif-1; i++) dxl[j*(nif-1)+i] = (dxl[j*(nif-1)+i]+dyl[i*nif+j])*0.5;
-  }
-
-  for(j=0; j<njf-1; j++) {
-    for(i=0; i<nif; i++) dyl[j*nif+i] = dxl[i*(nif-1)+j];
-  }
-
-  for(j=0; j<njf-1; j++) {
-    for(i=0; i<nif-1; i++) {
-      if(j<i) 
-	areal[j*(nif-1)+i] = (areal[j*(nif-1)+i]+areal[i*(nif-1)+j])*0.5;
-      else if(j>i)
-        areal[j*(nif-1)+i] = areal[i*(nif-1)+j];
-    }
-  }
-
-  /* Use symmetry to fill second octant */
-  for(j=1; j<njf; j++) {
-    for(i=0; i<j; i++) {
-      dxl[j*(nif-1)+i] = dyl[i*nif+j];
-    }
-  }
-
-  for(j=1; j<njf-1; j++) {
-    for(i=0; i<j; i++) {
-      areal[j*(nif-1)+i] = areal[i*(nif-1)+j];
-    }
-  }
-
-  /* copy data from fine grid to super grid. */
-  
-  for(j=0;j<nyh;j++) {
-    for(i=0;i<nxh-1;i++) {
-      ar = 0;
-      for(n=0;n<nratio;n++) ar = ar + dxl[j*nratio*(nif-1)+i*nratio+n];
-      dx[j*nx+i] = ar*RADIUS;
-    }
-  }
-    
-  for(j=0;j<nyh-1;j++) {
-    for(i=0;i<nxh-1;i++) {
-      ar = 0;
-      for(n=0; n<nratio; n++) 
-	for(m=0; m<nratio; m++) ar += areal[(j*nratio+n)*(nif-1)+i*nratio+m];
-      area[j*nx+i] = ar*RADIUS*RADIUS;
-    }
-  }
-  
-  /*use reflection symmetry of quadrants to fill face. */
-  for(j=0;j<nyh; j++) {
-    for(i=nxh-1; i<nx; i++) {
-      dx[j*nx+i] = dx[j*nx+nxp-i-2];
-    }
-  }
-
-  for(j=nyh;j<nyp; j++) {
-    for(i=0; i<nx; i++) {
-      dx[j*nx+i] = dx[(ny-j)*nx+i];
-    }
-  }
-
-  for(j=0;j<nyh-1; j++) {
-    for(i=nxh-1; i<nx; i++) {
-      area[j*nx+i]   = area[j*nx+nxp-i-2];
-    }
-  }
-
-  for(j=nyh-1;j<ny; j++) {
-    for(i=0; i<nx; i++) {
-      area[j*ny+i]   = area[(nyp-j-2)*nx+i];
-    }
-  }
-
-  /* copy dx to dy */
-  for(j=0;j<ny;j++) 
-    for(i=0;i<nxp;i++) dy[j*nxp+i] =  dx[i*nx+j] ;
-
-}; /* calc_fvgrid */
-
-
-/******************************************************************************* 
-   array<double>* angle_between_vectors(array<double> vec1, array<double> vec2)
-*******************************************************************************/
-
-double* angle_between_vectors(int ni, int nj, double *vec1, double *vec2) {
-  int n;
-  double vector_prod, nrm1, nrm2;
-  double *angle;
-  
-  angle = (double *)malloc(ni*nj*sizeof(double));
-
-  for(n=0; n<ni*nj; n++) {
-    vector_prod=vec1[n]*vec2[n] + vec1[ni*nj+n]*vec2[ni*nj+n] + vec1[2*ni*nj+n]*vec2[2*ni*nj+n];
-      nrm1=pow(vec1[n],2)+pow(vec1[ni*nj+n],2)+pow(vec1[2*ni*nj+n],2);
-      nrm2=pow(vec2[n],2)+pow(vec2[ni*nj+n],2)+pow(vec2[2*ni*nj+n],2);
-      angle[n] = acos( vector_prod/sqrt(nrm1*nrm2) );
-  }
-  return angle;
-}; /* angle_between_vectors */
-
-/*****************************************************************
-   double* excess_of_quad(int ni, int nj, double *vec1, double *vec2, 
-                          double *vec3, double *vec4 )
-*******************************************************************/
-double* excess_of_quad(int ni, int nj, double *vec1, double *vec2, double *vec3, double *vec4 )
-{
-  int n;
-  double ang12, ang23, ang34, ang41;
-  double *excess, *plane1, *plane2, *plane3, *plane4;
-  double *angle12, *angle23, *angle34, *angle41;
-  
-  excess = (double *)malloc(ni*nj*sizeof(double));
-
-  plane1=plane_normal(ni, nj, vec1, vec2);
-  plane2=plane_normal(ni, nj, vec2, vec3);
-  plane3=plane_normal(ni, nj, vec3, vec4);
-  plane4=plane_normal(ni, nj, vec4, vec1);
-  angle12=angle_between_vectors(ni, nj, plane2,plane1);
-  angle23=angle_between_vectors(ni, nj, plane3,plane2);
-  angle34=angle_between_vectors(ni, nj, plane4,plane3);
-  angle41=angle_between_vectors(ni, nj, plane1,plane4);
-
-  for(n=0; n<ni*nj; n++) {
-    ang12 = M_PI-angle12[n];
-    ang23 = M_PI-angle23[n];
-    ang34 = M_PI-angle34[n];
-    ang41 = M_PI-angle41[n];
-    excess[n] = ang12+ang23+ang34+ang41-2*M_PI;
-  }
-
-  free(plane1);
-  free(plane2);
-  free(plane3);
-  free(plane4);
-  free(angle12);
-  free(angle23);
-  free(angle34);
-  free(angle41);
-  
-  return excess;
-
-}; /* excess_of_quad */
-
-/***********************************************************************
-   double* plane_normal(int ni, int nj, double *P1, double *P2)
-***********************************************************************/
-
-double* plane_normal(int ni, int nj, double *P1, double *P2)
-{
-  int i, j, n;
-  double p1, p2, p3, mag;
-  double *plane;
-  
-  plane = (double *)malloc(ni*nj*3*sizeof(double));
-
-  for(j=0;j<nj;j++) {
-    for(i=0;i<ni;i++) {
-      n = j*ni + i;
-      p1 = P1[ni*nj+n] * P2[2*ni*nj+n] - P1[2*ni*nj+n] * P2[ni*nj+n];
-      p2 = P1[2*ni*nj+n] * P2[n] - P1[n] * P2[2*ni*nj+n];
-      p3 = P1[n] * P2[ni*nj+n] - P1[ni*nj+n] * P2[n];
-      mag=sqrt(pow(p1,2) + pow(p2,2) + pow(p3,2));
-      plane[n]=p1/mag;
-      plane[ni*nj+n]=p2/mag;
-      plane[2*ni*nj+n]=p3/mag;
-    }
-  }
-
-  return plane;
-
-};
-
-/******************************************************************
-
-  void calc_rotation_angle()
-
-******************************************************************/
-
-void calc_rotation_angle(int nxp, int nyp, double *x, double *y, double *angle_dx, double *angle_dy)
-{
-  int ip1, im1, jp1, jm1, tp1, tm1, i, j, n, ntiles, nx, ny;
-  double lon_scale;
-
-  nx = nxp - 1;
-  ny = nyp - 1;
-  ntiles = 6;
-  for(n=0; n<ntiles; n++) {
-    for(j=0; j<nyp; j++) {
-      for(i=0; i<nxp; i++) {
-	lon_scale = cos(y[n*nxp*nyp+j*nxp+i]*D2R);
-	tp1 = n;
-	tm1 = n;
-	ip1 = i+1;
-	im1 = i-1;
-	jp1 = j;
-	jm1 = j;
-
-        if(ip1 >= nxp) {  /* find the neighbor tile. */
-	  if(n % 2 == 0) { /* tile 1, 3, 5 */
-	    tp1 = n+1;
-	    ip1 = 0;
-	  }
-	  else { /* tile 2, 4, 6 */
-	    tp1 = n+2;
-	    if(tp1 >= ntiles) tp1 -= ntiles;
-	    ip1 = ny-j-1;
-	    jp1 = 0;
-	  }
-	}        
-        if(im1 < 0) {  /* find the neighbor tile. */
-	  if(n % 2 == 0) { /* tile 1, 3, 5 */
-	    tm1 = n-2;
-	    if(tm1 < 0) tm1 += ntiles;
-	    jm1 = ny;
-	    im1 = nx-j;
-	  }
-	  else { /* tile 2, 4, 6 */
-	    tm1 = n-1;
-	    im1 = nx;
-	  }
-	}
-
-	angle_dx[n*nxp*nyp+j*nxp+i] = atan2(y[tp1*nxp*nyp+jp1*nxp+ip1]-y[tm1*nxp*nyp+jm1*nxp+im1],
-					    (x[tp1*nxp*nyp+jp1*nxp+ip1]-x[tm1*nxp*nyp+jm1*nxp+im1])*lon_scale )*R2D;
-	tp1 = n;
-	tm1 = n;
-	ip1 = i;
-	im1 = i;
-	jp1 = j+1;
-	jm1 = j-1;
-        if(jp1 >=nyp) {  /* find the neighbor tile. */
-	  if(n % 2 == 0) { /* tile 1, 3, 5 */
-	    tp1 = n+2;
-	    if(tp1 >= ntiles) tp1 -= ntiles;
-	    jp1 = nx-i;
-	    ip1 = 0;
-	  }
-	  else { /* tile 2, 4, 6 */
-	    tp1 = n+1;
-	    if(tp1 >= ntiles) tp1 -= ntiles;
-	    jp1 = 0;
-	  }
-	}        
-        if(jm1 < 0) {  /* find the neighbor tile. */
-	  if(n % 2 == 0) { /* tile 1, 3, 5 */
-	    tm1 = n-1;
-	    if(tm1 < 0) tm1 += ntiles;
-	    jm1 = ny;
-	  }
-	  else { /* tile 2, 4, 6 */
-	    tm1 = n-2;
-	    if(tm1 < 0) tm1 += ntiles;
-	    im1 = nx;
-	    jm1 = nx-i;
-	  }
-	}	
-
-	angle_dy[n*nxp*nyp+j*nxp+i] = atan2(y[tp1*nxp*nyp+jp1*nxp+ip1]-y[tm1*nxp*nyp+jm1*nxp+im1],
-					    (x[tp1*nxp*nyp+jp1*nxp+ip1]-x[tm1*nxp*nyp+jm1*nxp+im1])*lon_scale )*R2D;
-      }
-    }
-  }
-
-}; /* calc_rotation_angle */
- 
diff --git a/gridspec/tools/shared/create_gnomonic_cubic_grid.c b/gridspec/tools/shared/create_gnomonic_cubic_grid.c
deleted file mode 100644
index 5f3b4fb..0000000
--- a/gridspec/tools/shared/create_gnomonic_cubic_grid.c
+++ /dev/null
@@ -1,908 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include "mpp.h"
-#include "constant.h"
-#include "mosaic_util.h"
-#include "tool_util.h"
-#include "create_hgrid.h"
-#define  D2R (M_PI/180.)
-#define  R2D (180./M_PI)
-#define  EPSLN (1.e-10)
-
-/* private subroutines */
-void gnomonic_ed  (int ni, double* lamda, double* theta);
-void gnomonic_angl(int ni, double* lamda, double* theta);
-void gnomonic_dist(int ni, double* lamda, double* theta);
-void cartesian_to_spherical(double x, double y, double z, double *lon, double *lat, double *r);
-void spherical_to_cartesian(double lon, double lat, double r, double *x, double *y, double *z);
-void symm_ed(int ni, double *lamda, double *theta);
-void mirror_grid(int ni, int ntiles, double *x, double *y );
-void mirror_latlon(double lon1, double lat1, double lon2, double lat2, double lon0,
-		   double lat0, double *lon, double *lat);
-void rot_3d(int axis, double x1in, double y1in, double z1in, double angle, double *x2out,
-	    double *y2out, double *z2out, int degrees, int convert);
-double excess_of_quad2(const double *vec1, const double *vec2, const double *vec3, const double *vec4 );
-double angle_between_vectors2(const double *vec1, const double *vec2);
-void plane_normal2(const double *P1, const double *P2, double *plane);
-void calc_rotation_angle2(int nxp, double *x, double *y, double *angle_dx, double *angle_dy);
-void cell_center(int ni, const double *lonc, const double *latc, double *lont, double *latt);
-void cell_east(int ni, const double *lonc, const double *latc, double *lone, double *late);
-void cell_north(int ni, const double *lonc, const double *latc, double *lonn, double *latn);
-/*******************************************************************************
-  void create_gnomonic_cubic_grid( int *npoints, int *nratio, char *method, char *orientation, double *x,
-                          double *y, double *dx, double *dy, double *area, double *angle_dx,
-                          double *angle_dy )
-  create nomomic cubic grid. All six tiles grid will be generated.
-*******************************************************************************/
-void create_gnomonic_cubic_grid( char* grid_type, int *npts, double *x, double *y,
-				double *dx, double *dy, double *area, double *angle_dx,
-			        double *angle_dy )
-{
-  const int ntiles = 6;
-  int nx, nxp, ni, nip;
-  int i, j, n;
-  double p1[2], p2[2];
-  double p_ll[2], p_ul[2], p_lr[2], p_ur[2], ar;
-  double *lon, *lat;
-  double *xc, *yc, *xt, *yt;
-  double *xe, *ye, *xn, *yn;
-  
-  nx  = *npts;
-  if( nx%2 ) mpp_error("create_gnomonic_cubic_grid: supergrid size should be divided by 2");
-  ni  = nx/2;
-  nip = ni + 1;
-  nxp = nx+1;
-
-  lon = (double *)malloc(nip*nip*sizeof(double));
-  lat = (double *)malloc(nip*nip*sizeof(double));
-  
-  if(strcmp(grid_type, "gnomonic_ed")==0 )
-    gnomonic_ed(  ni, lon, lat);
-  else if(strcmp(grid_type,"gnomonic_dist")==0)
-    gnomonic_dist(ni, lon, lat);
-  else if(strcmp(grid_type,"gnomonic_angl")==0)
-    gnomonic_angl(ni, lon, lat);
-  else mpp_error("create_gnomonic_cubic_grid: grid type should be 'gnomonic_ed', "
-		 "'gnomonic_dist' or 'gnomonic_angl'");
-
-  symm_ed(ni, lon, lat);
-
-  xc = (double *)malloc(ntiles*nip*nip*sizeof(double));
-  yc = (double *)malloc(ntiles*nip*nip*sizeof(double));
-  xt = (double *)malloc(ntiles*ni *ni *sizeof(double));
-  yt = (double *)malloc(ntiles*ni *ni *sizeof(double));
-  xe = (double *)malloc(ntiles*nip*ni *sizeof(double));
-  ye = (double *)malloc(ntiles*nip*ni *sizeof(double));
-  xn = (double *)malloc(ntiles*ni *nip*sizeof(double));
-  yn = (double *)malloc(ntiles*ni *nip*sizeof(double));
-  
-  for(j=0; j<nip; j++) {
-    for(i=0; i<nip; i++) {
-      xc[j*nip+i] = lon[j*nip+i] - M_PI;
-      yc[j*nip+i] = lat[j*nip+i];
-    }
-  }
-  
-  /* mirror_grid assumes that the tile=1 is centered on equator
-     and greenwich meridian Lon[-pi,pi]  */
-  mirror_grid(ni, ntiles, xc, yc);
-
-  for(n=0; n<ntiles*nip*nip; n++) {
-#ifndef NO_SHIFT_WEST
-    /* This will result in the corner close to east coast of china */
-    xc[n] -= M_PI/18.;
-#endif    
-    if(xc[n] < 0.) xc[n] += 2.*M_PI;
-    if(fabs(xc[n]) < EPSLN) xc[n] = 0;
-    if(fabs(yc[n]) < EPSLN) yc[n] = 0;
-  }
-      
-  /* ensure consistency on the boundary between tiles */
-  for(j=0; j<nip; j++) {
-    xc[  nip*nip+j*nip] = xc[j*nip+ni];                 /* 1E -> 2W */
-    yc[  nip*nip+j*nip] = yc[j*nip+ni];                 /* 1E -> 2W */
-    xc[2*nip*nip+j*nip] = xc[ni*nip+ni-j];              /* 1N -> 3W */
-    yc[2*nip*nip+j*nip] = yc[ni*nip+ni-j];              /* 1N -> 3W */      
-  }
-  for(i=0; i<nip; i++) {
-    xc[4*nip*nip+ni*nip+i] = xc[(ni-i)*nip];            /* 1W -> 5N */
-    yc[4*nip*nip+ni*nip+i] = yc[(ni-i)*nip];            /* 1W -> 2N */
-    xc[5*nip*nip+ni*nip+i] = xc[i];                     /* 1S -> 6N */
-    yc[5*nip*nip+ni*nip+i] = yc[i];                     /* 1S -> 6N */      
-    xc[2*nip*nip+i]        = xc[nip*nip+ni*nip+i];      /* 2N -> 3S */
-    yc[2*nip*nip+i]        = yc[nip*nip+ni*nip+i];      /* 2N -> 3S */
-    xc[3*nip*nip+i]        = xc[nip*nip+(ni-i)*nip+ni];  /* 2E -> 4S */
-    yc[3*nip*nip+i]        = yc[nip*nip+(ni-i)*nip+ni];  /* 2E -> 4S */      
-  }
-  for(j=0; j<nip; j++) {
-    xc[5*nip*nip+j*nip+ni] = xc[nip*nip+ni-j];          /* 2S -> 6E */
-    yc[5*nip*nip+j*nip+ni] = yc[nip*nip+ni-j];          /* 2S -> 6E */  
-    xc[3*nip*nip+j*nip]    = xc[2*nip*nip+j*nip+ni];    /* 3E -> 4W */
-    yc[3*nip*nip+j*nip]    = yc[2*nip*nip+j*nip+ni];    /* 3E -> 4W */
-    xc[4*nip*nip+j*nip]    = xc[2*nip*nip+ni*nip+ni-j]; /* 3N -> 5W */
-    yc[4*nip*nip+j*nip]    = yc[2*nip*nip+ni*nip+ni-j]; /* 3N -> 5W */
-  }
-  for(i=0; i<nip; i++) {
-    xc[4*nip*nip+i] = xc[3*nip*nip+ni*nip+i];           /* 4N -> 5S */
-    yc[4*nip*nip+i] = yc[3*nip*nip+ni*nip+i];           /* 4N -> 5S */
-    xc[5*nip*nip+i] = xc[3*nip*nip+(ni-i)*nip+ni];      /* 4E -> 6S */
-    yc[5*nip*nip+i] = yc[3*nip*nip+(ni-i)*nip+ni];      /* 4E -> 6S */
-  }
-  for(j=0; j<nip; j++) {
-    xc[5*nip*nip+j*nip] = xc[4*nip*nip+j*nip+ni];    /* 5E -> 6W */
-    yc[5*nip*nip+j*nip] = yc[4*nip*nip+j*nip+ni];    /* 5E -> 6W */  
-  }
-
-  /* calculate grid box center location */
-       
-  for(n=0; n<ntiles; n++) {
-    cell_center(ni, xc+n*nip*nip, yc+n*nip*nip, xt+n*ni*ni, yt+n*ni*ni);
-    cell_east(ni, xc+n*nip*nip, yc+n*nip*nip, xe+n*nip*ni, ye+n*nip*ni);
-    cell_north(ni, xc+n*nip*nip, yc+n*nip*nip, xn+n*ni*nip, yn+n*ni*nip);
-  }
-
-  /* copy grid box vertices location into super grid */
-  for(n=0; n<ntiles; n++) for(j=0; j<nip; j++) for(i=0; i<nip; i++) {
-    x[n*nxp*nxp+j*2*nxp+i*2]=xc[n*nip*nip+j*nip+i];
-    y[n*nxp*nxp+j*2*nxp+i*2]=yc[n*nip*nip+j*nip+i];
-  }
-
-  /* copy grid box center location to super grid */
-  for(n=0; n<ntiles; n++) for(j=0; j<ni; j++) for(i=0; i<ni; i++) {
-    x[n*nxp*nxp+(j*2+1)*nxp+i*2+1]=xt[n*ni*ni+j*ni+i];
-    y[n*nxp*nxp+(j*2+1)*nxp+i*2+1]=yt[n*ni*ni+j*ni+i];
-  }  
-
-  /* copy grid box east location to super grid */
-  for(n=0; n<ntiles; n++) for(j=0; j<ni; j++) for(i=0; i<nip; i++) {
-    x[n*nxp*nxp+(j*2+1)*nxp+i*2]=xe[n*nip*ni+j*nip+i];
-    y[n*nxp*nxp+(j*2+1)*nxp+i*2]=ye[n*nip*ni+j*nip+i];
-  }  
-
-  /* copy grid box north location to super grid */
-  for(n=0; n<ntiles; n++) for(j=0; j<nip; j++) for(i=0; i<ni; i++) {
-    x[n*nxp*nxp+j*2*nxp+i*2+1]=xn[n*ni*nip+j*ni+i];
-    y[n*nxp*nxp+j*2*nxp+i*2+1]=yn[n*ni*nip+j*ni+i];
-  }  
-  
-  free(xt);
-  free(yt);
-  free(xc);
-  free(yc);  
-  free(xe);
-  free(ye);
-  free(xn);
-  free(yn);
-  
-  /* calculate grid cell length */
-  for(n=0; n<ntiles; n++) {
-    for(j=0; j<nxp; j++) {
-      for(i=0; i<nx; i++) {
-	p1[0] = x[n*nxp*nxp+j*nxp+i];
-	p1[1] = y[n*nxp*nxp+j*nxp+i];
-	p2[0] = x[n*nxp*nxp+j*nxp+i+1];
-	p2[1] = y[n*nxp*nxp+j*nxp+i+1];
-	dx[n*nx*nxp+j*nx+i] = great_circle_distance(p1, p2);
-      }
-    }
-  }
-
-  /* copy dx to dy */
-  for(n=0; n<ntiles; n++) {
-    for(j=0; j<nxp; j++) {
-      for(i=0; i<nx; i++) dy[n*nx*nxp+i*nxp+j] = dx[n*nx*nxp+j*nx+i];
-    }
-  }
-
-  /* ensure consistency on the boundaries between tiles */
-  for(j=0; j<nx; j++) {
-    dy[j*nxp]             = dx[4*nx*nxp+nx*nx+nx-j-1]; /* 5N -> 1W */
-    dy[j*nxp+nx]          = dy[nxp*nx+j*nxp];          /* 2W -> 1E */
-    dy[nxp*nx+j*nxp+nx]   = dx[3*nx*nxp+(nx-j-1)];     /* 4S -> 2E */
-    dy[2*nxp*nx+j*nxp]    = dx[nx*nx+nx-j-1];          /* 1N -> 3W */
-    dy[2*nxp*nx+j*nxp+nx] = dy[3*nxp*nx+j*nxp];        /* 4W -> 3E */
-    dy[3*nxp*nx+j*nxp+nx] = dx[5*nx*nxp+(nx-j-1)];     /* 4S -> 2E */
-    dy[4*nxp*nx+j*nxp]    = dx[2*nx*nxp+nx*nx+nx-j-1]; /* 3N -> 5W */
-    dy[4*nxp*nx+j*nxp+nx] = dy[5*nxp*nx+j*nxp];        /* 6W -> 5E */
-    dy[5*nxp*nx+j*nxp+nx] = dx[nx*nxp+(nx-j-1)];       /* 2S -> 6E */    
-  }
-
-  for(j=0; j<nx; j++) {
-    for(i=0; i<nx; i++) {
-      p_ll[0] = x[j*nxp+i];       p_ll[1] = y[j*nxp+i];
-      p_ul[0] = x[(j+1)*nxp+i];   p_ul[1] = y[(j+1)*nxp+i];
-      p_lr[0] = x[j*nxp+i+1];     p_lr[1] = y[j*nxp+i+1];
-      p_ur[0] = x[(j+1)*nxp+i+1]; p_ur[1] = y[(j+1)*nxp+i+1];
-      /* all the face have the same area */
-      ar = spherical_excess_area(p_ll, p_ul, p_lr, p_ur, RADIUS);
-      area[j*nx+i] = ar;
-      area[nx*nx+j*nx+i] = ar;
-      area[2*nx*nx+j*nx+i] = ar;
-      area[3*nx*nx+j*nx+i] = ar;
-      area[4*nx*nx+j*nx+i] = ar;
-      area[5*nx*nx+j*nx+i] = ar;        
-    }
-  }
-
-  /*calculate rotation angle, just some workaround, will modify this in the future. */
-  calc_rotation_angle2(nxp, x, y, angle_dx, angle_dy );
-
-  /* convert grid location from radians to degree */
-  for(i=0; i<nxp*nxp*ntiles; i++) {
-    x[i] = x[i]*R2D;
-    y[i] = y[i]*R2D;
-  }
-  
-}; /* void create_gnomonic_cubic_grid */
-
-
-/*-----------------------------------------------------
-      void gnomonic_ed
-  Equal distance along the 4 edges of the cubed sphere
-  -----------------------------------------------------
-  Properties: 
-  * defined by intersections of great circles
-  * max(dx,dy; global) / min(dx,dy; global) = sqrt(2) = 1.4142
-  * Max(aspect ratio) = 1.06089
-  * the N-S coordinate curves are const longitude on the 4 faces with equator 
-  For C2000: (dx_min, dx_max) = (3.921, 5.545)    in km unit
-  ! Ranges:
-  ! lamda = [0.75*pi, 1.25*pi]
-  ! theta = [-alpha, alpha]
-  --------------------------------------------------------*/
-void gnomonic_ed(int ni, double* lamda, double* theta)
-{
-
-  int i, j, n, nip;
-  double dely;
-  double *pp, *x, *y, *z;
-  double rsq3, alpha;
-
-
-  nip = ni + 1;
-  rsq3 = 1./sqrt(3.);
-  alpha = asin( rsq3 );
-
-  dely = 2.*alpha/ni;
-
-  /* Define East-West edges: */
-  for(j=0; j<nip; j++) {
-    lamda[j*nip]    = 0.75*M_PI;               /* West edge */
-    lamda[j*nip+ni] = 1.25*M_PI;               /* East edge */
-    theta[j*nip]    = -alpha + dely*j;       /* West edge */
-    theta[j*nip+ni] = theta[j*nip];          /* East edge */
-  }
-
-  /* Get North-South edges by symmetry: */
-
-  for(i=1; i<ni; i++) {
-      mirror_latlon(lamda[0], theta[0], lamda[ni*nip+ni], theta[ni*nip+ni],  
-		    lamda[i*nip], theta[i*nip], &lamda[i], &theta[i] );
-      lamda[ni*nip+i] = lamda[i];
-      theta[ni*nip+i] = -theta[i];
-  }
-
-  x = (double *)malloc(nip*nip*sizeof(double));
-  y = (double *)malloc(nip*nip*sizeof(double));
-  z = (double *)malloc(nip*nip*sizeof(double));
-  /* Set 4 corners: */
-  latlon2xyz(1, &lamda[0], &theta[0], &x[0], &y[0], &z[0]);
-  latlon2xyz(1, &lamda[ni], &theta[ni], &x[ni], &y[ni], &z[ni]);
-  latlon2xyz(1, &lamda[ni*nip], &theta[ni*nip], &x[ni*nip], &y[ni*nip], &z[ni*nip]);
-  latlon2xyz(1, &lamda[ni*nip+ni], &theta[ni*nip+ni], &x[ni*nip+ni], &y[ni*nip+ni], &z[ni*nip+ni]);
-
-  /* Map edges on the sphere back to cube:
-     Intersections at x=-rsq3   */
-
-  for(j=1; j<ni; j++) {
-    n = j*nip;
-    latlon2xyz(1, &lamda[n], &theta[n], &x[n], &y[n], &z[n]);
-    y[n] = -y[n]*rsq3/x[n];
-    z[n] = -z[n]*rsq3/x[n];
-  }
-
-  for(i=1; i<ni; i++) {
-    latlon2xyz(1, &lamda[i], &theta[i], &x[i], &y[i], &z[i]);
-    y[i] = -y[i]*rsq3/x[i];
-    z[i] = -z[i]*rsq3/x[i];
-  }    
-
-  for(j=0; j<nip; j++)
-    for(i=0; i<nip; i++) x[j*nip+i] = -rsq3;
-
-  for(j=1;j<nip; j++) {
-    for(i=1; i<nip; i++) {
-      y[j*nip+i] = y[i];
-      z[j*nip+i] = z[j*nip];
-    }
-  }
-
-  xyz2latlon(nip*nip, x, y, z, lamda, theta);
-
-}; /* gnomonic_ed */
-
-/*----------------------------------------------------------
-  void gnomonic_angl()
-  This is the commonly known equi-angular grid
-**************************************************************/
-
-void gnomonic_angl(int ni, double* lamda, double* theta)
-{
-
-
-
-}; /* gnomonic_angl */
-
-/*----------------------------------------------------------
-  void gnomonic_dist()
-  This is the commonly known equi-distance grid
-**************************************************************/
-
-void gnomonic_dist(int ni, double* lamda, double* theta)
-{
-
-
-
-}; /* gnomonic_dist */
-
-/*------------------------------------------------------------------
-        void mirror_latlon
-   Given the "mirror" as defined by (lon1, lat1), (lon2, lat2), and center 
-   of the sphere, compute the mirror image of (lon0, lat0) as  (lon, lat)
-   ---------------------------------------------------------------*/
-   
-void mirror_latlon(double lon1, double lat1, double lon2, double lat2, double lon0,
-		   double lat0, double *lon, double *lat)
-{
-  double p0[3], p1[3], p2[3], pp[3], nb[3];
-  double pdot;
-  int k;
-
-  latlon2xyz(1, &lon0, &lat0, &p0[0], &p0[1], &p0[2]);
-  latlon2xyz(1, &lon1, &lat1, &p1[0], &p1[1], &p1[2]);
-  latlon2xyz(1, &lon2, &lat2, &p2[0], &p2[1], &p2[2]);
-  vect_cross(p1, p2, nb);
-     
-  pdot = sqrt(nb[0]*nb[0]+nb[1]*nb[1]+nb[2]*nb[2]);
-  for(k=0; k<3; k++) nb[k] = nb[k]/pdot;
-
-  pdot = p0[0]*nb[0] + p0[1]*nb[1] + p0[2]*nb[2];
-  for(k=0; k<3; k++) pp[k] = p0[k] - 2*pdot*nb[k];
-  xyz2latlon(1, &pp[0], &pp[1], &pp[2], lon, lat);
-    
-}; /* mirror_latlon */
-
-/*-------------------------------------------------------------------------
-  void symm_ed(int ni, double *lamda, double *theta)
-  ! Make grid symmetrical to i=ni/2+1 and j=nj/2+1
-  ------------------------------------------------------------------------*/
-void symm_ed(int ni, double *lamda, double *theta)
-{
-  
-  int nip, i, j, ip, jp;
-  double avg;
-  
-  nip = ni+1;
-
-  for(j=1; j<nip; j++)
-    for(i=1; i<ni; i++) lamda[j*nip+i] = lamda[i];
-  
-  for(j=0; j<nip; j++) {
-    for(i=0; i<ni/2; i++) {
-      ip = ni - i;
-      avg = 0.5*(lamda[j*nip+i]-lamda[j*nip+ip]);
-      lamda[j*nip+i] = avg + M_PI;
-      lamda[j*nip+ip] = M_PI - avg;
-      avg = 0.5*(theta[j*nip+i]+theta[j*nip+ip]);
-      theta[j*nip+i] = avg;
-      theta[j*nip+ip] = avg;      
-    }
-  }
-
-  /* Make grid symmetrical to j=im/2+1 */
-  for(j = 0; j<ni/2; j++) {
-    jp = ni - j;
-    for(i=1; i<ni; i++) {
-      avg = 0.5*(lamda[j*nip+i]+lamda[jp*nip+i]);
-      lamda[j*nip+i] = avg;
-      lamda[jp*nip+i] = avg;
-      avg = 0.5*(theta[j*nip+i]-theta[jp*nip+i]);
-      theta[j*nip+i] = avg;
-      theta[jp*nip+i] = -avg;
-    }
-  }
-}/* symm_ed */
-
-/*------------------------------------------------------------------------------
-  void mirror_grid( )
-  Mirror Across the 0-longitude
-  ----------------------------------------------------------------------------*/
-void mirror_grid(int ni, int ntiles, double *x, double *y )
-{
-  int nip, i, j, ip, jp, nt;
-  double x1, y1, z1, x2, y2, z2, ang;
-
-  nip = ni+1;
-  
-  for(j=0; j<ceil(nip/2.); j++) {
-    jp = ni - j;
-    for(i=0; i<ceil(nip/2.); i++) {
-      ip = ni - i;
-      x1 = 0.25 * (fabs(x[j*nip+i]) + fabs(x[j*nip+ip]) + fabs(x[jp*nip+i]) + fabs(x[jp*nip+ip]) );
-      x[j*nip+i]   = x1 * (x[j*nip+i]   >=0 ? 1:-1);
-      x[j*nip+ip]  = x1 * (x[j*nip+ip]  >=0 ? 1:-1);
-      x[jp*nip+i]  = x1 * (x[jp*nip+i]  >=0 ? 1:-1);
-      x[jp*nip+ip] = x1 * (x[jp*nip+ip] >=0 ? 1:-1);      
-
-      y1 = 0.25 * (fabs(y[j*nip+i]) + fabs(y[j*nip+ip]) + fabs(y[jp*nip+i]) + fabs(y[jp*nip+ip]) );
-      y[j*nip+i]   = y1 * (y[j*nip+i]   >=0 ? 1:-1);
-      y[j*nip+ip]  = y1 * (y[j*nip+ip]  >=0 ? 1:-1);
-      y[jp*nip+i]  = y1 * (y[jp*nip+i]  >=0 ? 1:-1);
-      y[jp*nip+ip] = y1 * (y[jp*nip+ip] >=0 ? 1:-1);      
-      
-      /* force dateline/greenwich-meridion consitency */
-      if( nip%2 ) {
-	if( i == (nip-1)/2 ) {
-	  x[j*nip+i] = 0.0;
-	  x[jp*nip+i] = 0.0;
-	}
-      }
-    }
-  }
-
-  /* define the the other five tiles. */
-  for(nt=1; nt<ntiles; nt++) {
-    for(j=0; j<nip; j++) {
-      for(i=0; i<nip; i++) {
-	x1 = x[j*nip+i];
-	y1 = y[j*nip+i];
-	z1 = RADIUS;
-	switch (nt) {
-	case 1: /* tile 2 */
-	  ang = -90.;
-	  rot_3d( 3, x1, y1, z1, ang, &x2, &y2, &z2, 1, 1);  /* rotate about the z-axis */
-	  break;
-	case 2: /* tile 3 */
-	  ang = -90.;
-	  rot_3d( 3, x1, y1, z1, ang, &x2, &y2, &z2, 1, 1);  /* rotate about the z-axis */
-	  ang = 90.;
-	  rot_3d( 1, x2, y2, z2, ang, &x1, &y1, &z1, 1, 1); /* rotate about the z-axis */
-	  x2=x1;
-	  y2=y1;
-	  z2=z1;
-
-	  /* force North Pole and dateline/greenwich-meridion consitency */
-	  if(nip%2) {
-	    if( (i==(nip-1)/2) && (i==j) ) {
-	      x2 = 0;
-	      y2 = M_PI*0.5;
-	    }
-
-	    if( (j==(nip-1)/2) && (i<(nip-1)/2) ) x2 = 0;
-	    if( (j==(nip-1)/2) && (i>(nip-1)/2) ) x2 = M_PI;
-	  }
-	  break;
-	case 3: /* tile 4 */
-	  ang = -180.;
-	  rot_3d( 3, x1, y1, z1, ang, &x2, &y2, &z2, 1, 1); /* rotate about the z-axis */
-	  ang = 90.;
-	  rot_3d( 1, x2, y2, z2, ang, &x1, &y1, &z1, 1, 1); /* rotate about the z-axis */
-	  x2=x1;
-	  y2=y1;
-	  z2=z1;
-
-	  /* force dateline/greenwich-meridion consitency */
-	  if( nip%2 ) {
-	    if( j == (nip-1)/2 ) x2 = M_PI;
-	  }
-	  break;
-	case 4: /* tile 5 */
-	  ang = 90.;
-	  rot_3d( 3, x1, y1, z1, ang, &x2, &y2, &z2, 1, 1); /* rotate about the z-axis */
-	  ang = 90.;
-	  rot_3d( 2, x2, y2, z2, ang, &x1, &y1, &z1, 1, 1); /* rotate about the z-axis */
-	  x2=x1;
-	  y2=y1;
-	  z2=z1;
-	  break;
-	case 5: /* tile 6 */
-	  ang = 90.;
-	  rot_3d( 2, x1, y1, z1, ang, &x2, &y2, &z2, 1, 1); /* rotate about the z-axis */
-	  ang = 0.;
-	  rot_3d( 3, x2, y2, z2, ang, &x1, &y1, &z1, 1, 1); /* rotate about the z-axis */
-	  x2=x1;
-	  y2=y1;
-	  z2=z1;
-	  
-	  /* force South Pole and dateline/greenwich-meridion consitency */
-	  if(nip%2) {
-	    if( (i==(nip-1)/2) && (i==j) ) {
-	      x2 = 0;
-	      y2 = -M_PI*0.5;
-	    }
-
-	    if( (i==(nip-1)/2) && (j>(nip-1)/2) ) x2 = 0;
-	    if( (i==(nip-1)/2) && (j<(nip-1)/2) ) x2 = M_PI;
-	  }
-	  break;
-	}
-	x[nt*nip*nip+j*nip+i] = x2;
-	y[nt*nip*nip+j*nip+i] = y2;
-      }
-    }
-  }
-}; /* mirror_grid */
-
-
-/*-------------------------------------------------------------------------------
-  void rot_3d()
-  rotate points on a sphere in xyz coords (convert angle from
-  degrees to radians if necessary)
-  -----------------------------------------------------------------------------*/
-void rot_3d(int axis, double x1in, double y1in, double z1in, double angle, double *x2out,
-	    double *y2out, double *z2out, int degrees, int convert)
-{
-
-  double x1, y1, z1, x2, y2, z2, c, s;
-  
-  if(convert)
-    spherical_to_cartesian(x1in, y1in, z1in, &x1, &y1, &z1);
-  else {
-    x1=x1in;
-    y1=y1in;
-    z1=z1in;
-  }
-
-  if(degrees) angle = angle*D2R;
-
-  c = cos(angle);
-  s = sin(angle);
-
-  switch (axis) {
-  case 1:
-    x2 =  x1;
-    y2 =  c*y1 + s*z1;
-    z2 = -s*y1 + c*z1;
-    break;
-  case 2:
-    x2 = c*x1 - s*z1;
-    y2 = y1;
-    z2 = s*x1 + c*z1;
-    break;
-  case 3:
-    x2 =  c*x1 + s*y1;
-    y2 = -s*x1 + c*y1;
-    z2 = z1;
-    break;
-  default:
-    mpp_error("Invalid axis: must be 1 for X, 2 for Y, 3 for Z.");
-  }
-  
-  if(convert)
-    cartesian_to_spherical(x2, y2, z2, x2out, y2out, z2out);
-  else {
-    *x2out=x2;;
-    *y2out=y2;
-    *z2out=z2;
-    }
-} /* rot_3d */
-
-/*-------------------------------------------------------------
-  void cartesian_to_spherical(x, y, z, lon, lat, r)
-  may merge with xyz2latlon in the future
-  ------------------------------------------------------------*/
-void cartesian_to_spherical(double x, double y, double z, double *lon, double *lat, double *r)
-{
-
-  *r = sqrt(x*x + y*y + z*z);
-  if ( (fabs(x) + fabs(y)) < EPSLN )       /* poles */
-    *lon = 0.;
-  else
-    *lon = atan2(y,x);    /* range: [-pi,pi] */
-
-
-  *lat = acos(z/(*r)) - M_PI/2.;
-};/* cartesian_to_spherical */
-
-/*-------------------------------------------------------------------------------
-  void spherical_to_cartesian
-  convert from spheircal coordinates to xyz coords
-  may merge with latlon2xyz in the future
-  -----------------------------------------------------------------------------*/
-void spherical_to_cartesian(double lon, double lat, double r, double *x, double *y, double *z)
-{
-  *x = r * cos(lon) * cos(lat);
-  *y = r * sin(lon) * cos(lat);
-
-  *z = -r * sin(lat);
-} /* spherical_to_cartesian */
-
-
-/*****************************************************************
-   double* excess_of_quad(int ni, int nj, double *vec1, double *vec2, 
-                          double *vec3, double *vec4 )
-*******************************************************************/
-double excess_of_quad2(const double *vec1, const double *vec2, const double *vec3, const double *vec4 )
-{
-  double plane1[3], plane2[3], plane3[3], plane4[3];
-  double angle12, angle23, angle34, angle41, excess;
-  double ang12, ang23, ang34, ang41;
-  
-  plane_normal2(vec1, vec2, plane1);
-  plane_normal2(vec2, vec3, plane2);
-  plane_normal2(vec3, vec4, plane3);
-  plane_normal2(vec4, vec1, plane4);
-  angle12 = angle_between_vectors2(plane2,plane1);
-  angle23 = angle_between_vectors2(plane3,plane2);
-  angle34 = angle_between_vectors2(plane4,plane3);
-  angle41 = angle_between_vectors2(plane1,plane4);
-  ang12 = M_PI-angle12;
-  ang23 = M_PI-angle23;
-  ang34 = M_PI-angle34;
-  ang41 = M_PI-angle41;
-  excess = ang12+ang23+ang34+ang41-2*M_PI;
-  /*  excess = 2*M_PI - angle12 - angle23 - angle34 - angle41; */
-
-  return excess;
-
-}; /* excess_of_quad */
-
-/******************************************************************************* 
-double angle_between_vectors(const double *vec1, const double *vec2)
-*******************************************************************************/
-
-double angle_between_vectors2(const double *vec1, const double *vec2) {
-  int n;
-  double vector_prod, nrm1, nrm2;
-  double angle;
-  
-  vector_prod=vec1[0]*vec2[0] + vec1[1]*vec2[1] + vec1[2]*vec2[2];
-  nrm1=pow(vec1[0],2)+pow(vec1[1],2)+pow(vec1[2],2);
-  nrm2=pow(vec2[0],2)+pow(vec2[1],2)+pow(vec2[2],2);
-  if(nrm1*nrm2>0)
-    angle = acos( vector_prod/sqrt(nrm1*nrm2) );
-  else
-    angle = 0;
-  
-  return angle;
-}; /* angle_between_vectors */
-
-
-/***********************************************************************
-   double* plane_normal(int ni, int nj, double *P1, double *P2)
-***********************************************************************/
-
-void plane_normal2(const double *P1, const double *P2, double *plane)
-{
-  double mag;
-  
-  plane[0] = P1[1] * P2[2] - P1[2] * P2[1];
-  plane[1] = P1[2] * P2[0] - P1[0] * P2[2];
-  plane[2] = P1[0] * P2[1] - P1[1] * P2[0];
-  mag=sqrt(pow(plane[0],2) + pow(plane[1],2) + pow(plane[2],2));
-  if(mag>0) {
-    plane[0]=plane[0]/mag;
-    plane[1]=plane[1]/mag;
-    plane[2]=plane[2]/mag;
-  }
-  
-}; /* plane_normal */
-
-/******************************************************************
-
-  void calc_rotation_angle()
-
-******************************************************************/
-
-void calc_rotation_angle2(int nxp, double *x, double *y, double *angle_dx, double *angle_dy)
-{
-  int ip1, im1, jp1, jm1, tp1, tm1, i, j, n, ntiles, nx;
-  double lon_scale;
-
-  nx = nxp - 1;
-  ntiles = 6;
-  for(n=0; n<ntiles; n++) {
-    for(j=0; j<nxp; j++) {
-      for(i=0; i<nxp; i++) {
-	lon_scale = cos(y[n*nxp*nxp+j*nxp+i]*D2R);
-	tp1 = n;
-	tm1 = n;
-	ip1 = i+1;
-	im1 = i-1;
-	jp1 = j;
-	jm1 = j;
-
-        if(ip1 >= nxp) {  /* find the neighbor tile. */
-	  if(n % 2 == 0) { /* tile 1, 3, 5 */
-	    tp1 = n+1;
-	    ip1 = 0;
-	  }
-	  else { /* tile 2, 4, 6 */
-	    tp1 = n+2;
-	    if(tp1 >= ntiles) tp1 -= ntiles;
-	    ip1 = nx-j-1;
-	    jp1 = 0;
-	  }
-	}        
-        if(im1 < 0) {  /* find the neighbor tile. */
-	  if(n % 2 == 0) { /* tile 1, 3, 5 */
-	    tm1 = n-2;
-	    if(tm1 < 0) tm1 += ntiles;
-	    jm1 = nx;
-	    im1 = nx-j;
-	  }
-	  else { /* tile 2, 4, 6 */
-	    tm1 = n-1;
-	    im1 = nx;
-	  }
-	}
-
-	angle_dx[n*nxp*nxp+j*nxp+i] = atan2(y[tp1*nxp*nxp+jp1*nxp+ip1]-y[tm1*nxp*nxp+jm1*nxp+im1],
-					    (x[tp1*nxp*nxp+jp1*nxp+ip1]-x[tm1*nxp*nxp+jm1*nxp+im1])*lon_scale )*R2D;
-	tp1 = n;
-	tm1 = n;
-	ip1 = i;
-	im1 = i;
-	jp1 = j+1;
-	jm1 = j-1;
-        if(jp1 >=nxp) {  /* find the neighbor tile. */
-	  if(n % 2 == 0) { /* tile 1, 3, 5 */
-	    tp1 = n+2;
-	    if(tp1 >= ntiles) tp1 -= ntiles;
-	    jp1 = nx-i;
-	    ip1 = 0;
-	  }
-	  else { /* tile 2, 4, 6 */
-	    tp1 = n+1;
-	    if(tp1 >= ntiles) tp1 -= ntiles;
-	    jp1 = 0;
-	  }
-	}        
-        if(jm1 < 0) {  /* find the neighbor tile. */
-	  if(n % 2 == 0) { /* tile 1, 3, 5 */
-	    tm1 = n-1;
-	    if(tm1 < 0) tm1 += ntiles;
-	    jm1 = nx;
-	  }
-	  else { /* tile 2, 4, 6 */
-	    tm1 = n-2;
-	    if(tm1 < 0) tm1 += ntiles;
-	    im1 = nx;
-	    jm1 = nx-i;
-	  }
-	}	
-
-	angle_dy[n*nxp*nxp+j*nxp+i] = atan2(y[tp1*nxp*nxp+jp1*nxp+ip1]-y[tm1*nxp*nxp+jm1*nxp+im1],
-					    (x[tp1*nxp*nxp+jp1*nxp+ip1]-x[tm1*nxp*nxp+jm1*nxp+im1])*lon_scale )*R2D;
-      }
-    }
-  }
-
-}; /* calc_rotation_angle2 */
-
-
-/* This routine calculate center location based on the vertices location */
-void cell_center(int ni, const double *lonc, const double *latc, double *lont, double *latt)
-{
-
-  int    nip, i, j, p, p1, p2, p3, p4;
-  double *xc, *yc, *zc, *xt, *yt, *zt;
-  double dd;
-  
-  nip = ni+1;  
-  xc = (double *)malloc(nip*nip*sizeof(double));
-  yc = (double *)malloc(nip*nip*sizeof(double));
-  zc = (double *)malloc(nip*nip*sizeof(double));
-  xt = (double *)malloc(ni *ni *sizeof(double));
-  yt = (double *)malloc(ni *ni *sizeof(double));
-  zt = (double *)malloc(ni *ni *sizeof(double));  
-  latlon2xyz(nip*nip, lonc, latc, xc, yc, zc); 
-
-  for(j=0; j<ni; j++) for(i=0; i<ni; i++) {
-    p =  j*ni+i;
-    p1 = j*nip+i;
-    p2 = j*nip+i+1;
-    p3 = (j+1)*nip+i+1;
-    p4 = (j+1)*nip+i;
-    xt[p] = xc[p1] + xc[p2] + xc[p3] + xc[p4];
-    yt[p] = yc[p1] + yc[p2] + yc[p3] + yc[p4];
-    zt[p] = zc[p1] + zc[p2] + zc[p3] + zc[p4];
-
-    dd = sqrt(pow(xt[p],2) + pow(yt[p],2) + pow(zt[p],2) );
-    xt[p] /= dd;
-    yt[p] /= dd;
-    zt[p] /= dd;
-  }
-  xyz2latlon(ni*ni, xt, yt, zt, lont, latt);
-  free(zt);
-  free(yt);
-  free(xt);
-  free(zc);
-  free(yc);
-  free(xc);
-  
-}; /* cell_center */
-
-
-/* This routine calculate east location based on the vertices location */
-void cell_east(int ni, const double *lonc, const double *latc, double *lone, double *late)
-{
-
-  int    nip, i, j, p, p1, p2;
-  double *xc, *yc, *zc, *xe, *ye, *ze;
-  double dd;
-  
-  nip = ni+1;  
-  xc = (double *)malloc(nip*nip*sizeof(double));
-  yc = (double *)malloc(nip*nip*sizeof(double));
-  zc = (double *)malloc(nip*nip*sizeof(double));
-  xe = (double *)malloc(nip*ni *sizeof(double));
-  ye = (double *)malloc(nip*ni *sizeof(double));
-  ze = (double *)malloc(nip*ni *sizeof(double));  
-  latlon2xyz(nip*nip, lonc, latc, xc, yc, zc); 
-
-  for(j=0; j<ni; j++) for(i=0; i<nip; i++) {
-    p =  j*nip+i;
-    p1 = j*nip+i;
-    p2 = (j+1)*nip+i;
-    xe[p] = xc[p1] + xc[p2];
-    ye[p] = yc[p1] + yc[p2];
-    ze[p] = zc[p1] + zc[p2];
-
-    dd = sqrt(pow(xe[p],2) + pow(ye[p],2) + pow(ze[p],2) );
-    xe[p] /= dd;
-    ye[p] /= dd;
-    ze[p] /= dd;
-  }
-  xyz2latlon(nip*ni, xe, ye, ze, lone, late);
-  free(ze);
-  free(ye);
-  free(xe);
-  free(zc);
-  free(yc);
-  free(xc);
-  
-}; /* cell_east */
-
-
-/* This routine calculate center location based on the vertices location */
-void cell_north(int ni, const double *lonc, const double *latc, double *lonn, double *latn)
-{
-
-  int    nip, i, j, p, p1, p2;
-  double *xc, *yc, *zc, *xn, *yn, *zn;
-  double dd;
-  
-  nip = ni+1;  
-  xc = (double *)malloc(nip*nip*sizeof(double));
-  yc = (double *)malloc(nip*nip*sizeof(double));
-  zc = (double *)malloc(nip*nip*sizeof(double));
-  xn = (double *)malloc(ni *nip*sizeof(double));
-  yn = (double *)malloc(ni *nip*sizeof(double));
-  zn = (double *)malloc(ni *nip*sizeof(double));  
-  latlon2xyz(nip*nip, lonc, latc, xc, yc, zc); 
-
-  for(j=0; j<nip; j++) for(i=0; i<ni; i++) {
-    p =  j*ni+i;
-    p1 = j*nip+i;
-    p2 = j*nip+i+1;
-    xn[p] = xc[p1] + xc[p2];
-    yn[p] = yc[p1] + yc[p2];
-    zn[p] = zc[p1] + zc[p2];
-
-    dd = sqrt(pow(xn[p],2) + pow(yn[p],2) + pow(zn[p],2) );
-    xn[p] /= dd;
-    yn[p] /= dd;
-    zn[p] /= dd;
-  }
-  xyz2latlon(ni*nip, xn, yn, zn, lonn, latn);
-  free(zn);
-  free(yn);
-  free(xn);
-  free(zc);
-  free(yc);
-  free(xc);
-  
-}; /* cell_north */
diff --git a/gridspec/tools/shared/create_grid_from_file.c b/gridspec/tools/shared/create_grid_from_file.c
deleted file mode 100644
index e639d62..0000000
--- a/gridspec/tools/shared/create_grid_from_file.c
+++ /dev/null
@@ -1,179 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <complex.h>
-#include <math.h>
-#include <string.h>
-#include "mpp.h"
-#include "mosaic_util.h"
-#include "tool_util.h"
-#include "constant.h"
-#include "mpp_io.h"
-#include "create_hgrid.h"
-#define  D2R (M_PI/180.)
-#define  R2D (180./M_PI)
-
-/***********************************************************************
-  void create_grid_from_file( char *file, int *nlon, int *nlat, double *x, double *y, double *dx,
-                              double *dy, double *area, double *angle_dx )
-   the grid location is defined through ascii file. calculate cell length,
-   cell area and rotation angle  
-************************************************************************/
-void create_grid_from_file( char *file, int *nlon, int *nlat, double *x, double *y, double *dx, double *dy,
-           		    double *area, double *angle_dx )
-{
-  double *xb, *yb, *xt, *yt, *xc, *yc;
-  double p1[4], p2[4];
-  int nx, ny, nxp, nyp, ni, nj, i, j, n;
-  int is_uniform;
-  FILE *pFile;
-  char mesg[256], txt[128];
-  
-  /************************************************************
-     identify the grid_file is ascii file or netcdf file,
-     if the file name contains ".nc", it is a netcdf file,
-     otherwise it is ascii file.
-  *********************************************************/
-  nx  = *nlon;
-  ny  = *nlat;
-  nxp = nx + 1;
-  nyp = ny + 1;
-  if(strstr(file, ".nc") ) {
-    int fid, vid;
-
-    ni  = *nlon/2;
-    nj  = *nlat/2;
-    xc = (double *)malloc((ni+1)*(nj+1)*sizeof(double));
-    yc = (double *)malloc((ni+1)*(nj+1)*sizeof(double));
-    xt = (double *)malloc( ni   * nj   *sizeof(double));
-    yt = (double *)malloc( ni   * nj   *sizeof(double));
-    fid = mpp_open(file, MPP_READ);
-    vid = mpp_get_varid(fid, "grid_lon");
-    mpp_get_var_value(fid, vid, xc);
-    vid = mpp_get_varid(fid, "grid_lat");
-    mpp_get_var_value(fid, vid, yc);
-    vid = mpp_get_varid(fid, "grid_lont");
-    mpp_get_var_value(fid, vid, xt);
-    vid = mpp_get_varid(fid, "grid_latt");
-    mpp_get_var_value(fid, vid, yt);
-    mpp_close(fid);
-    for(j=0; j<nj+1; j++) for(i=0; i<ni+1; i++) {
-      x[j*2*nxp+i*2] = xc[j*(ni+1)+i];
-      y[j*2*nxp+i*2] = yc[j*(ni+1)+i];
-    }
-    for(j=0; j<nj; j++) for(i=0; i<ni; i++) {
-      x[(j*2+1)*nxp+i*2+1] = xt[j*ni+i];
-      y[(j*2+1)*nxp+i*2+1] = yt[j*ni+i];
-    }
-    /* check if the grid is uniform of not */
-    is_uniform = 1;
-    for(j=0; j<nj; j++) {
-      for(i=1; i<ni; i++) {
-	if(yt[j*ni+i] != yt[j*ni]) is_uniform = 0;
-      }
-    }
-    
-    for(i=0; i<ni; i++) {
-      for(j=1; j<nj; j++) {
-	if(xt[j*ni+i] != xt[i]) is_uniform = 0;
-      }
-    }
-
-    if(is_uniform) {
-       for(j=0; j<nj+1; j++) for(i=0; i<ni; i++) {
-         x[j*2*nxp+i*2+1] = xt[i];   
-         y[j*2*nxp+i*2+1] = yc[j*(ni+1)+i];
-       }
-       for(j=0; j<nj; j++) for(i=0; i<ni+1; i++) {
-	 x[(j*2+1)*nxp+i*2] = xc[j*(ni+1)+i];
-	 y[(j*2+1)*nxp+i*2] = yt[j*ni];
-       }
-    }
-    else {
-      for(j=0; j<nj+1; j++) for(i=0; i<ni; i++) {
-	x[j*2*nxp+i*2+1] = (xc[j*(ni+1)+i]+xc[j*(ni+1)+i+1])*0.5;
-	y[j*2*nxp+i*2+1] = (yc[j*(ni+1)+i]+yc[j*(ni+1)+i+1])*0.5;
-      }    
-      for(j=0; j<nj; j++) for(i=0; i<ni+1; i++) {
-	x[(j*2+1)*nxp+i*2] = (xc[j*(ni+1)+i]+xc[(j+1)*(ni+1)+i])*0.5;
-	y[(j*2+1)*nxp+i*2] = (yc[j*(ni+1)+i]+yc[(j+1)*(ni+1)+i])*0.5;
-      }
-    }
-    for(j=0; j<nyp; j++) for(i=0; i<nx; i++) {
-      p1[0] = x[j*nxp+i]*D2R; p2[0] = x[j*nxp+i+1]*D2R;
-      p1[1] = y[j*nxp+i]*D2R; p2[1] = y[j*nxp+i+1]*D2R;
-      dx[j*nx+i] = great_circle_distance(p1, p2);
-    }
-    for(j=0; j<ny; j++) for(i=0; i<nxp; i++) {
-      p1[0] = x[j*nxp+i]*D2R; p2[0] = x[(j+1)*nxp+i]*D2R;
-      p1[1] = y[j*nxp+i]*D2R; p2[1] = y[(j+1)*nxp+i]*D2R;
-      dy[j*nxp+i] = great_circle_distance(p1, p2);
-    }    
-    for(j=0; j<ny; j++) for(i=0; i<nx; i++) {
-      p1[0] = x[j*nxp+i]*D2R; p1[1] = x[j*nxp+i+1]*D2R; p1[2] = x[(j+1)*nxp+i+1]*D2R; p1[3] = x[(j+1)*nxp+i]*D2R;
-      p2[0] = y[j*nxp+i]*D2R; p2[1] = y[j*nxp+i+1]*D2R; p2[2] = y[(j+1)*nxp+i+1]*D2R; p2[3] = y[(j+1)*nxp+i]*D2R;
-      area[j*nx+i] = poly_area(p1, p2, 4);
-    }
-    /* currently set angle to 0 */
-    for(j=0; j<nyp; j++) for(i=0; i<nxp; i++) angle_dx[j*nxp+i] = 0;    
-    free(xt);
-    free(yt);
-    free(xc);
-    free(yc);
-  }
-  else {
-    pFile = fopen (file,"r");
-    if(!pFile) {
-      strcpy(mesg, "RegularSphericalGrid: Can not open ascii file ");
-      strcat(mesg,file);
-      mpp_error(mesg);
-    }
-
-    fscanf(pFile, "%s%*[^\n]",txt); /* header line (ignored) */
-    xb = (double *) malloc(nxp*sizeof(double));
-    yb = (double *) malloc(nyp*sizeof(double));
-    for(i=0;i<nxp;i++) 
-      fscanf(pFile, "%lg", xb+i); /* longitude */ 
-    fscanf(pFile, "%s%*[^\n]",txt); /* header line (ignored) */   
-    for(j=0;j<nyp;j++) fscanf(pFile, "%lg", yb+j); /* latitude */
-    
-    fclose(pFile);
-    n=0;
-    for(j=0; j<nyp; j++) {
-      for(i=0; i<nxp; i++) {
-	x[n]       = xb[i];
-	y[n]       = yb[j];
-	angle_dx[n++] = 0;   
-      }
-    }
-    /* zonal length */
-    n = 0;
-    for(j=0; j<nyp; j++) {
-      for(i=0; i<nx; i++ ) {
-	dx[n++] = spherical_dist(x[j*nxp+i], y[j*nxp+i], x[j*nxp+i+1], y[j*nxp+i+1] );
-      }
-    }
-
-    /* meridinal length */
-    n = 0;
-    for(j=0; j<ny; j++) {
-      for(i=0; i<nxp; i++ ) {
-	dy[n++] = spherical_dist(x[j*nxp+i], y[j*nxp+i], x[(j+1)*nxp+i], y[(j+1)*nxp+i] );
-      }
-    }
-
-    /* cell area */
-    n = 0;
-    for(j=0; j<ny; j++) {
-      for(i=0; i<nx; i++ ) {
-	area[n++] = box_area(x[j*nxp+i]*D2R, y[j*nxp+i]*D2R, x[(j+1)*nxp+i+1]*D2R, y[(j+1)*nxp+i+1]*D2R );
-      }
-    }
-
-    free(xb);
-    free(yb);
-  }
-}; /* create_grid_from_file */
-
-
-
-
diff --git a/gridspec/tools/shared/create_hgrid.h b/gridspec/tools/shared/create_hgrid.h
deleted file mode 100644
index 964c323..0000000
--- a/gridspec/tools/shared/create_hgrid.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
-                             create_hgrid.h
-  This header file provide interface to create different types of horizontal 
-  grid. geographical grid location, cell length, cell area and rotation
-  angle are returned. All the returned data are on supergrid.
-
-  contact: Zhi.Liang at noaa.gov
-
-*******************************************************************************/
-#ifndef CREATE_HGRID_H_
-#define CREATE_HGRID_H_
-void create_regular_lonlat_grid( int *nxbnds, int *nybnds, double *xbnds, double *ybnds,
-		         	 int *nlon, int *nlat, int *isc, int *iec,
-				 int *jsc, int *jec, double *x, double *y, double *dx,
-				 double *dy, double *area, double *angle_dx, const char *center );
-
-void create_simple_cartesian_grid( double *xbnds, double *ybnds, int *nlon, int *nlat,
-				   double *simple_dx, double *simple_dy, int *isc, int *iec,
-				   int *jsc, int *jec, double *x, double *y,
-				   double *dx, double *dy, double *area, double *angle_dx);
-
-void create_grid_from_file( char *file, int *nlon, int *nlat, double *x, double *y, double *dx, double *dy,
-           		    double *area, double *angle_dx );
-
-void create_spectral_grid( int *nlon, int *nlat, int *isc, int *iec,
-			   int *jsc, int *jec, double *x, double *y, double *dx,
-			   double *dy, double *area, double *angle_dx );
-
-void create_tripolar_grid( int *nxbnds, int *nybnds, double *xbnds, double *ybnds,
-			   int *nlon, int *nlat, double *lat_join_in, int *isc, int *iec,
-			   int *jsc, int *jec, double *x, double *y, double *dx, double *dy,
-			   double *area, double *angle_dx, const char *center  );
-
-void create_conformal_cubic_grid( int *npts, int *nratio, char *method, char *orientation, double *x,
-			          double *y, double *dx, double *dy, double *area, double *angle_dx,
-			          double *angle_dy );
-
-void create_gnomonic_cubic_grid( char* grid_type, int *npts, double *x, double *y,
-				double *dx, double *dy, double *area, double *angle_dx,
-			        double *angle_dy );
-#endif
diff --git a/gridspec/tools/shared/create_lonlat_grid.c b/gridspec/tools/shared/create_lonlat_grid.c
deleted file mode 100644
index 6636ecf..0000000
--- a/gridspec/tools/shared/create_lonlat_grid.c
+++ /dev/null
@@ -1,407 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <complex.h>
-#include <math.h>
-#include <string.h>
-#include "mpp.h"
-#include "mosaic_util.h"
-#include "interp.h"
-#include "tool_util.h"
-#include "constant.h"
-#include "create_hgrid.h"
-#define  D2R (M_PI/180.)
-#define  R2D (180./M_PI)
-
-/*********************************************************************************
-   some private routines used in this file
-*********************************************************************************/
-void set_regular_lonlat_grid( int nxp, int nyp, int isc, int iec, int jsc, int jec, double *xb, double *yb,
-			      double *x, double *y, double *dx, double *dy, double *area, double *angle );
-/************************************************************************************
-   void create_regular_lonlat_grid( int *nxbnds, int *nybnds, double *xbnds, double *ybnds,
-                                    int *nlon, int *nlat, int *isc, int *iec,
-                                    int *jsc, int *jec, double *x, double *y, double *dx,
-                                    double *dy, double *area, double *angle_dx )
-   calculate grid location, length, area and rotation angle.
-   The routine takes the following arguments
-
-   INPUT:
-
-   OUTPUT:
-
-************************************************************************************/
-void create_regular_lonlat_grid( int *nxbnds, int *nybnds, double *xbnds, double *ybnds,
-		         	 int *nlon, int *nlat, int *isc, int *iec,
-				 int *jsc, int *jec, double *x, double *y, double *dx,
-				 double *dy, double *area, double *angle_dx, const char *center )
-{
-  int nx, ny, nxp, nyp, nxb, nyb;
-  double *xb=NULL, *yb=NULL;
-  int refine;
-  
-  /* use cubic-spline interpolation algorithm to calculate nominal zonal grid location. */
-  nxb = *nxbnds;
-  nyb = *nybnds;
-
-  xb = compute_grid_bound(nxb, xbnds, nlon, &nx, center), 
-  nxp = nx + 1;
-  
-  yb = compute_grid_bound(nyb, ybnds, nlat, &ny, center), 
-  nyp = ny + 1;
-     
-  set_regular_lonlat_grid( nxp, nyp, *isc, *iec, *jsc, *jec, xb, yb, x, y, dx, dy, area, angle_dx);
-  free(xb);
-  free(yb);
-    
-}; /* create_regular_lonlat_grid */
-
-
-/************************************************************************************
-   void create_simple_cartesian_grid( double *xbnds, double *ybnds, int *nlon, int *nlat,
-                                      double *simple_dx, *simple_dy, int *isc, int *iec,
-				      int *jsc, int *jec, double *x, double *y,
-				      double *dx, double *dy, double *area, double *angle_dx )
-   calculate grid location, length, area and rotation angle.
-   The routine takes the following arguments
-
-   INPUT:
-
-   OUTPUT:
-
-************************************************************************************/
-void create_simple_cartesian_grid( double *xbnds, double *ybnds, int *nlon, int *nlat,
-				   double *simple_dx, double *simple_dy, int *isc, int *iec,
-				   int *jsc, int *jec, double *x, double *y,
-				   double *dx, double *dy, double *area, double *angle_dx )
-{
-  int nx, ny, nxp, nyp, i, j, n, nxc, nyc, nxb, nyb;
-  double *grid1=NULL, *grid2=NULL, *xb=NULL, *yb=NULL;
-
-  nxb = 2;
-  nyb = 2;
-  nx = *nlon;
-  ny = *nlat;
-  nxp = nx + 1;
-  nyp = ny + 1;  
-  /* use cubic-spline interpolation algorithm to calculate nominal zonal grid location. */
-  xb    = (double *)malloc(nxp*sizeof(double));
-  grid1 = (double *)malloc(nxb*sizeof(double));
-  grid1[0] = 1;
-  grid1[1] = nxp;
-  grid2 = (double *)malloc(nxp*sizeof(double));
-  for(i=0;i<nxp;i++) grid2[i] = i + 1.0;
-  cubic_spline( nxb, nxp, grid1, grid2, xbnds, xb, 1e30,1e30);
-  free(grid1);
-  free(grid2);
-
-  /* use cubic-spline interpolation algorithm to calculate nominal meridinal grid location. */
-  yb    = (double *)malloc(nyp*sizeof(double));
-  grid1 = (double *)malloc(nyb*sizeof(double));
-  grid1[0] = 1;
-  grid1[1] = nyp;
-  grid2 = (double *)malloc(nyp*sizeof(double));
-  for(j=0;j<nyp;j++) grid2[j] = j + 1.0;
-  cubic_spline( nyb, nyp, grid1, grid2, ybnds, yb, 1e30,1e30);
-  free(grid1);
-  free(grid2);
-
-  n = 0;
-  for(j=0; j<nyp; j++) {
-    for(i=0; i<nxp; i++) {
-      x[n] = xb[i];
-      y[n++] = yb[j];
-    }
-  }
-
-  nxc = *iec - *isc + 1;
-  nyc = *jec - *jsc + 1;
-  
-  for(n = 0; n< nxc*(nyc+1);     n++) dx[n] = *simple_dx;
-  for(n = 0; n< (nxc+1)*nyc;     n++) dy[n] = *simple_dy;
-  for(n = 0; n< nxc*nyc;         n++) area[n] = (*simple_dx)*(*simple_dy);
-  for(n = 0; n< (nxc+1)*(nyc+1); n++) angle_dx[n] = 0;
-  
-  free(xb);
-  free(yb);
-    
-}; /* create_simple_cartesian_grid */
-
-
-/*******************************************************************************
-   void create_spectral_grid( nt *nlon, int *nlat, int *isc, int *iec,
-                              int *jsc, int *jec, double *x, double *y, double *dx,
-                              double *dy, double *area, double *angle_dx )
-   generate spectral horizontal grid
-*******************************************************************************/
-void create_spectral_grid( int *nlon, int *nlat, int *isc, int *iec,
-			   int *jsc, int *jec, double *x, double *y, double *dx,
-			   double *dy, double *area, double *angle_dx )
-{
-  const int itermax = 10;
-  const double epsln = 1e-15;
-  int ni, nj, nx, ny, nxp, nyp, i, j, converge, iter;
-  double dlon, z, p1, p2, p3, z1, pp, a, b, c, d, sum_wts; 
-  double *xb, *yb, *lon, *lonb, *lat, *latb;
-  double *sin_hem, *wts_hem, *sin_lat, *wts_lat;
-  
-  nx = *nlon;
-  ny = *nlat;
-  nxp = nx + 1;
-  nyp = ny + 1;
-  ni = nx/2;
-  nj = ny/2;
-
-  xb = (double *) malloc(nxp*sizeof(double));
-  yb = (double *) malloc(nyp*sizeof(double));
-  lon     = (double *) malloc(ni    *sizeof(double));
-  lonb    = (double *) malloc((ni+1)*sizeof(double));
-  lat     = (double *) malloc(nj    *sizeof(double));
-  latb    = (double *) malloc((nj+1)*sizeof(double));
-  sin_hem = (double *) malloc(nj/2*sizeof(double));
-  wts_hem = (double *) malloc(nj/2*sizeof(double));
-  sin_lat = (double *) malloc(nj*sizeof(double));
-  wts_lat = (double *) malloc(nj*sizeof(double));
-  dlon = 360./ni;
-  for(i=0;i< ni;i++) lon[i] = i*dlon;
-  for(i=0;i<=ni;i++) lonb[i] = (i-0.5)*dlon;
-
-  for(j=0;j<nj/2;j++) {
-    converge = 0;
-    z = cos(M_PI*(j +0.75)/(nj + 0.5));
-    for(iter=1; iter<=itermax; i++){
-      p1 = 1.0;
-      p2 = 0.0;
-
-      for(i=1;i<=nj;i++) {
-        p3 = p2;
-        p2 = p1;
-        p1 = ((2.0*i - 1.0)*z*p2 - (i - 1.0)*p3)/i;
-      }
-
-      pp = nj*(z*p1 - p2)/(z*z - 1.0E+00);
-      z1 = z;
-      z  = z1 - p1/pp;
-      if(fabs(z - z1) < epsln ) {
-        converge = 1;
-	break;
-      }
-    }
-    if(! converge) mpp_error("create_spectral_grid: abscissas failed to converge "
-			     "in itermax iterations");
-    sin_hem [j]     = z;
-    wts_hem [j]     = 2.0/((1.0 - z*z)*pp*pp);
-  }
-
-  for(j=0;j<nj/2;j++) {
-    sin_lat[j]      = - sin_hem[j];
-    sin_lat[nj-1-j] =   sin_hem[j];
-    wts_lat[j]      =   wts_hem[j];
-    wts_lat[nj-1-j] =   wts_hem[j];
-  }
-
-  for(j=0;j<nj;j++){
-    lat[j]    = asin(sin_lat[j])*R2D;
-  }
-
-  latb[0] = -90.;
-  latb[nj] = 90.;
-  for(j=1;j<nj;j++) {
-    sum_wts = sum_wts + wts_lat[j-1];
-    latb[j] = asin(sum_wts-1.)*R2D;
-  }
-
-  for(i=0;i<=ni;i++) xb[i*2]   = lonb[i];
-  for(i=0;i<ni; i++) xb[i*2+1] = lon[i];
-  for(j=0;j<=nj;j++) yb[j*2]   = latb[j];
-  for(j=0;j<nj; j++) yb[j*2+1] = lat[j];
-
-  set_regular_lonlat_grid( nxp, nyp, *isc, *iec, *jsc, *jec, xb, yb, x, y, dx, dy, area, angle_dx );
-  free(xb);
-  free(yb);
-  free(lon);
-  free(lonb);
-  free(lat);
-  free(latb);
-  free(sin_hem);
-  free(wts_hem);
-  free(sin_lat);
-  free(wts_lat); 
-  
-}; /* create_spectral_grid */
-
-/*******************************************************************************
-   void set_regular_lonlat_grid( int nxp, int nyp, int isc, int iec, int jsc, int jec,
-                                 double *xb, double *yb, double *x, double *y,
-                                 double *dx, double *dy, double *area, double *angle )
-   set geographic grid location, calculate grid length, area and rotation angle
-   x and y are on global domain, the other fields are on compute domain 
-*******************************************************************************/
-void set_regular_lonlat_grid( int nxp, int nyp, int isc, int iec, int jsc, int jec, double *xb, double *yb,
-			      double *x, double *y, double *dx, double *dy, double *area, double *angle )
-{
-  int n, i, j;
-  
-  n = 0;
-  for(j=0; j<nyp; j++) {
-    for(i=0; i<nxp; i++) {
-      x[n]   = xb[i];
-      y[n++] = yb[j];
-    }
-  }
-  /* zonal length */
-  n = 0;
-  for(j=jsc; j<=jec+1; j++) {
-    for(i=isc; i<=iec; i++ ) {
-      dx[n++] = spherical_dist(x[j*nxp+i], y[j*nxp+i], x[j*nxp+i+1], y[j*nxp+i+1] );
-    }
-  }
-
-  /* meridinal length */
-  n = 0;
-  for(j=jsc; j<=jec; j++) {
-    for(i=isc; i<=iec+1; i++ ) {
-      dy[n++] = spherical_dist(x[j*nxp+i], y[j*nxp+i], x[(j+1)*nxp+i], y[(j+1)*nxp+i] );
-    }
-  }
-
-  /* cell area */
-  n = 0;
-  for(j=jsc; j<=jec; j++) {
-    for(i=isc; i<=iec; i++ ) {
-      area[n++] = box_area(x[j*nxp+i]*D2R, y[j*nxp+i]*D2R, x[(j+1)*nxp+i+1]*D2R, y[(j+1)*nxp+i+1]*D2R );
-    }
-  }
-
-  /* rotation angle */
-  n = 0;
-  for(j=jsc; j<=jec+1; j++) {
-    for(i=isc; i<=iec+1; i++ ) angle[n++] = 0;   
-  }
-
-};  /* set_regular_lonlat_grid */
-
-
-/*******************************************************************************
-   void create_tripolar_grid( int int nxbnds, int nybnds, double *xbnds, double *ybnds,
-                              int *nlon, int *nlat, double *lat_join_in, int *isc, int *iec,
-                              int *jsc, int *jec, double *x, double *y, double *dx, double *dy,
-			      double *area, double *angle_dx )
-   create tripolar grid infomrmation
-********************************************************************************/
-void create_tripolar_grid( int *nxbnds, int *nybnds, double *xbnds, double *ybnds,
-			   int *nlon, int *nlat, double *lat_join_in, int *isc, int *iec,
-			   int *jsc, int *jec, double *x, double *y, double *dx, double *dy,
-			   double *area, double *angle_dx, const char *center )
-{
-  int nxb, nyb, i, j, nx, ny, nxp, nyp, j_join, n, ip1, ii, n_count;
-  double lat_join, lon_start, lon_end, lon_bpeq, lon_bpnp, lon_bpsp;
-  double lam0, rp, lon_last, lon_scale;
-  double *xb, *yb;
-  double x_poly[20], y_poly[20];
-  
-  nxb = *nxbnds;
-  nyb = *nybnds;
-
-  xb = compute_grid_bound(nxb, xbnds, nlon, &nx, center), 
-  nxp = nx + 1;
-  
-  yb = compute_grid_bound(nyb, ybnds, nlat, &ny, center), 
-  nyp = ny + 1;
-
-  n = 0;
-  for(j=0; j<nyp; j++) {
-    for(i=0; i<nxp; i++) {
-      x[n] = xb[i];
-      y[n++] = yb[j];
-    }
-  }
-
-  lat_join = *lat_join_in;
-  j_join = nearest_index(lat_join, yb, nyp);
-  lat_join  = yb[j_join];
-  lon_start = xbnds[0];
-  lon_end   = xbnds[1];  
-  lon_bpeq = lon_start + 90. ;
-  lon_bpnp = lon_start;
-  lon_bpsp = lon_start+180.;
-  
-  if(*lat_join_in != lat_join) {
-    if(mpp_pe() == mpp_root_pe() )printf("NOTE: Change join latitude from %f to %f\n",*lat_join_in, lat_join);
-  }
-  /**********************************************************************
-     Transform from bipolar grid coordinates (bp_lon, bp_lat) to
-     geographic coordinates (geolon_t, geolat_t) following R. Murray,
-     "Explicit generation of orthogonal grids for ocean models",
-     1996, J.Comp.Phys., v. 126, p. 251-273.  All equation
-     numbers refer to the Murray paper.
-  **********************************************************************/
-
-  lam0 = fmod(lon_bpeq*D2R + 2*M_PI, 2*M_PI);
-  rp = tan((0.5*M_PI-lat_join*D2R)/2.);        /* eqn. 2 */
-
-  /*   calculate zonal length */
-  n = 0;
-  for(j=*jsc;j<=*jec+1;j++){
-    for(i=*isc;i<=*iec;i++){
-      if(j < j_join )  /* regular grid region */
-        dx[n++] = spherical_dist(x[j*nxp+i], y[j*nxp+i], x[j*nxp+i+1], y[j*nxp+i+1]);
-      else /*bipolar region */
-	dx[n++] = bipolar_dist(x[j*nxp+i], y[j*nxp+i], x[j*nxp+i+1], y[j*nxp+i+1], lon_bpeq, lon_bpsp, lon_bpnp, rp );
-    }
-  }
-  
-  /*   calculate meridinal length */
-  n = 0;
-  for(j=*jsc;j<=*jec;j++){
-    for(i=*isc;i<=*iec+1;i++){
-      if(j < j_join )  /* regular grid region */
-        dy[n++] = spherical_dist(x[j*nxp+i], y[j*nxp+i], x[(j+1)*nxp+i], y[(j+1)*nxp+i]);
-      else /*bipolar region */
-	dy[n++] = bipolar_dist(x[j*nxp+i], y[j*nxp+i], x[(j+1)*nxp+i], y[(j+1)*nxp+i], lon_bpeq, lon_bpsp, lon_bpnp, rp );
-    }
-  }
-  
-  /*define tripolar grid location */
-  for(j=j_join;j<nyp;j++) {
-    for(i=0;i<nxp;i++) {
-      lon_last = x[j*nxp+max(i-1,0)];
-      tp_trans(&(x[j*nxp+i]),&(y[j*nxp+i]),lon_last,lon_start, lam0, lon_bpeq, lon_bpsp, lon_bpnp, rp);
-    }
-  }
-
- /*calculte cell area */
-  n = 0;
-  for(j=*jsc;j<=*jec;j++){
-    for(i=*isc;i<=*iec;i++){
-      if(j < j_join) 
-	area[n++] = box_area(x[j*nxp+i]*D2R, y[j*nxp+i]*D2R, x[(j+1)*nxp+i+1]*D2R, y[(j+1)*nxp+i+1]*D2R);
-      else {
-	x_poly[0] = x[j*nxp+i]*D2R;       y_poly[0] = y[j*nxp+i]*D2R;
-	x_poly[1] = x[j*nxp+i+1]*D2R;     y_poly[1] = y[j*nxp+i+1]*D2R;
-	x_poly[2] = x[(j+1)*nxp+i+1]*D2R; y_poly[2] = y[(j+1)*nxp+i+1]*D2R;
-	x_poly[3] = x[(j+1)*nxp+i]*D2R;   y_poly[3] = y[(j+1)*nxp+i]*D2R;
-        n_count = fix_lon(x_poly, y_poly, 4, M_PI);
-	area[n++] = poly_area(x_poly, y_poly, n_count);
-      }
-    }
-  }  
-  
-  /*calculte rotation angle at cell vertex */
-  n = 0;
-  for(j=*jsc;j<=(*jec)+1;j++){
-    for(i=*isc;i<=(*iec)+1;i++){
-      if(j < j_join) 
-	angle_dx[n++] = 0.0;
-      else {
-	lon_scale = cos(y[j*nxp+i]*D2R);
-	if(i==0 || i == nx ) /* always at the boundary */
-	  angle_dx[n++] = 0;
-	else
-	  angle_dx[n++] = atan2(y[j*nxp+i+1]-y[j*nxp+i-1],(x[j*nxp+i+1]-x[j*nxp+i-1])*lon_scale)*R2D;
-      }
-    }
-  }
-  
-}; /* create_tripolar_grid */
-
-
diff --git a/gridspec/tools/shared/create_vgrid.c b/gridspec/tools/shared/create_vgrid.c
deleted file mode 100644
index 6e84402..0000000
--- a/gridspec/tools/shared/create_vgrid.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <stdlib.h>
-#include "create_vgrid.h"
-#include "tool_util.h"
-
-/***********************************************************************
-   void create_vgrid(int nbnds, double *bnds, int *nz, char center, double *zeta)
-   This routine is used to create vertical grid. The created grid is on super grid.
-   the refinement is assumed to be 2.
-
-   INPUT:
-      nbnds:  number of vertical regions for varying resolution.      
-      bnds:   boundaries for defining vertical regions of varying resolution.
-              The size of bnds is nz.
-      nz:     Number of model grid points for each vertical regions of varying resolution.
-              The size of nz will be nz-1
-      center: grid cell center location. Its value can be 'N', 'T' or 'C' with default
-              value 'N'. When the value is 'N', supergrid location will be calculated.
-              When the value is 'T', model grid corner location will be calculated,
-              other grid location of the supergrid will be derived through T-cell
-              centered condition. When the value is 'C', model grid corner location will
-              be calculated, other grid location of the supergrid will be derived through
-              C-cell centered condition.
-
-   OUTPUT:
-      zeta:   created vertical grid location.
-
-***********************************************************************/
-
-void create_vgrid(int nbnds, double *bnds, int *nz, double *zeta, const char *center)
-{
-  int i, np;
-  double *zb=NULL;
-
-  
-  zb = compute_grid_bound(nbnds, bnds, nz, &np, center);
-  np++;
-  
-  for(i=0; i<np; i++) zeta[i] =zb[i];
-
-  free(zb);
-    
-  
-}; /* create_vgrid */
diff --git a/gridspec/tools/shared/create_vgrid.h b/gridspec/tools/shared/create_vgrid.h
deleted file mode 100644
index 679f7d4..0000000
--- a/gridspec/tools/shared/create_vgrid.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/***********************************************************************
-                       creater_vgrid.h
-    This header file contains interface to create vertical grid on supergrid. 
-    refinement =2 is assumed in this routine.
-    contact: Zhi.Liang at noaa.gov
-************************************************************************/
-
-#ifndef CREATE_VGRID_H_
-#define CREATE_VGRID_H_
-void create_vgrid(int nbnds, double *bnds, int *nz, double *zeta, const char *center);
-#endif
diff --git a/gridspec/tools/shared/fregrid_util.c b/gridspec/tools/shared/fregrid_util.c
deleted file mode 100644
index f17b5ca..0000000
--- a/gridspec/tools/shared/fregrid_util.c
+++ /dev/null
@@ -1,1785 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include "fregrid_util.h"
-#include "mpp.h"
-#include "mpp_io.h"
-#include "tool_util.h"
-#include "mosaic_util.h"
-#include "read_mosaic.h"
-#include "gradient_c2l.h"
-#include "globals.h"
-
-#define D2R (M_PI/180)
-#define R2D (180/M_PI)
-#define EPSLN (1.e-10)
-void init_halo(double *var, int nx, int ny, int nz, int halo);
-void update_halo(int nx, int ny, int nz, double *data, Bound_config *bound, Data_holder *dHold);
-void setup_boundary(const char *mosaic_file, int ntiles, Grid_config *grid, Bound_config *bound, int halo, int position);
-void delete_bound_memory(int ntiles, Bound_config *bound);
-void copy_var_config(const Var_config *var_in, Var_config *var_out);
-void init_var_config(Var_config *var, int interp_method);
-/*******************************************************************************
-  void setup_tile_data_file(Mosaic_config mosaic, const char *filename)
-  This routine will setup the data file name for each tile.
-*******************************************************************************/
-
-void set_mosaic_data_file(int ntiles, const char *mosaic_file, const char *dir, File_config *file,
-			  const char *filename)
-{
-  char   str1[STRING]="", str2[STRING]="", tilename[STRING]="";
-  char   gridfile[STRING], gridpath[STRING], griddir[STRING];
-  int    i, len, fid, vid, gid, g_fid;
-  size_t start[4], nread[4];
-
-  len = strlen(filename); 
-  if( strstr(filename, ".nc") ) 
-    strncpy(str1, filename, len-3);
-  else
-    strcpy(str1, filename);
-  if(dir) {
-    if(strlen(dir)+strlen(str1) >= STRING)mpp_error("set_mosaic_data_file(fregrid_util): length of str1 + "
-						    "length of dir should be no greater than STRING");
-    sprintf(str2, "%s/%s", dir, str1);
-  }
-  else
-    strcpy(str2, str1);
-  
-  for(i=0; i<4; i++) {
-    start[i] = 0; nread[i] = 1;
-  }
-  nread[1] = STRING;
-  if(ntiles > 1) {
-    if(!mosaic_file) mpp_error("fregrid_util: when ntiles is greater than 1, mosaic_file should be defined");
-    get_file_path(mosaic_file, griddir);
-    fid = mpp_open(mosaic_file, MPP_READ);
-    gid = mpp_get_varid(fid, TILE_FILES_NAME);
-    for(i = 0; i < ntiles; i++) {
-      start[0] = i; start[1] = 0; nread[0] = 1; nread[1] = STRING;
-      mpp_get_var_value_block(fid, gid, start, nread, gridfile);
-      sprintf(gridpath, "%s/%s", griddir, gridfile);
-      g_fid = mpp_open(gridpath, MPP_READ);
-      vid   = mpp_get_varid(g_fid, TILE_NAME);
-      mpp_get_var_value(g_fid, vid, tilename);
-      mpp_close(g_fid);
-      if(strlen(str2) + strlen(tilename) > STRING -5) mpp_error("set_mosaic_data_file(fregrid_util): length of str2 + "
-								"length of tilename should be no greater than STRING-5");
-      sprintf(file[i].name, "%s.%s.nc", str2, tilename);
-    }
-    mpp_close(fid);
-  }
-  else {
-    for(i = 0; i < ntiles; i++) sprintf(file[i].name, "%s.nc", str2);
-  }
-
-}; /* setup_data_file */
-
-/*******************************************************************************
-  void set_scalar_var()
-*******************************************************************************/
-void set_field_struct(int ntiles, Field_config *field, int nvar, char * varname, File_config *file)
-{
-  int  n, i;
-  
-  if(nvar == 0) return;
- 
-  for(n=0; n<ntiles; n++) {
-    field[n].file = file[n].name;
-    field[n].fid = &(file[n].fid);
-    field[n].nvar = nvar;
-    field[n].var = (Var_config *)malloc(nvar*sizeof(Var_config)); 
-    for(i=0; i<nvar; i++) 
-      strcpy(field[n].var[i].name, varname+i*STRING);
-  }
-
-}; /* set_field_var */
-
-
-/*******************************************************************************
-  void get_mosaic_grid()
-
-*******************************************************************************/
-void get_input_grid(int ntiles, Grid_config *grid, Bound_config *bound_T, const char *mosaic_file, unsigned int opcode)
-{
-  int         n, m1, m2, i, j, l, ind1, ind2, nlon, nlat;
-  int         ts, tw, tn, te, halo, nbound;
-  int         m_fid, g_fid, vid;
-  int         *nx, *ny;
-  double      *x, *y;
-  char         grid_file[256], filename[256], dir[256];
-  size_t        start[4], nread[4];
-  Data_holder *dHold;
-  Bound_config *bound_C;
-  
-  halo = 0;
-  if(opcode & BILINEAR) halo = 1;
-  for(n=0; n<4; n++) {
-    start[n] = 0; nread[n] = 1;
-  }
-
-  bound_C = (Bound_config *)malloc(ntiles*sizeof(Bound_config));
-  nx = (int *)malloc(ntiles * sizeof(int) );
-  ny = (int *)malloc(ntiles * sizeof(int) );
-
-  m_fid = mpp_open(mosaic_file, MPP_READ);
-  get_file_path(mosaic_file, dir);
-  for(n=0; n<ntiles; n++) {
-    start[0] = n; start[1] = 0; nread[0] = 1; nread[1] = STRING;
-    vid = mpp_get_varid(m_fid, TILE_FILES_NAME);
-    mpp_get_var_value_block(m_fid, vid, start, nread, filename);
-    sprintf(grid_file, "%s/%s", dir, filename);
-    g_fid = mpp_open(grid_file, MPP_READ);
-    
-    nx[n] = mpp_get_dimlen(g_fid, "nx");
-    ny[n] = mpp_get_dimlen(g_fid, "ny");
-    if(nx[n]%2) mpp_error("fregrid_util(get_input_grid): the size of dimension nx should be even (on supergrid)");
-    if(ny[n]%2) mpp_error("fregrid_util(get_input_grid): the size of dimension ny should be even (on supergrid)");
-    nx[n] /= 2;
-    ny[n] /= 2;
-    grid[n].halo = halo;
-    grid[n].nx   = nx[n];
-    grid[n].ny   = ny[n];
-    grid[n].nxc  = nx[n];
-    grid[n].nyc  = ny[n];
-    
-    /* get supergrid */
-    x = (double *)malloc((2*nx[n]+1)*(2*ny[n]+1)*sizeof(double));
-    y = (double *)malloc((2*nx[n]+1)*(2*ny[n]+1)*sizeof(double));
-
-    vid = mpp_get_varid(g_fid, "x");
-    mpp_get_var_value(g_fid, vid, x);
-    vid = mpp_get_varid(g_fid, "y");
-    mpp_get_var_value(g_fid, vid, y);
-    grid[n].lont = (double *) malloc((nx[n]+2)*(ny[n]+2)*sizeof(double));
-    grid[n].latt = (double *) malloc((nx[n]+2)*(ny[n]+2)*sizeof(double));
-    grid[n].lonc = (double *) malloc((nx[n]+1+2*halo)*(ny[n]+1+2*halo)*sizeof(double));
-    grid[n].latc = (double *) malloc((nx[n]+1+2*halo)*(ny[n]+1+2*halo)*sizeof(double));
-    if(halo>0) {
-      init_halo(grid[n].lonc, nx[n]+1, ny[n]+1, 1, halo);
-      init_halo(grid[n].latc, nx[n]+1, ny[n]+1, 1, halo);
-    }
-    for(j=0; j<=ny[n]; j++) for(i=0; i<=nx[n]; i++) {
-      ind1 = (j+halo)*(nx[n]+1+2*halo)+i+halo;
-      ind2 = 2*j*(2*nx[n]+1)+2*i;
-      grid[n].lonc[ind1] = x[ind2]*D2R;
-      grid[n].latc[ind1] = y[ind2]*D2R;
-    }
-    for(j=0; j<ny[n]; j++) for(i=0; i<nx[n]; i++) {
-      ind1 = (j+1)*(nx[n]+2)+i+1;
-      ind2 = (2*j+1)*(2*nx[n]+1)+2*i+1;
-      grid[n].lont[ind1] = x[ind2]*D2R;
-      grid[n].latt[ind1] = y[ind2]*D2R;
-    }
-    init_halo(grid[n].lont, nx[n], ny[n], 1, 1);
-    init_halo(grid[n].latt, nx[n], ny[n], 1, 1);
-    
-    if(opcode & CONSERVE_ORDER2 || opcode & BILINEAR ) {
-      grid[n].vlon_t = (double *) malloc(3*(nx[n]+2*halo)*(ny[n]+2*halo)*sizeof(double));
-      grid[n].vlat_t = (double *) malloc(3*(nx[n]+2*halo)*(ny[n]+2*halo)*sizeof(double));
-      grid[n].xt     = (double *) malloc((nx[n]+2)*(ny[n]+2)*sizeof(double));
-      grid[n].yt     = (double *) malloc((nx[n]+2)*(ny[n]+2)*sizeof(double));
-      grid[n].zt     = (double *) malloc((nx[n]+2)*(ny[n]+2)*sizeof(double));
-    }
-    /* if vector, need to get rotation angle */
-    /* we assume the grid is orthogonal */
-    if( opcode & VECTOR ) {
-      if( opcode & AGRID) {
-	double *angle;
-      	angle          = (double *) malloc((2*nx[n]+1)*(2*ny[n]+1)*sizeof(double));
-	grid[n].cosrot = (double *) malloc(nx[n]*ny[n]*sizeof(double));	 
-	grid[n].sinrot = (double *) malloc(nx[n]*ny[n]*sizeof(double));
-	vid = mpp_get_varid(g_fid, "angle_dx");
-	mpp_get_var_value(g_fid, vid, angle);
-	grid[n].rotate = 0;
-	for(j=0; j<ny[n]; j++) for(i=0; i<nx[n]; i++) {
-          m1 = j*nx[n]+i;
-	  m2 = (2*j+2)*(2*nx[n]+2)+2*i+2;
-	  grid[n].cosrot[m1] = cos(angle[m2]*D2R);
-	  grid[n].sinrot[m1] = sin(angle[m2]*D2R);
-	  if(fabs(grid[n].sinrot[m1]) > EPSLN) grid[n].rotate = 1;
-	}
-	free(angle);
-      }
-    }
-    free(x);
-    free(y);
-    mpp_close(g_fid);
-  }
-
-  mpp_close(m_fid);
-  
-  /* get the boundary condition */
-  setup_boundary(mosaic_file, ntiles, grid, bound_T, 1, CENTER);
-  if(opcode & BILINEAR)
-    setup_boundary(mosaic_file, ntiles, grid, bound_C, 1, CORNER);
-
-  for(n=0; n<ntiles; n++) {
-    nlon = grid[n].nx;
-    nlat = grid[n].ny;
-    nbound = bound_T[n].nbound;
-    if(nbound > 0 ) {
-      dHold = (Data_holder *)malloc(nbound*sizeof(Data_holder));
-      for(l=0; l<nbound; l++) {
-	dHold[l].data = grid[bound_T[n].tile2[l]].lont;
-	dHold[l].nx = grid[bound_T[n].tile2[l]].nx+2;
-	dHold[l].ny = grid[bound_T[n].tile2[l]].ny+2;
-      }
-      update_halo(nlon+2, nlat+2, 1, grid[n].lont, &(bound_T[n]), dHold );
-      for(l=0; l<nbound; l++) dHold[l].data = grid[bound_T[n].tile2[l]].latt;
-      update_halo(nlon+2, nlat+2, 1, grid[n].latt, &(bound_T[n]), dHold );
-	
-      for(l=0; l<nbound; l++) dHold[l].data = NULL;
-      free(dHold);
-    }
-  }
-  
-  if(opcode & BILINEAR) {
-
-  }
-  
-  /* for bilinear interpolation, need to get cell-center grid */
-  if(opcode & BILINEAR) {
-    /*--- fill the halo of corner cell */
-    for(n=0; n<ntiles; n++) {
-      nlon = grid[n].nx;
-      nlat = grid[n].ny;
-      latlon2xyz((nlon+2)*(nlat+2), grid[n].lont, grid[n].latt, grid[n].xt, grid[n].yt, grid[n].zt);
-      unit_vect_latlon((nlon+2)*(nlat+2), grid[n].lont, grid[n].latt, grid[n].vlon_t, grid[n].vlat_t);
-      nbound = bound_C[n].nbound;
-      if(nbound > 0) {
-	dHold = (Data_holder *)malloc(nbound*sizeof(Data_holder));
-	for(l=0; l<nbound; l++) {
-	  dHold[l].data = grid[bound_C[n].tile2[l]].lonc;
-	  dHold[l].nx   = grid[bound_C[n].tile2[l]].nx + 1 + 2*halo;
-	  dHold[l].ny   = grid[bound_C[n].tile2[l]].ny + 1 + 2*halo;
-	}
-	update_halo(nlon+1+2*halo, nlat+1+2*halo, 1, grid[n].lonc, &(bound_C[n]), dHold);
-	for(l=0; l<nbound; l++) dHold[l].data = grid[bound_C[n].tile2[l]].latc;
-	
-	update_halo(nlon+1+2*halo, nlat+1+2*halo, 1, grid[n].latc, &(bound_C[n]), dHold);
-	for(l=0; l<nbound; l++) dHold[l].data = NULL;
-	free(dHold);
-      }
-    }
-  }
-  else if(opcode & CONSERVE_ORDER2) {
-    double p1[3], p2[3], p3[3], p4[3];
-    
-    for(n=0; n<ntiles; n++) {
-      int is_true = 1;
-      nlon = grid[n].nx;
-      nlat = grid[n].ny;
-      /* calculate dx, dy, area */
-      grid[n].dx     = (double *)malloc(nlon    *(nlat+1)*sizeof(double));
-      grid[n].dy     = (double *)malloc((nlon+1)*nlat    *sizeof(double));
-      grid[n].area   = (double *)malloc(nlon    *nlat    *sizeof(double));
-      grid[n].edge_w = (double *)malloc(         (nlat+1)*sizeof(double));
-      grid[n].edge_e = (double *)malloc(         (nlat+1)*sizeof(double));
-      grid[n].edge_s = (double *)malloc((nlon+1)         *sizeof(double));
-      grid[n].edge_n = (double *)malloc((nlon+1)         *sizeof(double));
-      grid[n].en_n   = (double *)malloc(3*nlon  *(nlat+1)*sizeof(double));
-      grid[n].en_e   = (double *)malloc(3*(nlon+1)*nlat  *sizeof(double));
-      calc_c2l_grid_info(&nlon, &nlat, grid[n].lont, grid[n].latt, grid[n].lonc, grid[n].latc,
-			 grid[n].dx, grid[n].dy, grid[n].area, grid[n].edge_w, grid[n].edge_e,
-			 grid[n].edge_s, grid[n].edge_n, grid[n].en_n, grid[n].en_e,
-			 grid[n].vlon_t, grid[n].vlat_t, &is_true, &is_true, &is_true, &is_true);
-    }
-  }
-
-  if(opcode & BILINEAR) delete_bound_memory(ntiles, bound_C);
-  free(bound_C);
-  free(nx);
-  free(ny);
-}; /* get_input_grid */ 
-
-/*******************************************************************************
-  void get_output_grid_from_mosaic(Mosaic_config *mosaic)
-
-*******************************************************************************/
-void get_output_grid_from_mosaic(int ntiles, Grid_config *grid, const char *mosaic_file, unsigned int opcode)
-{
-  int         n, i, j, ii, jj, npes, layout[2];
-  int         m_fid, g_fid, vid;
-  int         *nx, *ny;
-  double      *x, *y;
-  size_t        start[4], nread[4];
-  char         grid_file[256], filename[256], dir[256];
-  
-  if(opcode & BILINEAR) mpp_error("fregrid_util: for bilinear interpolation, output grid can not got from mosaic file");
-  
-  npes   = mpp_npes();
-  nx = (int *)malloc(ntiles * sizeof(int) );
-  ny = (int *)malloc(ntiles * sizeof(int) );
-
-  for(n=0; n<4; n++) {
-    start[n] = 0;
-    nread[n] = 1;
-  }
-  m_fid = mpp_open(mosaic_file, MPP_READ);
-  get_file_path(mosaic_file, dir);
-  
-  for(n=0; n<ntiles; n++) {
-    start[0] = n; start[1] = 0; nread[0] = 1; nread[1] = STRING;
-    vid = mpp_get_varid(m_fid, TILE_FILES_NAME);
-    mpp_get_var_value_block(m_fid, vid, start, nread, filename);
-    sprintf(grid_file, "%s/%s", dir, filename);
-    g_fid = mpp_open(grid_file, MPP_READ);
-    nx[n] = mpp_get_dimlen(g_fid, "nx");
-    ny[n] = mpp_get_dimlen(g_fid, "ny");
-    if(nx[n]%2) mpp_error("fregrid_util(get_output_grid_from_mosaic): the size of dimension nx should be even (on supergrid)");
-    if(ny[n]%2) mpp_error("fregrid_util(get_output_grid_from_mosaic): the size of dimension ny should be even (on supergrid)");
-    nx[n] /= 2;
-    ny[n] /= 2;
-    grid[n].nx = nx[n];
-    grid[n].ny = ny[n];
-    /* to be able to reprocessor count, layout need to be set as follwoing */
-    layout[0] = 1;
-    layout[1] = npes;
-    mpp_define_domain2d(grid[n].nx, grid[n].ny, layout, 0, 0, &(grid[n].domain));
-    mpp_get_compute_domain2d(grid[n].domain, &(grid[n].isc), &(grid[n].iec), &(grid[n].jsc), &(grid[n].jec));
-    grid[n].nxc = grid[n].iec - grid[n].isc + 1;
-    grid[n].nyc = grid[n].jec - grid[n].jsc + 1;
-
-    grid[n].lonc  = (double *) malloc((grid[n].nxc+1)*(grid[n].nyc+1)*sizeof(double));
-    grid[n].latc  = (double *) malloc((grid[n].nxc+1)*(grid[n].nyc+1)*sizeof(double));
-    
-    grid[n].lont1D = (double *) malloc(nx[n]*sizeof(double));
-    grid[n].latt1D = (double *) malloc(ny[n]*sizeof(double));
-    grid[n].lonc1D = (double *) malloc((nx[n]+1)*sizeof(double));
-    grid[n].latc1D = (double *) malloc((ny[n]+1)*sizeof(double));
-    x = (double *) malloc((2*nx[n]+1)*(2*ny[n]+1)*sizeof(double));
-    y = (double *) malloc((2*nx[n]+1)*(2*ny[n]+1)*sizeof(double));
-    vid = mpp_get_varid(g_fid, "x");
-    mpp_get_var_value(g_fid, vid, x);
-    vid = mpp_get_varid(g_fid, "y");
-    mpp_get_var_value(g_fid, vid, y);
-    for(j=0; j<=grid[n].nyc; j++) for(i=0; i<=grid[n].nxc; i++) {
-      jj = 2*(j + grid[n].jsc);
-      ii = 2*(i + grid[n].isc);
-      grid[n].lonc[j*(grid[n].nxc+1)+i] = x[jj*(2*nx[n]+1)+ii] * D2R;
-      grid[n].latc[j*(grid[n].nxc+1)+i] = y[jj*(2*nx[n]+1)+ii] * D2R;
-    }
-    for(i=0; i<nx[n]+1; i++) grid[n].lonc1D[i] = x[2*i] * D2R;
-    for(j=0; j<ny[n]+1; j++) grid[n].latc1D[j] = y[2*j*(2*nx[n]+1)] * D2R;
-
-    for(i=0; i<nx[n]; i++) grid[n].lont1D[i] = x[2*nx[n]+1+2*i+1] * D2R;
-    for(j=0; j<ny[n]; j++) grid[n].latt1D[j] = y[(2*j+1)*(2*nx[n]+1) + 1] * D2R;
-    free(x);
-    free(y);
-      
-    /* if vector, need to get rotation angle */
-    /* we assume the grid is orthogonal */
-    if(opcode & VECTOR) {
-      if(opcode & AGRID) {
-	double *angle; 
-	angle          = (double *) malloc((2*nx[n]+1)*(2*ny[n]+1)*sizeof(double));
-	grid[n].cosrot = (double *) malloc(nx[n]*ny[n]*sizeof(double));	 
-	grid[n].sinrot = (double *) malloc(nx[n]*ny[n]*sizeof(double));
-	vid = mpp_get_varid(g_fid, "angle_dx");
-	mpp_get_var_value(g_fid, vid, angle);
-	grid[n].rotate = 0;
-	for(j=0; j<grid[n].nyc; j++) for(i=0; i<grid[n].nxc; i++) {
-	  jj = 2*(j + grid[n].jsc);
-	  ii = 2*(i + grid[n].isc);
-	  grid[n].cosrot[j*grid[n].nxc+i] = cos(angle[jj*(2*nx[n]+1)+ii]*D2R);
-	  grid[n].sinrot[j*grid[n].nxc+i] = sin(angle[jj*(2*nx[n]+1)+ii]*D2R);
-	  if(fabs(grid[n].sinrot[j*grid[n].nxc+i]) > EPSLN) grid[n].rotate = 1;
-	}
-	free(angle);
-      }
-    }
-    mpp_close(g_fid);
-  }
-
-  mpp_close(m_fid);
-  
-  free(nx);
-  free(ny);
-}; /* get_output_grid_from_mosaic*/ 
-
-/*******************************************************************************
-  void get_output_grid_by_size(Mosaic_config *mosaic, int nlon, int nlat, int finer_steps, unsigned int opcode)
-  calculate output grid based on nlon, nlat and finer steps.
-
-*******************************************************************************/
-void get_output_grid_by_size(int ntiles, Grid_config *grid, double lonbegin, double lonend, double latbegin, double latend,
-			     int nlon, int nlat, int finer_steps, int center_y, unsigned int opcode)
-{
-  double      dlon, dlat, lon_fine, lat_fine, lon_range, lat_range;
-  int         nx_fine, ny_fine, i, j, layout[2];
-  int nxc, nyc, ii, jj;
-  
-  if(ntiles !=1) mpp_error("fregrid_utils: ntiles of output mosaic must be 1 for bilinear interpolation");
-  if(finer_steps && !(opcode&BILINEAR)) mpp_error("fregrid_util: finer_steps must be 0 when interp_method is not bilinear");
-  
-  grid->nx      = nlon;
-  grid->ny      = nlat;
-  grid->nx_fine = pow(2,finer_steps)*nlon;
-  grid->ny_fine = pow(2,finer_steps)*(nlat-1)+1;
-  nx_fine       = grid->nx_fine;
-  ny_fine       = grid->ny_fine;
-  lon_range     = lonend - lonbegin;
-  lat_range     = latend - latbegin;
-
-  grid->lont1D = (double *)malloc(nlon*sizeof(double));
-  grid->latt1D = (double *)malloc(nlat*sizeof(double));
-  grid->lonc1D = (double *)malloc((nlon+1)*sizeof(double));
-  grid->latc1D = (double *)malloc((nlat+1)*sizeof(double));
-
-  dlon=lon_range/nlon;
-  for(i=0; i<nlon; i++) grid->lont1D[i]  = (lonbegin + (i + 0.5)*dlon)*D2R;
-  for(i=0; i<=nlon; i++) grid->lonc1D[i] = (lonbegin + i*dlon)*D2R;
-
-  layout[0] = 1;
-  layout[1] = mpp_npes();
-  mpp_define_domain2d(grid->nx, grid->ny, layout, 0, 0, &(grid->domain));
-  mpp_get_compute_domain2d(grid->domain, &(grid->isc), &(grid->iec), &(grid->jsc), &(grid->jec));
-  grid->nxc = grid->iec - grid->isc + 1;
-  grid->nyc = grid->jec - grid->jsc + 1;
-  nxc       = grid->nxc;
-  nyc       = grid->nyc;
-  if(center_y) {
-    dlat=lat_range/nlat;
-    for(j=0; j<nlat; j++) grid->latt1D[j] = (latbegin+(j+0.5)*dlat)*D2R;
-    for(j=0; j<=nlat; j++) grid->latc1D[j] = (latbegin+j*dlat)*D2R;
-  }
-  else {
-    dlat=lat_range/(nlat-1);
-    for(j=0; j<nlat; j++) grid->latt1D[j] = (latbegin+j*dlat)*D2R;
-    for(j=0; j<=nlat; j++) grid->latc1D[j] = (latbegin+(j-0.5)*dlat)*D2R;
-  }
-  
-  if(opcode & BILINEAR) {
-    grid->latt1D_fine = (double *)malloc(ny_fine*sizeof(double));
-    grid->lont   = (double *)malloc(nx_fine*ny_fine*sizeof(double));
-    grid->latt   = (double *)malloc(nx_fine*ny_fine*sizeof(double));
-    grid->xt     = (double *)malloc(nx_fine*ny_fine*sizeof(double));
-    grid->yt     = (double *)malloc(nx_fine*ny_fine*sizeof(double));  
-    grid->zt     = (double *)malloc(nx_fine*ny_fine*sizeof(double));  
-    grid->vlon_t = (double *)malloc(3*nx_fine*ny_fine*sizeof(double));
-    grid->vlat_t = (double *)malloc(3*nx_fine*ny_fine*sizeof(double));  
-
-    dlon = lon_range/nx_fine;
-    for(i=0; i<nx_fine; i++) {
-      lon_fine = (lonbegin + (i + 0.5)*dlon)*D2R;
-      for(j=0; j<ny_fine; j++) grid->lont[j*nx_fine+i] = lon_fine;
-    }
-    if(center_y) {
-      dlat=lat_range/ny_fine;
-      for(j=0; j<ny_fine; j++)grid->latt1D_fine[j] = (latbegin+(j+0.5)*dlat)*D2R;
-    }
-    else {
-      dlat = lat_range/(ny_fine-1);
-      for(j=0; j<ny_fine; j++) grid->latt1D_fine[j] = (latbegin+j*dlat)*D2R;
-     
-    }
-    for(j=0; j<ny_fine; j++) for(i=0; i<nx_fine; i++) {
-      grid->latt[j*nx_fine+i] = grid->latt1D_fine[j];
-    }
-    /* get the cartesian coordinates */  
-    latlon2xyz(nx_fine*ny_fine, grid->lont, grid->latt, grid->xt, grid->yt, grid->zt);
-
-    unit_vect_latlon(nx_fine*ny_fine, grid->lont, grid->latt, grid->vlon_t, grid->vlat_t);
-  
-  }
-  else { /* for conservative interpolation */
-
-    grid->lonc  = (double *) malloc((nxc+1)*(nyc+1)*sizeof(double));
-    grid->latc  = (double *) malloc((nxc+1)*(nyc+1)*sizeof(double));
-    for(j=0; j<=nyc; j++) {
-      jj = j + grid->jsc;
-      for(i=0; i<=nxc; i++) {
-	ii = i + grid->isc;
-	grid->lonc[j*(nxc+1)+i] = grid->lonc1D[ii];
-	grid->latc[j*(nxc+1)+i] = grid->latc1D[jj];
-      }
-    }
-    if(opcode & VECTOR) { /* no rotation is needed for regular lat-lon grid. */
-      grid->rotate = 0;
-    }
-  }
-  
-}; /* get_output_grid_by_size */
-
-
-/*******************************************************************************
-void init_var_config(Var_config *var)
-*******************************************************************************/
-void init_var_config(Var_config *var, int interp_method)
-{
-  var->nz            = 1;
-  var->nn            = 1;
-  var->has_naxis     = 0;
-  var->has_zaxis     = 0;
-  var->has_taxis     = 0;  
-  var->kstart        = 0;
-  var->kend          = 0;
-  var->lstart        = 0;
-  var->lend          = 0;
-  var->ndim          = 0;
-  var->interp_method = interp_method;
-  
-}
-
-/*******************************************************************************
-void copy_var_config(Var_config *var)
-*******************************************************************************/
-void copy_var_config(const Var_config *var_in, Var_config *var_out)
-{
-  int i;
-  
-  var_out->nz            = var_in->nz;
-  var_out->nn            = var_in->nn;
-  var_out->has_naxis     = var_in->has_naxis;
-  var_out->has_zaxis     = var_in->has_zaxis;
-  var_out->has_taxis     = var_in->has_taxis;
-  var_out->kstart        = var_in->kstart;
-  var_out->kend          = var_in->kend ;
-  var_out->lstart        = var_in->lstart;
-  var_out->lend          = var_in->lend;
-  var_out->ndim          = var_in->ndim;
-  var_out->interp_method = var_in->interp_method;
-  for(i=0; i<var_in->ndim; i++) var_out->index[i] = var_in->index[i];
-}
-  
-
-/*******************************************************************************
-  void get_input_metadata(Mosaic_config, *mosaic)
-*******************************************************************************/
-void get_input_metadata(int ntiles, int nfiles, File_config *file1, File_config *file2,
-		        Field_config *scalar, Field_config *u_comp, Field_config *v_comp,
-			const Grid_config *grid, int kbegin, int kend, int lbegin, int lend,
-			unsigned int opcode)
-{
-  int     n, m, i, l, ll, nscalar, nvector, nfield;
-  int     ndim, dimsize[4], nz;
-  nc_type type[5];
-  char    cart[5];
-  char    dimname[5][STRING], bndname[5][STRING], errmsg[STRING];
-  File_config  *file  = NULL;
-  Field_config *field = NULL;
-  size_t start[4], nread[4];
-  int interp_method, use_bilinear, use_conserve;
-  char    remap_method[STRING];
-  
-  use_bilinear = 0;
-  use_conserve = 0;
-  if(opcode & CONSERVE_ORDER1) {
-    use_conserve = 1;
-    interp_method = CONSERVE_ORDER1;
-  }
-  else if(opcode & CONSERVE_ORDER2) {
-    use_conserve = 1;
-    interp_method = CONSERVE_ORDER2;
-  }
-  else if(opcode & BILINEAR) {
-    use_bilinear = 1;
-    interp_method = BILINEAR;
-  }
-    
-  /* First find out how many fields in file and file2. */
-  nscalar = 0;
-  nvector = 0;
-  if( scalar) nscalar = scalar->nvar;
-  if( u_comp) nvector = u_comp->nvar;
-
-  for(n=0; n<4; n++) {
-    start[n] = 0; nread[n] = 1;
-  }
-  
-  for(m=0; m<nfiles; m++) {
-    file = m==0? file1:file2;  
-    for(n=0; n<ntiles; n++) {
-      file[n].nt        = 1;
-      file[n].axis      = (Axis_config *)malloc(MAXDIM*sizeof(Axis_config));
-      file[n].ndim      = 0;
-      file[n].has_tavg_info = 0;
-    }
-  }
-             
-  for(l=0; l<nscalar; l++) for(n=0; n<ntiles; n++) {
-    init_var_config(scalar[n].var+l, interp_method);
-  }
-    
-  for(l=0; l<nvector; l++) for(n=0; n<ntiles; n++) {
-    init_var_config(u_comp[n].var+l, interp_method);
-    init_var_config(v_comp[n].var+l, interp_method);
-  }
-  
-  nfield = (nfiles == 1)? (nscalar+2*nvector):nvector;  /* when nfiles = 2, no scalar */
-  
-  for(m=0; m<nfiles; m++) {
-    file = m==0? file1:file2;
-    for(n=0; n<ntiles; n++) {
-      for(l=0; l<nfield; l++) {
-	if(nfiles == 1) {
-	  if(l<nscalar) {
-	    field = scalar;
-	    ll = l;
-	  }
-	  else if(l<nscalar + nvector) {
-	    field = u_comp;
-	    ll = l - nscalar;
-	  }
-	  else {
-	    field = v_comp;
-	    ll = l - nscalar - nvector;
-	  }
-	}
-	else {
-	  ll = l;
-	  field = (m==0)?u_comp:v_comp;
-	}
-
-      	field[n].var[ll].vid = mpp_get_varid(file[n].fid, field[n].var[ll].name);
-	field[n].var[ll].type  = mpp_get_var_type(file[n].fid, field[n].var[ll].vid);
-	if(field[n].var[ll].type != NC_SHORT && field[n].var[ll].type != NC_INT &&
-	   field[n].var[ll].type != NC_FLOAT && field[n].var[ll].type != NC_DOUBLE ) {
-	  sprintf(errmsg, "fregrid_util(get_input_metadata): field %s in file %s has an invalid type, "
-		  "the type should be NC_DOUBLE, NC_FLOAT, NC_INT or NC_SHORT", field[n].var[ll].name, file[n].name );
-	  mpp_error(errmsg);
-	}
-        /* check if time_avg_info attribute existed in any variables */
-	if(!file[n].has_tavg_info) {
-	  if(mpp_var_att_exist(file[n].fid, field[n].var[ll].vid, "time_avg_info") ) file[n].has_tavg_info = 1;
-	}
-	/* get the interp_method from the field attribute if existing */
-	if(mpp_var_att_exist(file[n].fid, field[n].var[ll].vid, "interp_method")) {
-	  mpp_get_var_att(file[n].fid, field[n].var[ll].vid, "interp_method", remap_method);
-	  if(!strcmp(remap_method, "conserve_order1") ) {
-	    use_conserve = 1;
-	    field[n].var[ll].interp_method = CONSERVE_ORDER1;
-	  }
-	  else if(!strcmp(remap_method, "conserve_order2") ) {
-	    use_conserve = 1;
-	    field[n].var[ll].interp_method = CONSERVE_ORDER2;
-	  }
-	  else if(!strcmp(remap_method, "bilinear") ) {
-	    use_bilinear = 1;
-	    field[n].var[ll].interp_method = BILINEAR;
-	  }
-	  else {
-	    sprintf(errmsg, "get_input_metadata(fregrid_util.c): in file %s, attribute interp_method of field %s has value = %s"
-		    "is not suitable, it should be conserve_order1, conserve_order2 or bilinear", file[n].name,
-		    field[n].var[ll].name, remap_method);
-      	    mpp_error(errmsg);
-	  }
-	}
-	
-	ndim = mpp_get_var_ndim(file[n].fid, field[n].var[ll].vid);
-	if(ndim <2 || ndim>5) mpp_error("get_input_metadata(fregrid_util.c): ndim should be no less than 2 and no larger than 5");	
-	for(i=0; i<ndim; i++) {
-	  int vid;
-          mpp_get_var_dimname(file[n].fid, field[n].var[ll].vid, i, dimname[i]);
-	  dimsize[i] = mpp_get_dimlen(file[n].fid, dimname[i]);
-	  vid = mpp_get_varid(file[n].fid, dimname[i]);
-	  cart[i] = mpp_get_var_cart(file[n].fid, vid);
-	  type[i] = mpp_get_var_type(file[n].fid, vid);
-	  mpp_get_var_bndname(file[n].fid, vid, bndname[i]);
-      	}
-	field[n].var[ll].ndim = ndim;
-	if(cart[ndim-1] != 'X') mpp_error("get_input_metadata(fregrid_util.c): the last dimension cartesian should be 'X'");
-	if(cart[ndim-2] != 'Y') mpp_error("get_input_metadata(fregrid_util.c): the second last dimension cartesian should be 'Y'");
-	if(dimsize[ndim-1] != grid[n].nx) mpp_error("get_input_metadata(fregrid_util.c): x-size in grid file in not the same as in data file");
-	if(dimsize[ndim-2] != grid[n].ny) mpp_error("get_input_metadata(fregrid_util.c): y-size in grid file in not the same as in data file");
-        if(ndim > 2) {
-	  if(cart[ndim-3] == 'Z') {
-	    field[n].var[ll].has_zaxis = 1;
-	    field[n].var[ll].nz        = dimsize[ndim-3];
-	    if(kend > field[n].var[ll].nz) {
-	      sprintf(errmsg, "get_input_metadata(fregrid_util.c): KlevelEnd should be no larger than "
-		      "number of vertical levels of field %s in file %s.", field[n].var[ll].name, file[n].name);
-	      mpp_error(errmsg);
-	    }
-	    if(kbegin>0) {
-	      field[n].var[ll].kstart = kbegin - 1;
-	      field[n].var[ll].kend   = kend - 1;
-	      field[n].var[ll].nz     = kend - kbegin + 1;
-	    }
-	    else {
-	      field[n].var[ll].kstart = 0;
-	      field[n].var[ll].kend   = field[n].var[ll].nz - 1;
-	    }	    
-	  }
-	  else if(cart[ndim-3] == 'N') {
-	    field[n].var[ll].has_naxis = 1;
-	    field[n].var[ll].nn        = dimsize[ndim-3];
-	  }
-	}
-	if(ndim > 3) {
-	  if(cart[ndim-4] == 'Z') {
-	    mpp_error("get_input_metadata(fregrid_util.c): the Z-axis must be the third dimension");
-	  }
-	  if(cart[ndim-4] == 'N') {
-	    field[n].var[ll].has_naxis = 1;
-	    field[n].var[ll].nn        = dimsize[ndim-4];
-	  }
-	}
-	  
-	if(cart[0] == 'T') {
-	  field[n].var[ll].has_taxis = 1;
-	  if(lend > dimsize[0]) {
-	    sprintf(errmsg, "get_input_metadata(fregrid_util.c): LstepEnd should be no larger than "
-		    "number of time levels of field %s in file %s.", field[n].var[ll].name, file[n].name);
-	    mpp_error(errmsg);
-	  }
-	  if(lbegin>0) {
-	    field[n].var[ll].lstart = lbegin - 1;
-	    field[n].var[ll].lend   = lend - 1;
-	    file[n].nt              = lend - lbegin + 1;
-	  }
-	  else {
-	    field[n].var[ll].lstart = 0;
-	    field[n].var[ll].lend   = dimsize[0] - 1;
-	    file[n].nt              = dimsize[0];
-	  }
-	    
-	}
-	for(i=0; i<ndim; i++) {
-	  /* loop through all the file dimensions to see if the dimension already exist or not */
-	  int found, j; 
-	  found = 0;
-	  for(j=0; j<file[n].ndim; j++) {
-	    if(!strcmp(dimname[i], file[n].axis[j].name) ) {
-	      found = 1;
-	      field[n].var[ll].index[i] = j;
-	      break;
-	    }
-	  }
-	  if(!found) {
-	    j                         = file[n].ndim;
-	    field[n].var[ll].index[i] = file[n].ndim;
-	    file[n].ndim++;
-            if(	file[n].ndim > MAXDIM) mpp_error("get_input_metadata(fregrid_util.c):ndim is greater than MAXDIM");
-
-	    file[n].axis[j].cart = cart[i];
-	    file[n].axis[j].type = type[i];
-	    strcpy(file[n].axis[j].name, dimname[i]);
-	    strcpy(file[n].axis[j].bndname, bndname[i]);
-	    file[n].axis[j].vid = mpp_get_varid(file[n].fid, dimname[i]);
-	    if(cart[i] == 'T') {
-	      start[0] = field[n].var[ll].lstart;
-	      file[n].axis[j].size = file[n].nt;
-	    }
-	    else if(cart[i] == 'Z') {
-	      start[0] = field[n].var[ll].kstart;
-	      file[n].axis[j].size = field[n].var[ll].nz;
-	    }
-	    else {
-	      start[0] = 0;
-               file[n].axis[j].size = dimsize[i];
-	    }
-	    file[n].axis[j].data = (double *)malloc(file[n].axis[j].size*sizeof(double));
-	    nread[0] = file[n].axis[j].size;
-	    mpp_get_var_value_block(file[n].fid, file[n].axis[j].vid, start, nread, file[n].axis[j].data);
-	    file[n].axis[j].bndtype = 0;
-	    if(strcmp(bndname[i], "none") ) {
-	      file[n].axis[j].bndid = mpp_get_varid(file[n].fid, bndname[i]);
-	      if(mpp_get_var_ndim(file[n].fid,file[n].axis[j].bndid) == 1) {
-		file[n].axis[j].bndtype = 1;
-		file[n].axis[j].bnddata = (double *)malloc((file[n].axis[j].size+1)*sizeof(double));
-		nread[0] = file[n].axis[j].size+1;
-	      }
-	      else {
-	        file[n].axis[j].bndtype = 2;
-		file[n].axis[j].bnddata = (double *)malloc(2*file[n].axis[j].size*sizeof(double));
-		nread[0] = file[n].axis[j].size; nread[1] = 2;
-	      }
-	      mpp_get_var_value_block(file[n].fid, file[n].axis[j].bndid, start, nread, file[n].axis[j].bnddata);
-	    }
-	  }
-	} /*ndim*/
-      }  /* nvar */
-    } /* ntile */
-    /* make sure the consistency between tiles */
-    for(n=1; n<ntiles; n++) {
-      if(file[n].has_tavg_info != file[0].has_tavg_info)
-	mpp_error("get_input_metadata(fregrid_util.c): mismatch between tiles for field attribute has_tavg_info");
-      
-      if(file[n].ndim != file[0].ndim)
-	mpp_error("get_input_metadata(fregrid_util.c): mismatch between tiles for file ndim");
-      for(l=0; l<file[n].ndim; l++) {
-	if(strcmp(file[n].axis[l].name, file[0].axis[l].name) )
-	   mpp_error("get_input_metadata(fregrid_util.c): mismatch between tiles for file axis name");
-      }
-      for(l=0; l<nscalar+2*nvector; l++) {
-	if(l<nscalar) {
-	  field = scalar;
-	  ll = l;
-	}
-	else if(l<nscalar + nvector) {
-	  field = u_comp;
-	  ll = l - nscalar;
-	}
-	else {
-	  field = v_comp;
-	  ll = l - nscalar - nvector;
-	}      
-	if(field[n].var[ll].ndim != field[0].var[ll].ndim)
-	  mpp_error("get_input_metadata(fregrid_util.c): mismatch between tiles for var ndim");
-	if(field[n].var[ll].interp_method != field[0].var[ll].interp_method)
-	  mpp_error("get_input_metadata(fregrid_util.c): mismatch between tiles for interp_method");
-	for(i=0; i<field[n].var[ll].ndim; i++) {  
-	  if(field[n].var[ll].index[i] != field[0].var[ll].index[i])
-	    mpp_error("get_input_metadata(fregrid_util.c): mismatch between tiles for var dimindex");
-	}
-      }
-    }
-    /* close the file and get the tavg_info */
-    for(n=0; n<ntiles; n++) {
-      if(file[n].has_tavg_info) {
-
-	file[n].t1    = (double *)malloc(file[n].nt*sizeof(double));
-	file[n].t2    = (double *)malloc(file[n].nt*sizeof(double));	
-	file[n].dt    = (double *)malloc(file[n].nt*sizeof(double));
-	file[n].id_t1 = mpp_get_varid(file[n].fid, "average_T1");
-	file[n].id_t2 = mpp_get_varid(file[n].fid, "average_T2");
-	file[n].id_dt = mpp_get_varid(file[n].fid, "average_DT");
-	if(lbegin > 0) 
-	  start[0] = lbegin-1;
-	else
-	  start[0] = 0;
-	nread[0] = file[n].nt; nread[1] = 1; 
-	mpp_get_var_value_block(file[n].fid, file[n].id_t1, start, nread, file[n].t1);
-	mpp_get_var_value_block(file[n].fid, file[n].id_t2, start, nread, file[n].t2);	
-	mpp_get_var_value_block(file[n].fid, file[n].id_dt, start, nread, file[n].dt);
-      }
-    }
-
-  } /*nfile*/
-
-  /* make sure bilinear and conservative interpolation do not co-exist. */
-  if(use_bilinear && use_conserve) mpp_error("get_input_metadata(fregrid_util.c): bilinear interpolation and conservative "
-					     "interpolation can not co-exist, check you option interp_method in command "
-					     "line and field attribute interp_method in source file");
-  
-}; /* get_input_metadata */
-  
-
-/*******************************************************************************
-void set_output_metadata ( Mosaic_config *mosaic)
-*******************************************************************************/
-
-void set_output_metadata (int ntiles_in, int nfiles, const File_config *file1_in, const File_config *file2_in,
-			  const Field_config *scalar_in, const Field_config *u_in, const Field_config *v_in,
-			  int ntiles_out, File_config *file1_out, File_config *file2_out, Field_config *scalar_out,
-			  Field_config *u_out, Field_config *v_out, const Grid_config *grid_out,
-			  const char *history, const char *tagname)
-{
-  int m, n, ndim, i, l, dims[5];
-  int dim_bnds, dim_time;
-  int nscalar, nvector;
-  const File_config *file_in = NULL;
-  File_config *file_out = NULL;
-
-  
-  nscalar = 0;
-  nvector = 0;
-  if( scalar_in) nscalar = scalar_in->nvar;
-  if( u_in)      nvector = u_in->nvar;
-  for(n=0; n<ntiles_out; n++) {
-    for(l=0; l<nscalar; l++) {
-      copy_var_config(scalar_in[0].var+l, scalar_out[n].var+l);
-    }
-    
-    for(l=0; l<nvector; l++) {
-      copy_var_config(u_in[0].var+l, u_out[n].var+l);
-      copy_var_config(v_in[0].var+l, v_out[n].var+l);
-    }
-  }
-  
-  for(m=0; m<nfiles; m++) {
-    file_in  = m==0? file1_in:file2_in;
-    file_out = m==0? file1_out:file2_out;
-    for(n=0; n<ntiles_out; n++) {
-      char tilename[STRING];
-      file_out[n].nt        = file_in[0].nt;
-      ndim                  = file_in[0].ndim;
-      file_out[n].ndim      = ndim;
-      file_out[n].axis      = (Axis_config *)malloc(ndim*sizeof(Axis_config));
-      file_out[n].has_tavg_info = file_in[0].has_tavg_info;
-      
-      for(i=0; i<ndim; i++) {
-	file_out[n].axis[i].cart = file_in[0].axis[i].cart;
-	file_out[n].axis[i].size = file_in[0].axis[i].size;
-	if(file_out[n].axis[i].cart == 'X') file_out[n].axis[i].size = grid_out[n].nx;
-	if(file_out[n].axis[i].cart == 'Y') file_out[n].axis[i].size = grid_out[n].ny;	
-	file_out[n].axis[i].type    = file_in[0].axis[i].type;
-	file_out[n].axis[i].bndtype = file_in[0].axis[i].bndtype;
-	strcpy(file_out[n].axis[i].name, file_in[0].axis[i].name);
-	strcpy(file_out[n].axis[i].bndname, file_in[0].axis[i].bndname);
-      }
-      for(i=0; i<ndim; i++) {
-	file_out[n].axis[i].data = (double *)malloc(file_out[n].axis[i].size*sizeof(double));
-	if( file_out[n].axis[i].cart == 'X' ) {   /* x-axis */
-	  for(l=0; l<file_out[n].axis[i].size; l++) 
-	    file_out[n].axis[i].data[l] = grid_out[n].lont1D[l]*R2D; /* T-cell center */
-	}
-	else if ( file_out[n].axis[i].cart == 'Y') { /* y-axis */
-	  for(l=0; l<file_out[n].axis[i].size; l++) 
-	    file_out[n].axis[i].data[l] = grid_out[n].latt1D[l]*R2D; /* T-cell center */
-	}	  
-	else { /* z or t axis */
-	  for(l=0; l<file_out[n].axis[i].size; l++) 
-	    file_out[n].axis[i].data[l] = file_in[0].axis[i].data[l];
-	}
-	switch( file_out[n].axis[i].bndtype ) {
-	case 1:
-	  file_out[n].axis[i].bnddata = (double *)malloc((file_out[n].axis[i].size+1)*sizeof(double));
-	  if( file_out[n].axis[i].cart == 'X' ) {   /* x-axis */
-	    for(l=0; l<=file_out[n].axis[i].size; l++) file_out[n].axis[i].bnddata[l] = grid_out[n].lonc1D[l]*R2D;
-	  }
-	  else if(file_out[n].axis[i].cart == 'Y') {
-	    for(l=0; l<=file_out[n].axis[i].size; l++) file_out[n].axis[i].bnddata[l  ] = grid_out[n].latc1D[l]*R2D;
-	  }
-	  else {
-	    for(l=0; l<=file_out[n].axis[i].size; l++) file_out[n].axis[i].bnddata[l] = file_in[0].axis[i].bnddata[l];
-	  }
-	  break;
-     	case 2:
-	  file_out[n].axis[i].bnddata = (double *)malloc(2*file_out[n].axis[i].size*sizeof(double));
-	  if( file_out[n].axis[i].cart == 'X' ) {   /* x-axis */
-	    for(l=0; l<file_out[n].axis[i].size; l++) {
-	      file_out[n].axis[i].bnddata[2*l  ] = grid_out[n].lonc[l]*R2D;
-	      file_out[n].axis[i].bnddata[2*l+1] = grid_out[n].lonc[l+1]*R2D;
-	    }
-	  }
-	  else if(file_out[n].axis[i].cart == 'Y') {
-	    for(l=0; l<file_out[n].axis[i].size; l++) {
-	      file_out[n].axis[i].bnddata[2*l  ] = grid_out[n].latc[l]*R2D;
-	      file_out[n].axis[i].bnddata[2*l+1] = grid_out[n].latc[l+1]*R2D;
-	    }
-	  }
-	  else {
-	    for(l=0; l<file_out[n].axis[i].size; l++) {
-	      file_out[n].axis[i].bnddata[2*l  ] = file_in[0].axis[i].bnddata[2*l];
-	      file_out[n].axis[i].bnddata[2*l+1] = file_in[0].axis[i].bnddata[2*l+1];
-	    }
-	  }
-	  break;	  
-	}
-      }
-	for(l=0; l<nscalar; l++)scalar_out[n].var[l].type = scalar_in[0].var[l].type;
-      
-      if(mpp_pe() == mpp_root_pe()) {
-	file_out[n].fid = mpp_open(file_out[n].name, MPP_WRITE);
-	mpp_copy_global_att(file_in[0].fid, file_out[n].fid);
-	mpp_def_global_att(file_out[n].fid, "history", history);
-	mpp_def_global_att(file_out[n].fid, "code_version", tagname);
-	/* define dim_bnds if bnds axis exist */
-	for(i=0; i<ndim; i++) {
-	  if(file_out[n].axis[i].bndtype == 2) {
-	    dim_bnds = mpp_def_dim(file_out[n].fid, "bnds", 2);
-	    break;
-	  }
-	}
-	for(i=0; i<ndim; i++) {
-	  if(file_out[n].axis[i].cart=='T') {
-	    file_out[n].axis[i].dimid = mpp_def_dim(file_out[n].fid, file_out[n].axis[i].name, NC_UNLIMITED);
-	    dim_time = file_out[n].axis[i].dimid;
-	  }
-	  else
-	    file_out[n].axis[i].dimid = mpp_def_dim(file_out[n].fid, file_out[n].axis[i].name, file_out[n].axis[i].size);
-	  file_out[n].axis[i].vid = mpp_def_var(file_out[n].fid, file_out[n].axis[i].name, file_out[n].axis[i].type, 1,
-						  &(file_out[n].axis[i].dimid), 0);
-	  mpp_copy_var_att(file_in[0].fid, file_in[0].axis[i].vid, file_out[n].fid, file_out[n].axis[i].vid);
-	  switch( file_out[n].axis[i].bndtype ) {
-	  case 1:
-	    dims[0] = mpp_def_dim(file_out[n].fid, file_out[n].axis[i].bndname, file_out[n].axis[i].size+1);
-	    file_out[n].axis[i].bndid = mpp_def_var(file_out[n].fid, file_out[n].axis[i].bndname, file_out[n].axis[i].type, 1, dims , 0);
-	    mpp_copy_var_att(file_in[0].fid, file_in[0].axis[i].bndid, file_out[n].fid, file_out[n].axis[i].bndid);
-	    break;
-	  case 2:
-	    dims[0] = file_out[n].axis[i].dimid;
-	    dims[1] = dim_bnds;
-	    file_out[n].axis[i].bndid = mpp_def_var(file_out[n].fid, file_out[n].axis[i].bndname, file_out[n].axis[i].type, 2, dims , 0);
-	    mpp_copy_var_att(file_in[0].fid, file_in[0].axis[i].bndid, file_out[n].fid, file_out[n].axis[i].bndid);
-	    break;
-	  }
-	    
-	}
-
-	/* define the field meta data */
-	for(l=0; l<nscalar; l++) {
-	  for(i=0; i<scalar_out[n].var[l].ndim; i++) dims[i] = file_out[n].axis[scalar_out[n].var[l].index[i]].dimid;
-	  scalar_out[n].var[l].vid = mpp_def_var(file_out[n].fid, scalar_out[n].var[l].name, scalar_out[n].var[l].type,
-						   scalar_out[n].var[l].ndim, dims, 0); 
-	  mpp_copy_var_att(file_in[0].fid, scalar_in[0].var[l].vid, file_out[n].fid, scalar_out[n].var[l].vid);
-	  if(scalar_out[n].var[l].interp_method == CONSERVE_ORDER1)
-             mpp_def_var_att(file_out[n].fid, scalar_out[n].var[l].vid, "interp_method", "conserve_order1");
-	  else if(scalar_out[n].var[l].interp_method == CONSERVE_ORDER2)
-             mpp_def_var_att(file_out[n].fid, scalar_out[n].var[l].vid, "interp_method", "conserve_order2");
-	  else if(scalar_out[n].var[l].interp_method == BILINEAR)
-             mpp_def_var_att(file_out[n].fid, scalar_out[n].var[l].vid, "interp_method", "bilinear");
-	}
-	for(l=0; l<nvector; l++) {
-	  if(m==0) {
-	    u_out[n].var[l].type = u_in[0].var[l].type;
-	    for(i=0; i<u_out[n].var[l].ndim; i++) dims[i] = file_out[n].axis[u_out[n].var[l].index[i]].dimid;
-	    u_out[n].var[l].vid = mpp_def_var(file_out[n].fid, u_out[n].var[l].name, u_out[n].var[l].type,
-			        		u_out[n].var[l].ndim, dims, 0); 
-	    mpp_copy_var_att(file_in[0].fid, u_in[0].var[l].vid, file_out[n].fid, u_out[n].var[l].vid);
-	    if(u_out[n].var[l].interp_method == CONSERVE_ORDER1)
-	      mpp_def_var_att(file_out[n].fid, u_out[n].var[l].vid, "remapping_method", "conserve_order1");
-	    else if(u_out[n].var[l].interp_method == CONSERVE_ORDER2)
-	      mpp_def_var_att(file_out[n].fid, u_out[n].var[l].vid, "remapping_method", "conserve_order2");
-	    else if(u_out[n].var[l].interp_method == BILINEAR)
-	      mpp_def_var_att(file_out[n].fid, u_out[n].var[l].vid, "remapping_method", "bilinear");
-	    
-	  }
-	  if(m==1 || nfiles == 1) {
-	    v_out[n].var[l].type = v_in[0].var[l].type;
-	    for(i=0; i<v_out[n].var[l].ndim; i++) dims[i] = file_out[n].axis[v_out[n].var[l].index[i]].dimid;
-	    v_out[n].var[l].vid = mpp_def_var(file_out[n].fid, v_out[n].var[l].name, v_out[n].var[l].type,
-						v_out[n].var[l].ndim, dims, 0); 
-	    mpp_copy_var_att(file_in[0].fid, v_in[0].var[l].vid, file_out[n].fid, v_out[n].var[l].vid);
-	    if(v_out[n].var[l].interp_method == CONSERVE_ORDER1)
-	      mpp_def_var_att(file_out[n].fid, v_out[n].var[l].vid, "remapping_method", "conserve_order1");
-	    else if(v_out[n].var[l].interp_method == CONSERVE_ORDER2)
-	      mpp_def_var_att(file_out[n].fid, v_out[n].var[l].vid, "remapping_method", "conserve_order2");
-	    else if(v_out[n].var[l].interp_method == BILINEAR)
-	      mpp_def_var_att(file_out[n].fid, v_out[n].var[l].vid, "remapping_method", "bilinear");
-	  }
-	}
-	/* define time avg info variables */
-	if(file_out[n].has_tavg_info) {
-	  int ll;
-	  file_out[n].id_t1 = mpp_def_var(file_out[n].fid, "average_T1", NC_DOUBLE, 1, &dim_time, 0);
-	  mpp_copy_var_att(file_in[0].fid, file_in[0].id_t1, file_out[n].fid, file_out[n].id_t1);
-	  file_out[n].id_t2 = mpp_def_var(file_out[n].fid, "average_T2", NC_DOUBLE, 1, &dim_time, 0);
-	  mpp_copy_var_att(file_in[0].fid, file_in[0].id_t2, file_out[n].fid, file_out[n].id_t2);	  
-	  file_out[n].id_dt = mpp_def_var(file_out[n].fid, "average_DT", NC_DOUBLE, 1, &dim_time, 0);
-	  mpp_copy_var_att(file_in[0].fid, file_in[0].id_dt, file_out[n].fid, file_out[n].id_dt);
-	  file_out[n].t1 = (double *)malloc(file_out[n].nt*sizeof(double));
-	  file_out[n].t2 = (double *)malloc(file_out[n].nt*sizeof(double));
-	  file_out[n].dt = (double *)malloc(file_out[n].nt*sizeof(double));
-	  for(ll=0; ll<file_out[n].nt; ll++) {
-	    file_out[n].t1[ll] = file_in[0].t1[ll];
-	    file_out[n].t2[ll] = file_in[0].t2[ll];
-	    file_out[n].dt[ll] = file_in[0].dt[ll];
-	  }
-	}
-	mpp_end_def(file_out[n].fid);
-	for(i=0; i<ndim; i++) {
-	  if(file_out[n].axis[i].cart == 'T') continue;
-	  mpp_put_var_value(file_out[n].fid, file_out[n].axis[i].vid, file_out[n].axis[i].data);
-	  if(strcmp(file_out[n].axis[i].bndname, "none") )
-	    mpp_put_var_value(file_out[n].fid, file_out[n].axis[i].bndid, file_out[n].axis[i].bnddata);
-	}
-      }
-    }
-  }
-  
-}; /* set_output_metadata */
-
-/*******************************************************************************
-   void get_field_attribute( )
-   *******************************************************************************/
-void get_field_attribute( int ntiles, Field_config *field)
-{
-  int n, l, nfield;
-  char str[128];
-  
-  nfield = field->nvar;
-
-  for(l=0; l<nfield; l++) {
-    for(n=0; n<ntiles; n++) {
-      field[n].var[l].missing = 0;
-      field[n].var[l].scale   = 0;
-      field[n].var[l].offset  = 0;
-      field[n].var[l].vid = mpp_get_varid(*(field[n].fid), field[n].var[l].name);
-      if( field[n].var[l].has_missing = mpp_var_att_exist(*(field[n].fid), field[n].var[l].vid, "missing_value") ) {
-	mpp_get_var_att_double(*(field[n].fid), field[n].var[l].vid, "missing_value", &(field[n].var[l].missing));
-      }
-      if(mpp_var_att_exist(*(field[n].fid), field[n].var[l].vid, "scale_factor")) {
-	mpp_get_var_att_double(*(field[n].fid), field[n].var[l].vid, "scale_factor", &(field[n].var[l].scale) );
-      }
-      if(mpp_var_att_exist(*(field[n].fid), field[n].var[l].vid, "add_offset")) {
-	mpp_get_var_att_double(*(field[n].fid), field[n].var[l].vid, "add_offset", &(field[n].var[l].offset) );
-      }      
-    }
-  }
-
-}; /* get_field_attribute */
-
-/*******************************************************************************
-void copy_field_attribute()
-*******************************************************************************/
-void copy_field_attribute( int ntiles_out, Field_config *field_in, Field_config *field_out)
-{
-
-  int n, l;
-  
-  for(n=0; n<ntiles_out; n++) 
-    for(l=0; l<field_out->nvar; l++) {
-      field_out[n].var[l].missing = field_in->var[l].missing;
-      field_out[n].var[l].scale   = field_in->var[l].scale;
-      field_out[n].var[l].offset  = field_in->var[l].offset;
-    }
-  
-
-}
-  
-
-/*******************************************************************************
-void set_remap_file( )
-*******************************************************************************/
-void set_remap_file( int ntiles, const char *mosaic_file, const char *remap_file, Interp_config *interp,
-		     unsigned int *opcode, int save_weight_only)
-{
-  int    i, len, m, fid, vid;
-  size_t start[4], nread[4];
-  char str1[STRING], tilename[STRING];
-  int file_exist;
-  
-  if(!remap_file) return;
-  
-  for(i=0; i<4; i++) {
-    start[i] = 0; nread[i] = 1;
-  }
-  nread[1] = STRING;
-  
-  len = strlen(remap_file);
-  if(len >= STRING) mpp_error("setoutput_remap_file(fregrid_util): length of remap_file should be less than STRING");  
-  if( strstr(remap_file, ".nc") ) {
-    strncpy(str1, remap_file, len-3);
-    str1[len-3] = 0;
-  }
-  else
-    strcpy(str1, remap_file);
-
-  (*opcode) |= WRITE;
-
-  if(ntiles>1) {
-     fid = mpp_open(mosaic_file, MPP_READ);
-     vid   = mpp_get_varid(fid, "gridtiles");
-  }
-  
-  for(m=0; m<ntiles; m++) {
-    interp[m].file_exist = 0;
-    if(ntiles > 1) {
-      start[0] = m;
-      mpp_get_var_value_block(fid, vid, start, nread, tilename);
-      if(strlen(str1) + strlen(tilename) > STRING -5) mpp_error("set_output_remap_file(fregrid_util): length of str1 + "
-								"length of tilename should be no greater than STRING-5");
-      sprintf(interp[m].remap_file, "%s.%s.nc", str1, tilename);
-    }
-    else
-      sprintf(interp[m].remap_file, "%s.nc", str1);
-    /* check xgrid file to be read (=1) or write ( = 2) */
-    if(!save_weight_only && mpp_file_exist(interp[m].remap_file)) {
-      (*opcode) |= READ;
-      interp[m].file_exist = 1;
-    }
-      
-  }
-
-  if(ntiles>1) mpp_close(fid);
-  
-};/* set_remap_file */
-
-
-/*----------------------------------------------------------------------
-  void write_output_axis_data( )
-  write out time axis data of the output data file
-  --------------------------------------------------------------------*/
-void write_output_time(int ntiles, File_config *file, int level)
-{
-  int         i, n;
-  size_t      start[4], nwrite[4];
-
-  for(i=0; i<4; i++) {
-    start[i] = 0; nwrite[i] = 1;
-  }
-  start[0] = level;   
-  if( mpp_pe() == mpp_root_pe()) {
-    for(n=0; n<ntiles; n++) {
-      for(i=0; i<file[n].ndim; i++) {
-	if(file[n].axis[i].cart == 'T') {
-	  nwrite[1] = 1;
-	  mpp_put_var_value_block(file[n].fid, file[n].axis[i].vid, start,
-				 nwrite, &(file[n].axis[i].data[level]));
-	  if(strcmp(file[n].axis[i].bndname, "none") ) {
-	    nwrite[1] = 2;
-	    mpp_put_var_value_block(file[n].fid, file[n].axis[i].bndid, start,
-				   nwrite, &(file[n].axis[i].bnddata[level*2]));
-	  }
-	}
-      }
-      /* write out time_avg_info if exist */
-      if(file[n].has_tavg_info) {
-	nwrite[1] = 1;
-	mpp_put_var_value_block(file[n].fid, file[n].id_t1, start, nwrite, &(file[n].t1[level]) );
-	mpp_put_var_value_block(file[n].fid, file[n].id_t2, start, nwrite, &(file[n].t2[level]) );
-	mpp_put_var_value_block(file[n].fid, file[n].id_dt, start, nwrite, &(file[n].dt[level]) );
-      }
-    }
-  }
-}; /* write_output_time */
-
-/*---------------------------------------------------------------------------
-  void get_input_data(Mosaic_config *input, int l)
-  get the input data for the number l variable.
-  -------------------------------------------------------------------------*/
-void get_input_data(int ntiles, Field_config *field, Grid_config *grid, Bound_config *bound,
-		    int varid, int level_z, int level_n, int level_t)
-{
-  int         halo, i, j, i1, i2, n, memsize, nx, ny, ndim, nbound, l, pos;
-  size_t      *start, *nread;
-  double      *data;
-  short       *data_i2;
-  int         *data_i4;
-  Data_holder *dHold;
-  int         interp_method;
-  
-  interp_method = field->var[varid].interp_method;
-  if(interp_method == CONSERVE_ORDER1)
-    halo = 0;
-  else
-    halo = 1;
-
-  ndim = field->var[varid].ndim;
-  if(ndim < 2) mpp_error("fregrid_util(get_input_data): ndim must be no less than 2");
-  nread  = (size_t *)malloc(ndim*sizeof(size_t));
-  start  = (size_t *)malloc(ndim*sizeof(size_t));
-  for(i=0; i<ndim; i++) {
-    start[i] = 0; nread[i] = 1;
-  }
-  pos = 0;
-  if(field->var[varid].has_taxis) start[pos++] = level_t;
-  if(field->var[varid].has_naxis) start[pos++] = level_n;
-  if(field->var[varid].has_zaxis) start[pos++] = level_z;
-  if(ndim != pos + 2) mpp_error("fregrid_util(get_input_data): mimstch between ndim and has_taxis/has_zaxis/has_naxis");
-  
-  /* first read input data for each tile */
-  for(n=0; n<ntiles; n++) {
-    nx = grid[n].nx;
-    ny = grid[n].ny;
-    memsize = 1;
-    nread[pos]   = ny;
-    nread[pos+1] = nx;
-    memsize = (nx+2*halo)*(ny+2*halo);
-    
-    field[n].data = (double *)malloc(memsize*sizeof(double));
-    if(halo ==0 )
-      data = field[n].data;
-    else {
-      data = (double *)malloc(nx*ny*sizeof(double));
-      init_halo(field[n].data, nx, ny, 1, 1);
-    }
-    
-    switch(field[n].var[varid].type) {
-    case NC_SHORT:
-      data_i2 = (short *)malloc(memsize*sizeof(short));
-      mpp_get_var_value_block(*(field[n].fid), field[n].var[varid].vid, start, nread, data_i2);
-      for(i=0; i<nx*ny; i++) data[i] = data_i2[i];
-      free(data_i2);
-      break;
-    case NC_INT:
-      data_i4 = (int *)malloc(memsize*sizeof(int));
-      mpp_get_var_value_block(*(field[n].fid), field[n].var[varid].vid, start, nread, data_i4);
-      for(i=0; i<nx*ny; i++) data[i] = data_i4[i];
-      free(data_i4);
-      break;      
-    case NC_DOUBLE:case NC_FLOAT:
-      mpp_get_var_value_block(*(field[n].fid), field[n].var[varid].vid, start, nread, data);
-      break;
-    default:
-      mpp_error("fregrid_util(get_input_data): field type should be NC_INT, NC_SHORT, NC_FLOAT or NC_DOUBLE");
-    }
-      
-    if(field[n].var[varid].scale != 0) {
-      for(i=0; i<nx*ny; i++) data[i] *= field[n].var[varid].scale;
-    }
-    if(field[n].var[varid].offset != 0) {
-      for(i=0; i<nx*ny; i++) data[i] += field[n].var[varid].offset;
-    }      
-
-    if(halo != 0) {
-      /* copy the data onto compute domain */
-      for(j=0; j<ny; j++) for(i=0; i<nx; i++) {
-	i1 = (j+halo)*(nx+2*halo)+i+halo;
-	i2 = j*nx+i;
-	field[n].data[i1] = data[i2];
-      }
-      free(data);
-    }
-  }  
-
-  /* update halo when halo > 0 */
-  if(halo > 0) {
-    for(n=0; n<ntiles; n++) {
-      nbound = bound[n].nbound;
-      if(nbound > 0) {
-	dHold = (Data_holder *)malloc(nbound*sizeof(Data_holder));
-	for(l=0; l<nbound; l++) {
-	  dHold[l].data = field[bound[n].tile2[l]].data;
-	  dHold[l].nx = grid[bound[n].tile2[l]].nx+2;
-	  dHold[l].ny = grid[bound[n].tile2[l]].ny+2;
-	}
-	update_halo(grid[n].nx+2, grid[n].ny+2, 1, field[n].data, &(bound[n]), dHold );
-	for(l=0; l<nbound; l++) dHold[l].data = NULL;
-	free(dHold);
-      }
-    }
-    /* second order conservative interpolation, gradient need to be calculated */
-    if(interp_method == CONSERVE_ORDER2) {
-      for(n=0; n<ntiles; n++) {
-	int is_true = 1;
-	nx = grid[n].nx;
-	ny = grid[n].ny;
-	field[n].grad_x = (double *)malloc(nx*ny*sizeof(double));
-	field[n].grad_y = (double *)malloc(nx*ny*sizeof(double));
-	  grad_c2l(&(grid[n].nx), &(grid[n].ny), field[n].data, grid[n].dx, grid[n].dy, grid[n].area,
-		   grid[n].edge_w, grid[n].edge_e, grid[n].edge_s, grid[n].edge_n,
-		   grid[n].en_n, grid[n].en_e, grid[n].vlon_t, grid[n].vlat_t, 
-		   field[n].grad_x, field[n].grad_y, &is_true, &is_true, &is_true, &is_true);
-	/* where there is missing and using second order conservative interpolation, need to calculate mask for gradient */
-	if( field[n].var[varid].has_missing ) {
-	  int ip1, im1, jp1, jm1,kk,ii,jj;
-	  double missing;
-	  missing = field[n].var[varid].missing;
-	  field[n].grad_mask = (int *)malloc(nx*ny*sizeof(int));
-	  for(j=0; j<ny; j++) for(i=0; i<nx; i++) {
-	    ii=i+1; ip1 = ii+1; im1 = ii-1; jj = j+1; jp1 = jj+1; jm1 = jj-1;
-	    if(field[n].data[jm1*(nx+2)+im1] == missing || field[n].data[jm1*(nx+2)+ii ] == missing ||
-	       field[n].data[jm1*(nx+2)+ip1] == missing || field[n].data[jj *(nx+2)+im1] == missing ||
-	       field[n].data[jj *(nx+2)+ip1] == missing || field[n].data[jp1*(nx+2)+im1] == missing ||
-	       field[n].data[jp1*(nx+2)+ii ] == missing || field[n].data[jp1*(nx+2)+ip1] == missing  )
-	      field[n].grad_mask[j*nx+i] = 1;
-	    else
-	      field[n].grad_mask[j*nx+i] = 0;
-	  }
-	}
-      }
-    }
-  }
-
-
-  
-}; /* get_input_data */
-
-/*---------------------------------------------------------------------------
-  void get_input_data(Mosaic_config *input, int l)
-  get the input data for the number l variable.
-  -------------------------------------------------------------------------*/
-void get_test_input_data(char *test_case, double test_param, int ntiles, Field_config *field,
-			 Grid_config *grid, Bound_config *bound, unsigned int opcode)
-{
-  int         halo, i, j, k, ii, n, nx, ny, l, nbound;
-  double      *data;
-  Data_holder *dHold;
-  char input_file[128];
-  int  fid, vid, dim[2]; 
-  
-  if(opcode & CONSERVE_ORDER1)
-    halo = 0;
-  else
-    halo = 1;
-  
-  for(n=0; n<ntiles; n++) {
-    nx = grid[n].nx;
-    ny = grid[n].ny;
-    field[n].data = (double *)malloc((nx+2*halo)*(ny+2*halo)*sizeof(double));
-    data          = (double *)malloc(nx*ny*sizeof(double));
-    if(!strcmp(test_case,"tanh_cosphi_costheta") ) {
-      for(j=0; j<ny; j++) for(i=0; i<nx; i++) {
-	data[j*ny+i] = tanh(test_param*cos(grid[n].lont[(j+1)*(nx+2)+i+1])*cos(grid[n].latt[(j+1)*(nx+2)+i+1]));
-      }
-    }
-    if(!strcmp(test_case,"tanh_sinphi_sintheta") ) {
-      for(j=0; j<ny; j++) for(i=0; i<nx; i++) {
-	data[j*ny+i] = tanh(test_param*sin(grid[n].lont[(j+1)*(nx+2)+i+1])*sin(grid[n].latt[(j+1)*(nx+2)+i+1]));
-      }
-    }    
-    else if(!strcmp(test_case,"cosphi_costheta") ) {
-      for(j=0; j<ny; j++) for(i=0; i<nx; i++) {
-	data[j*ny+i] = cos(grid[n].lont[(j+1)*(nx+2)+i+1])*cos(grid[n].latt[(j+1)*(nx+2)+i+1]);
-      }
-    }
-    else if(!strcmp(test_case,"sinphi_costheta") ) {
-      for(j=0; j<ny; j++) for(i=0; i<nx; i++) {
-	data[j*ny+i] = sin(grid[n].lont[(j+1)*(nx+2)+i+1])*cos(grid[n].latt[(j+1)*(nx+2)+i+1]);
-      }
-    }
-    else
-      mpp_error("fregrid_util: invalid choice of test_case");
-
-    /* write out input data */
-    sprintf(input_file, "%s.input.tile%d.nc", test_case, n+1);
-    fid = mpp_open(input_file, MPP_WRITE);
-    dim[0] = mpp_def_dim(fid, "grid_y", ny);
-    dim[1] = mpp_def_dim(fid, "grid_x", nx);
-    vid    = mpp_def_var(fid, "data", NC_DOUBLE, 2, dim, 0);
-    mpp_end_def(fid);
-    mpp_put_var_value(fid, vid, data);
-    mpp_close(fid);
-    
-    for(j=0; j<ny; j++) for(i=0; i<nx; i++) {
-      ii = (j+halo)*(nx+2*halo)+i+halo;
-      field[n].data[ii] = data[j*nx+i];
-    }
-    free(data);
-  }
-    
-  /* update halo when halo > 0 */
-  if(halo > 0) {
-    for(n=0; n<ntiles; n++) {
-      nbound = bound[n].nbound;
-      if(nbound > 0) {
-	dHold = (Data_holder *)malloc(nbound*sizeof(Data_holder));
-	for(l=0; l<nbound; l++) {
-	  dHold[l].data = field[bound[n].tile2[l]].data;
-	  dHold[l].nx = grid[bound[n].tile2[l]].nx+2;
-	  dHold[l].ny = grid[bound[n].tile2[l]].ny+2;
-	}
-	update_halo(grid[n].nx+2, grid[n].ny+2, 1, field[n].data, &(bound[n]), dHold );
-	for(l=0; l<nbound; l++) dHold[l].data = NULL;
-	free(dHold);
-      }
-    }
-    /* second order conservative interpolation, gradient need to be calculated */
-    if(opcode & CONSERVE_ORDER2) {
-      for(n=0; n<ntiles; n++) {
-	int is_true = 1;
-	field[n].grad_x = (double *)malloc((grid[n].nx+2)*(grid[n].ny+2)*sizeof(double));
-	field[n].grad_y = (double *)malloc((grid[n].nx+2)*(grid[n].ny+2)*sizeof(double));
-	grad_c2l(&(grid[n].nx), &(grid[n].ny), field[n].data, grid[n].dx, grid[n].dy, grid[n].area,
-		 grid[n].edge_w, grid[n].edge_e, grid[n].edge_s, grid[n].edge_n,
-		 grid[n].en_n, grid[n].en_e, grid[n].vlon_t, grid[n].vlat_t,
-		 field[n].grad_x, field[n].grad_y, &is_true, &is_true, &is_true, &is_true);
-      }
-    }
-  }
-  
-}; /* get_test_input_data */
-
-
-void allocate_field_data(int ntiles, Field_config *field, Grid_config *grid)
-{
-  int n, i;
-  size_t memsize;
-  
-  for(n=0; n<ntiles; n++) {
-    memsize = grid[n].nx*grid[n].ny;
-    field[n].data = (double *)malloc(memsize*sizeof(double));
-  }
-
-}; /* allocate_field_data */
-
-
-/*-------------------------------------------------------------------------
-  write_field_data(Mosaic_config *output)
-  write data to output file
-  -----------------------------------------------------------------------*/
-void write_field_data(int ntiles, Field_config *field, Grid_config *grid, int varid, int level_z, int level_n, int level_t)
-{
-  double *gdata;
-  short  *data_i2;
-  int    *data_i4;
-  int    nx, ny, n, ndim, i, j, data_size, pos;
-  size_t *nwrite, *start;
-
-  ndim = field->var[varid].ndim;
-  if(ndim < 2) mpp_error("fregrid_util(write_field_data): ndim must be no less than 2");
-
-  nwrite = (size_t *)malloc(ndim*sizeof(size_t));
-  start  = (size_t *)malloc(ndim*sizeof(size_t));
-  for(i=0; i<ndim; i++) {
-    start[i] = 0; nwrite[i] = 1;
-  }
-
-  pos = 0;
-  if(field->var[varid].has_taxis) start[pos++] = level_t;
-  if(field->var[varid].has_naxis) start[pos++] = level_n;
-  if(field->var[varid].has_zaxis) start[pos++] = level_z;
-  if(ndim != pos + 2) mpp_error("fregrid_util(write_field_data): mimstch between ndim and has_taxis/has_zaxis/has_naxis");
-  
-  for(n=0; n<ntiles; n++) {
-    /* global data onto root pe */
-    nx = grid[n].nx;
-    ny = grid[n].ny;
-    nwrite[pos]   = ny;
-    nwrite[pos+1] = nx;    
-    data_size = nx*ny;
-
-    if(field[n].var[varid].offset != 0) {
-      for(i=0; i<nx*ny; i++) field[n].data[i] -= field[n].var[varid].offset;
-    }
-    if(field[n].var[varid].scale != 0) {
-      for(i=0; i<nx*ny; i++) field[n].data[i] /= field[n].var[varid].scale;
-    }
-
-    if(mpp_npes() == 1) {
-      gdata = field[n].data;
-    }
-    else {
-      gdata = (double *)malloc(nx*ny*sizeof(double));
-      mpp_global_field_double(grid[n].domain, grid[n].nxc, grid[n].nyc,
-			      field[n].data, gdata);
-    }
-    
-    switch(field[n].var[varid].type) {
-    case NC_SHORT:
-      data_i2 = (short *)malloc(data_size*sizeof(short));
-      for(i=0; i<data_size; i++) data_i2[i] = (short)gdata[i];
-      if(mpp_pe() == mpp_root_pe()) mpp_put_var_value_block(*(field[n].fid), field[n].var[varid].vid, start, nwrite, data_i2);
-      free(data_i2);
-      break;
-    case NC_INT:
-      data_i4 = (int *)malloc(data_size*sizeof(int));
-      for(i=0; i<data_size; i++) data_i4[i] = (int)gdata[i];
-      if(mpp_pe() == mpp_root_pe()) mpp_put_var_value_block(*(field[n].fid), field[n].var[varid].vid, start, nwrite, data_i4);
-      free(data_i4);
-      break;
-    case NC_DOUBLE:case NC_FLOAT:
-      if(mpp_pe() == mpp_root_pe())mpp_put_var_value_block(*(field[n].fid), field[n].var[varid].vid, start, nwrite, gdata);
-      break;
-    default:
-      mpp_error("fregrid_util(write_field_data): field type should be NC_SHORT, NC_FLOAT or NC_DOUBLE");
-    }
-    if(mpp_npes() != 1) free(gdata);
-  }
-
-};/* write_output_data */
-
-void get_contact_direction(int ncontact, const int *tile, const int *istart, const int *iend,
-			   const int *jstart, const int *jend, int *dir)
-{
-  int n;
-   
-  for(n=0; n<ncontact; n++) {
-    if(istart[n] == iend[n] && jstart[n] == jend[n])
-      mpp_error("fregrid_util: istart = iend and jstart = jend can not be both true for one contact");
-    if(istart[n] != iend[n] && jstart[n] != jend[n])
-      mpp_error("fregrid_util: either istart = iend or jstart = jend need to be true");
-    if(istart[n] == iend[n]) {
-      if(istart[n] == 0)
-	dir[n] = WEST;
-      else
-	dir[n] = EAST;
-    }
-    else {
-      if(jstart[n] == 0)
-	dir[n] = SOUTH;
-      else
-	dir[n] = NORTH;
-    }
-  }
-
-}
-
-void setup_boundary(const char *mosaic_file, int ntiles, Grid_config *grid, Bound_config *bound, int halo, int position)
-{
-  int ncontacts, shift, n, nbound, l, l2, nb, nx, ny;
-  int *tile, *dir;
-  int *istart, *iend, *jstart, *jend;
-
-  ncontacts = read_mosaic_ncontacts(mosaic_file);
-  if(ncontacts == 0) {
-    for(n=0; n<ntiles; n++) bound[n].nbound = 0;
-    return;
-  }
-
-  if(position == CENTER)
-    shift = 0;
-  else if(position == CORNER)
-    shift = 1;
-  else
-    mpp_error("fregrid_util: position should be CENTER or CORNER");
-  
-  tile   = (int *)malloc(2*ncontacts*sizeof(int));
-  istart = (int *)malloc(2*ncontacts*sizeof(int));
-  iend   = (int *)malloc(2*ncontacts*sizeof(int));
-  jstart = (int *)malloc(2*ncontacts*sizeof(int));
-  jend   = (int *)malloc(2*ncontacts*sizeof(int));
-  dir    = (int *)malloc(2*ncontacts*sizeof(int));
-  read_mosaic_contact(mosaic_file, tile, tile+ncontacts, istart, iend, jstart, jend,
-		      istart+ncontacts, iend+ncontacts, jstart+ncontacts, jend+ncontacts);
-  for(n=0; n<2*ncontacts; n++) --tile[n];
-  get_contact_direction(2*ncontacts, tile, istart, iend, jstart, jend, dir);
-  
-  /* First find number of boundary for each tile */
-  for(n=0; n<ntiles; n++) {
-    nbound = 0;
-    nx = grid[n].nx;
-    ny = grid[n].ny;
-    for(l=0; l<2*ncontacts; l++) {
-      if(tile[l] == n) nbound++;
-    }
-    bound[n].nbound = nbound;
-    if(nbound > 0) {
-      bound[n].is1    = (int *)malloc(nbound*sizeof(int));
-      bound[n].ie1    = (int *)malloc(nbound*sizeof(int));
-      bound[n].js1    = (int *)malloc(nbound*sizeof(int));
-      bound[n].je1    = (int *)malloc(nbound*sizeof(int));
-      bound[n].is2    = (int *)malloc(nbound*sizeof(int));
-      bound[n].ie2    = (int *)malloc(nbound*sizeof(int));
-      bound[n].js2    = (int *)malloc(nbound*sizeof(int));
-      bound[n].je2    = (int *)malloc(nbound*sizeof(int));      
-      bound[n].rotate = (int *)malloc(nbound*sizeof(int));
-      bound[n].tile2  = (int *)malloc(nbound*sizeof(int));
-      nb = 0;
-      for(l=0; l<2*ncontacts; l++) {
-	if(tile[l] != n) continue;
-	switch(dir[l]) {
-	case WEST:
-	  bound[n].is1[nb]  = 0;
-	  bound[n].ie1[nb]  = halo-1;
-	  bound[n].js1[nb]  = min(jstart[l],jend[l])+halo;
-	  bound[n].je1[nb]  = max(jstart[l],jend[l])+halo+shift;
-	  break;
-	case EAST:
-	  bound[n].is1[nb]  = nx+shift+halo;
-	  bound[n].ie1[nb]  = nx+shift+halo+halo-1;
-	  bound[n].js1[nb]  = min(jstart[l],jend[l])+halo;
-	  bound[n].je1[nb]  = max(jstart[l],jend[l])+halo+shift;
-	  break;
-	case SOUTH:
-	  bound[n].is1[nb]  = min(istart[l],iend[l])+halo;
-	  bound[n].ie1[nb]  = max(istart[l],iend[l])+halo+shift;
-	  bound[n].js1[nb]  = 0;
-	  bound[n].je1[nb]  = halo-1;
-	  break;
-	case NORTH:
-	  bound[n].is1[nb]  = min(istart[l],iend[l])+halo;
-	  bound[n].ie1[nb]  = max(istart[l],iend[l])+halo+shift;
-	  bound[n].js1[nb]  = ny+shift+halo;
-	  bound[n].je1[nb]  = ny+shift+halo+halo-1;
-	  break;	    
-	}
-	l2 = (l+ncontacts)%(2*ncontacts);
-	bound[n].tile2[nb] = tile[l2];
-	switch(dir[l2]) {
-	case WEST:
-	  bound[n].is2[nb]  = halo+shift;
-	  bound[n].ie2[nb]  = halo+shift+halo-1;
-	  bound[n].js2[nb]  = min(jstart[l2],jend[l2])+halo;
-	  bound[n].je2[nb]  = max(jstart[l2],jend[l2])+halo+shift;
-	  break;
-	case EAST:
-	  bound[n].is2[nb]  = nx-halo+1;
-	  bound[n].ie2[nb]  = nx;
-	  bound[n].js2[nb]  = min(jstart[l2],jend[l2])+halo;
-	  bound[n].je2[nb]  = max(jstart[l2],jend[l2])+halo+shift;
-	  break;
-	case SOUTH:
-	  bound[n].is2[nb]  = min(istart[l2],iend[l2])+halo;
-	  bound[n].ie2[nb]  = max(istart[l2],iend[l2])+halo+shift;
-	  bound[n].js2[nb]  = halo+shift;
-	  bound[n].je2[nb]  = halo+shift+halo-1;
-	  break;
-	case NORTH:
-	  bound[n].is2[nb]  = min(istart[l2],iend[l2])+halo;
-	  bound[n].ie2[nb]  = max(istart[l2],iend[l2])+halo+shift;
-	  bound[n].js2[nb]  = ny-halo+1;
-	  bound[n].je2[nb]  = ny;
-	  break;	    
-	}
-	bound[n].rotate[nb] = ZERO;
-	if(dir[l] == WEST && dir[l2] == NORTH) bound[n].rotate[nb] = NINETY;
-	if(dir[l] == EAST && dir[l2] == SOUTH) bound[n].rotate[nb]= NINETY;
-	if(dir[l] == SOUTH && dir[l2] == EAST) bound[n].rotate[nb] = MINUS_NINETY;
-	if(dir[l] == NORTH && dir[l2] == WEST) bound[n].rotate[nb] = MINUS_NINETY;      
-	if(dir[l] == NORTH && dir[l2] == NORTH) bound[n].rotate[nb] = ONE_HUNDRED_EIGHTY;
-	/* make sure the size match at the boundary */
-	if( (bound[n].ie2[nb]-bound[n].is2[nb]+1)*(bound[n].je2[nb]-bound[n].js2[nb]+1) !=
-	    (bound[n].ie1[nb]-bound[n].is1[nb]+1)*(bound[n].je1[nb]-bound[n].js1[nb]+1) )
-	  mpp_error("fregrid_util: size mismatch between the boundary");
-	nb++;
-      }      
-    }
-  }
-}; /* setup_boundary */
-
-void delete_bound_memory(int ntiles, Bound_config *bound)
-{
-  int n;
-  
-  for(n=0; n<ntiles; n++) {
-    if(bound[n].nbound > 0) {
-      free(bound[n].is1);
-      free(bound[n].ie1);
-      free(bound[n].js1);
-      free(bound[n].je1);
-      free(bound[n].is2);
-      free(bound[n].ie2);
-      free(bound[n].js2);
-      free(bound[n].je2);
-      free(bound[n].tile2);
-      free(bound[n].rotate);
-    }
-  }
-}
-  
-
-/*-----------------------------------------------------------------------------
-  void init_halo(double *var, int nx, int ny, int nz, int halo)
-  initialze the halo data to be zero.
-  ---------------------------------------------------------------------------*/
-void init_halo(double *var, int nx, int ny, int nz, int halo)
-{
-  int i, j, k;
-  int nxd, nyd, nall;
-
-  nxd = nx+2*halo;
-  nyd = ny+2*halo;
-  nall = nxd*nyd;
-  
-  for(k=0; k<nz; k++) {
-    for(j=0; j<nyd; j++) for(i=0; i<halo; i++) var[k*nall+j*nxd+i] = 0; /* west halo */
-    for(j=0; j<nyd; j++) for(i=nx+halo; i<nxd; i++) var[k*nall+j*nxd+i] = 0; /* east halo */
-    for(j=0; j<halo; j++) for(i=0; i<nxd; i++) var[k*nall+j*nxd+i] = 0; /* south halo */
-    for(j=ny+halo; j<nyd; j++) for(i=0; i<nxd; i++) var[k*nall+j*nxd+i] = 0; /* north halo */
-  }
-
-};/* init_halo */
-
- 
-void update_halo(int nx, int ny, int nz, double *data, Bound_config *bound, Data_holder *dHold)
-{
-  int nbound, n, i, j, k, l, size1, size2, nx2, ny2;
-  int is1, ie1, js1, je1, is2, ie2, js2, je2, bufsize;
-  double *buffer;
-  
-  nbound = bound->nbound;
-  size1  = nx*ny;
-
-  for(n=0; n<nbound; n++) {
-    is1 = bound->is1[n];
-    ie1 = bound->ie1[n];
-    js1 = bound->js1[n];
-    je1 = bound->je1[n];
-    is2 = bound->is2[n];
-    ie2 = bound->ie2[n];
-    js2 = bound->js2[n];
-    je2 = bound->je2[n];
-    nx2 = dHold[n].nx;
-    ny2 = dHold[n].ny;
-    size2 = nx2*ny2;
-    bufsize = nz*(ie2-is2+1)*(je2-js2+1);
-    buffer = (double *)malloc(bufsize*sizeof(double));
-    /* fill the buffer */
-    l = 0;
-    switch(bound->rotate[n]) {
-    case ZERO:
-      for(k=0; k<nz; k++) for(j=js2; j<=je2; j++) for(i=is2; i<=ie2; i++) buffer[l++] = dHold[n].data[k*size2+j*nx2+i];
-      break;
-    case NINETY:
-      for(k=0; k<nz; k++) for(i=ie2; i>=is2; i--) for(j=js2; j<=je2; j++) buffer[l++] = dHold[n].data[k*size2+j*nx2+i];
-      break;
-    case MINUS_NINETY:
-      for(k=0; k<nz; k++) for(i=is2; i<=ie2; i++) for(j=je2; j>=js2; j--) buffer[l++] = dHold[n].data[k*size2+j*nx2+i];
-      break;
-    case ONE_HUNDRED_EIGHTY:
-      for(k=0; k<nz; k++) for(j=je2; j>=js2; j--) for(i=ie2; i>=is2; i--) buffer[l++] = dHold[n].data[k*size2+j*nx2+i];
-      break;
-    }
-    l = 0;
-    for(k=0; k<nz; k++) for(j=js1; j<=je1; j++) for(i=is1; i<=ie1; i++) data[k*size1+j*nx+i] = buffer[l++];
-    free(buffer);
-  }  
-
-}
- 
diff --git a/gridspec/tools/shared/fregrid_util.h b/gridspec/tools/shared/fregrid_util.h
deleted file mode 100644
index e07b5ad..0000000
--- a/gridspec/tools/shared/fregrid_util.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef FREGRID_UTIL_H_
-#define FREGRID_UTIL_H_
-#include "globals.h"
-void set_mosaic_data_file(int ntiles, const char *mosaic_file, const char *dir, File_config *file,
-			  const char *filename);
-void set_field_struct(int ntiles, Field_config *field, int nvar, char * varname, File_config *file);
-void get_input_grid(int ntiles, Grid_config *grid, Bound_config *bound, const char *mosaic_file, unsigned int opcode);
-void get_output_grid_from_mosaic(int ntiles, Grid_config *grid, const char *mosaic_file, unsigned int opcode);
-void get_output_grid_by_size(int ntiles, Grid_config *grid, double lonbegin, double lonend, double latbegin, double latend, 
-                             int nlon, int nlat, int finer_steps, int center_y, unsigned int opcode);
-void get_input_metadata(int ntiles, int nfiles, File_config *file1, File_config *file2,
-		        Field_config *scalar, Field_config *u_comp, Field_config *v_comp,
-			const Grid_config *grid, int kbegin, int kend, int lbegin, int lend, unsigned int opcode);
-void set_output_metadata (int ntiles_in, int nfiles, const File_config *file1_in, const File_config *file2_in,
-			  const Field_config *scalar_in, const Field_config *u_in, const Field_config *v_in,
-			  int ntiles_out, File_config *file1_out, File_config *file2_out, Field_config *scalar_out,
-			  Field_config *u_out, Field_config *v_out, const Grid_config *grid_out, const char *history, 
-                          const char *tagname);
-void get_field_attribute( int ntiles, Field_config *field);
-void copy_field_attribute( int ntiles_out, Field_config *field_in, Field_config *field_out);
-void set_remap_file( int ntiles, const char *mosaic_file, const char *remap_file, Interp_config *interp, unsigned int *opcode, int save_weight_only);
-void write_output_time(int ntiles, File_config *output, int level);
-void get_input_data(int ntiles, Field_config *field, Grid_config *grid, Bound_config *bound,
-		    int varid, int level_z, int level_n, int level_t);
-void get_test_input_data(char *test_case, double test_param, int ntiles, Field_config *field,
-			 Grid_config *grid, Bound_config *bound, unsigned int opcode);
-void allocate_field_data(int ntiles, Field_config *field, Grid_config *grid);
-void write_field_data(int ntiles, Field_config *field, Grid_config *grid, int varid, int level_z, int level_n, int level_t);
-
-#endif
diff --git a/gridspec/tools/shared/make_boundary_contact.c b/gridspec/tools/shared/make_boundary_contact.c
deleted file mode 100644
index 0a92326..0000000
--- a/gridspec/tools/shared/make_boundary_contact.c
+++ /dev/null
@@ -1,483 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include "mpp_io.h"
-#include "mpp.h"
-#include "make_boundary_contact.h"
-#include "mosaic_util.h"
-#include "tool_util.h"
-
-const int MAXCONTACT = 100;
-double* east_bound(const double *data, int nx, int ny);
-double* west_bound(const double *data, int nx, int ny);
-double* south_bound(const double *data, int nx, int ny);
-double* north_bound(const double *data, int nx, int ny);
-int get_contact_index( int size1, int size2, double *x1, double *y1, double *x2, double *y2, double periodx,
-		       double periody, int *start1, int *end1, int *start2, int *end2);
-#define EPSLN (1.0e-10)
-
-/************************************************************************************************
-  This routine will create the boundary condition of the mosaic, whose tile grid files
-  are tilefile. Then save the boundary condition (line contact) into file file
-  contact_file. Return ncontact.
-  This routine assume the starting and ending points of the  contact line are coincidence with
-  the grid points of both tiles. lrg_rectangle tiles are assumed. 
-************************************************************************************************/
-int make_boundary_contact(const char *mosaic_name, int ntile, char tilefile[][STRING],
-			  const char *contact_file, double periodx, double periody,
-			  const char *history, char *grid_type, char *congruence)
-{
-  char tagname[] = "$Name:  $";
-
-  double *xb1, *yb1, *xb2, *yb2;
-  int ncontact, start1, end1, start2, end2;
-  int nx1, ny1, nx2, ny2, n, m, i;
-  int *nxp=NULL, *nyp=NULL;
-  double **x=NULL, **y=NULL;
-  double *x1=NULL, *x2=NULL, *y1=NULL, *y2=NULL;
-  int tile1[MAXCONTACT], tile2[MAXCONTACT];
-  int istart1[MAXCONTACT], iend1[MAXCONTACT], jstart1[MAXCONTACT], jend1[MAXCONTACT];
-  int istart2[MAXCONTACT], iend2[MAXCONTACT], jstart2[MAXCONTACT], jend2[MAXCONTACT];
-  char tile_history[512];
-  char **tile_name=NULL;
-  
-  /* First read the grid */
-  nxp = (int *)malloc(ntile*sizeof(int));
-  nyp = (int *)malloc(ntile*sizeof(int));
-  x = (double **)malloc(ntile*sizeof(double *));
-  y = (double **)malloc(ntile*sizeof(double *));
-  tile_name = (char **)malloc(ntile*sizeof(char *));
-  strcpy(grid_type, "not-specified");
-  for(n=0; n<ntile; n++) {
-    int fid, vid;
-    fid = mpp_open(tilefile[n], MPP_READ);
-    nxp[n] = mpp_get_dimlen(fid, "nxp");
-    nyp[n] = mpp_get_dimlen(fid, "nyp");
-    x[n] = (double *)malloc(nxp[n]*nyp[n]*sizeof(double));
-    y[n] = (double *)malloc(nxp[n]*nyp[n]*sizeof(double));
-    tile_name[n] = (char *)malloc(STRING*sizeof(char));
-    vid = mpp_get_varid(fid, "tile");
-    mpp_get_var_value(fid, vid, tile_name[n]);
-    vid = mpp_get_varid(fid, "x");
-    mpp_get_var_value(fid, vid, x[n]);
-    vid = mpp_get_varid(fid, "y");
-    mpp_get_var_value(fid, vid, y[n]);
-    if(n==0) {
-      if(mpp_global_att_exist(fid, "history")) {
-	char *pch;
-	mpp_get_global_att(fid, "history", tile_history);
-	pch = strtok (tile_history," ");
-	while (pch != NULL) {
-	  pch = strtok (NULL, " ");
-	  if( !strcmp(pch, "--grid_type") ) {
-	    pch = strtok (NULL, " ");
-	    if(!strcmp(pch, "gnomonic_ed"))
-	      strcpy(grid_type, "gnomonic_cubic_sphere");
-	    else
-	      strcpy(grid_type, pch);
-	    break;
-	  }
-	}
-      }
-    }
-    
-    mpp_close(fid);
-  }  
-
-  strcpy(congruence, "true");
-  for(n=1; n<ntile; n++) {
-    if(nxp[n] != nxp[n-1] || nyp[n] != nyp[n-1] ) {
-      strcpy(congruence, "false");
-      break;
-    }
-  }
-  
-  ncontact = 0;
-  for(n=0; n<ntile; n++) {
-    for(m=n; m<ntile; m++) {
-      x1 = x[n];
-      x2 = x[m];
-      y1 = y[n];
-      y2 = y[m];
-      nx1 = nxp[n]; ny1 = nyp[n];
-      nx2 = nxp[m]; ny2 = nyp[m];
-      /* East bound of tile1 and west bound of tile2 */
-      xb1 = east_bound(x1, nx1, ny1);
-      yb1 = east_bound(y1, nx1, ny1);
-      xb2 = west_bound(x2, nx2, ny2);
-      yb2 = west_bound(y2, nx2, ny2);
-      if( get_contact_index( ny1, ny2, xb1, yb1, xb2, yb2, periodx, 0.0, &start1, &end1, &start2, &end2) ) {
-	if(ncontact == MAXCONTACT) mpp_error("make_boundary_contact: number of contacts is more than MAXCONTACT 1");
-	istart1[ncontact] = nx1-1;
-	iend1[ncontact]   = nx1-1;
-	istart2[ncontact] = 1;
-	iend2[ncontact]   = 1;    
-	jstart1[ncontact] = start1;
-	jend1[ncontact]   = end1;
-	jstart2[ncontact] = start2;
-	jend2[ncontact]   = end2;
-	tile1[ncontact]   = n;
-	tile2[ncontact]   = m;
-	ncontact++;   
-      }
-
-      /* East bound of tile1 and SOUTH bound of tile2, tile1 and tile must be different tile */
-      if(n != m) {
-	free(xb2);
-	free(yb2);
-	xb2 = south_bound(x2, nx2, ny2);
-	yb2 = south_bound(y2, nx2, ny2);
-	if( get_contact_index( ny1, nx2, xb1, yb1, xb2, yb2, 0.0, 0.0, &start1, &end1, &start2, &end2) ) {
-	  if(ncontact == MAXCONTACT) mpp_error("make_boundary_contact: number of contacts is more than MAXCONTACT 2");
-	  istart1[ncontact] = nx1-1;
-	  iend1[ncontact]   = nx1-1;
-	  istart2[ncontact] = start2;
-	  iend2[ncontact]   = end2;    
-	  jstart1[ncontact] = start1;
-	  jend1[ncontact]   = end1;
-	  jstart2[ncontact] = 1;
-	  jend2[ncontact]   = 1;
-	  tile1[ncontact]   = n;
-	  tile2[ncontact]   = m;  
-	  ncontact++;
-	}
-      }
-      free(xb1);
-      free(yb1);   
-      free(xb2);
-      free(yb2);  
-  
-      /* South bound of tile1 and NORTH bound of tile2 */
-      xb1 = south_bound(x1, nx1, ny1);
-      yb1 = south_bound(y1, nx1, ny1);
-      xb2 = north_bound(x2, nx2, ny2);
-      yb2 = north_bound(y2, nx2, ny2);
-      if( get_contact_index( nx1, nx2, xb1, yb1, xb2, yb2, 0.0, periody, &start1, &end1, &start2, &end2) ) {
-	if(ncontact == MAXCONTACT) mpp_error("make_boundary_contact: number of contacts is more than MAXCONTACT 3");
-	istart1[ncontact] = start1;
-	iend1[ncontact]   = end1;
-	istart2[ncontact] = start2;
-	iend2[ncontact]   = end2;    
-	jstart1[ncontact] = 1;
-	jend1[ncontact]   = 1;
-	jstart2[ncontact] = ny2-1;
-	jend2[ncontact]   = ny2-1;
-	tile1[ncontact]   = n;
-	tile2[ncontact]   = m;
-	ncontact++;
-      }
-
-      /* South bound of tile1 and East bound of tile2, tile1 and tile must be different tile*/  
-      if(n != m ) {
-	free(xb2);
-	free(yb2);
-	xb2 = east_bound(x2, nx2, ny2);
-	yb2 = east_bound(y2, nx2, ny2);
-	if( get_contact_index( nx1, ny2, xb1, yb1, xb2, yb2, 0.0, 0.0, &start1, &end1, &start2, &end2) ) {
-	  if(ncontact == MAXCONTACT) mpp_error("make_boundary_contact: number of contacts is more than MAXCONTACT 4");
-	  istart1[ncontact] = start1;
-	  iend1[ncontact]   = end1;
-	  istart2[ncontact] = nx2-1;
-	  iend2[ncontact]   = nx2-1;    
-	  jstart1[ncontact] = 1;
-	  jend1[ncontact]   = 1;
-	  jstart2[ncontact] = start2;
-	  jend2[ncontact]   = end2;
-	  tile1[ncontact]   = n;
-	  tile2[ncontact]   = m;
-	  ncontact++;
-	}
-      }
-      free(xb1);
-      free(yb1);   
-      free(xb2);
-      free(yb2);  
-
-      /* to avoid duplicate, the following will be done only when tile1 not equal to tile2 */
-      if(n != m) {
-	/* West bound of tile1 and east bound of tile2*/
-	xb1 = west_bound(x1, nx1, ny1);
-	yb1 = west_bound(y1, nx1, ny1);
-	xb2 = east_bound(x2, nx2, ny2);
-	yb2 = east_bound(y2, nx2, ny2);
-	if( get_contact_index( ny1, ny2, xb1, yb1, xb2, yb2, periodx, 0.0, &start1, &end1, &start2, &end2) ) {
-	  if(ncontact == MAXCONTACT) mpp_error("make_boundary_contact: number of contacts is more than MAXCONTACT 5");
-	  istart1[ncontact] = 1;
-	  iend1[ncontact]   = 1;
-	  istart2[ncontact] = nx2-1;
-	  iend2[ncontact]   = nx2-1;    
-	  jstart1[ncontact] = start1;
-	  jend1[ncontact]   = end1;
-	  jstart2[ncontact] = start2;
-	  jend2[ncontact]   = end2;
-	  tile1[ncontact]   = n;
-	  tile2[ncontact]   = m;
-	  ncontact++;
-	}
-	free(xb2);
-	free(yb2);
-
-	/* West bound of tile1 and North bound of tile2 */  
-	xb2 = north_bound(x2, nx2, ny2);
-	yb2 = north_bound(y2, nx2, ny2);
-	if( get_contact_index( ny1, nx2, xb1, yb1, xb2, yb2, 0.0, 0.0, &start1, &end1, &start2, &end2) ) {
-	  if(ncontact == MAXCONTACT) mpp_error("make_boundary_contact: number of contacts is more than MAXCONTACT 6");
-	  istart1[ncontact] = 1;
-	  iend1[ncontact]   = 1;
-	  istart2[ncontact] = start2;
-	  iend2[ncontact]   = end2;    
-	  jstart1[ncontact] = start1;
-	  jend1[ncontact]   = end1;
-	  jstart2[ncontact] = ny2-1;
-	  jend2[ncontact]   = ny2-1;
-	  tile1[ncontact]   = n;
-	  tile2[ncontact]   = m;
-	  ncontact++;
-	}
-	free(xb1);
-	free(yb1);   
-	free(xb2);
-	free(yb2);  
-
-  
-	/* North bound of tile1 and South bound of tile2 */
-	xb1 = north_bound(x1, nx1, ny1);
-	yb1 = north_bound(y1, nx1, ny1);
-	xb2 = south_bound(x2, nx2, ny2);
-	yb2 = south_bound(y2, nx2, ny2);
-	if( get_contact_index( nx1, nx2, xb1, yb1, xb2, yb2, 0.0, periody, &start1, &end1, &start2, &end2) ) {
-	  if(ncontact == MAXCONTACT) mpp_error("make_boundary_contact: number of contacts is more than MAXCONTACT 7");
-	  istart1[ncontact] = start1;
-	  iend1[ncontact]   = end1;
-	  istart2[ncontact] = start2;
-	  iend2[ncontact]   = end2;    
-	  jstart1[ncontact] = ny1-1;
-	  jend1[ncontact]   = ny1-1;
-	  jstart2[ncontact] = 1;
-	  jend2[ncontact]   = 1;
-	  tile1[ncontact]   = n;
-	  tile2[ncontact]   = m;
-	  ncontact++;
-	}
-	free(xb2);
-	free(yb2);
-
-	/* North bound of tile1 and West bound of tile2 */  
-	xb2 = west_bound(x2, nx2, ny2);
-	yb2 = west_bound(y2, nx2, ny2);
-	if( get_contact_index( nx1, ny2, xb1, yb1, xb2, yb2, 0.0, 0.0, &start1, &end1, &start2, &end2) ) {
-	  if(ncontact == MAXCONTACT) mpp_error("make_boundary_contact: number of contacts is more than MAXCONTACT 8");
-	  istart1[ncontact] = start1;
-	  iend1[ncontact]   = end1;
-	  istart2[ncontact] = 1;
-	  iend2[ncontact]   = 1;    
-	  jstart1[ncontact] = ny1-1;
-	  jend1[ncontact]   = ny1-1;
-	  jstart2[ncontact] = start2;
-	  jend2[ncontact]   = end2;
-	  tile1[ncontact]   = n;
-	  tile2[ncontact]   = m;
-	  ncontact++;
-	}
-	free(xb1);
-	free(yb1);   
-	free(xb2);
-	free(yb2);  
-      }
-
-      /* when tile1 = tile2, we need to consider about folded. Only foled north is considered here */
-      if(n == m) {
-	int i, folded = 1;
-	double dx;
-	xb1 = north_bound(x1, nx1, ny1);
-	yb1 = north_bound(y1, nx1, ny1);
-	for(i=0; i<nx1/2; i++) {
-	  if( yb1[i] != yb1[nx1-i-1] ) {
-	    folded = 0;
-	    break;
-	  }
-	  dx = fabs(xb1[i] - xb1[nx1-i-1]);
-	  if( dx !=0 && dx != 360 ) {
-	    folded = 0;
-	    break;
-	  }
-	}
-	if(folded) {
-	  if(ncontact == MAXCONTACT) mpp_error("make_boundary_contact: number of contacts is more than MAXCONTACT 9");
-	  istart1[ncontact] = 1;
-	  iend1[ncontact]   = nx1/2;
-	  istart2[ncontact] = nx1-1;
-	  iend2[ncontact]   = nx1/2+1;    
-	  jstart1[ncontact] = ny1-1;
-	  jend1[ncontact]   = ny1-1;
-	  jstart2[ncontact] = ny1-1;
-	  jend2[ncontact]   = ny1-1;
-	  tile1[ncontact]   = n;
-	  tile2[ncontact]   = m;
-	  ncontact++;
-	}
-	free(xb1);
-	free(yb1);
-      }
-    }
-  }
-  
-  /* write out data */
-  if(ncontact>0) {
-    char str[STRING], outfile[STRING];
-    int fid, dim_ncontact, dim_string, id_mosaic, id_contacts;
-    int id_contact_index, dim[2];
-    size_t start[4], nwrite[4];
-
-    fid = mpp_open(contact_file, MPP_WRITE);
-    /* define dimenison */
-    dim_ncontact = mpp_def_dim(fid, "ncontact", ncontact);
-    dim_string = mpp_def_dim(fid, "string", STRING);    
-    /* define variable */
-    dim[0] = dim_ncontact; dim[1] = dim_string;
-    id_contacts = mpp_def_var(fid, "contacts", MPP_CHAR, 2, dim, 5, "standard_name", "grid_contact_spec",
-			      "contact_type", "boundary", "alignment", "true",
-			      "contact_index", "contact_index", "orientation", "orient");
-    id_contact_index = mpp_def_var(fid, "contact_index", MPP_CHAR, 2, dim, 1, "standard_name",
-				   "starting_ending_point_index_of_contact");
-
-    mpp_def_global_att(fid, "grid_version", grid_version);
-    mpp_def_global_att(fid, "code_version", tagname);
-    mpp_def_global_att(fid, "history", history);
-    mpp_end_def(fid);
-
-    /* write out data */
-    for(i=0; i<4; i++) {
-      start[i] = 0; nwrite[i] = 1;
-    }
-
-    for(n=0; n<ncontact; n++) {
-      sprintf(str,"%s:%s::%s:%s", mosaic_name, tile_name[tile1[n]], mosaic_name,
-	      tile_name[tile2[n]]);
-      start[0] = n; nwrite[1] = strlen(str);
-      mpp_put_var_value_block(fid, id_contacts, start, nwrite, str);
-      sprintf(str,"%d:%d,%d:%d::%d:%d,%d:%d", istart1[n], iend1[n], jstart1[n], jend1[n],
-	      istart2[n], iend2[n], jstart2[n], jend2[n] );
-      nwrite[1] = strlen(str);
-      mpp_put_var_value_block(fid, id_contact_index, start, nwrite, str);
-    }
-    mpp_close(fid);    
-  }  
-
-
-  /* release memory */
-  for(n=0; n<ntile; n++) {
-    free(tile_name[n]);
-    free(x[n]);
-    free(y[n]);
-  }
-  free(tile_name);
-  free(nxp);
-  free(nyp);
-  free(x);
-  free(y);
-  
-  return ncontact;
-}; /*make_boundary_contact*/
-
-
-/*************************************************************************************************/
-int get_contact_index( int size1, int size2, double *x1, double *y1, double *x2, double *y2, double periodx,
-		       double periody, int *start1, int *end1, int *start2, int *end2)
-{
-  int i1, i2;
-  double dx, dy;
-
-  /* Find the first point in tile 1 cocindent with a point in tile2  */
-  *start1 = -1;
-  *start2 = -1;
-  for(i1=0; i1<size1; i1++) {
-    for(i2=0; i2<size2; i2++) {
-      dx = fabs(x1[i1]- x2[i2]);
-      dx = min(dx, fabs(dx-periodx));
-      dy = fabs(y1[i1]- y2[i2]);
-      dy = min(dy, fabs(dy-periody));
-      if( dx < EPSLN && dy <EPSLN ) {
-	*start1 = i1+1;
-	*start2 = i2+1;
-	goto foundstart;
-      }
-    }
-  }
-
-  return 0;
-    
-  foundstart:
-
-  /* Find the last point in tile 1 cocindent with a point in tile2 */
-  *end1 = -1;
-  *end2 = -1;
-  for(i1=size1-1; i1>=0; i1--) {
-    for(i2=size2-1; i2>=0; i2--) {
-      dx = fabs(x1[i1]- x2[i2]);
-      dx = min(dx, fabs(dx-periodx));
-      dy = fabs(y1[i1]- y2[i2]);
-      dy = min(dy, fabs(dy-periody));
-      if( dx < EPSLN && dy <EPSLN ) {
-	*end1 = i1+1;
-	*end2 = i2+1;
-	goto foundend;
-      }
-    }
-  }
-
-  return 0;
-    
- foundend: if( *start1 == *end1 || *start2 == *end2 ) return 0;
-
-  if(*start1 > *end1 )
-    (*start1)--;
-  else
-    (*end1)--;
-
-  if(*start2 > *end2 )
-    (*start2)--;
-  else
-    (*end2)--;  
-
-  return 1;
-    
-};
-
-
-double* west_bound(const double *data, int nx, int ny)
-{
-  int i;
-  double *bnd;
-  bnd = (double *)malloc(ny*sizeof(double));
-  for(i=0; i<ny; i++) bnd[i] = data[i*nx];
-  return bnd;
-}
-
-double* east_bound(const double *data, int nx, int ny)
-{
-  int i;
-  double *bnd;
-  bnd = (double *)malloc(ny*sizeof(double));
-  for(i=0; i<ny; i++) bnd[i] = data[i*nx+nx-1];
-  return bnd;
-}
-
-double* south_bound(const double *data, int nx, int ny)
-{
-  int i;
-  double *bnd;
-  bnd = (double *)malloc(nx*sizeof(double));
-  for(i=0; i<nx; i++) bnd[i] = data[i];
-  return bnd;
-}
-
-double* north_bound(const double *data, int nx, int ny)
-{
-  int i;
-  double *bnd;
-  bnd = (double *)malloc(nx*sizeof(double));
-  for(i=0; i<nx; i++) bnd[i] = data[(ny-1)*nx+i];
-  return bnd;
-}
diff --git a/gridspec/tools/shared/make_boundary_contact.h b/gridspec/tools/shared/make_boundary_contact.h
deleted file mode 100644
index 761ba08..0000000
--- a/gridspec/tools/shared/make_boundary_contact.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef MAKE_BOUNDATRY_CONTACT_
-#define MAKE_BOUNDATRY_CONTACT_
-#include "constant.h"
-int make_boundary_contact(const char *mosaic_name, int ntile, char tilefile[][STRING],
-			  const char *contact_file, double periodx, double periody, 
-                          const char *history, char *grid_type, char *congruence);
-#endif
diff --git a/gridspec/tools/shared/make_xgrid_contact.c b/gridspec/tools/shared/make_xgrid_contact.c
deleted file mode 100644
index 1cc01be..0000000
--- a/gridspec/tools/shared/make_xgrid_contact.c
+++ /dev/null
@@ -1,227 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "mpp_io.h"
-#include "mpp.h"
-#include "constant.h"
-#include "make_xgrid_contact.h"
-#include "create_xgrid.h"
-#include "tool_util.h"
-#define  MAX_XGRID_FILE (100)
- 
-
-typedef struct {
-  int nx, ny;
-  double *x, *y;
-  double *mask;
-  char tile_name[STRING];
-} grid_type;
-
-
-/* This routine will get all the tile grid information */
-void get_mosaic_grid(const char *mosaic, int ntiles, grid_type *Grid)
-{
-  int nx, ny, n, i, j;
-  int m_fid, g_fid, vid, vid_childfile;
-  char dir[STRING], grid_file[STRING], filename[STRING];
-  double *tmpx=NULL, *tmpy=NULL;
-  size_t start[4], nread[4];
-  
-  m_fid = mpp_open(mosaic, MPP_READ);
-  vid_childfile = mpp_get_varid(m_fid, TILE_FILES_NAME);
-  get_file_path(mosaic , dir);
-  for(n=0; n<ntiles ; n++) {
-    start[0] = n; start[1] = 0; nread[0] = 1; nread[1] = STRING;
-    mpp_get_var_value_block(m_fid, vid_childfile, start, nread, filename);
-    sprintf(grid_file, "%s/%s", dir, filename);
-    g_fid = mpp_open(grid_file, MPP_READ);
-    vid = mpp_get_varid(g_fid, "tile");
-    mpp_get_var_value(g_fid, vid, Grid[n].tile_name);
-  
-    nx = mpp_get_dimlen(g_fid, "nx");
-    ny = mpp_get_dimlen(g_fid, "ny");
-    if(nx%2) mpp_error("make_xgrid_mosaic: the size of dimension nx of mosaic should be even (on supergrid)");
-    if(ny%2) mpp_error("make_xgrid_mosaic: the size of dimension ny of mosaic should be even (on supergrid)");
-    tmpx = (double *)malloc((nx+1)*(ny+1)*sizeof(double));
-    tmpy = (double *)malloc((nx+1)*(ny+1)*sizeof(double));
-    nx /= 2;
-    ny /= 2;
-    Grid[n].nx =nx;
-    Grid[n].ny =ny;
-    Grid[n].x = (double *)malloc((nx+1)*(ny+1)*sizeof(double));
-    Grid[n].y = (double *)malloc((nx+1)*(ny+1)*sizeof(double));
-    Grid[n].mask = (double *)malloc(nx*ny*sizeof(double));
-    vid = mpp_get_varid(g_fid, "x");
-    mpp_get_var_value(g_fid, vid, tmpx);
-    vid = mpp_get_varid(g_fid, "y");
-    mpp_get_var_value(g_fid, vid, tmpy);
-    for(j=0; j<=ny; j++) for(i=0; i<=nx; i++) {
-      Grid[n].x[j*(nx+1)+i] = tmpx[2*j*(2*nx+1)+2*i];
-      Grid[n].y[j*(nx+1)+i] = tmpy[2*j*(2*nx+1)+2*i];
-    }
-    
-    for(i=0; i<nx*ny; i++) Grid[n].mask[i] = 1.0;
-    free(tmpx);
-    free(tmpy);
-    mpp_close(g_fid);
-  }  
-
-  mpp_close(m_fid);
-  
-}
-  
-
-
-/****************************************************************************
-  This routine will compute the exchange grid information between two mosaic
-  and write out those information.
-
-****************************************************************************/
-int make_xgrid_contact(const char* mosaic1, const char* mosaic2, const char* contact_file,
-		       const char* history)
-{
-  int fid, vid, n;
-  int ntiles1, ntiles2, n1, n2, nxgrid, nxfile=0;
-  grid_type *Grid1=NULL, *Grid2=NULL;
-  int *i1=NULL, *j1=NULL, *i2=NULL, *j2=NULL;
-  double *di1=NULL, *dj1=NULL, *di2=NULL, *dj2=NULL, *xarea=NULL;
-  double *clon=NULL, *clat=NULL;
-  
-  char xfile[MAX_XGRID_FILE][STRING];
-  char mosaic1_name[STRING], mosaic2_name[STRING];  
-  char tagname[] = "$Name:  $";
-  
-  /* First read the grid information of mosaic1*/
-  fid = mpp_open(mosaic1, MPP_READ);
-  ntiles1 = mpp_get_dimlen(fid, NTILES_NAME);
-  vid = mpp_get_varid(fid, MOSAIC_NAME);    
-  mpp_get_var_value(fid, vid, mosaic1_name);
-  mpp_close(fid);
-  fid = mpp_open(mosaic2, MPP_READ);
-  vid = mpp_get_varid(fid, MOSAIC_NAME);    
-  mpp_get_var_value(fid, vid, mosaic2_name);
-  ntiles2 = mpp_get_dimlen(fid, NTILES_NAME);
-  mpp_close(fid);
-  Grid1 = (grid_type *)malloc(ntiles1*sizeof(grid_type));
-  Grid2 = (grid_type *)malloc(ntiles2*sizeof(grid_type));
-  get_mosaic_grid(mosaic1, ntiles1, Grid1);
-  get_mosaic_grid(mosaic2, ntiles2, Grid2);
-  i1    = (int    *)malloc(MAXXGRID   * sizeof(int   ));
-  j1    = (int    *)malloc(MAXXGRID   * sizeof(int   ));
-  i2    = (int    *)malloc(MAXXGRID   * sizeof(int   ));
-  j2    = (int    *)malloc(MAXXGRID   * sizeof(int   ));
-  clon  = (double *)malloc(MAXXGRID   * sizeof(double));
-  clat  = (double *)malloc(MAXXGRID   * sizeof(double));
-  di1   = (double *)malloc(MAXXGRID   * sizeof(double));
-  dj1   = (double *)malloc(MAXXGRID   * sizeof(double));
-  di2   = (double *)malloc(MAXXGRID   * sizeof(double));
-  dj2   = (double *)malloc(MAXXGRID   * sizeof(double));
-  xarea = (double *)malloc(MAXXGRID   * sizeof(double));
-
-  nxfile = 0;
-  for(n1=0; n1<ntiles1; n1++) {
-    for(n2=0;n2<ntiles2;n2++) {
-      nxgrid = create_xgrid_2dx2d_order2(&(Grid1[n1].nx), &(Grid1[n1].ny), &(Grid2[n2].nx), &(Grid2[n2].ny),
-					 Grid1[n1].x, Grid1[n1].y, Grid1[n2].x, Grid1[n2].y, Grid1[n1].mask,
-					 i1, j1, i2, j2, xarea, clon, clat);
-      if(nxgrid>0) {
-	int dim_ncontact, dim_two, dims[2], i;
-	int id_tile1_cell, id_tile2_cell, id_xgrid_area, id_tile1_dist, id_tile2_dist;
-	size_t start[4], nwrite[4];
-	if(nxfile==MAX_XGRID_FILE) mpp_error("make_xgrid_contact: number of exchange grid file is greater "
-					     "than MAX_XGRID_FILE, increase MAX_XGRID_FILE");
-	sprintf(xfile[nxfile], "%s_%sXlnd_%s_%s.nc", mosaic1_name, Grid1[n1].tile_name, mosaic2_name, Grid2[n2].tile_name);
-	fid = mpp_open(xfile[nxfile], MPP_WRITE);
-	dim_ncontact = mpp_def_dim(fid, "ncontact", nxgrid);
-	dim_two    = mpp_def_dim(fid, "two", 2);
-	dims[0] = dim_ncontact;
-	dims[1] = dim_two;
-	id_tile1_cell = mpp_def_var(fid, "tile1_cell", NC_INT, 2, dims, 1,
-				    "standard_name", "parent_cell_indices_in_mosaic1");
-	id_tile2_cell = mpp_def_var(fid, "tile2_cell", NC_INT, 2, dims, 1,
-				    "standard_name", "parent_cell_indices_in_mosaic2");
-	id_xgrid_area = mpp_def_var(fid, "xgrid_area", NC_DOUBLE, 1, &dim_ncontact, 2,
-				    "standard_name", "exchange_grid_area", "units", "m2");
-	id_tile1_dist = mpp_def_var(fid, "tile1_distance", NC_DOUBLE, 2, dims, 1,
-				    "standard_name", "distance_from_parent1_cell_centroid");
-	id_tile2_dist = mpp_def_var(fid, "tile2_distance", NC_DOUBLE, 2, dims, 1,
-				    "standard_name", "distance_from_parent2_cell_centroid");
-
-	mpp_end_def(fid);
-	for(i=0; i<4; i++) {
-	  start[i] = 0; nwrite[i] = 1;
-	}
-	   
-	mpp_put_var_value(fid, id_tile1_cell, i1);
-	mpp_put_var_value(fid, id_tile2_cell, i2);
-	mpp_put_var_value(fid, id_xgrid_area, xarea);
-	/*	mpp_put_var_value(fid, id_tile1_dist, di1);
-	  mpp_put_var_value(fid, id_tile2_dist, di2); */
-	start[1] = 1;
-	mpp_put_var_value(fid, id_tile1_cell, j1);
-	mpp_put_var_value(fid, id_tile2_cell, j2);
-	/*	mpp_put_var_value(fid, id_tile1_dist, dj1);
-	  mpp_put_var_value(fid, id_tile2_dist, dj2); */
-	mpp_close(fid);
-	nxfile ++;
-      }
-    }
-  }
-
-  if(nxfile >0) {
-    int dim_string, dim_nchild, dim[2];
-    int id_childfile, i;
-    size_t start[4], nwrite[4];
-    
-    fid = mpp_open(contact_file, MPP_WRITE);
-    dim_string = mpp_def_dim(fid, STRING_NAME, STRING);  
-    dim_nchild = mpp_def_dim(fid, NCONTACT_NAME, nxfile);
-    dim[0] = dim_nchild; dim[1] = dim_string;
-    id_childfile = mpp_def_var(fid, TILE_FILES_NAME, MPP_CHAR, 2, dim, 0);
-    mpp_def_global_att(fid, GRID_VERSION_NAME, grid_version);
-    mpp_def_global_att(fid, CODE_VERSION_NAME, tagname);
-    mpp_def_global_att(fid, HISTORY_NAME, history);
-    mpp_end_def(fid);    
-    /* write out data */
-    for(i=0; i<4; i++) {
-      start[i] = 0; nwrite[i] = 1;
-    }
-    for(n=0; n<nxfile; n++) {
-      start[0] = n;
-       nwrite[1] = strlen(xfile[n]);
-       mpp_put_var_value_block(fid, id_childfile, start, nwrite, xfile[n]);
-    }
-    mpp_close(fid);
-  }
-
-  free(i1);
-  free(j1);
-  free(i2);
-  free(j2);  
-  free(di1);
-  free(dj1);
-  free(di2);
-  free(dj2);
-  free(xarea);
-
-  for(n=0; n<ntiles1; n++) {
-    free(Grid1[n].x);
-    free(Grid1[n].y);
-  }
-  for(n=0; n<ntiles2; n++) {
-    free(Grid2[n].x);
-    free(Grid2[n].y);
-  }
-  
-  free(Grid1);
-  free(Grid2);
-  
-  return nxfile;
-    
-}; /* make_xgrid_contact */
-
-
-
-
-
-  
diff --git a/gridspec/tools/shared/make_xgrid_contact.h b/gridspec/tools/shared/make_xgrid_contact.h
deleted file mode 100644
index 42f168b..0000000
--- a/gridspec/tools/shared/make_xgrid_contact.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef MAKE_XGRID_CONTACT_
-#define MAKE_XGRID_CONTACT_
-int make_xgrid_contact(const char* mosaic1, const char* mosaic2, const char* contact_file, const char* history);
-#endif
diff --git a/gridspec/tools/shared/mpp.c b/gridspec/tools/shared/mpp.c
deleted file mode 100644
index 3fc320e..0000000
--- a/gridspec/tools/shared/mpp.c
+++ /dev/null
@@ -1,230 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#ifdef use_libMPI
-#include <mpi.h>
-#endif
-#include "mpp.h"
-
-
-/****************************************************
-         global variables
-*****************************************************/
-int npes, root_pe, pe;
-int *pelist=NULL;
-const int tag = 1;
-#ifdef use_libMPI  
-MPI_Request *request;
-#endif
-
-/**************************************************************
-                     void mpp_init()
-     this routine will create communicator.
-***************************************************************/
-
-void mpp_init(int *argc, char ***argv)
-{
-  int n;
-  
-#ifdef use_libMPI
-  MPI_Init(argc, argv); 
-  MPI_Comm_rank(MPI_COMM_WORLD,&pe);
-  MPI_Comm_size(MPI_COMM_WORLD,&npes);
-  request = (MPI_Request *)malloc(npes*sizeof(MPI_Request));
-  for(n=0; n<npes; n++) request[n] = MPI_REQUEST_NULL;
-#else
-  pe = 0;
-  npes = 1;
-#endif
-  pelist = (int *)malloc(npes*sizeof(int));
-  for(n=0; n<npes; n++) pelist[n] = n;
-  root_pe = 0;
-}; /* mpp_init */
-
-/***********************************************************
-               void mpp_end()
-     This routine will terminate the parallel.
-************************************************************/
-
-void mpp_end()
-{
-#ifdef use_libMPI   
-  MPI_Finalize();
-#endif  
-} /* mpp_end */
-
-/*****************************************************************
-           int mpp_pe()
-      Returns processor ID.
-******************************************************************/
-
-int mpp_pe()
-{
-  return pe;
-}; /* mpp_pe */
-
-
-/**************************************************************
-                 int mpp_npes()
-      Returns processor count for current pelist.
-**************************************************************/
-
-int mpp_npes()
-{
-  return npes;
-}; /* mpp_npes */
-
-/*************************************************************
-               int mpp_root_pe()
-    return root processor of current pelist
-*************************************************************/
-
-int mpp_root_pe()
-{
-  return root_pe;
-}; /* mpp_root_pe */
-
-/*************************************************************
-               int* mpp_get_pelist()
-    return current pelist
-*************************************************************/
-
-int* mpp_get_pelist()
-{
-  return pelist;
-}; /* mpp_get_pelist */
-
-/************************************************************
-    void mpp_sync_self()
- this is to check if current PE's outstanding puts are complete
-*************************************************************/
-void mpp_sync_self() {
-  int n;
-#ifdef use_libMPI     
-  MPI_Status status;
-  
-  for(n=0; n<npes; n++) {
-    if(request[n] != MPI_REQUEST_NULL) MPI_Wait( request+n, &status );
-  }
-#endif
-  
-}
-
-/*************************************************************
-    void mpp_send_double(const double* data, int size, int to_pe)
-      send data to "to_pe"
-*************************************************************/
-
-void mpp_send_double(const double* data, int size, int to_pe)
-{
-#ifdef use_libMPI    
-  MPI_Status status;
-  /* make sure only one message from pe->to_pe in queue */
-  if(request[to_pe] != MPI_REQUEST_NULL) {
-    MPI_Wait( request+to_pe, &status );
-  }
-    
-  MPI_Isend(data, size, MPI_DOUBLE, to_pe, tag, MPI_COMM_WORLD, request+to_pe);
-#endif
-  
-}; /* mpp_send_double */
-
-
-/*************************************************************
-    void mpp_send_int(const int* data, int size, int to_pe)
-      send data to "to_pe"
-*************************************************************/
-
-void mpp_send_int(const int* data, int size, int to_pe)
-{
-#ifdef use_libMPI    
-  MPI_Status status;
-  if(request[to_pe] != MPI_REQUEST_NULL) {
-    MPI_Wait( request+to_pe, &status );
-  }  
-
-  MPI_Isend(data, size, MPI_INT, to_pe, tag, MPI_COMM_WORLD, request+to_pe);
-#endif
-  
-}; /* mpp_send_int */
-
-/***********************************************************
-    void mpp_recv_double(double* data, int size, int from_pe)
-     receive data from "from_pe"
-***********************************************************/
-
-void mpp_recv_double(double* data, int size, int from_pe)
-{
-#ifdef use_libMPI      
-  MPI_Status status;
-  MPI_Recv(data, size, MPI_DOUBLE, from_pe, MPI_ANY_TAG, MPI_COMM_WORLD,&status);
-#endif  
-}; /* mpp_recv_double */
-
-/***********************************************************
-    void mpp_recv_int(int* data, int size, int from_pe)
-     receive data from "from_pe"
-***********************************************************/
-
-void mpp_recv_int(int* data, int size, int from_pe)
-{
-#ifdef use_libMPI      
-  MPI_Status status;
-  MPI_Recv(data, size, MPI_INT, from_pe, MPI_ANY_TAG, MPI_COMM_WORLD,&status);
-#endif  
-}; /* mpp_recv_int */
-
-
-/*******************************************************************************
-  int mpp_sum_int(int count, int *data)
-  sum integer over all the pes.
-*******************************************************************************/
-void mpp_sum_int(int count, int *data)
-{
-
-#ifdef use_libMPI
-  int i;
-  int *sum;
-  sum = (int *)malloc(count*sizeof(int));
-  MPI_Allreduce(data, sum, count, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
-  for(i=0; i<count; i++)data[i] = sum[i];
-  free(sum);
-#endif
-
-
-}; /* mpp_sum_int */
-
-/*******************************************************************************
-  void mpp_sum_double(int count, double *data)
-  sum double over all the pes.
-*******************************************************************************/
-void mpp_sum_double(int count, double *data)
-{
-
-#ifdef use_libMPI
-  int i;
-  double *sum;
-  sum = (double *)malloc(count*sizeof(double));
-  MPI_Allreduce(data, sum, count, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
-  for(i=0; i<count; i++)data[i] = sum[i];
-  free(sum);  
-#endif
-
-
-}; /* mpp_sum_double */
-
-
-/***********************************************************
-    void mpp_error(char *str)
-    error handler: will print out error message and then abort
-***********************************************************/
-
-void mpp_error(char *str)
-{
-  fprintf(stderr, "Error from pe %d: %s\n", pe, str );
-#ifdef use_libMPI      
-  MPI_Abort(MPI_COMM_WORLD, -1);
-#else
-  exit(1);
-#endif  
-}; /* mpp_error */
-
diff --git a/gridspec/tools/shared/mpp.h b/gridspec/tools/shared/mpp.h
deleted file mode 100644
index 51781f1..0000000
--- a/gridspec/tools/shared/mpp.h
+++ /dev/null
@@ -1,25 +0,0 @@
-
-/*********************************************************************
-                    mpp.h
-  This header contains subroutine for parallel programming.
-  only MPI parallel is implemented. 
-  Contact: Zhi.Liang at noaa.gov
- ********************************************************************/
-#ifndef MPP_H_
-#define MPP_H_
-
-void mpp_init(int *argc, char ***argv);          /* start parallel programming, create communicator */
-void mpp_end();           /* end of parallel programming, abort the program */
-int mpp_pe();      /* return processor ID */
-int mpp_root_pe(); /* return root pe of current pelist */
-int mpp_npes();    /* return number of processor used */
-int* mpp_get_pelist();
-void mpp_send_double(const double* data, int size, int to_pe); /* send data */
-void mpp_send_int(const int* data, int size, int to_pe); /* send data */
-void mpp_recv_double(double* data, int size, int from_pe); /* recv data */
-void mpp_recv_int(int* data, int size, int from_pe); /* recv data */
-void mpp_error(char *str);
-void mpp_sum_int(int count, int *data);
-void mpp_sum_double(int count, double *data);
-void mpp_sync_self();
-#endif
diff --git a/gridspec/tools/shared/mpp_domain.c b/gridspec/tools/shared/mpp_domain.c
deleted file mode 100644
index 49715af..0000000
--- a/gridspec/tools/shared/mpp_domain.c
+++ /dev/null
@@ -1,534 +0,0 @@
-/*
-      **** MppDomain.cpp ****
-      MppDomain package
-      NOTE: only mpi is implemented here. if needed, shmem version
-      will be added on in the future.
-      Contact: Zhi.Liang at noaa.gov
-*/
-#include <stdlib.h>
-#include <math.h>
-#include "mpp.h"
-#include "mpp_domain.h"
-
-/***********************************************************
-   global variables
-***********************************************************/
-int pe, npes, root_pe;
-
-/************************************************************
-         void mpp_domain_init()
-   initialization routine. get the processor information.
-   memory allocation.
-************************************************************/
-void mpp_domain_init( )
-{
-  pe      = mpp_pe();
-  npes    = mpp_npes();
-  root_pe = mpp_root_pe();
-}; /* mpp_domain_init */
-
-/*********************************************************** 
-         void mpp_domain_end()
-         release memory.
-***********************************************************/
-void mpp_domain_end ()
-{
-  /* will add something here if needed */
-};
-
-/************************************************************
-    void mpp_define_layout()
-    define domain layout based on given grid resolution and
-    number of processors
-***********************************************************/
-
-void mpp_define_layout(int ni, int nj, int ndivs, int layout[])
-{
-  int idiv, jdiv;
-  float fdiv;
-
-  /*first try to divide ndivs in the domain aspect ratio:
-    if imperfect aspect, reduce idiv till it divides ndivs */
-  fdiv = sqrt((1.0*ndivs*ni)/nj); 
-  idiv = floor(fdiv);
-  if(fdiv-idiv > 0.5) idiv = idiv + 1;
-  idiv = (idiv>1) ? idiv : 1;  /*for isz=1 line above can give 0*/
-  while( ndivs%idiv != 0 ) {
-    idiv = idiv - 1;
-  }                 /*will terminate at idiv=1 if not before*/
-  jdiv = ndivs/idiv;
-  layout[0] = idiv;
-  layout[1] = jdiv;
-};
-
-/***********************************************************
-    void mpp_define_domain_1d(int size, domain1D *domain )
-    define 1-D domain decomposition.
-**********************************************************/
-void mpp_define_domain_1d(int npts, int ndivs, domain1D *domain )
-{
-  int n, npts_left, pos, size;
-
-  domain->beglist = (int *)malloc(ndivs*sizeof(int));
-  domain->endlist = (int *)malloc(ndivs*sizeof(int));
-
-  if(ndivs > npts ) {
-     mpp_error("mpp_define_domain1d: more divisions requested than rows available. " );
-  }
-  npts_left = npts;
-  pos = 0;
-  for(n=0; n<ndivs; n++){
-    domain->beglist[n] = pos;
-    size = ceil((1.0*npts_left)/(ndivs-n));
-    domain->endlist[n] = pos + size - 1;
-    npts_left=npts_left - size;
-    pos += size;
-  }
-
-  if(npes == ndivs) {
-    domain->start = domain->beglist[pe];
-    domain->end   = domain->endlist[pe];
-    domain->size  = domain->end - domain->start + 1;
-    domain->sizeg = npts;
-  }
-  
-}; /* mpp_define_domain_1d */
-
-
-/************************************************************
-  void define_domain(int ni, int nj, int layout[], int xhalo, int yhalo, domain2D *domain  )
-   define 2D domain decomposition
-************************************************************/
-
-void mpp_define_domain2d(int ni, int nj, int layout[], int xhalo, int yhalo, domain2D *domain )
-{
-  domain1D domx, domy;
-  int i, j, posx, posy, n; 
-
-  domain->isclist = (int *)malloc(layout[0]*layout[1]*sizeof(int));
-  domain->ieclist = (int *)malloc(layout[0]*layout[1]*sizeof(int));
-  domain->jsclist = (int *)malloc(layout[0]*layout[1]*sizeof(int));
-  domain->jeclist = (int *)malloc(layout[0]*layout[1]*sizeof(int));  
-
-  mpp_define_domain_1d(ni, layout[0], &domx);
-  mpp_define_domain_1d(nj, layout[1], &domy); 
-
-  n = 0;
-  for(j=0; j<layout[1]; j++) {
-    for(i=0; i<layout[0]; i++) {
-      domain->isclist[n] = domx.beglist[i]+xhalo;
-      domain->ieclist[n] = domx.endlist[i]+xhalo;
-      domain->jsclist[n] = domy.beglist[j]+yhalo;
-      domain->jeclist[n] = domy.endlist[j]+yhalo;
-      n++;
-    }
-  }
-
-  domain->xhalo = xhalo;
-  domain->yhalo = yhalo;
-  domain->isc   = domain->isclist[pe];
-  domain->iec   = domain->ieclist[pe];
-  domain->jsc   = domain->jsclist[pe];
-  domain->jec   = domain->jeclist[pe];
-  domain->isd   = domain->isc - xhalo;
-  domain->ied   = domain->iec + xhalo;
-  domain->jsd   = domain->jsc - yhalo;
-  domain->jed   = domain->jec + yhalo;  
-  domain->nxc   = domain->iec - domain->isc + 1;
-  domain->nyc   = domain->jec - domain->jsc + 1;
-  domain->nxd   = domain->ied - domain->isd + 1;
-  domain->nyd   = domain->jed - domain->jsd + 1;
-  domain->nxg   = ni;
-  domain->nyg   = nj;
-
-  mpp_delete_domain1d(&domx);
-  mpp_delete_domain1d(&domy);
-  
-}; /* mpp_define_domain2d */
-
-/****************************************************************************
-  void mpp_delete_domain1d(domain1D *domain);
-  release the memory assigned to 1-D domain
-*****************************************************************************/
-void mpp_delete_domain1d(domain1D *domain)
-{
-
-  free(domain->beglist);
-  free(domain->endlist);
-  
-}; /* mpp_delete_domain1d */
-
-/****************************************************************************
-  void mpp_delete_domain2d(domain2D *domain);
-  release the memory assigned to 2-D domain
-*****************************************************************************/
-void mpp_delete_domain2d(domain2D *domain)
-{
-
-  free(domain->isclist);
-  free(domain->ieclist);
-  free(domain->jsclist);
-  free(domain->jeclist);
-  
-}; /* mpp_delete_domain2d */
-
-
-
-/***********************************************************
-     void get_get_compute_domain(omain2D domain, int *is, int *ie, int *js, int *je)
-    get the compute domain decomposition
-***********************************************************/
-
-void mpp_get_compute_domain2d(domain2D domain, int *is, int *ie, int *js, int *je)
-{
-  *is = domain.isc;
-  *ie = domain.iec;
-  *js = domain.jsc;
-  *je = domain.jec;
-}; /* mpp_get_compute_domain */
-
-/***********************************************************
-     void get_get_compute_domain( int *is, int *ie, int *js, int *je)
-    get the compute domain decomposition of current pe list.
-***********************************************************/
-
-void mpp_get_compute_domains2d(domain2D domain, int *is, int *ie, int *js, int *je)
-{
-  int n;
-  
-  for(n=0; n<npes;n++) {
-    is[n] = domain.isclist[n];
-    ie[n] = domain.ieclist[n];
-    js[n] = domain.jsclist[n];
-    je[n] = domain.jeclist[n];
-  }
-
-}/* mpp_get_compute_domains */
-
-/**********************************************************
-    void mpp_get_data_domain(int *is, int *ie, int *js, int *je)
-   get the data domain decomposition
-***********************************************************/
-
-void mpp_get_data_domain2d(domain2D domain, int *is, int *ie, int *js, int *je)
-{
-  *is = domain.isd;
-  *ie = domain.ied;
-  *js = domain.jsd;
-  *je = domain.jed;
-}; /* mpp_get_data_domain */ 
-
-/**********************************************************
-    void mpp_get_global_domain(int *nx, int *ny )
-   get the global domain size
-***********************************************************/
-
-void mpp_get_global_domain2d(domain2D domain, int *nx, int *ny )
-{
-  *nx = domain.nxg;
-  *ny = domain.nyg;
-}; /* mpp_get_global_domain */ 
-
-/****************************************************************
-   void mpp_get_shift(int sizex, int sizey, int *ishift, int *jshift)
-   Return the shift value. For non-symmetry domain, ishift will be always 0.
-   For symmetric domain, shift value can be 0 or 1 depending on position.
-
-****************************************************************/
-void mpp_get_shift(domain2D domain, int sizex, int sizey, int *ishift, int *jshift)
-{
-  int nxc, nyc, nxd, nyd;
-  
-  nxc = domain.nxc; nyc = domain.nyc;
-  nxd = domain.nxd; nyd = domain.nyd;
-
-  if( (sizex == nxc && sizey == nyc) || (sizex == nxd && sizey == nyd) ) { 
-    *ishift = 0;
-    *jshift = 0;
-  }
-  else if ( (sizex == nxc+1 && sizey == nyc) || (sizex == nxd+1 && sizey == nyd)) { 
-    *ishift = 1;
-    *jshift = 0;
-  }
-  else if ( (sizex == nxc && sizey == nyc+1) || (sizex == nxd && sizey == nyd+1) ) { 
-    *ishift = 0;
-    *jshift = 1;
-  }
-  else if ( (sizex == nxc+1 && sizey == nyc+1) || (sizex == nxd+1 && sizey == nyd+1) ) { 
-    *ishift = 1;
-    *jshift = 1;
-  }
-  else
-    mpp_error("mpp_domain: data should be on either compute or data domain.");
-
-}; /* mpp_get_shift */
-
-
-/*************************************************************
-    mpp_global_field_double(domain2D domain, int sizex, int sizey, const double *ldata, double *gdata)
-    get the global data on root pe.
-    ldata is on compute domain and gdata is on global domain
-************************************************************/
-void mpp_global_field_double(domain2D domain, int sizex, int sizey, const double* ldata, double* gdata)
-{
-  double *send_buffer=NULL, *recv_buffer=NULL;
-  int i, j, n, ni, nj, ii, jj, l, p, recv_size;
-  int ishift, jshift, nxc, nyc, nxd, nyd, nxg;
-  int is, ie, js, je, isd, jsd;
-  
-  mpp_get_shift( domain, sizex, sizey, &ishift, &jshift);
-  is = domain.isc;
-  ie = domain.iec + ishift;
-  js = domain.jsc;
-  je = domain.jec + jshift;
-  
-  nxc = ie-is+1;
-  nyc = je-js+1;
-  isd = domain.isd;
-  jsd = domain.jsd;
-  nxd = domain.nxd + ishift;
-  nyd = domain.nyd + jshift;
-  nxg = domain.nxg + ishift;
-  
-  /* all other pe except root pe will send data to root pe */
-  if( pe != root_pe) {
-    if( sizex == nxc && sizey == nyc ){ /* data is on compute domain */
-      mpp_send_double(ldata, sizex*sizey, root_pe);
-    }
-    else if( sizex == nxd && sizey == nyd  ){ /* data is on data domain */
-      send_buffer = (double *)malloc(nxc*nyc*sizeof(double));
-      n = 0;
-      for(j=js;j<=je;j++) {
-	for(i=is;i<=ie;i++) send_buffer[n++] = ldata[(j-jsd)*nxd+(i-isd)];
-      }
-      mpp_send_double(send_buffer, nxc*nyc, root_pe);
-    }
-    else
-      mpp_error("mpp_domain: data should be on compute/data domain");
-  }
-
-  /* receive from other pe on root pe   */
-  if( pe == root_pe ) {
-    for(p=0;p<npes;p++) {
-      if( p == root_pe) {
-	if( sizex == nxc && sizey == nyc  ){ /* data is on compute domain */
-	  n = 0;
-	  for(j=js;j<=je;j++) {
-	    for(i=is;i<=ie;i++) gdata[j*nxg+i] = ldata[n++];
-	  }
-	}
-	else {
-	  for(j=js;j<=je;j++) {
-	    for(i=is;i<=ie;i++) gdata[j*nxg+i] = ldata[(j-jsd)*nxd+(i-isd)];
-	  }
-	}
-      }
-      else {
-	recv_size = (domain.ieclist[p]-domain.isclist[p]+1+ishift)*(domain.jeclist[p]-domain.jsclist[p]+1+jshift);
-	recv_buffer = ( double *) malloc(recv_size*sizeof(double));
-	mpp_recv_double(recv_buffer, recv_size, p );
-	n = 0;
-	for(j=domain.jsclist[p]; j<=domain.jeclist[p]+jshift; j++){
-	  for(i=domain.isclist[p]; i<=domain.ieclist[p]+ishift; i++){
-	    gdata[j*nxg+i] = recv_buffer[n++];
-	  }
-	}
-	free(recv_buffer);
-      }
-    }
-  }
-
-  mpp_sync_self();
-  
-  if(send_buffer != NULL) free(send_buffer);
-}; /* mpp_global_field_double */
-
-/*************************************************************
-    mpp_global_field_double_3D(domain2D domain, int sizex, int sizey, int sizez,
-                               const double *ldata, double *gdata)
-    get the global data on root pe.
-    ldata is on compute domain and gdata is on global domain
-************************************************************/
-void mpp_global_field_double_3D(domain2D domain, int sizex, int sizey, int sizez,
-				const double* ldata, double* gdata)
-{
-  double *send_buffer=NULL, *recv_buffer=NULL;
-  int i, j, k, n, ni, nj, ii, jj, l, p, recv_size;
-  int ishift, jshift, nxc, nyc, nxd, nyd, nxg, nyg;
-  int is, ie, js, je, isd, jsd;
-  
-  mpp_get_shift( domain, sizex, sizey, &ishift, &jshift);
-  is = domain.isc;
-  ie = domain.iec + ishift;
-  js = domain.jsc;
-  je = domain.jec + jshift;
-  
-  nxc = ie-is+1;
-  nyc = je-js+1;
-  isd = domain.isd;
-  jsd = domain.jsd;
-  nxd = domain.nxd + ishift;
-  nyd = domain.nyd + jshift;
-  nxg = domain.nxg + ishift;
-  nyg = domain.nyg + ishift;
-
-  /* all other pe except root pe will send data to root pe */
-  if( pe != root_pe) {
-    if( sizex == nxc && sizey == nyc ){ /* data is on compute domain */
-      mpp_send_double(ldata, sizex*sizey*sizez, root_pe);
-    }
-    else if( sizex == nxd && sizey == nyd  ){ /* data is on data domain */
-      send_buffer = (double *)malloc(nxc*nyc*sizez*sizeof(double));
-      n = 0;
-      for(k=0; k<sizez; k++) for(j=js;j<=je;j++) {
-	for(i=is;i<=ie;i++) send_buffer[n++] = ldata[k*nxd*nyd+(j-jsd)*nxd+(i-isd)];
-      }
-      mpp_send_double(send_buffer, nxc*nyc*sizez, root_pe);
-    }
-    else
-      mpp_error("mpp_domain: data should be on compute/data domain");
-  }
-
-  /* receive from other pe on root pe   */
-  if( pe == root_pe ) {
-    for(p=0;p<npes;p++) {
-      if( p == root_pe) {
-	if( sizex == nxc && sizey == nyc  ){ /* data is on compute domain */
-	  n = 0;
-	  for(k=0;k<sizez;k++) for(j=js;j<=je;j++) {
-	    for(i=is;i<=ie;i++) gdata[k*nxg*nyg+j*nxg+i] = ldata[n++];
-	  }
-	}
-	else {
-	  for(k=0;k<sizez;k++) for(j=js;j<=je;j++) {
-	    for(i=is;i<=ie;i++) gdata[k*nxg*nyg+j*nxg+i] = ldata[k*nxd*nyd+(j-jsd)*nxd+(i-isd)];
-	  }
-	}
-      }
-      else {
-	recv_size = (domain.ieclist[p]-domain.isclist[p]+1+ishift)
-	  *(domain.jeclist[p]-domain.jsclist[p]+1+jshift)*sizez;
-	recv_buffer = ( double *) malloc(recv_size*sizeof(double));
-	mpp_recv_double(recv_buffer, recv_size, p );
-	n = 0;
-	for(k=0;k<sizez;k++) {
-	  for(j=domain.jsclist[p]; j<=domain.jeclist[p]+jshift; j++){
-	    for(i=domain.isclist[p]; i<=domain.ieclist[p]+ishift; i++){
-	      gdata[k*nxg*nyg+j*nxg+i] = recv_buffer[n++];
-	    }
-	  }
-	}
-	free(recv_buffer);
-      }
-    }
-  }
-
-  mpp_sync_self();
-  
-  if(send_buffer != NULL) free(send_buffer);
-}; /* mpp_global_field_double */
-
-/*******************************************************************************
-  void mpp_gather_field_int(int lsize, int *ldata, int *gdata)
-  gather integer data onto every processor
-*******************************************************************************/
-void mpp_gather_field_int(int lsize, int *ldata, int *gdata)
-{
-  int n, p, i;
-  int *rbuffer;
-  int *rsize;
-
-  rsize = (int *)malloc(npes*sizeof(int));
-  
-  for(p = 0; p<npes; p++) {
-    if(pe != p) { /* send to other pe. */
-      mpp_send_int(&lsize, 1, p);
-    }
-  }
-
-  for(p = 0; p<npes; p++) {
-    if(pe != p) { /* recv from other pe. */
-      mpp_recv_int(rsize+p, 1, p);
-    }
-  }
-
-  mpp_sync_self();
-
-  for(p = 0; p<npes; p++) {
-    if(pe != p) { /* send to other pe. */
-      if(lsize>0) mpp_send_int(ldata, lsize, p);
-    }
-  }  
-  n = 0;
-  /* receive from other pe and fill the gdata */
-  for(p = 0; p<npes; p++) {
-    if(pe != p) { /* recv from other pe. */
-      if(rsize[p]>0) {
-	rbuffer = ( int *) malloc(rsize[p]*sizeof(int));
-	mpp_recv_int(rbuffer, rsize[p], p );
-	for(i=0; i<rsize[p]; i++) gdata[n++] = rbuffer[i];
-	free(rbuffer);
-      }
-    }
-    else {
-      for(i=0; i<lsize; i++) gdata[n++] = ldata[i];
-    }
-  }
-
-  mpp_sync_self();
-  free(rsize);
-  
-}; /* mpp_gather_field_int */
-
-/*******************************************************************************
-  void mpp_gather_field_double(int lsize, double *ldata, double *gdata)
-  gather doubleeger data onto every processor
-*******************************************************************************/
-void mpp_gather_field_double(int lsize, double *ldata, double *gdata)
-{
-  int n, p, i;
-  double*rbuffer;
-  int *rsize;
-
-  rsize = (int *)malloc(npes*sizeof(int));
-  
-  for(p = 0; p<npes; p++) {
-    if(pe != p) { /* send to other pe. */
-      mpp_send_int(&lsize, 1, p);
-    }
-  }
-
-  for(p = 0; p<npes; p++) {
-    if(pe != p) { /* recv from other pe. */
-      mpp_recv_int(rsize+p, 1, p);
-    }
-  }
-
-  mpp_sync_self();
-
-  for(p = 0; p<npes; p++) {
-    if(pe != p) { /* send to other pe. */
-      if(lsize>0) mpp_send_double(ldata, lsize, p);
-    }
-  }  
-  n = 0;
-  /* receive from other pe and fill the gdata */
-  for(p = 0; p<npes; p++) {
-    if(pe != p) { /* recv from other pe. */
-      if(rsize[p]>0) {
-	rbuffer = (double *) malloc(rsize[p]*sizeof(double));
-	mpp_recv_double(rbuffer, rsize[p], p );
-	for(i=0; i<rsize[p]; i++) gdata[n++] = rbuffer[i];
-	free(rbuffer);
-      }
-    }
-    else {
-      for(i=0; i<lsize; i++) gdata[n++] = ldata[i];
-    }
-  }
-
-  mpp_sync_self();
-  free(rsize);
-  
-}; /* mpp_gather_field_double*/
-
diff --git a/gridspec/tools/shared/mpp_domain.h b/gridspec/tools/shared/mpp_domain.h
deleted file mode 100644
index c742c30..0000000
--- a/gridspec/tools/shared/mpp_domain.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************
-                        mpp_domain.h 
-   This headers define interface to define domain layout, 
-   define domain decomposition and global field to root pe, 
-   some utilities routine to return domain decomposition.
-   Currently it only used in tools and assume only one domain is created. 
-   If more domains are needed, we may define a struct to hold domain informaiton.
-   contact: Zhi.Liang at noaa.gov
-
-****************************************************************/
-#ifndef MPP_DOMAIN_H_
-#define MPP_DOMAIN_H_
-
-typedef struct{
-  int start, end;           /* starting and ending index of compute domain */
-  int size;                 /* compute domain size */
-  int sizeg;                /* global domain size */
-  int *beglist, *endlist; /* list of starting and ending index of compute domain */
-} domain1D;
-
-typedef struct {
-  int isc, iec, jsc, jec;   /* compute domain decomposition */
-  int isd, ied, jsd, jed;   /* data    domain decomposition */
-  int nxc, nyc;             /* compute domain size */
-  int nxd, nyd;             /* data    domain size */
-  int nxg, nyg;             /* global  domain size */
-  int *isclist, *ieclist;   /* list of i-index of compute domain */
-  int *jsclist, *jeclist;   /* list of j-index of compute domain */
-  int xhalo, yhalo;         /* halo size */
-} domain2D;
-
-void mpp_domain_init();
-void mpp_domain_end();
-void mpp_define_layout(int ni, int nj, int ndivs, int layout[]);
-void mpp_define_domain1d(int npts, int ndvis, domain1D *domain );
-void mpp_define_domain2d(int ni, int nj, int layout[], int xhalo, int yhalo, domain2D *domain );
-void mpp_delete_domain1d(domain1D *domain);
-void mpp_delete_domain2d(domain2D *domain);
-void mpp_get_compute_domain2d(domain2D domain, int *is, int *ie, int *js, int *je);
-void mpp_get_data_domain2d(domain2D domain, int *is, int *ie, int *js, int *je);
-void mpp_get_global_domain2d(domain2D domain,  int *nx, int *ny);
-void mpp_get_compute_domains2d(domain2D domain, int *is, int *ie, int *js, int *je);
-void mpp_get_shift(domain2D domain, int sizex, int sizey, int *ishift, int *jshift);
-void mpp_global_field_double(domain2D domain, int sizex, int sizey, const double* ldata, double* gdata);
-void mpp_global_field_double_3D(domain2D domain, int sizex, int sizey, int sizez,
-				const double* ldata, double* gdata);
-void mpp_gather_field_int(int lsize, int *ldata, int *gdata);
-void mpp_gather_field_double(int lsize, double *ldata, double *gdata);
-
-#endif
diff --git a/gridspec/tools/shared/mpp_io.c b/gridspec/tools/shared/mpp_io.c
deleted file mode 100644
index 495248b..0000000
--- a/gridspec/tools/shared/mpp_io.c
+++ /dev/null
@@ -1,1075 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <netcdf.h>
-#include "mpp.h"
-#include "mpp_domain.h"
-#include "mpp_io.h"
-
-#define  MAXFILE 50
-#define  MAXVAR  1024
-
-typedef struct {
-  int fldid;
-  char name[128];
-  nc_type type;
-} VarType;
-
-typedef struct {
-  int  ncid;
-  char name[512];
-  int  action;  /* indicate the action, MPP_WRITE or MPP_READ */
-  int  status;  /* indicate if the file is opened or closed */
-  int  nvar;
-  VarType *var;
-} FileType;
-
-FileType files[MAXFILE];
-int      nfiles = 0;
-
-/*********************************************************************
-    void netcdf_error( int status )
-    status is the returning value of netcdf call. this routine will
-    handle the error when status is not NC_NOERR.
-********************************************************************/
-void netcdf_error(const char *msg, int status )
-{
-  char errmsg[512];
-
-  sprintf( errmsg, "%s: %s", msg, nc_strerror(status) );
-  mpp_error(errmsg);
-
-}; /* netcdf_error */
-
-
-/*************************************************************
- int mpp_open(char *filename, int action)
- open netcdf file to read or write. return the id for the file opened.
- Here the id is not the netcdf ncid of the file opened, it is the index
- in the mpp_io data files. If the file is already opened, will exit with
- an error message. For the write action, mpp_open can only be called once.
- For the read action, the file could be open and then close and then open
- again. The action should be MPP_READ, MPP_WRITE, a constant defined in
- mpp_io.h. When action is MPP_WRITE, file will be created on root pe.
-************************************************************/
-
-int mpp_open(const char *file, int action) {
-  char curfile[128];
-  char errmsg[512];  
-  int ncid, status, n, fid;
-  
-  /* write only from root pe. */
-  if(action == MPP_WRITE && mpp_pe() != mpp_root_pe() ) return -1;
-  /*if file is not ended with .nc add .nc at the end. */
-  strcpy(curfile, file);
-  if(strstr(curfile, ".nc") == NULL) strcat(curfile,".nc");
-
-  /* look through currently files to make sure the file is not in the list*/
-  fid = -1;
-  for(n=0; n<nfiles; n++) {
-    if(!strcmp(files[n].name, file)) {
-      fid = n;
-      break;
-    }
-  }
-  if(fid > -1) {
-    if(files[n].action == MPP_WRITE) {
-      sprintf( errmsg, "mpp_io(mpp_open): %s is already created for write", file);
-      mpp_error(errmsg);
-    }
-    if(files[n].status) {
-      sprintf( errmsg, "mpp_io(mpp_open): %s is already opened", file);
-      mpp_error(errmsg);
-    }
-  }
-  else {
-    fid = nfiles;
-    nfiles++;
-    if(nfiles > MAXFILE) mpp_error("mpp_io(mpp_open): nfiles is larger than MAXFILE, increase MAXFILE");
-    strcpy(files[fid].name, file);
-    files[fid].nvar = 0;
-    files[fid].var = (VarType *)malloc(MAXVAR*sizeof(VarType));
-  }
-    
-  switch (action) {
-  case MPP_WRITE:
-#ifdef NC_64BIT_OFFSET
-    status = nc_create(curfile, NC_64BIT_OFFSET, &ncid);
-#else
-    status = nc_create(curfile, NC_WRITE, &ncid);
-#endif
-    break;
-  case MPP_APPEND:
-    status = nc_open(curfile, NC_WRITE, &ncid);
-    break;
-  case MPP_READ:
-    status = nc_open(curfile,NC_NOWRITE, &ncid);
-    break;
-  default:
-    sprintf(errmsg, "mpp_io(mpp_open): the action should be MPP_WRITE or MPP_READ when opening file %s", file);
-    mpp_error(errmsg);
-  }
-  
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_open): error in opening file %s", file);
-    netcdf_error(errmsg, status);
-  }
-
-  files[fid].ncid   = ncid;
-  files[fid].status = 1;
-  files[fid].action = action;
-  
-  return fid;
-}
-
-/* close the file */
-void mpp_close(int fid)
-{
-  int status;
-  char errmsg[512];
-
-  if(fid == -1 && mpp_pe() != mpp_root_pe() ) return;
-  
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_close): invalid id number, id should be "
-				    "a nonnegative integer that less than nfiles");
-  
-  status = nc_close(files[fid].ncid);
-  if(status != NC_NOERR) {
-    sprintf( errmsg, "mpp_io(mpp_close): error in closing files %s ", files[fid].name);
-    netcdf_error(errmsg, status);
-  }
-  files[fid].ncid = 0;
-  files[fid].status = 0;
-  
-}
-
-/*******************************************************************************/
-/*                                                                             */
-/*           The following are routines that retrieve information              */
-/*                                                                             */
-/*******************************************************************************/
-
-/*********************************************************************
-  int mpp_get_dimid(int fid, const char *dimname)
-  get the id of the dimname from file with fid, 
-*********************************************************************/
-int mpp_get_dimid(int fid, const char *dimname)
-{
-  int status, dimid;
-  char errmsg[512];
-  
-  /* First look through existing variables to see
-     if the fldid of varname is already retrieved. */
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_get_dimid): invalid id number, id should be "
-				    "a nonnegative integer that less than nfiles");
-  
-  status =  nc_inq_dimid(files[fid].ncid, dimname, &dimid);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_dimid): error in get dimension id of %s from file %s", dimname, files[fid].name);
-    netcdf_error(errmsg, status);
-  }
-
-  return dimid;
-
-};/* mpp_get_dimid */
-
-
-/*********************************************************************
-  int mpp_get_varid(int fid, const char *varname)
-  get the id of the varname from file with fid, the id will be the index
-  in files[fid].var.
-*********************************************************************/
-int mpp_get_varid(int fid, const char *varname)
-{
-  int status, fldid, vid, n;
-  char errmsg[512];
-  
-  /* First look through existing variables to see
-     if the fldid of varname is already retrieved. */
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_get_varid): invalid id number, id should be "
-				    "a nonnegative integer that less than nfiles");
-  
-  for(n=0; n<files[fid].nvar; n++) {
-    if( !strcmp(files[fid].var[n].name, varname) ) return n;
-  }
-
-  vid = files[fid].nvar;
-  files[fid].nvar++;
-  if(files[fid].nvar > MAXVAR ) mpp_error("mpp_io(mpp_get_varid): nvar is larger than MAXVAR, increase MAXVAR");
-  
-  status =  nc_inq_varid(files[fid].ncid, varname, &fldid);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_varid): error in get field_id of variable %s from file %s", varname, files[fid].name);
-    netcdf_error(errmsg, status);
-  }
-
-  status = nc_inq_vartype(files[fid].ncid, fldid, &(files[fid].var[vid].type));
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_varid): Error in getting type of of field %s in file %s ",
-	    files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-  
-  files[fid].var[vid].fldid = fldid;
-  strcpy(files[fid].var[vid].name, varname);
-  return vid;
-
-};/* mpp_get_varid */
-
-/********************************************************************
-  int mpp_get_dimlen(char* file, char *name)
-  Get the dimension.
- *******************************************************************/
-int mpp_get_dimlen(int fid, const char *name)
-{
-  int ncid, dimid, status, len;
-  size_t size;
-  char errmsg[512];
-  
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_get_dimlen): invalid fid number, fid should be "
-				    "a nonnegative integer that less than nfiles");
-  ncid = files[fid].ncid;
-  status = nc_inq_dimid(ncid, name, &dimid);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_dimlen): error in inquiring dimid of %s from file %s", name, files[fid].name);
-    netcdf_error(errmsg, status);
-  }
-  status = nc_inq_dimlen(ncid, dimid, &size);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_dimlen): error in inquiring dimlen of %s from file %s", name, files[fid].name);
-    netcdf_error(errmsg, status);
-  }
-  len = size;
-  return len;
-  
-}; /* mpp_get_dimlen */
-
-/*********************************************************************
-  void mpp_get_var_value(int fid, int vid, void *data)
-  read part of var data, the part is defined by start and nread.
-*********************************************************************/
-void mpp_get_var_value(int fid, int vid, void *data)
-{
-  int status;
-  int *data_i4;
-  short *data_i2;
-  float *data_r4;
-  char errmsg[512];
-  
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_get_var_value_block): invalid fid number, fid should be "
-				    "a nonnegative integer that less than nfiles");
-  if(vid<0 || vid >=files[fid].nvar) mpp_error("mpp_io(mpp_get_var_value_block): invalid vid number, vid should be "
-				    "a nonnegative integer that less than nvar");
-
-  switch(files[fid].var[vid].type) {
-  case NC_DOUBLE:case NC_FLOAT:
-    status = nc_get_var_double(files[fid].ncid, files[fid].var[vid].fldid, data);
-    break;
-  case NC_INT:
-    status = nc_get_var_int(files[fid].ncid, files[fid].var[vid].fldid, data);
-    break;
-  case NC_SHORT:
-    status = nc_get_var_short(files[fid].ncid, files[fid].var[vid].fldid, data);
-    break;    
-  case NC_CHAR:
-    status = nc_get_var_text(files[fid].ncid, files[fid].var[vid].fldid, data);
-    break; 
-  default:
-    sprintf(errmsg, "mpp_io(mpp_get_var_value): field %s in file %s has an invalid type, "
-	    "the type should be NC_DOUBLE, NC_FLOAT, NC_INT, NC_SHORT or NC_CHAR",
-	    files[fid].var[vid].name, files[fid].name );
-    mpp_error(errmsg);
-  }    
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_var_value): Error in getting value of variable %s from file %s",
-	    files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-  
-}; /* mpp_get_var_value */
-
-/*********************************************************************
-  void mpp_get_var_value_block(int fid, int vid, const size_t *start, const size_t *nread, void *data)
-  read part of var data, the part is defined by start and nread.
-*********************************************************************/
-void mpp_get_var_value_block(int fid, int vid, const size_t *start, const size_t *nread, void *data)
-{
-  int status;
-  char errmsg[512];
-  
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_get_var_value_block): invalid fid number, fid should be "
-				    "a nonnegative integer that less than nfiles");
-  if(vid<0 || vid >=files[fid].nvar) mpp_error("mpp_io(mpp_get_var_value_block): invalid vid number, vid should be "
-				    "a nonnegative integer that less than nvar");
-
-  switch(files[fid].var[vid].type) {
-  case NC_DOUBLE:case NC_FLOAT:
-    status = nc_get_vara_double(files[fid].ncid, files[fid].var[vid].fldid, start, nread, data);
-    break;
-  case NC_INT:
-    status = nc_get_vara_int(files[fid].ncid, files[fid].var[vid].fldid, start, nread, data);
-    break;
-  case NC_SHORT:
-    status = nc_get_vara_short(files[fid].ncid, files[fid].var[vid].fldid, start, nread, data);
-    break;  
-  case NC_CHAR:
-    status = nc_get_vara_text(files[fid].ncid, files[fid].var[vid].fldid, start, nread, data);
-    break; 
-  default:
-    sprintf(errmsg, "mpp_io(mpp_get_var_value_block): field %s in file %s has an invalid type, "
-	    "the type should be NC_DOUBLE, NC_FLOAT, NC_INT, NC_SHORT or NC_CHAR",
-	    files[fid].var[vid].name, files[fid].name );
-    mpp_error(errmsg);
-  }    
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_var_value_block): Error in getting value of variable %s from file %s",
-	    files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-  
-}; /* mpp_get_var_value_block */
-
-/*******************************************************************
- void mpp_get_var_att(int fid, int vid, const char *name, void *val)
- get the attribute value of vid from file fid.
- ******************************************************************/
-void mpp_get_var_att(int fid, int vid, const char *name, void *val)
-{
-  int status;
-  char errmsg[512];
-  nc_type type;
-
-  
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_get_var_att): invalid fid number, fid should be "
-				    "a nonnegative integer that less than nfiles");
-  if(vid<0 || vid >=files[fid].nvar) mpp_error("mpp_io(mpp_get_var_att): invalid vid number, vid should be "
-				    "a nonnegative integer that less than nvar");
-
-  status = nc_inq_atttype(files[fid].ncid, files[fid].var[vid].fldid, name, &type);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_var_att): Error in getting type of attribute %s of field %s in file %s ",
-	    name, files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-  
-  switch(type) {
-  case NC_DOUBLE:case NC_FLOAT:
-    status = nc_get_att_double(files[fid].ncid, files[fid].var[vid].fldid, name, val);
-    break;
-  case NC_INT:
-    status = nc_get_att_int(files[fid].ncid, files[fid].var[vid].fldid, name, val);
-    break;      
-  case NC_SHORT:
-    status = nc_get_att_short(files[fid].ncid, files[fid].var[vid].fldid, name, val);
-    break;
-  case NC_CHAR:
-    status = nc_get_att_text(files[fid].ncid, files[fid].var[vid].fldid, name, val);
-    break;    
-  default:
-    sprintf(errmsg, "mpp_io(mpp_get_var_att): attribute %s of field %s in file %s has an invalid type, "
-	    "the type should be NC_DOUBLE, NC_FLOAT, NC_INT, NC_SHORT or NC_CHAR",
-	    name, files[fid].var[vid].name, files[fid].name );
-    mpp_error(errmsg);
-  }
-  
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_var_att): Error in getting value of attribute %s of variable %s from file %s",
-	    name, files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-}
-
-/*******************************************************************
- void mpp_get_var_att_double(int fid, int vid, const char *name, double *val)
- get the attribute value of vid from file fid.
- ******************************************************************/
-void mpp_get_var_att_double(int fid, int vid, const char *name, double *val)
-{
-  int status;
-  char errmsg[512];
-  nc_type type;
-  short sval;
-  int   ival;
-  
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_get_var_att): invalid fid number, fid should be "
-				    "a nonnegative integer that less than nfiles");
-  if(vid<0 || vid >=files[fid].nvar) mpp_error("mpp_io(mpp_get_var_att): invalid vid number, vid should be "
-				    "a nonnegative integer that less than nvar");
-
-  status = nc_inq_atttype(files[fid].ncid, files[fid].var[vid].fldid, name, &type);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_var_att): Error in getting type of attribute %s of field %s in file %s ",
-	    name, files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-  
-  switch(type) {
-  case NC_DOUBLE:case NC_FLOAT:
-    status = nc_get_att_double(files[fid].ncid, files[fid].var[vid].fldid, name, val);
-    break;
-  case NC_INT:
-    status = nc_get_att_int(files[fid].ncid, files[fid].var[vid].fldid, name, &ival);
-    *val = ival;
-    break;      
-  case NC_SHORT:
-    status = nc_get_att_short(files[fid].ncid, files[fid].var[vid].fldid, name, &sval);
-    *val = sval;
-    break;
-  default:
-    sprintf(errmsg, "mpp_io(mpp_get_var_att): attribute %s of field %s in file %s has an invalid type, "
-	    "the type should be NC_DOUBLE, NC_FLOAT, NC_INT, NC_SHORT or NC_CHAR",
-	    name, files[fid].var[vid].name, files[fid].name );
-    mpp_error(errmsg);
-  }
-  
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_var_att): Error in getting value of attribute %s of variable %s from file %s",
-	    name, files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-}
-
-/*******************************************************************
- void mpp_get_global_att(int fid, const char *name, void *val)
- get the global attribute from file fid.
- ******************************************************************/
-void mpp_get_global_att(int fid, const char *name, void *val)
-{
-  int status;
-  char errmsg[512];
-  nc_type type;
-  
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_get_global_att): invalid fid number, fid should be "
-				    "a nonnegative integer that less than nfiles");
-  status = nc_inq_atttype(files[fid].ncid, NC_GLOBAL, name, &type);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_global_att): Error in getting type of global attribute %s in file %s ",
-	    name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-  
-  switch(type) {
-  case NC_DOUBLE:case NC_FLOAT:
-    status = nc_get_att_double(files[fid].ncid, NC_GLOBAL, name, val);
-    break;
-  case NC_INT:
-    status = nc_get_att_int(files[fid].ncid, NC_GLOBAL, name, val);
-    break;
-  case NC_SHORT:
-    status = nc_get_att_short(files[fid].ncid, NC_GLOBAL, name, val);
-    break;  
-  case NC_CHAR:
-    status = nc_get_att_text(files[fid].ncid, NC_GLOBAL, name, val);
-    break;  
-  default:
-    sprintf(errmsg, "mpp_io(mpp_get_global_att): global attribute %s in file %s has an invalid type, "
-	    "the type should be NC_DOUBLE, NC_FLOAT, NC_INT, NC_SHORT or NC_CHAR", name, files[fid].name );
-    mpp_error(errmsg);
-  }
-  
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_global_att): Error in getting value of global attribute %s from file %s",
-	    name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-
-}
-
-/********************************************************************
-  int mpp_get_var_ndim(int fid, int vid)
-********************************************************************/
-int mpp_get_var_ndim(int fid, int vid)
-{
-  int status, ndim;
-  char errmsg[512];
-  
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_get_var_ndim): invalid fid number, fid should be "
-				    "a nonnegative integer that less than nfiles");
-  if(vid<0 || vid >=files[fid].nvar) mpp_error("mpp_io(mpp_get_var_ndim): invalid vid number, vid should be "
-				    "a nonnegative integer that less than nvar");
-  
-  status = nc_inq_varndims(files[fid].ncid, files[fid].var[vid].fldid, &ndim);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_var_ndim): Error in getting ndims of var %s from file %s",
-	    files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-  
-  return ndim;
-}
-
-/********************************************************************
-  nc_type mpp_get_var_type(int fid, int vid)
-  get var type
-********************************************************************/
-nc_type mpp_get_var_type(int fid, int vid)
-{
-  char errmsg[512];
-  
-  nc_type vartype;
-  int status;
-
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_get_var_ndim): invalid fid number, fid should be "
-				    "a nonnegative integer that less than nfiles");
-  if(vid<0 || vid >=files[fid].nvar) mpp_error("mpp_io(mpp_get_var_ndim): invalid vid number, vid should be "
-				    "a nonnegative integer that less than nvar");
-  
-  status = nc_inq_vartype(files[fid].ncid, files[fid].var[vid].fldid, &vartype);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_var_type): Error in getting type of var %s from file %s",
-	    files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-
-  return vartype;
-}
-
-
-/*********************************************************************
-void mpp_get_var_dimname(int fid, int vid, int i, char *name)
-For each dimension we are assuming there is a 1-d field have the same name as the dimension.
-*********************************************************************/
-void mpp_get_var_dimname(int fid, int vid, int ind, char *name)
-{
-  int status, ncid, fldid, ndims, dims[4];
-  char errmsg[512];
-  
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_get_var_dimname): invalid fid number, fid should be "
-				    "a nonnegative integer that less than nfiles");
-  if(vid<0 || vid >=files[fid].nvar) mpp_error("mpp_io(mpp_get_var_dimname): invalid vid number, vid should be "
-				    "a nonnegative integer that less than nvar");
-  ncid = files[fid].ncid;
-  fldid = files[fid].var[vid].fldid;
-  
-  status = nc_inq_varndims(ncid, fldid, &ndims);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_var2D_dimname): Error in getting ndims of var %s from file %s",
-	    files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-
-  if(ind < 0 || ind >= ndims) mpp_error("mpp_io(mpp_get_var_dimname): invalid ind value, ind should be between 0 and ndim-1");
-  
-  status = nc_inq_vardimid(ncid,fldid,dims);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_var2D_dimname): Error in getting dimid of var %s from file %s",
-	    files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-  status = nc_inq_dimname(ncid, dims[ind], name);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_get_var2D_dimname): Error in getting %d dimension name of var %s from file %s",
-	    ind, files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-
-}; /* mpp_get_var_dimname */
-
-
-/***************************************************************************
-  char mpp_get_var_cart(int fid, int vid)
-  get the cart of the dimension variable
-  *************************************************************************/
-char mpp_get_var_cart(int fid, int vid)
-{
-  char cart;
-  int ncid, fldid, status;
-  char errmsg[512];
-  
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_get_var_cart): invalid fid number, fid should be "
-				      "a nonnegative integer that less than nfiles"); 
-  if(vid<0 || vid >=files[fid].nvar) mpp_error("mpp_io(mpp_get_var_cart): invalid vid number, vid should be "
-				    "a nonnegative integer that less than nvar");
-  cart = 'N';
-
-  ncid = files[fid].ncid;
-  fldid = files[fid].var[vid].fldid;
-  status = nc_get_att_text(ncid, fldid, "cartesian_axis", &cart);
-  if(status != NC_NOERR)status = nc_get_att_text(ncid, fldid, "axis", &cart);
-  if(status != NC_NOERR){
-    sprintf(errmsg, "mpp_io(mpp_get_var_cart): Error in getting attribute cartesian_axis/axis of "
-	    "dimension variable %s from file %s", files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-    
-  return cart;
-}
-
-/***************************************************************************
- void mpp_get_var_bndname(int fid, int vid, char *bndname)
- Get the bound name of dimension variable if it exist, otherwise the value will be 'none'
- for time axis, the bounds may be 'climatology' 
- **************************************************************************/
-void mpp_get_var_bndname(int fid, int vid, char *bndname)
-{
-  int ncid, fldid, status;
-  char errmsg[512], name[32];
-  size_t siz;
-  
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_get_var_cart): invalid fid number, fid should be "
-				      "a nonnegative integer that less than nfiles"); 
-  if(vid<0 || vid >=files[fid].nvar) mpp_error("mpp_io(mpp_get_var_cart): invalid vid number, vid should be "
-				    "a nonnegative integer that less than nvar");
-  ncid = files[fid].ncid;
-  fldid = files[fid].var[vid].fldid;  
-  strcpy(name, "climatology");
-  status = nc_inq_attlen(ncid, fldid, name, &siz);
-  if(status != NC_NOERR){
-    strcpy(name, "bounds");
-    status = nc_inq_attlen(ncid, fldid, name, &siz);
-  }
-  if(status != NC_NOERR){
-    strcpy(name, "edges");
-    status = nc_inq_attlen(ncid, fldid, name, &siz);
-  }
-  if(status != NC_NOERR) {
-    strcpy(bndname, "none");
-  }
-  else {
-    status = nc_get_att_text(ncid, fldid, name, bndname);
-    bndname[siz] = '\0';
-    if(status != NC_NOERR) {
-      sprintf(errmsg, "mpp_io(mpp_get_var_bndname): Error in getting attribute %s of "
-	      "dimension variable %s from file %s", name, files[fid].var[vid].name, files[fid].name );
-      netcdf_error(errmsg, status);
-    }
-  }  
-}
-
-/***************************************************************************
-  int mpp_var_att_exist(int fid, int vid, const char *att)
-  check the field var has the attribute "att" or not.
-***************************************************************************/
-int mpp_var_att_exist(int fid, int vid, const char *att)
-{
-  int    status;
-  size_t attlen;
-  nc_type atttype;
-
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_var_att_exist): invalid fid number, fid should be "
-				    "a nonnegative integer that less than nfiles");
-  if(vid<0 || vid >=files[fid].nvar) mpp_error("mpp_io(mpp_var_att_exist): invalid vid number, vid should be "
-				    "a nonnegative integer that less than nvar");
-  
-  status = nc_inq_att(files[fid].ncid, files[fid].var[vid].fldid, att, &atttype, &attlen);
-  if(status == NC_NOERR) 
-    return 1;
-  else
-    return 0;
-  
-}; /* mpp_att_exist */
-
-
-/***************************************************************************
-  int mpp_global_att_exist(int fid, const char *att)
-  check global attribute "att" exist or not.
-***************************************************************************/
-int mpp_global_att_exist(int fid, const char *att)
-{
-  int    status;
-  size_t attlen;
-  nc_type atttype;
-
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_var_att_exist): invalid fid number, fid should be "
-				    "a nonnegative integer that less than nfiles");
-  
-  status = nc_inq_att(files[fid].ncid, NC_GLOBAL, att, &atttype, &attlen);
-  if(status == NC_NOERR) 
-    return 1;
-  else
-    return 0;
-  
-}; /* mpp_att_exist */
-
-/*******************************************************************************/
-/*                                                                             */
-/*     The following are routines to write out data                            */
-/*                                                                             */
-/*******************************************************************************/
-
-/********************************************************************
- int mpp_def_dim(int fid, char* name, int size)
- define dimension. 
-********************************************************************/
-int mpp_def_dim(int fid, const char* name, int size) {
-  int dimid, status;
-  char errmsg[512];
-  
-  if( mpp_pe() != mpp_root_pe() ) return 0;
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_def_dim): invalid fid number, fid should be "
-				      "a nonnegative integer that less than nfiles");
-  
-  status = nc_def_dim(files[fid].ncid, name, size, &dimid);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_def_dim): Error in defining dimension %s of file %s",
-	    name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-  return dimid;
-} /* mpp_def_dim */
-
-/********************************************************************
- int mpp_def_var(nt fid, const char* name, int type, int ndim, int *dims, int natts ... )
- define metadata of field.
-********************************************************************/
-int mpp_def_var(int fid, const char* name, nc_type type, int ndim, const int *dims, int natts, ...) {
-  int fldid, status, i, vid, ncid;
-  va_list ap;
-  char errmsg[512];
-  
-  if( mpp_pe() != mpp_root_pe() ) return 0;
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_def_var): invalid fid number, fid should be "
-				      "a nonnegative integer that less than nfiles");
-
-  ncid = files[fid].ncid;
-  status = nc_def_var(ncid, name, type, ndim, dims, &fldid);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_def_var): Error in defining var %s of file %s",
-	    name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-  vid = files[fid].nvar;
-  files[fid].nvar++;
-  if(files[fid].nvar > MAXVAR ) mpp_error("mpp_io(mpp_def_var): nvar is larger than MAXVAR, increase MAXVAR");  
-  files[fid].var[vid].fldid = fldid;
-  files[fid].var[vid].type = type;
-  strcpy(files[fid].var[vid].name, name);
-  
-  va_start(ap, natts);
-  for( i=0; i<natts; i++) {
-    char* attname = va_arg(ap, char*);
-    char* attval = va_arg(ap, char*);
-    if( attname == NULL || attval == NULL) {
-      mpp_error("mpp_io: attribute name and attribute value not defined suitably, check the arguments list.");
-    }
-    status = nc_put_att_text(ncid,fldid,attname,strlen(attval),attval);
-    if(status != NC_NOERR ) {
-      sprintf(errmsg, "mpp_io(mpp_def_var): Error in put attribute %s of var %s of file %s",
-	      attname, name, files[fid].name );
-      netcdf_error(errmsg, status);
-    }
-  }
-  va_end(ap);
-  return vid;
-} /* mpp_define_var */
-
-/*********************************************************************
-  void mpp_def_global_att(int fid, const char *name, const char *val)
-  write out global attribute
- ********************************************************************/
-void mpp_def_global_att(int fid, const char *name, const char *val)
-{
-  size_t status;
-  char errmsg[512];
-  
-  if( mpp_pe() != mpp_root_pe() ) return;
-
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_def_global_att): invalid fid number, fid should be "
-				      "a nonnegative integer that less than nfiles");
-  status = nc_put_att_text(files[fid].ncid, NC_GLOBAL, name, strlen(val), val);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_def_global_att): Error in put glboal attribute %s of file %s",
-	    name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-  
-}; /* mpp_def_global_att */
-
-
-/**********************************************************************
-void mpp_def_var_att(int fid, int vid, const char *attname, const char *attval)
- define one field attribute
-*********************************************************************/
-void mpp_def_var_att(int fid, int vid, const char *attname, const char *attval)
-{
-  int ncid, fldid, status;
-  char errmsg[512];
-  
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_def_var_att): invalid fid number, fid should be "
-				      "a nonnegative integer that less than nfiles");
-  if(vid<0 || vid >=files[fid].nvar) mpp_error("mpp_io(mpp_def_var_att): invalid vid number, vid should be "
-					       "a nonnegative integer that less than nvar");
-  ncid  = files[fid].ncid;
-  fldid = files[fid].var[vid].fldid;
-  status = nc_put_att_text(ncid,fldid,attname,strlen(attval),attval);
-  if(status != NC_NOERR ) {
-    sprintf(errmsg, "mpp_io(mpp_def_var_att): Error in put attribute %s of var %s of file %s",
-	    attname, files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-  
-} /* mpp_def_var_att */
-
-/**********************************************************************
-  void mpp_copy_var_att(fid_in, fid_out)
-  copy all the field attribute from infile to outfile
-**********************************************************************/
-void mpp_copy_var_att(int fid_in, int vid_in, int fid_out, int vid_out)
-{
-  int natt, status, i, ncid_in, ncid_out, fldid_in, fldid_out;
-  char name[256];
-  char errmsg[512];
-
-  if( mpp_pe() != mpp_root_pe() ) return;
-  
-  if(fid_in<0 || fid_in >=nfiles) mpp_error("mpp_io(mpp_copy_var_att): invalid fid_in number, fid should be "
-				      "a nonnegative integer that less than nfiles");
-  if(fid_out<0 || fid_out >=nfiles) mpp_error("mpp_io(mpp_copy_var_att): invalid fid_out number, fid should be "
-				      "a nonnegative integer that less than nfiles");
-        
-  ncid_in   = files[fid_in].ncid;
-  ncid_out  = files[fid_out].ncid;  
-  fldid_in  = files[fid_in].var[vid_in].fldid;
-  fldid_out = files[fid_out].var[vid_out].fldid;
-  
-  status = nc_inq_varnatts(ncid_in, fldid_in, &natt);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_copy_var_att): Error in inquiring natts of var %s of file %s",
-	    files[fid_in].var[vid_in].name, files[fid_in].name );
-    netcdf_error(errmsg, status);
-  }
-  
-  for(i=0; i<natt; i++) {
-    status = nc_inq_attname(ncid_in, fldid_in, i, name);
-    if(status != NC_NOERR) {
-      sprintf(errmsg, "mpp_io(mpp_copy_var_att): Error in inquiring %d attname of var %s of file %s", i, 
-	      files[fid_in].var[vid_in].name, files[fid_in].name );
-      netcdf_error(errmsg, status);
-    }
-    status = nc_copy_att(ncid_in, fldid_in, name, ncid_out, fldid_out);
-    if(status != NC_NOERR) {
-      sprintf(errmsg, "mpp_io(mpp_copy_var_att): Error in copying att %s of var %s of file %s", name,  
-	      files[fid_in].var[vid_in].name, files[fid_in].name );
-      netcdf_error(errmsg, status);
-    }
-  }
-
-}; /* mpp_copy_field_att */
-
-
-
-
-/**********************************************************************
-  void mpp_copy_global_att(fid_in, fid_out)
-  copy all the global attribute from infile to outfile
-**********************************************************************/
-void mpp_copy_global_att(int fid_in, int fid_out)
-{
-  int natt, status, i, ncid_in, ncid_out;
-  char name[256], errmsg[512];
-
-  if( mpp_pe() != mpp_root_pe() ) return;
-
-  if(fid_in<0 || fid_in >=nfiles) mpp_error("mpp_io(mpp_copy_global_att): invalid fid_in number, fid should be "
-				      "a nonnegative integer that less than nfiles");
-  if(fid_out<0 || fid_out >=nfiles) mpp_error("mpp_io(mpp_copy_global_att): invalid fid_out number, fid should be "
-				      "a nonnegative integer that less than nfiles");
-  ncid_in = files[fid_in].ncid;
-  ncid_out = files[fid_out].ncid;
-  
-  status = nc_inq_varnatts(ncid_in, NC_GLOBAL, &natt);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_copy_global_att): Error in inquiring natts(global) of file %s",
-	    files[fid_in].name );
-    netcdf_error(errmsg, status);
-  }
-
-  for(i=0; i<natt; i++) {
-    status = nc_inq_attname(ncid_in, NC_GLOBAL, i, name);
-    if(status != NC_NOERR) {
-      sprintf(errmsg, "mpp_io(mpp_copy_global_att): Error in inquiring %d global attname of file %s", i, 
-	      files[fid_in].name );
-      netcdf_error(errmsg, status);
-    }    
-
-    status = nc_copy_att(ncid_in, NC_GLOBAL, name, ncid_out, NC_GLOBAL);
-    if(status != NC_NOERR) {
-      sprintf(errmsg, "mpp_io(mpp_copy_global_att): Error in copying %d global att %s of file %s", i,  name,  
-	      files[fid_in].name );
-      netcdf_error(errmsg, status);
-    }
-  }
-
-}; /* mpp_copy_global_att */
-
-/*********************************************************************
-  void mpp_put_var_value(int fid, int vid, const void* data)
-  write out string-type data
-
- ********************************************************************/
-void mpp_put_var_value(int fid, int vid, const void* data)
-{
-  size_t status;
-  char errmsg[600];
-  
-  if( mpp_pe() != mpp_root_pe() ) return;
-
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_put_var_value): invalid fid number, fid should be "
-				    "a nonnegative integer that less than nfiles");
-  if(vid<0 || vid >=files[fid].nvar) mpp_error("mpp_io(mpp_put_var_value): invalid vid number, vid should be "
-				    "a nonnegative integer that less than nvar");
-
-  switch(files[fid].var[vid].type) {
-  case NC_DOUBLE:case NC_FLOAT:
-    status = nc_put_var_double(files[fid].ncid, files[fid].var[vid].fldid, data);
-    break;
-  case NC_INT:
-    status = nc_put_var_int(files[fid].ncid, files[fid].var[vid].fldid, data);
-    break;
-  case NC_SHORT:
-    status = nc_put_var_short(files[fid].ncid, files[fid].var[vid].fldid, data);
-    break;
-  case NC_CHAR:
-    status = nc_put_var_text(files[fid].ncid, files[fid].var[vid].fldid, data);
-    break;    
-  default:
-    sprintf(errmsg, "mpp_io(mpp_put_var_value): field %s in file %s has an invalid type, "
-	    "the type should be NC_DOUBLE, NC_FLOAT, NC_INT, NC_SHORT or NC_CHAR",
-	    files[fid].var[vid].name, files[fid].name );
-    mpp_error(errmsg);
-  }
-  
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_put_var_value): Error in putting value of variable %s from file %s",
-	    files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-  
-}; /* mpp_put_var_value*/
-
-/*********************************************************************
-  void mpp_put_var_value_block(int fid, int vid, const size_t *start, const size_t *nread, void *data)
-  read part of var data, the part is defined by start and nread.
-*********************************************************************/
-void mpp_put_var_value_block(int fid, int vid, const size_t *start, const size_t *nwrite, const void *data)
-{
-  int status;
-  char errmsg[512];
-
-  if( mpp_pe() != mpp_root_pe() ) return;
-  
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_put_var_value_block): invalid fid number, fid should be "
-				    "a nonnegative integer that less than nfiles");
-  if(vid<0 || vid >=files[fid].nvar) mpp_error("mpp_io(mpp_put_var_value_block): invalid vid number, vid should be "
-				    "a nonnegative integer that less than nvar");
-
-  switch(files[fid].var[vid].type) {
-  case NC_DOUBLE:case NC_FLOAT:
-    status = nc_put_vara_double(files[fid].ncid, files[fid].var[vid].fldid, start, nwrite, data);
-    break;
-  case NC_INT:
-    status = nc_put_vara_int(files[fid].ncid, files[fid].var[vid].fldid, start, nwrite, data);
-    break;
-  case NC_SHORT:
-    status = nc_put_vara_short(files[fid].ncid, files[fid].var[vid].fldid, start, nwrite, data);
-    break;    
-  case NC_CHAR:
-    status = nc_put_vara_text(files[fid].ncid, files[fid].var[vid].fldid, start, nwrite, data);
-    break;
-  default:
-    sprintf(errmsg, "mpp_io(mpp_put_var_value_block): field %s in file %s has an invalid type, "
-	    "the type should be NC_DOUBLE, NC_FLOAT, NC_INT, NC_SHORT or NC_CHAR",
-	    files[fid].var[vid].name, files[fid].name );
-    mpp_error(errmsg);
-  }    
-  
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_put_var_value_block): Error in putting value of variable %s from file %s",
-	    files[fid].var[vid].name, files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-  
-}; /* mpp_put_var_value_block */
-
-/*********************************************************************
-   void mpp_redef(int fid) 
-   redef the meta data of netcdf file with fid.
- *******************************************************************/
-void mpp_redef(int fid) {
-  int status;
-  char errmsg[512];
-  
-  if( mpp_pe() != mpp_root_pe() ) return;
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_redef): invalid fid number, fid should be "
-				      "a nonnegative integer that less than nfiles");
-  
-  status = nc_redef(files[fid].ncid);
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_redef): Error in redef the meta data of file %s", files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-} /* mpp_redef */
-
-/*********************************************************************
-   void mpp_end_def(int ncid) 
-   end the definition of netcdf file with ncid.
- *******************************************************************/
-void mpp_end_def(int fid) {
-  int status;
-  char errmsg[512];
-  
-  if( mpp_pe() != mpp_root_pe() ) return;
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_end_def): invalid fid number, fid should be "
-				      "a nonnegative integer that less than nfiles");
-  if(HEADER_BUFFER_VALUE>0)
-    status = nc__enddef(files[fid].ncid, HEADER_BUFFER_VALUE, 4, 0, 4);
-  else
-    status = nc_enddef(files[fid].ncid);
-    
-  if(status != NC_NOERR) {
-    sprintf(errmsg, "mpp_io(mpp_end_def): Error in end definition of file %s", files[fid].name );
-    netcdf_error(errmsg, status);
-  }
-} /* mpp_end_def */
-
-/*******************************************************************************
-  int mpp_file_exist(const char *file)
-  check to see if file exist or not.
-*******************************************************************************/
-int mpp_file_exist(const char *file)
-{
-  int status, ncid;
-  
-  status = nc_open(file,NC_NOWRITE, &ncid);
-  if(status == NC_NOERR) {
-    status = nc_close(ncid);
-    if(status != NC_NOERR) netcdf_error("mpp_file_exist(mpp_io):in closing file", status);
-    return 1;
-  }
-  else
-    return 0;
-};
-
-int mpp_field_exist(const char *file, const char *field)
-{
-  int fid, status, varid;
-
-  fid = mpp_open(file, MPP_READ);
-  status = nc_inq_varid(files[fid].ncid, field, &varid);
-  mpp_close(fid);
-
-  if(status == NC_NOERR)
-    return 1;
-  else
-    return 0;
-
-}
-
-int mpp_var_exist(int fid, const char *field)
-{
-  int status, varid;
-
-  if(fid<0 || fid >=nfiles) mpp_error("mpp_io(mpp_var_exist): invalid fid number, fid should be "
-				      "a nonnegative integer that less than nfiles");
-  
-  status = nc_inq_varid(files[fid].ncid, field, &varid);
-
-  if(status == NC_NOERR)
-    return 1;
-  else
-    return 0;
-
-} 
-
-
diff --git a/gridspec/tools/shared/mpp_io.h b/gridspec/tools/shared/mpp_io.h
deleted file mode 100644
index 25c608c..0000000
--- a/gridspec/tools/shared/mpp_io.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************
-                    mpp_io.h
-   This headers defines interface to read and write netcdf file. All the data
-will be written out from root pe. 
-
-   contact: Zhi.Liang at noaa.gov
-
-****************************************************************/
-#ifndef MPP_IO_H_
-#define MPP_IO_H_
-#include <netcdf.h>
-
-#define MPP_WRITE 100
-#define MPP_READ  200
-#define MPP_APPEND  300
-#define MPP_INT NC_INT
-#define MPP_DOUBLE NC_DOUBLE
-#define MPP_CHAR NC_CHAR
-/*#define HEADER_BUFFER_VALUE (16384)*/
-#define HEADER_BUFFER_VALUE (8192)
-
-int mpp_open(const char *file, int action);
-void mpp_close(int ncid);
-int mpp_get_varid(int fid, const char *varname);
-int mpp_get_dimid(int fid, const char *dimname);
-int mpp_get_dimlen(int fid, const char *name);
-void mpp_get_var_value(int fid, int vid, void *data);
-void mpp_get_var_value_block(int fid, int vid, const size_t *start, const size_t *nread, void *data);
-void mpp_get_var_att(int fid, int vid, const char *name, void *val);
-void mpp_get_var_att_double(int fid, int vid, const char *name, double *val);
-void mpp_get_global_att(int fid, const char *name, void *val);
-int mpp_get_var_ndim(int fid, int vid);
-nc_type mpp_get_var_type(int fid, int vid);
-char mpp_get_var_cart(int fid, int vid);
-void mpp_get_var_dimname(int fid, int vid, int ind, char *name);
-char mpp_get_dim_cart(int fid, const char *name);
-void mpp_get_var_bndname(int fid, int vid, char *bndname);
-int mpp_var_att_exist(int fid, int vid, const char *att);
-int mpp_global_att_exist(int fid, const char *att);
-
-int mpp_def_dim(int fid, const char* name, int size);
-int mpp_def_var(int fid, const char* name, nc_type type, int ndim, const int *dims, int natts, ...);
-void mpp_def_global_att(int fid, const char *name, const char *val);
-void mpp_def_var_att(int fid, int vid, const char *attname, const char *attval);
-void mpp_copy_var_att(int fid_in, int vid_in, int fid_out, int vid_out);
-void mpp_copy_global_att(int fid_in, int fid_out);
-void mpp_put_var_value(int fid, int vid, const void* data);
-void mpp_put_var_value_block(int fid, int vid, const size_t *start, const size_t *nread, const void *data);
-void mpp_end_def(int fid);
-void mpp_redef(int fid);
-int mpp_file_exist(const char *file);
-int mpp_field_exist(const char *file, const char *field);
-int mpp_var_exist(int fid, const char *field);
-#endif
diff --git a/gridspec/tools/shared/tool_util.c b/gridspec/tools/shared/tool_util.c
deleted file mode 100644
index 93b13c6..0000000
--- a/gridspec/tools/shared/tool_util.c
+++ /dev/null
@@ -1,3554 +0,0 @@
-
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include "constant.h"
-#include "mosaic_util.h"
-#include "read_mosaic.h"
-#include "tool_util.h"
-#include "interp.h"
-#include "mpp.h"
-#include "mpp_domain.h"
-#include "mpp_io.h"
-#include "conserve_interp.h"
-#include "bilinear_interp.h"
-#include "fregrid_util.h"
-
-#define  D2R (M_PI/180.)
-#define  R2D (180./M_PI)
-
-char tagname[] = "$Name:  $";
-
-const double SMALL = 1.0e-4;
-double distant(double a, double b, double met1, double met2);
-double bp_lam(double x, double y, double bpeq, double rp);
-double bp_phi(double x, double y, double bpsp, double bpnp);
-double lon_in_range(double lon, double lon_strt);
-void vtx_insert(double *x, double *y, int *n, int n_ins);
-void vtx_delete(double *x, double *y, int *n, int n_del);
-int lon_fix(double *x, double *y, int n_in, double tlon);
-
-/***************************************************************************
-  void get_file_path(const char *file, char *dir)
-  get the directory where file is located. The dir will be the complate path
-  before the last "/". If no "/" exist in file, the path will be current ".".
-***************************************************************************/
-void get_file_path(const char *file, char *dir)
-{
-  int len;
-  char *strptr = NULL;
-
-  /* get the diretory */
- 
-  strptr = strrchr(file, '/');
-  if(strptr) {
-    len = strptr - file;
-    strncpy(dir, file, len);
-  }
-  else {
-    len = 1;
-    strcpy(dir, ".");
-  }
-  dir[len] = 0;
-
-}; /* get_file_path */
-
-/* This file will get the directory that stores the file and the file name (without the dir path) */
-void get_file_dir_and_name(char *file, char *filedir, char *filename)
-{
-  char *fptr=NULL;
-  int siz;
-  
-  fptr = strrchr(file, '/');
-
-    if(!fptr) {
-      strcpy(filename, file);
-      strcpy(filedir, "./");
-    }
-    else {
-      ++fptr;
-      siz = fptr - file;
-      strcpy(filename, fptr);
-      strncpy(filedir, file, siz);      
-    }
-};
-
-
-int get_int_entry(char *line, int* value)
-{
-  char* pch;
-  int num;
-  
-  pch = strtok(line, ", ");
-  num = 0;
-  while( pch != NULL) {
-    value[num++] = atoi(pch);
-    pch = strtok(NULL, ", ");
-  }
-  return num;
-    
-};
-
-int get_double_entry(char *line, double *value)
-{
-  char* pch;
-  int num;
-  
-  pch = strtok(line, ", ");
-  num = 0;
-  while( pch != NULL) {
-    value[num++] = atof(pch);
-    pch = strtok(NULL, ", ");
-  }
-  return num;
-};
-
-/*********************************************************************
-  double spherical_dist(double x1, double y1, double x2, double y2)
-  return distance between spherical grid on the earth
-*********************************************************************/
-
-double spherical_dist(double x1, double y1, double x2, double y2)
-{
-  double dist = 0.0;
-  double h1, h2;
-  
-  if(x1 == x2) {
-    h1 = RADIUS;
-    h2 = RADIUS;
-    dist = distant(y1,y2,h1,h2);
-  }
-  else if(y1 == y2) {
-    h1 = RADIUS * cos(y1*D2R);
-    h2 = RADIUS * cos(y2*D2R);
-    dist = distant(x1,x2,h1,h2);
-  }
-  else 
-    mpp_error("tool_till: This is not rectangular grid");
-
-  return dist;
-}; /* spherical_dist */
-  
-
-/*********************************************************************
-  void double bipolar_dist(double x1, double y1, double x2, double y2)
-  return distance of bipolar grids
-*********************************************************************/
-double bipolar_dist(double x1, double y1, double x2, double y2,
-		    double bpeq, double bpsp, double bpnp, double rp )
-{
-  double dist, x[2],y[2], bp_lon[2], bp_lat[2], metric[2];
-  double h1[2], h2[2], chic;
-  int n;
-  
-  x[0] = x1;  x[1] = x2;
-  y[0] = y1;  y[1] = y2;
-  
-  /*--- get the bipolar grid and metric term ----------------------------*/
-  for(n=0; n<2; n++){
-    bp_lon[n] = bp_lam(x[n],y[n],bpeq, rp);     /* longitude (degrees) in bipolar grid system */
-    bp_lat[n] = bp_phi(x[n],y[n],bpsp, bpnp);  /* latitude (degrees) in bipolar grid system */
-    h1[n]     = RADIUS*cos(bp_lat[n]*D2R);
-    h2[n]     = RADIUS;
-    metric[n] = 1.0;
-    if (fabs(y[n]-90.0) < SMALL || fabs(bp_lon[n]*D2R) >= SMALL
-	|| fabs(bp_lat[n]*D2R) >= SMALL) {
-      chic = acos(cos(bp_lon[n]*D2R)*cos(bp_lat[n]*D2R));            /* eqn. 6 */
-      metric[n] = rp*(1/pow(cos(chic/2),2))/(1+(pow(rp,2))*(pow(tan(chic/2),2)));/* eq 3 */
-    }
-  }
-
-  /*--- then calculate the distance -------------------------------------*/
-  if(x1 == x2) 
-    dist = distant(bp_lon[0],bp_lon[1],metric[0]*h1[0],metric[1]*h1[1]);
-  else if(y1 == y2) 
-    dist = distant(bp_lat[0],bp_lat[1],metric[0]*h2[0],metric[1]*h2[1]);
-  else
-    mpp_error("tool_util: This tripolar grid not transformed from rectangular grid");    
-
-  return dist;
-  
-}; /* bipolar_dist */
-
-/*********************************************************************
-  double distant(double a, double b, double met1, double met2)
-  return distant on the earth
-*********************************************************************/
-double distant(double a, double b, double met1, double met2)
-{
-   return fabs(a-b)*D2R*(met1+met2)/2. ;
-}; /* distant */
-
-/*********************************************************************
-   double spherical_area(double x1, double y1, double x2, double y2,
-                   double x3, double y3, double x4, double y4 )            
-   rectangular grid box area
- ********************************************************************/
-double spherical_area(double x1, double y1, double x2, double y2,
-		      double x3, double y3, double x4, double y4 )
-{
-  double area, dx, lat1, lat2, x[4],y[4];
-  int i, ip;
-  
-  x[0] = x1; y[0] = y1;
-  x[1] = x2; y[1] = y2;
-  x[2] = x3; y[2] = y3;
-  x[3] = x4; y[3] = y4;
-
-  area = 0.0;
-
-  for(i=0; i<4; i++) {
-    ip = i+1;
-    if(ip ==4) ip = 0;
-    dx = (x[ip] - x[i])*D2R;
-    lat1 = y[ip]*D2R;
-    lat2 = y[i]*D2R;
-    if(dx==0.0) continue;
-    if(dx > M_PI)  dx = dx - 2.0*M_PI;
-    if(dx < -M_PI) dx = dx + 2.0*M_PI;
-
-    if (lat1 == lat2) /* cheap area calculation along latitude  */
-      area = area - dx*sin(lat1);
-    else 
-      area = area - dx*(sin(lat1)+sin(lat2))/2;   /*  TRAPEZOID_RULE */
-  }
-
-  area = area * RADIUS * RADIUS;
-
-  return area;
-}; /* spherical_area */
-
-/*********************************************************************
-   double bipolar_area(double x1, double y1, double x2, double y2,
-                       double x3, double y3, double x4, double y4 )            
-   bipolar grid  area
- ********************************************************************/
-double bipolar_area(double x1, double y1, double x2, double y2,
-			  double x3, double y3, double x4, double y4 )
-{
-  double area, dx, lat1, lat2, x[8],y[8];
-  int i, ip, n;
-  
-  x[0] = x1; y[0] = y1;
-  x[1] = x2; y[1] = y2;
-  x[2] = x3; y[2] = y3;
-  x[3] = x4; y[3] = y4;
-
-
-  /*--- first fix the longitude at the pole -----------------------------*/
-  n = lon_fix(x, y, 4, 180.);
-
-  /*--- calculate the area ----------------------------------------------  */
-  area = 0.0;  
-  for(i=0; i<n; i++){
-    ip = i+1;
-    if(ip == n) ip = 0;
-    dx   = (x[ip] - x[i])*D2R;
-    lat1 = y[ip]*D2R;
-    lat2 = y[i]*D2R;
-    if(dx==0.0) continue;
-    if(dx > M_PI)  dx = dx - 2.0*M_PI;
-    if(dx < -M_PI) dx = dx + 2.0*M_PI;
-
-    if (lat1 == lat2)  /* cheap area calculation along latitude */
-      area = area - dx*sin(lat1);
-    else
-      area = area - dx*(sin(lat1)+sin(lat2))/2;   /*  TRAPEZOID_RULE */
-  }
-  
-  area = area * RADIUS * RADIUS;
-
-  return area;
-}; /* bipolar_area */
-
-/*********************************************************************
-  double lat_dist(double x1, double x2)
-  distance (in degrees) between points on lat. circle
- ********************************************************************/
-  double lat_dist(double x1, double x2)
-{
-  return min(fmod(x1-x2+720,360.),fmod(x2-x1+720,360.));
-};
-
-
-/*********************************************************************
-  double bp_lam(double x, double y, double bpeq)
-  find bipolar grid longitude given geo. coordinates
- ********************************************************************/
-  double bp_lam(double x, double y, double bpeq, double rp)
-{
-  double bp_lam;
-
-  /*  bp_lam = ((90-y)/(90-lat_join))*90 */
-  /* invert eqn. 5 with phic=0 to place point at specified geo. lat */
-  bp_lam = 2.*atan(tan((0.5*M_PI-y*D2R)/2)/rp)*R2D;
-  if (lat_dist(x,bpeq)<90.) bp_lam = -bp_lam;
-  return bp_lam;
-}; /* bp_lam */
-
-/*********************************************************************
-   double bp_phi(double x, double y, double bpsp, double bpnp)
-   find bipolar grid latitude given geo. coordinates
- ********************************************************************/
-   double bp_phi(double x, double y, double bpsp, double bpnp)
-{
-  if (lat_dist(x,bpsp)<90.)
-    return (-90+lat_dist(x,bpsp));
-  else
-    return ( 90-lat_dist(x,bpnp));
-}; /* bp_phi */
-
-
-/*********************************************************************
-  void tp_trans(double& lon, double& lat, double lon_ref)
-  calculate tripolar grid
- ********************************************************************/
-void tp_trans(double *lon, double *lat, double lon_ref, double lon_start, 
-		    double lam0, double bpeq, double bpsp, double bpnp, double rp )
-{
-  double lamc, phic, lams, chic, phis;
-  
-  lamc = bp_lam(*lon, *lat, bpeq, rp )*D2R;
-  phic = bp_phi(*lon, *lat, bpsp, bpnp)*D2R;
-
-  if (fabs(*lat-90.) < SMALL) {
-       if (phic > 0) 
-	 *lon=lon_in_range(lon_start,lon_ref);
-       else
-	 *lon=lon_start+180.;
-       chic = acos(cos(lamc)*cos(phic));                     /* eqn. 6 */
-       phis = M_PI*0.5-2*atan(rp*tan(chic/2));                   /* eqn. 5 */
-       *lat = phis*R2D;
-       return;
-  }
-
-  if (fabs(lamc) < SMALL && fabs(phic) < SMALL) {
-    *lat=90.;
-    *lon=lon_ref;
-  }
-  else {
-    lams = fmod(lam0+M_PI+M_PI/2-atan2(sin(lamc),tan(phic)),2*M_PI);  /* eqn. 5 */
-    chic = acos(cos(lamc)*cos(phic));                          /* eqn. 6 */
-    phis = M_PI*0.5-2*atan(rp*tan(chic/2));                        /* eqn. 5 */
-    *lon = lams*R2D;
-    *lon = lon_in_range(*lon,lon_ref); 
-    *lat = phis*R2D;
-  }
-}; /* tp_trans */
-
-/*********************************************************************
-  double Lon_in_range(double lon, double lon_strt)
-  Returns lon_strt <= longitude <= lon_strt+360
- ********************************************************************/
-double lon_in_range(double lon, double lon_strt)
-{
-  double lon_in_range, lon_end;
-
-  lon_in_range = lon;
-  lon_end = lon_strt+360.;
-
-  if (fabs(lon_in_range - lon_strt) < SMALL) 
-    lon_in_range = lon_strt;
-  else if (fabs(lon_in_range - lon_end) < SMALL)
-    lon_in_range = lon_strt;
-  else {
-    while(1) {
-      if (lon_in_range < lon_strt)          
-	lon_in_range = lon_in_range +  360.;
-      else if (lon_in_range  >  lon_end)
-	lon_in_range  = lon_in_range - 360.;
-      else
-	break;
-    }
-  }
-  return lon_in_range;
-}; /* lon_in_range */
-
-
-/*********************************************************************
-   int lon_fix(double *x, double *y, int n_in, double tlon) 
-   fix longitude at pole.
- ********************************************************************/
-int lon_fix(double *x, double *y, int n_in, double tlon)
-{
-  int i, ip, im, n_out;
-  double x_sum, dx;
-  
-  n_out = n_in;
-  i     = 0;
-  while( i < n_out) {
-    if(fabs(y[i]) >= 90.-SMALL) {
-      im = i - 1;
-      if(im < 0) im = im + n_out;
-      ip = i + 1;
-      if(ip >= n_out) ip = ip - n_out;
-      /*--- all pole points must be paired ---------------------------- */
-      if(y[im] == y[i] && y[ip] == y[i] ) {
-	vtx_delete(x,y, &n_out, i);
-	i = i - 1;
-      }
-      else if(y[im] != y[i] && y[ip] != y[i] ) {
-        vtx_insert(x,y,&n_out,i);
-	i = i + 1;
-      }
-    }
-    i = i + 1;
-  }
-
-  /*--- first of pole pair has longitude of previous vertex -------------
-    --- second of pole pair has longitude of subsequent vertex ---------- */
-  for(i=0;i<n_out;i++){
-    if(fabs(y[i]) >= 90.-SMALL) {
-      im= i - 1;
-      if(im < 0) im = im + n_out;
-      ip = i + 1;
-      if(ip >= n_out) ip = ip - n_out;
-
-      if(y[im] != y[i]) x[i] = x[im];
-      if(y[ip] != y[i]) x[i] = x[ip];
-    }
-  }
-
-  if(n_out == 0) return 0;
-
-  x_sum = x[1];
-  for(i=1;i< n_out;i++){
-    dx = x[i] - x[i-1];
-    if(dx < -180) 
-      dx = dx + 360;
-    else if (dx >  180)
-      dx = dx - 360;
-
-    x[i] = x[i-1] + dx;
-    x_sum = x_sum + x[i];
-  }
-
-  dx = x_sum/(n_out) - tlon;
-  if (dx < -180.) 
-    for(i=0;i<n_out;i++) x[i] = x[i] + 360.;
-  else if (dx > 180.)
-    for(i=0;i<n_out;i++) x[i] = x[i] - 360.;
-
-  return n_out;
-  
-}; /* lon_fix */
-
-
-/*********************************************************************
-   void vtx_delete(double *x, double *y, int *n, int n_del)
-   delete vertex
- ********************************************************************/
-void vtx_delete(double *x, double *y, int *n, int n_del)
-{
-  int i;
-
-  for(i=n_del; i<=*n-2; i++)
-    {
-      x[i] = x[i+1];
-      y[i] = y[i+1];
-    }
-  (*n)--;
-}; /* vtx_delete */
-
-/*********************************************************************
-   void Vtx_insert(double *x, double *y, int *n, int n_del)
-   insert vertex
- ********************************************************************/
-void vtx_insert(double *x, double *y, int *n, int n_ins)
-{
-  int i;
-
-  for(i=*n-1; i>=n_ins; i--){
-    x[i+1] = x[i];
-    y[i+1] = y[i];
-  }
-  (*n)++;
-
-}; /* vtx_insert */
-
-
-/*----------------------------------------------------------------------
-    void vect_cross(e, p1, p2)
-    Perform cross products of 3D vectors: e = P1 X P2
-    -------------------------------------------------------------------*/
-    
-/********************************************************************************
-  void compute_grid_bound(int nb, const couble *bnds, const int *npts, int *grid_size, const char *center_cell)
-  compute the 1-D grid location.
-********************************************************************************/
-double* compute_grid_bound(int nb, const double *bnds, const int *npts, int *grid_size, const char *center)
-{
-  int    refine, i, n, np;
-  double *grid=NULL, *tmp=NULL;
-  double *grid1=NULL, *grid2=NULL;
-
-  if(!strcmp(center, "none") )
-    refine = 1;
-  else if(!strcmp(center, "t_cell") || !strcmp(center, "c_cell") )
-    refine = 2;
-  else
-    mpp_error("tool_util: center should be 'none', 'c_cell' or 't_cell' ");
-	  
-  grid1 = (double *)malloc(nb*sizeof(double));
-  grid1[0] = 1;
-  n = 0;
-  for(i=1; i<nb; i++) {
-    if(npts[i-1]%refine) mpp_error("tool_util: when center_cell is not 'none', npts should be divided by 2");
-    n += npts[i-1]/refine;
-    grid1[i] = n+1;
-  }
-  np = n + 1;
-  *grid_size = n*refine;
-  tmp   = (double *)malloc(np*sizeof(double));
-  grid  = (double *)malloc((*grid_size+1)*sizeof(double));
-  grid2 = (double *)malloc(np*sizeof(double));
-  for(i=0;i<np;i++) grid2[i] = i + 1.0;
-
-  cubic_spline( nb, np, grid1, grid2, bnds, tmp, 1e30, 1e30);
-  if(!strcmp(center, "none")) {
-    for(i=0; i<np; i++) grid[i] = tmp[i];
-  }
-  else if(!strcmp(center, "t_cell")) {
-    for(i=0; i<np; i++) grid[2*i] = tmp[i];
-    for(i=0; i<n;  i++) grid[2*i+1] = 0.5*(tmp[i]+tmp[i+1]);
-  }
-  else if( !strcmp(center, "c_cell")) {
-    for(i=0; i<np; i++) grid[2*i] = tmp[i];
-    grid[1] = 0.5*(tmp[0]+tmp[1]);
-    for(i=1; i<n;  i++) grid[2*i+1] = 2*grid[2*i] - grid[2*i-1];
-  }
-    
-  free(grid1);
-  free(grid2);
-  free(tmp);  
-
-  return grid;
-  
-};/* compute_grid_bound */
-
-double* get_subregion(int ni, double *data, int is, int ie, int js, int je)
-{
-  int i, j, pos;
-  double *ldata;
-  
-  ldata = (double *)malloc((ie-is+1)*(je-js+1)*sizeof(double));
-  pos = 0;
-  for(j=js; j<=je; j++)
-    for(i=is; i<=ie; i++) ldata[pos++] = data[j*ni+i];
-
-  return ldata;
-  
-}; /* get_subregion */
-
-
-#define MAXBOUNDS 100
-#define STRINGLEN 255
-#define GRID_VERSION "0.2"
-#define TAGNAME "$Name:  $"
-
-#include "create_hgrid.h"
-
-int
-gs_make_hgrid(char *grid_type, int *nlat, int *nlon, 
-	      int nxbnds0, int nybnds0, int nxbnds1, int nybnds1, 
-	      int nxbnds2, int nybnds2, double lat_join, int nratio, 
-	      double simple_dx, double simple_dy, int ntilex, int *ndivx,
-	      int ntiley, int *ndivy,
-              char *gridname, char *center, char *history, double *xbnds, 
-	      double *ybnds)
-{
-  
-   char method[32] = "conformal";
-   char orientation[32] = "center_pole";
-   int  nxbnds=2, nybnds=2;
-   char my_grid_file[MAXBOUNDS][STRINGLEN];
-   int nx, ny, nxp, nyp, ntiles=1;
-   double *x=NULL, *y=NULL, *dx=NULL, *dy=NULL, *angle_dx=NULL, *angle_dy=NULL, *area=NULL;
-
-   char geometry[32] = "spherical";
-   char projection[32] = "none";
-   char arcx[32] = "small_circle";
-   char north_pole_tile[32] = "lon:0.0, lat:90.0";
-   char north_pole_arcx[32] = "lon:0.0, lat:90.0";
-   char discretization[32]  = "logically_rectangular";
-   char conformal[32]       = "true";
-   char regular[32]         = "true";
-   
-   char mesg[256], str[128];
-   int isc, iec, jsc, jec, nxc, nyc, layout[2];
-   domain2D domain;
-   int n, errflg, c, i;  
-
-   /* check the command-line arguments to make sure the value are suitable */
-   if( strcmp(grid_type,"regular_lonlat_grid") ==0 ) {
-      nxbnds = nxbnds0; nybnds = nybnds0;
-      if( nxbnds <2 || nybnds < 2) mpp_error("make_hgrid: grid type is 'regular_lonlat_grid', "
-      "both nxbnds and nybnds should be no less than 2");
-      if( nxbnds != nxbnds1 || nxbnds != nxbnds2+1 )
-	 mpp_error("make_hgrid: grid type is 'regular_lonlat_grid', nxbnds does"
-	 "not match number of entry in xbnds or nlon");
-      if( nybnds != nybnds1 || nybnds != nybnds2+1 )
-	 mpp_error("make_hgrid: grid type is 'regular_lonlat_grid', nybnds does "
-	 "not match number of entry in ybnds or nlat");
-   }
-   else if( strcmp(grid_type,"tripolar_grid") ==0 ) {
-      strcpy(projection, "tripolar");
-      strcpy(regular, "false");
-      nxbnds = nxbnds0; nybnds = nybnds0;
-      if( nxbnds != 2) mpp_error("make_hgrid: grid type is 'tripolar_grid', nxbnds should be 2");
-      if( nybnds < 2) mpp_error("make_hgrid: grid type is 'tripolar_grid', nybnds should be no less than 2");
-      if( nxbnds != nxbnds1 || nxbnds != nxbnds2+1 )
-	 mpp_error("make_hgrid: grid type is 'tripolar_grid', nxbnds does not match number of entry in xbnds or nlon");
-      if( nybnds != nybnds1 || nybnds != nybnds2+1 )
-	 mpp_error("make_hgrid: grid type is 'tripolar_grid', nybnds does not match number of entry in ybnds or nlat");
-   }
-   else if( strcmp(grid_type,"from_file") ==0 ) {
-      /* For ascii file, nlon and nlat should be specified through --nlon, --nlat
-	 For netcdf file, grid resolution will be read from grid file
-      */
-    
-      for(n=0; n<ntiles; n++) {
-	 if(strstr(my_grid_file[n],".nc") ) {
-	    /* get the grid size for each tile, the grid is on model grid, should need to multiply by 2 */
-	    int fid;
-	    fid = mpp_open(my_grid_file[n], MPP_READ);
-	    nlon[n] = mpp_get_dimlen(fid, "grid_xt")*2;
-	    nlat[n] = mpp_get_dimlen(fid, "grid_yt")*2;
-	    mpp_close(fid);
-	 }
-	 else {
-	    if(nxbnds2 != ntiles || nybnds2 != ntiles ) mpp_error("make_hgrid: grid type is 'from_file', number entry entered "
-	    "through --nlon and --nlat should be equal to number of files "
-	    "specified through --my_grid_file");
-	 }
-      }
-      /* for simplify purpose, currently we assume all the tile have the same grid size */
-      for(n=1; n<ntiles; n++) {
-	 if( nlon[n] != nlon[0] || nlat[n] != nlat[0])  mpp_error("make_hgrid: grid_type is from_file, all the tiles should "
-	 "have same grid size, contact developer");
-      }
-   }
-   else if( strcmp(grid_type,"simple_cartesian_grid") ==0) {
-      strcpy(geometry, "planar");
-      strcpy(north_pole_tile, "none");
-      if(nxbnds1 != 2 || nybnds1 != 2 ) mpp_error("make_hgrid: grid type is 'simple_cartesian_grid', number entry entered "
-      "through --xbnds and --ybnds should be 2");
-      if(nxbnds2 != 1 || nybnds2 != 1 ) mpp_error("make_hgrid: grid type is 'simple_cartesian_grid', number entry entered "
-      "through --nlon and --nlat should be 1");
-      if(simple_dx == 0 || simple_dy == 0) mpp_error("make_hgrid: grid_type is 'simple_cartesian_grid', "
-      "both simple_dx and simple_dy both should be specified");
-   }
-   else if ( strcmp(grid_type,"spectral_grid") ==0 ) {
-      if(nxbnds2 != 1 || nybnds2 != 1 ) mpp_error("make_hgrid: grid type is 'spectral_grid', number entry entered "
-      "through --nlon and --nlat should be 1");    
-   }
-   else if( strcmp(grid_type,"conformal_cubic_grid") ==0 ) {
-      strcpy(projection, "cube_gnomonic");
-      strcpy(regular, "false");
-      if(nxbnds2 != 1 ) mpp_error("make_hgrid: grid type is 'conformal_cubic_grid', number entry entered "
-      "through --nlon should be 1");
-      if(nratio < 1) mpp_error("make_hgrid: grid type is 'conformal_cubic_grid', nratio should be a positive integer");
-   }
-   else if(  !strcmp(grid_type,"gnomonic_ed") ) {
-      strcpy(projection, "cube_gnomonic");
-      strcpy(conformal, "false");
-      strcpy(regular, "false");
-      if(nxbnds2 != 1 ) mpp_error("make_hgrid: grid type is 'gnomonic_cubic_grid', number entry entered "
-      "through --nlon should be 1");
-   }
-   else {
-      mpp_error("make_hgrid: only grid_type = 'regular_lonlat_grid', 'tripolar_grid', 'from_file', "
-      "'gnomonic_ed', 'conformal_cubic_grid', 'simple_cartesian_grid' and "
-      "'spectral_grid' is implemented");  
-   }
-  
-   /* get super grid size */
-
-   if( !strcmp(grid_type,"gnomonic_ed") || !strcmp(grid_type,"conformal_cubic_grid") ) {
-      nx = nlon[0];
-      ny = nx;
-   }
-   else {
-      nx = 0;
-      ny = 0;
-      for(n=0; n<nxbnds-1; n++) nx += nlon[n];
-      for(n=0; n<nybnds-1; n++) ny += nlat[n];  
-   }
-   nxp = nx + 1;
-   nyp = ny + 1;
-
-   if( !strcmp(grid_type,"gnomonic_ed") || !strcmp(grid_type,"conformal_cubic_grid") ) {
-      ntiles = 6;
-      /* Cubic grid is required to run on single processor.*/
-      if(mpp_npes() > 1) mpp_error( "make_hgrid: cubic grid generation must be run one processor, contact developer");
-   }
-   /* Currently we restrict nx can be divided by ndivx and ny can be divided by ndivy */
-   if(ntilex >0 && ntilex != ntiles) mpp_error("make_hgrid: number of entry specified through --ndivx does not equal ntiles");
-   if(ntiley >0 && ntiley != ntiles) mpp_error("make_hgrid: number of entry specified through --ndivy does not equal ntiles");   
-   for(n=0; n<ntiles; n++) {
-      if( nx%ndivx[n] ) mpp_error("make_hgrid: nx can not be divided by ndivx");
-      if( ny%ndivy[n] ) mpp_error("make_hgrid: ny can not be divided by ndivy");
-   }
-
-   if(strcmp(center,"none") && strcmp(center,"c_cell") && strcmp(center,"t_cell") )
-      mpp_error("make_hgrid: center should be 'none', 'c_cell' or 't_cell' ");
-  
-   /* set up domain decomposition, x and y will be on global domain and
-      other fields will be on compute domain. 
-   */
-
-   mpp_define_layout( nx, ny, mpp_npes(), layout);
-   mpp_define_domain2d( nx, ny, layout, 0, 0, &domain);
-   mpp_get_compute_domain2d(domain, &isc, &iec, &jsc, &jec);
-   nxc = iec - isc + 1;
-   nyc = jec - jsc + 1;
-
-   /* create grid information */
-   x        = (double *) malloc(nxp*nyp*ntiles*sizeof(double));
-   y        = (double *) malloc(nxp*nyp*ntiles*sizeof(double));
-   dx       = (double *) malloc(nxc*(nyc+1)*ntiles*sizeof(double));
-   dy       = (double *) malloc((nxc+1)*nyc*ntiles*sizeof(double));
-   area     = (double *) malloc(nxc    *nyc*ntiles*sizeof(double));
-   angle_dx = (double *) malloc((nxc+1)*(nyc+1)*ntiles*sizeof(double));
-   if( strcmp(conformal,"true") !=0 )angle_dy = (double *) malloc(nxp*nyp*ntiles*sizeof(double));
-  
-   if(strcmp(grid_type,"regular_lonlat_grid") ==0) 
-      create_regular_lonlat_grid(&nxbnds, &nybnds, xbnds, ybnds, nlon, nlat, &isc, &iec, &jsc, &jec,
-      x, y, dx, dy, area, angle_dx, center);
-   else if(strcmp(grid_type,"tripolar_grid") ==0) 
-      create_tripolar_grid(&nxbnds, &nybnds, xbnds, ybnds, nlon, nlat, &lat_join, &isc, &iec, &jsc, &jec,
-      x, y, dx, dy, area, angle_dx, center);
-   else if( strcmp(grid_type,"from_file") ==0 ) {
-      for(n=0; n<ntiles; n++) {
-	 int n1, n2, n3, n4;
-	 n1 = n * nxp * nyp;
-	 n2 = n * nx  * nyp;
-	 n3 = n * nxp * ny;
-	 n4 = n * nx  * ny;
-	 create_grid_from_file(my_grid_file[n], &nx, &ny, x+n1, y+n1, dx+n2, dy+n3, area+n4, angle_dx+n1);
-      }
-   }
-   else if(strcmp(grid_type,"simple_cartesian_grid") ==0) 
-      create_simple_cartesian_grid(xbnds, ybnds, &nx, &ny, &simple_dx, &simple_dy, &isc, &iec, &jsc, &jec,
-      x, y, dx, dy, area, angle_dx );
-   else if(strcmp(grid_type,"spectral_grid") ==0 )
-      create_spectral_grid(&nx, &ny, &isc, &iec, &jsc, &jec, x, y, dx, dy, area, angle_dx );
-   else if(strcmp(grid_type,"conformal_cubic_grid") ==0 ) 
-      create_conformal_cubic_grid(&nx, &nratio, method, orientation, x, y, dx, dy, area, angle_dx, angle_dy );
-   else if(strcmp(grid_type,"gnomonic_ed") ==0 ) 
-      create_gnomonic_cubic_grid(grid_type, &nx, x, y, dx, dy, area, angle_dx, angle_dy );
-  
-   /* write out data */
-   {
-      int fid, id_tile, id_x, id_y, id_dx, id_dy, id_area, id_angle_dx, id_angle_dy, id_arcx;
-      int dimlist[5], dims[2], i, j, l, ni, nj, nip, njp, m;
-      size_t start[4], nwrite[4];
-      double *tmp, *gdata;
-      char tilename[128] = "";
-      char outfile[128] = "";
-    
-      l = 0;
-      for(n=0 ; n< ntiles; n++) {
-	 for(j=0; j<ndivy[n]; j++) {
-	    for(i=0; i<ndivx[n]; i++) {
-	       ++l;
-	       sprintf(tilename, "tile%d", l);
-	       if(ntiles>1 || ndivx[n]>1 || ndivy[n] > 1)
-		  sprintf(outfile, "%s.tile%d.nc", gridname, l);
-	       else
-		  sprintf(outfile, "%s.nc", gridname);
-	       fid = mpp_open(outfile, MPP_WRITE);
-	       /* define dimenison */
-	       ni = nx/ndivx[n];
-	       nj = ny/ndivy[n];
-	       nip = ni + 1;
-	       njp = nj + 1;
-	       dimlist[0] = mpp_def_dim(fid, STRING_NAME, STRINGLEN);
-	       dimlist[1] = mpp_def_dim(fid, NX_NAME, ni);
-	       dimlist[2] = mpp_def_dim(fid, NY_NAME, nj);
-	       dimlist[3] = mpp_def_dim(fid, NXP_NAME, nip);
-	       dimlist[4] = mpp_def_dim(fid, NYP_NAME, njp);
-	       /* define variable */
-	       if( strcmp(north_pole_tile, "none") == 0) /* no north pole, then no projection */
-		 id_tile = mpp_def_var(fid, TILE_NAME, MPP_CHAR, 1, dimlist, 6, "standard_name", "grid_tile_spec",
-				       GEOMETRY_NAME, geometry,
-				       DISCRETIZATION_NAME, discretization, CONFORMAL_NAME, conformal,
-				       REGULAR_NAME, regular, "projection", projection);
-	       else
-		 id_tile = mpp_def_var(fid, TILE_NAME, MPP_CHAR, 1, dimlist, 7, "standard_name", "grid_tile_spec",
-				       GEOMETRY_NAME, geometry, DISCRETIZATION_NAME,
-				       discretization, CONFORMAL_NAME, conformal, REGULAR_NAME, regular,
-				       "projection", projection, "north_pole", north_pole_tile );
-
-	       dims[0] = dimlist[4]; dims[1] = dimlist[3];
-	       id_x = mpp_def_var(fid, X_NAME, MPP_DOUBLE, 2, dims, 2, "standard_name", "geographic_longitude",
-				  "units", "degree_east");
-	       id_y = mpp_def_var(fid, Y_NAME, MPP_DOUBLE, 2, dims, 2, "standard_name", "geographic_latitude",
-				  "units", "degree_north");
-	       dims[0] = dimlist[4]; dims[1] = dimlist[1];
-	       id_dx = mpp_def_var(fid, DX_NAME, MPP_DOUBLE, 2, dims, 2, "standard_name", "grid_edge_x_distance",
-				   "units", "meters");
-	       dims[0] = dimlist[2]; dims[1] = dimlist[3];
-	       id_dy = mpp_def_var(fid, DY_NAME, MPP_DOUBLE, 2, dims, 2, "standard_name", "grid_edge_y_distance",
-				   "units", "meters");
-	       dims[0] = dimlist[2]; dims[1] = dimlist[1];
-	       id_area = mpp_def_var(fid, "area", MPP_DOUBLE, 2, dims, 2, "standard_name", "grid_cell_area",
-				     "units", "m2" );
-	       dims[0] = dimlist[4]; dims[1] = dimlist[3];
-	       id_angle_dx = mpp_def_var(fid, ANGLE_DX_NAME, MPP_DOUBLE, 2, dims, 2, "standard_name",
-					 "grid_vertex_x_angle_WRT_geographic_east", "units", "degrees_east");
-	       if(strcmp(conformal, "true") != 0)
-		 id_angle_dy = mpp_def_var(fid, ANGLE_DY_NAME, MPP_DOUBLE, 2, dims, 2, "standard_name",
-					   "grid_vertex_y_angle_WRT_geographic_north", "units", "degrees_north");
-	       if( strcmp(north_pole_arcx, "none") == 0)
-		 id_arcx = mpp_def_var(fid, ARCX_NAME, MPP_CHAR, 1, dimlist, 1, "standard_name", "grid_edge_x_arc_type" );
-	       else
-		 id_arcx = mpp_def_var(fid, ARCX_NAME, MPP_CHAR, 1, dimlist, 2, "standard_name", "grid_edge_x_arc_type",
-				       "north_pole", north_pole_arcx );
-	       mpp_def_global_att(fid, GRID_VERSION_NAME, grid_version);
-	       mpp_def_global_att(fid, CODE_VERSION_NAME, tagname);
-	       mpp_def_global_att(fid, HISTORY_NAME, history);
-      
-	       mpp_end_def(fid);
-	       for(m=0; m<4; m++) { start[m] = 0; nwrite[m] = 0; }
-	       nwrite[0] = strlen(tilename);
-	       mpp_put_var_value_block(fid, id_tile, start, nwrite, tilename );
-
-	       tmp = get_subregion(nxp, x+n*nxp*nyp, i*ni, (i+1)*ni, j*nj, (j+1)*nj);
-	       mpp_put_var_value(fid, id_x, tmp);
-	       free(tmp);
-	       tmp = get_subregion(nxp, y+n*nxp*nyp, i*ni, (i+1)*ni, j*nj, (j+1)*nj);
-	       mpp_put_var_value(fid, id_y, tmp);
-	       free(tmp);
-	       gdata = (double *)malloc(nx*nyp*sizeof(double));
-	       mpp_global_field_double(domain, nxc, nyc+1, dx+n*nx*nyp, gdata);
-	       tmp = get_subregion( nx, gdata, i*ni, (i+1)*ni-1, j*nj, (j+1)*nj);
-	       mpp_put_var_value(fid, id_dx, tmp);
-	       free(tmp);
-	       free(gdata);
-	       gdata = (double *)malloc(nxp*ny*sizeof(double));
-	       mpp_global_field_double(domain, nxc+1, nyc, dy+n*nxp*ny, gdata);
-	       tmp = get_subregion( nxp, gdata, i*ni, (i+1)*ni, j*nj, (j+1)*nj-1);
-	       mpp_put_var_value(fid, id_dy, tmp);
-	       free(tmp);
-	       free(gdata);	  
-	       gdata = (double *)malloc(nx*ny*sizeof(double));
-	       mpp_global_field_double(domain, nxc, nyc, area+n*nx*ny, gdata);
-	       tmp = get_subregion( nx, gdata, i*ni, (i+1)*ni-1, j*nj, (j+1)*nj-1);
-	       mpp_put_var_value(fid, id_area, tmp);
-	       free(tmp);
-	       free(gdata);
-	       gdata = (double *)malloc(nxp*nyp*sizeof(double));
-	       mpp_global_field_double(domain, nxc+1, nyc+1, angle_dx+n*nxp*nyp, gdata);
-	       tmp = get_subregion( nxp, gdata, i*ni, (i+1)*ni, j*nj, (j+1)*nj);
-	       mpp_put_var_value(fid, id_angle_dx, tmp);
-	       free(tmp);
-	       free(gdata);
-	  
-	       if(strcmp(conformal, "true") != 0) {
-		 gdata = (double *)malloc(nxp*nyp*sizeof(double));
-		 mpp_global_field_double(domain, nxc+1, nyc+1, angle_dy+n*nxp*nyp, gdata);
-		 tmp = get_subregion( nxp, gdata, i*ni, (i+1)*ni, j*nj, (j+1)*nj);
-		 mpp_put_var_value(fid, id_angle_dy, tmp);
-		 free(tmp);
-		 free(gdata);
-	       }
-	       nwrite[0] = strlen(arcx);
-	       mpp_put_var_value_block(fid, id_arcx, start, nwrite, arcx );
-	       mpp_close(fid);
-	    }
-	       
-	 }
-      }
-   }
-
-   free(x);
-   free(y);
-   free(dx);
-   free(dy);
-   free(area);
-   free(angle_dx);
-   if(strcmp(conformal, "true") != 0) free(angle_dy);
-
-   return 0;
-   
-}
-
-int
-gs_fregrid(char *history, char *mosaic_in, char *mosaic_out, char *dir_in, 
-           char *dir_out, char input_file[][STRING], int nfiles, char output_file[][STRING], 
-           int nfiles_out, char *remap_file, char scalar_name[][STRING], int nscalar,
-           char u_name[][STRING], int nvector, char v_name[][STRING], int nvector2, 
-           char *interp_method, char *test_case, double test_param, 
-           unsigned int opcode, int grid_type, unsigned int finer_step,
-           int fill_missing, int nlon, int nlat, int check_conserve, 
-           int y_at_center, double lonbegin, double lonend, double latbegin,
-           double latend, int kbegin, int kend, int lbegin, int lend)
-{
-  int     ntiles_in = 0;              /* number of tiles in input mosaic */
-  int     ntiles_out = 0;             /* number of tiles in output mosaic */
-  int     i, n, m, l;
-  char    txt[STRING];
-
-  Grid_config   *grid_in    = NULL;   /* store input grid  */
-  Grid_config   *grid_out   = NULL;   /* store output grid */
-  Field_config  *scalar_in  = NULL;   /* store input scalar data */
-  Field_config  *scalar_out = NULL;   /* store output scalar data */
-  Field_config  *u_in       = NULL;   /* store input vector u-component */
-  Field_config  *v_in       = NULL;   /* store input vector v-component */
-  Field_config  *u_out      = NULL;   /* store input vector u-component */
-  Field_config  *v_out      = NULL;   /* store input vector v-component */
-  File_config   *file_in    = NULL;   /* store input file information */
-  File_config   *file_out   = NULL;   /* store output file information */
-  File_config   *file2_in   = NULL;   /* store input file information */
-  File_config   *file2_out  = NULL;   /* store output file information */
-  Bound_config  *bound_T    = NULL;   /* store halo update information for T-cell*/
-  Interp_config *interp     = NULL;   /* store remapping information */
-  int save_weight_only      = 0;
-  
-  int fid;
-  
-  /* check the arguments */
-  if( !mosaic_in  ) mpp_error("fregrid: input_mosaic is not specified");
-  if( !mosaic_out ) {
-    if(nlon == 0 || nlat ==0 ) mpp_error("fregrid: when output_mosaic is not specified, nlon and nlat should be specified");
-    if(lonend <= lonbegin) mpp_error("fregrid: when output_mosaic is not specified, lonEnd should be larger than lonBegin");
-    if(latend <= latbegin) mpp_error("fregrid: when output_mosaic is not specified, latEnd should be larger than latBegin");
-  }
-  else {
-    if(nlon !=0 || nlat != 0) mpp_error("fregrid: when output_mosaic is specified, nlon and nlat should not be specified");
-  }
-  
-  if( nfiles == 0) {
-    if(nvector > 0 || nscalar > 0 || nvector2 > 0)
-      mpp_error("fregrid: when --input_file is not specified, --scalar_field, --u_field and --v_field should also not be specified");
-    if(!remap_file) mpp_error("fregrid: when --input_file is not specified, remap_file must be specified to save weight information");
-    save_weight_only = 1;
-    if(mpp_pe()==mpp_root_pe())printf("NOTE: No input file specified in this run, no data file will be regridded "
-				      "and only weight information is calculated.\n");
-  }
-  else if( nfiles == 1 || nfiles ==2) {
-    if( nvector != nvector2 ) mpp_error("fregrid: number of fields specified in u_field must be the same as specified in v_field");
-    if( nscalar+nvector==0 ) mpp_error("fregrid: both scalar_field and vector_field are not specified");
-    /* when nvector =2 and nscalar=0, nfiles can be 2 otherwise nfiles must be 1 */
-    if( nscalar && nfiles != 1 )
-      mpp_error("fregrid: when scalar_field is specified, number of files must be 1");
-    if( nfiles_out == 0 ) {
-      for(i=0; i<nfiles; i++) strcpy(output_file[i], input_file[i]);
-    }
-    else if (nfiles_out != nfiles )
-      mpp_error("fregrid:number of input file is not equal to number of output file");
-  }
-  else
-    mpp_error("fregrid: number of input file should be 1 or 2");
-
-  if(kbegin != 0 || kend != -1) { /* at least one of kbegin and kend is set */
-    if(kbegin < 1 || kend < kbegin) mpp_error("fregrid:KlevelBegin should be a positive integer and no larger "
-					      "than KlevelEnd when you want pick certain klevel");
-  }
-  if(lbegin != 0 || lend != -1) { /* at least one of lbegin and lend is set */
-     if(lbegin < 1 || lend < lbegin) mpp_error("fregrid:LstepBegin should be a positive integer and no larger "
-					      "than LstepEnd when you want pick certain Lstep");
-  }
-  
-  if(nvector > 0) {
-    opcode |= VECTOR;
-    if(grid_type == AGRID)
-      opcode |= AGRID;
-    else if(grid_type == BGRID)
-      opcode |= BGRID;
-  }
-  
-  /* get the mosaic information of input and output mosaic*/
-  fid = mpp_open(mosaic_in, MPP_READ);
-  ntiles_in = mpp_get_dimlen(fid, "ntiles");
-  mpp_close(fid);
-  if(mosaic_out) {
-    fid = mpp_open(mosaic_out, MPP_READ);
-    ntiles_out = mpp_get_dimlen(fid, "ntiles");
-    mpp_close(fid);
-  }
-  else
-    ntiles_out = 1;
-
-  if(!strcmp(interp_method, "conserve_order1") ) {
-    if(mpp_pe() == mpp_root_pe())printf("****fregrid: first order conservative scheme will be used for regridding.\n");
-    opcode |= CONSERVE_ORDER1;
-  }
-  else if(!strcmp(interp_method, "conserve_order2") ) {
-    if(mpp_pe() == mpp_root_pe())printf("****fregrid: second order conservative scheme will be used for regridding.\n");
-    opcode |= CONSERVE_ORDER2;
-  }
-  else if(!strcmp(interp_method, "bilinear") ) {
-    if(mpp_pe() == mpp_root_pe())printf("****fregrid: bilinear remapping scheme will be used for regridding.\n");  
-    opcode |= BILINEAR;
-  }
-  else
-    mpp_error("fregrid: interp_method must be 'conserve_order1', 'conserve_order2' or 'bilinear'");
-
-  if(test_case) {
-    if(nfiles != 1) mpp_error("fregrid: when test_case is specified, nfiles should be 1");
-    sprintf(output_file[0], "%s.%s.output", test_case, interp_method);
-  }
-
-  if(check_conserve) opcode |= CHECK_CONSERVE;
-  
-  if( opcode & BILINEAR ) {
-    int ncontact;
-    ncontact = read_mosaic_ncontacts(mosaic_in);
-    if( nlon == 0 || nlat == 0) mpp_error("fregrid: when interp_method is bilinear, nlon and nlat should be specified");
-    if(ntiles_in != 6) mpp_error("fregrid: when interp_method is bilinear, the input mosaic should be 6 tile cubic grid");
-    if(ncontact !=12)  mpp_error("fregrid: when interp_method is bilinear, the input mosaic should be 12 contact cubic grid");
-    if(mpp_npes() > 1) mpp_error("fregrid: parallel is not implemented for bilinear remapping");
-  }
-  else
-    y_at_center = 1;
-
-
-  /* memory allocation for data structure */
-  grid_in   = (Grid_config *)malloc(ntiles_in *sizeof(Grid_config));
-  grid_out  = (Grid_config *)malloc(ntiles_out*sizeof(Grid_config));
-  bound_T   = (Bound_config *)malloc(ntiles_in *sizeof(Bound_config));
-  interp    = (Interp_config *)malloc(ntiles_out*sizeof(Interp_config));
-  get_input_grid( ntiles_in, grid_in, bound_T, mosaic_in, opcode );
-  if(mosaic_out)
-    get_output_grid_from_mosaic( ntiles_out, grid_out, mosaic_out, opcode );
-  else
-    get_output_grid_by_size(ntiles_out, grid_out, lonbegin, lonend, latbegin, latend,
-			    nlon, nlat, finer_step, y_at_center, opcode);
-
-   if(remap_file) set_remap_file(ntiles_out, mosaic_out, remap_file, interp, &opcode, save_weight_only);  
-  
-  if(!save_weight_only) {
-    file_in   = (File_config *)malloc(ntiles_in *sizeof(File_config));
-    file_out  = (File_config *)malloc(ntiles_out*sizeof(File_config));
- 
-    if(nfiles == 2) {
-      file2_in   = (File_config *)malloc(ntiles_in *sizeof(File_config));
-      file2_out  = (File_config *)malloc(ntiles_out*sizeof(File_config));
-    }
-    if(nscalar > 0) {
-      scalar_in  = (Field_config *)malloc(ntiles_in *sizeof(Field_config));
-      scalar_out = (Field_config *)malloc(ntiles_out *sizeof(Field_config));
-    }
-    if(nvector > 0) {
-      u_in  = (Field_config *)malloc(ntiles_in *sizeof(Field_config));
-      u_out = (Field_config *)malloc(ntiles_out *sizeof(Field_config));    
-      v_in  = (Field_config *)malloc(ntiles_in *sizeof(Field_config));
-      v_out = (Field_config *)malloc(ntiles_out *sizeof(Field_config));
-    }
-  
-    set_mosaic_data_file(ntiles_in, mosaic_in, dir_in, file_in,  input_file[0]);
-    set_mosaic_data_file(ntiles_out, mosaic_out, dir_out, file_out, output_file[0]);
-    if(nfiles == 2) {
-      set_mosaic_data_file(ntiles_in, mosaic_in, dir_in, file2_in,  input_file[1]);
-      set_mosaic_data_file(ntiles_out, mosaic_out, dir_out, file2_out, output_file[1]);    
-    }
-
-    for(n=0; n<ntiles_in; n++) file_in[n].fid = mpp_open(file_in[n].name, MPP_READ);
-
-    set_field_struct ( ntiles_in,   scalar_in,   nscalar, scalar_name[0], file_in);
-    set_field_struct ( ntiles_out,  scalar_out,  nscalar, scalar_name[0], file_out);
-    set_field_struct ( ntiles_in,   u_in,        nvector, u_name[0], file_in);
-    set_field_struct ( ntiles_out,  u_out,       nvector, u_name[0], file_out);
-    if(nfiles == 1) {
-      set_field_struct ( ntiles_in,   v_in,        nvector, v_name[0], file_in);
-      set_field_struct ( ntiles_out,  v_out,       nvector, v_name[0], file_out);
-    }
-    else {
-      set_field_struct ( ntiles_in,   v_in,        nvector, v_name[0], file2_in);
-      set_field_struct ( ntiles_out,  v_out,       nvector, v_name[0], file2_out);
-    }
-
-    get_input_metadata(ntiles_in, nfiles, file_in, file2_in, scalar_in, u_in, v_in, grid_in, kbegin, kend, lbegin, lend, opcode);
-
-    set_output_metadata(ntiles_in, nfiles, file_in, file2_in, scalar_in, u_in, v_in,
-			ntiles_out, file_out, file2_out, scalar_out, u_out, v_out, grid_out, history, tagname);
-    /* when the interp_method specified through command line is CONSERVE_ORDER1, but the interp_method in the source file
-       field attribute is CONSERVE_ORDER2, need to modify the interp_method value */
-    if(opcode & CONSERVE_ORDER1) {
-      for(l=0; l<nscalar; l++) {
-	if(scalar_out->var[l].interp_method == CONSERVE_ORDER2) {
-	  if(mpp_pe() == mpp_root_pe())printf("NOTE from fregrid: even though the interp_method specified through command line is "
-					      "conserve_order1, the interp_method is reset to conserve_order2 because some fields in "
-					      "the source data have interp_method attribute value conserve_order2");
-	  opcode = opcode & ~CONSERVE_ORDER1;
-	  opcode |= CONSERVE_ORDER2;
-	  break;
-	}
-      }
-    }
-    if(opcode & CONSERVE_ORDER1) {
-      for(l=0; l<nvector; l++) {
-	if(u_out->var[l].interp_method == CONSERVE_ORDER2) {
-	  if(mpp_pe() == mpp_root_pe())printf("NOTE from fregrid: even though the interp_method specified through command line is "
-					      "conserve_order1, the interp_method is reset to conserve_order2 because some fields in "
-					      "the source data have interp_method attribute value conserve_order2");
-	  opcode = opcode & ~CONSERVE_ORDER1;
-	  opcode |= CONSERVE_ORDER2;
-	  break;
-	}
-      }
-    }    
-  }
-  
-  /* preparing for the interpolation, if remapping information exist, read it from remap_file,
-     otherwise create the remapping information and write it to remap_file
-  */
-   if( opcode & BILINEAR ) /* bilinear interpolation from cubic to lalon */
-     setup_bilinear_interp(ntiles_in, grid_in, ntiles_out, grid_out, interp, opcode );
-   else
-     setup_conserve_interp(ntiles_in, grid_in, ntiles_out, grid_out, interp, opcode);
-  
-   if(save_weight_only) {
-     if(mpp_pe() == mpp_root_pe() ) {
-       printf("NOTE: Successfully running fregrid and the following files which store weight information are generated.\n");
-       for(n=0; n<ntiles_out; n++) {
-	 printf("****%s\n", interp[n].remap_file);
-       }
-     }
-     mpp_end();
-     return 0;     
-   }
-  
-   if(nscalar > 0) {
-     get_field_attribute(ntiles_in, scalar_in);
-     copy_field_attribute(ntiles_out, scalar_in, scalar_out);
-   }
-   
-   if(nvector > 0) {
-     get_field_attribute(ntiles_in, u_in);
-     get_field_attribute(ntiles_in, v_in);
-     copy_field_attribute(ntiles_out, u_in, u_out);
-     copy_field_attribute(ntiles_out, v_in, v_out);
-   }
-
-
-  
-   /* set time step to 1, only test scalar field now, nz need to be 1 */
-   if(test_case) {
-     if(nscalar != 1 || nvector != 0) mpp_error("fregrid: when test_case is specified, nscalar must be 1 and nvector must be 0");
-     if(scalar_in->var->nz != 1) mpp_error("fregrid: when test_case is specified, number of vertical level must be 1");
-     file_in->nt = 1;
-     file_out->nt = 1;
-   }
-   
-  /* Then doing the regridding */
-  for(m=0; m<file_in->nt; m++) {
-    int memsize, level_z, level_n, level_t;
-
-    write_output_time(ntiles_out, file_out, m);
-    if(nfiles > 1) write_output_time(ntiles_out, file2_out, m);
-    
-    /* first interp scalar variable */
-    for(l=0; l<nscalar; l++) {
-      if( !scalar_in->var[l].has_taxis && m>0) continue;
-      level_t = m + scalar_in->var[l].lstart;
-      /*--- to reduce memory usage, we are only do remapping for on horizontal level one time */
-      for(level_n =0; level_n < scalar_in->var[l].nn; level_n++)
-	for(level_z=scalar_in->var[l].kstart; level_z <= scalar_in->var[l].kend; level_z++)
-	  {	    
-	    if(test_case)
-	      get_test_input_data(test_case, test_param, ntiles_in, scalar_in, grid_in, bound_T, opcode);
-	    else
-	      get_input_data(ntiles_in, scalar_in, grid_in, bound_T, l, level_z, level_n, level_t);
-	    allocate_field_data(ntiles_out, scalar_out, grid_out);
-	    if( opcode & BILINEAR ) 
-	      do_scalar_bilinear_interp(interp, l, ntiles_in, grid_in, grid_out, scalar_in, scalar_out, finer_step, fill_missing);
-	    else
-	      do_scalar_conserve_interp(interp, l, ntiles_in, grid_in, ntiles_out, grid_out, scalar_in, scalar_out, opcode);
-	    write_field_data(ntiles_out, scalar_out, grid_out, l, level_z, level_n, m);
-	    if(scalar_out->var[l].interp_method == CONSERVE_ORDER2) {
-	      for(n=0; n<ntiles_in; n++) {
-		free(scalar_in[n].grad_x);
-		free(scalar_in[n].grad_y);
-		if(scalar_in[n].var[l].has_missing) free(scalar_in[n].grad_mask);
-	      }
-	    }
-	    for(n=0; n<ntiles_in; n++) free(scalar_in[n].data);
-	    for(n=0; n<ntiles_out; n++) free(scalar_out[n].data);
-	  }
-    }
-
-    /* then interp vector field */
-    for(l=0; l<nvector; l++) {
-      if( !u_in[n].var[l].has_taxis && m>0) continue;
-      level_t = m + u_in->var[l].lstart;
-      get_input_data(ntiles_in, u_in, grid_in, bound_T, l, level_z, level_n, level_t);
-      get_input_data(ntiles_in, v_in, grid_in, bound_T, l, level_z, level_n, level_t);
-      allocate_field_data(ntiles_out, u_out, grid_out);
-      allocate_field_data(ntiles_out, v_out, grid_out);
-      if( opcode & BILINEAR )
-	do_vector_bilinear_interp(interp, l, ntiles_in, grid_in, ntiles_out, grid_out, u_in, v_in, u_out, v_out, finer_step, fill_missing);
-      else
-	do_vector_conserve_interp(interp, l, ntiles_in, grid_in, ntiles_out, grid_out, u_in, v_in, u_out, v_out, opcode);
-      
-      write_field_data(ntiles_out, u_out, grid_out, l, level_z, level_n, m);
-      write_field_data(ntiles_out, v_out, grid_out, l, level_z, level_n, m);
-      for(n=0; n<ntiles_in; n++) {
-	free(u_in[n].data);
-	free(v_in[n].data);
-      }
-      for(n=0; n<ntiles_out; n++) {
-	free(u_out[n].data);
-	free(v_out[n].data);
-      }      
-    }
-  }
-
-  if(mpp_pe() == mpp_root_pe() ) {
-    printf("Successfully running fregrid and the following output file are generated.\n");
-    for(n=0; n<ntiles_out; n++) {
-      mpp_close(file_out[n].fid);
-      printf("****%s\n", file_out[n].name);
-      if( nfiles > 1 ) {
-	mpp_close(file2_out[n].fid);
-	printf("****%s\n", file2_out[n].name);
-      }
-    }
-  }
-   return 0;
-}
-
-#include "topog.h"
-
-int 
-gs_make_topog(char *history, char *mosaic_file, char *topog_type, 
-              int x_refine, int y_refine, 
-              double basin_depth, char *topog_file, char *topog_field, double bottom_depth, 
-              double min_depth, double scale_factor, int num_filter_pass, 
-              double gauss_amp, double gauss_scale, double slope_x,
-              double slope_y, double bowl_south, double bowl_north, 
-              double bowl_west, double bowl_east, int fill_first_row, 
-              int filter_topog, int round_shallow, int fill_shallow, 
-              int deepen_shallow, int smooth_topo_allow_deepening, 
-              char *topog_mosaic)
-{
-  char   output_file[STRING];
-  char   mosaic_file_name[STRING];
-  int    i, c;
-
-  if(x_refine != 2 || y_refine != 2 ) mpp_error("Error from make_topog: x_refine and y_refine should be 2, contact developer");
-  if(mpp_pe() == mpp_root_pe()) printf("NOTE from make_topog ==> x_refine is %d, y_refine is %d\n",
-				       x_refine, y_refine);
-
-  if (strcmp(topog_type,"rectangular_basin") == 0) {
-    if(mpp_pe() == mpp_root_pe()) printf("NOTE from make_topog ==> the basin depth is %f\n",basin_depth);
-  }
-  else if (strcmp(topog_type,"gaussian") == 0) {
-    if(mpp_pe() == mpp_root_pe()){
-      printf("NOTE from make_topog ==> bottom_depth is: %f\n", bottom_depth );
-      printf("NOTE from make_topog ==> min_depth is: %f\n", min_depth );
-      printf("NOTE from make_topog ==> gauss_amp is: %f\n", gauss_amp );
-      printf("NOTE from make_topog ==> gauss_scale is: %f\n", gauss_scale );
-      printf("NOTE from make_topog ==> slope_x is: %f\n", slope_x );
-      printf("NOTE from make_topog ==> slope_y is: %f\n", slope_y );      
-    }
-  }
-  else if(strcmp(topog_type,"bowl") == 0) {
-    if(mpp_pe() == mpp_root_pe()){
-      printf("NOTE from make_topog ==> bottom_depth is: %f\n",bottom_depth);
-      printf("NOTE from make_topog ==> min_depth is: %f\n",min_depth);
-      printf("NOTE from make_topog ==> bowl_south is: %f\n",bowl_south);
-      printf("NOTE from make_topog ==> bowl_north is: %f\n",bowl_north);
-      printf("NOTE from make_topog ==> bowl_west is: %f\n",bowl_west);
-      printf("NOTE from make_topog ==> bowl_east is: %f\n",bowl_east);
-    }
-  }
-  else if(strcmp(topog_type,"idealized") == 0) {
-    if(mpp_pe() == mpp_root_pe()){
-      printf("NOTE from make_topog ==> bottom_depth is: %f\n",bottom_depth);
-      printf("NOTE from make_topog ==> min_depth is: %f\n",min_depth);
-    }
-  }
-  else if(strcmp(topog_type,"realistic") == 0) {
-    if(!topog_file || !topog_field)
-      mpp_error("Error from make_topog: when topog_type is realistic, topog_file and topog_field must be specified.");
-    if(mpp_pe() == mpp_root_pe()){
-      printf("NOTE from make_topog ==> bottom_depth is: %f\n",bottom_depth);
-      printf("NOTE from make_topog ==> min_depth is: %f\n",min_depth);
-      printf("NOTE from make_topog ==> topog_file is: %s\n", topog_file);
-      printf("NOTE from make_topog ==> topog_field is: %s\n", topog_field);
-      printf("NOTE from make_topog ==> scale_factor is: %f\n", scale_factor);
-      printf("NOTE from make_topog ==> num_filter_pass is: %d\n", num_filter_pass);
-      if(fill_first_row) printf("NOTE from make_topog ==>make first row of ocean model all land points.\n");
-      if(filter_topog) printf("NOTE from make_topog ==>will apply filter to topography.\n");
-      if(round_shallow) printf("NOTE from make_topog ==>Make cells land if depth is less than 1/2 "
-			       "mimumim depth, otherwise make ocean.\n");
-      if(fill_shallow) printf("NOTE from make_topog ==>Make cells less than minimum depth land.\n");
-      if(deepen_shallow) printf("NOTE from make_topog ==>Make cells less than minimum depth equal to minimum depth.\n");
-      if(smooth_topo_allow_deepening) printf("NOTE from make_topog ==>allow filter to deepen cells.\n");
-    }
-  }
-  else {
-    mpp_error("make_topog: topog_type should be rectangular_basin, gaussian, bowl, idealized or realistic");
-  }
-  
-  if(mpp_pe() == mpp_root_pe()) {
-    printf("**************************************************\n");
-    printf("Begin to generate topography \n");
-  }
-
-  {
-    int m_fid, g_fid, vid;
-    int ntiles, fid, dim_ntiles, n, dims[2];
-    size_t start[4], nread[4], nwrite[4];
-    int *nx, *ny, *nxp, *nyp;
-    int *id_depth;
-    double *depth, *x, *y;
-    int  *t_fid;
-    int  dim_nchild, dim_string, id_mosaic, id_childfile;
-    char **tile_files, **topog_files;
-    char gridfile[256], griddir[256];
-    
-    /* grid should be located in the same directory of mosaic file */
-    get_file_dir_and_name(mosaic_file, griddir, mosaic_file_name);
-    get_file_path(mosaic_file, griddir);
-    
-    /* get mosaic dimension */
-    m_fid = mpp_open(mosaic_file, MPP_READ);
-    ntiles = mpp_get_dimlen( m_fid, "ntiles");
-    tile_files  = (char **)malloc(ntiles*sizeof(char *));
-    topog_files = (char **)malloc(ntiles*sizeof(char *));
-    t_fid       = (int *)  malloc(ntiles*sizeof(int ));
-    id_depth = (int *)malloc(ntiles*sizeof(int));
-    /* loop through each tile to get tile information and set up meta data for output file */
-    sprintf(output_file, "%s.nc", topog_mosaic);
-    fid = mpp_open(output_file, MPP_WRITE);
-    mpp_def_global_att(fid, GRID_VERSION_NAME, grid_version);
-    mpp_def_global_att(fid, CODE_VERSION_NAME, tagname);
-    mpp_def_global_att(fid, HISTORY_NAME, history);
-    dim_nchild = mpp_def_dim(fid, NTILES_NAME, ntiles);
-    dim_string = mpp_def_dim(fid, STRING_NAME, STRING);
-    id_mosaic = mpp_def_var(fid, MOSAIC_FILES_NAME, MPP_CHAR, 1, &dim_string, 1, "standard_name", "grid_mosaic_files");
-    dims[0] = dim_nchild; dims[1] = dim_string;
-    id_childfile = mpp_def_var(fid, TILE_FILES_NAME, MPP_CHAR, 2, dims, 0);
-    mpp_end_def(fid);
-    
-    nx = (int *)malloc(ntiles*sizeof(int));
-    ny = (int *)malloc(ntiles*sizeof(int));
-    nxp = (int *)malloc(ntiles*sizeof(int));
-    nyp = (int *)malloc(ntiles*sizeof(int));    
-
-    for( n = 0; n < ntiles; n++ ) {
-      char tile_name[128];
-      tile_files[n] = (char *)malloc(STRING*sizeof(double));
-      topog_files[n] = (char *)malloc(STRING*sizeof(double));
-      start[0] = n;
-      start[1] = 0;
-      nread[0] = 1;
-      nread[1] = STRING;
-      vid = mpp_get_varid(m_fid, TILE_FILES_NAME);
-      mpp_get_var_value_block(m_fid, vid, start, nread, gridfile);
-      sprintf(tile_files[n], "%s/%s", griddir, gridfile);
-      
-      g_fid = mpp_open(tile_files[n], MPP_READ);
-      vid = mpp_get_varid(g_fid, "tile");
-      mpp_get_var_value(g_fid, vid, tile_name);
-      sprintf(topog_files[n],"%s.%s.nc", topog_mosaic, tile_name);
-      nx[n] = mpp_get_dimlen(g_fid, "nx");
-      ny[n] = mpp_get_dimlen(g_fid, "ny");
-      if( nx[n]%x_refine != 0 ) mpp_error("make_topog: supergrid x-size can not be divided by x_refine");
-      if( ny[n]%y_refine != 0 ) mpp_error("make_topog: supergrid y-size can not be divided by y_refine");
-      nx[n] /= x_refine;
-      ny[n] /= y_refine;
-      nxp[n] = nx[n] + 1;
-      nyp[n] = ny[n] + 1;
-
-      t_fid[n] = mpp_open(topog_files[n], MPP_WRITE);
-      mpp_def_global_att(t_fid[n], GRID_VERSION_NAME, grid_version);
-      mpp_def_global_att(t_fid[n], CODE_VERSION_NAME, tagname);
-      mpp_def_global_att(t_fid[n], HISTORY_NAME, history);      
-      dims[1] = mpp_def_dim(t_fid[n], NX_NAME, nx[n]); 
-      dims[0] = mpp_def_dim(t_fid[n], NY_NAME, ny[n]);
-      id_depth[n] = mpp_def_var(t_fid[n], DEPTH_NAME, NC_DOUBLE, 2, dims,  2, "standard_name",
-				"topographic depth at T-cell centers", "units", "meters");
-      mpp_close(g_fid);
-      mpp_end_def(t_fid[n]);
-    }
-    mpp_close(m_fid);
-
-    /* Generate topography and write out to the output_file */
-    for(n=0; n<ntiles; n++) {
-      int layout[2], isc, iec, jsc, jec, nxc, nyc, ni, i, j;
-      double *gdata, *tmp;
-      domain2D domain;
-      
-      /* define the domain, each tile will be run on all the processors. */
-      mpp_define_layout( nx[n], ny[n], mpp_npes(), layout);
-      mpp_define_domain2d( nx[n], ny[n], layout, 0, 0, &domain);
-      mpp_get_compute_domain2d( domain, &isc, &iec, &jsc, &jec);
-      nxc = iec - isc + 1;
-      nyc = jec - jsc + 1;
-      
-      depth = (double *)malloc(nxc*nyc*sizeof(double));
-      x     = (double *)malloc((nxc+1)*(nyc+1)*sizeof(double));
-      y     = (double *)malloc((nxc+1)*(nyc+1)*sizeof(double));
-      tmp   = (double *)malloc((nxc*x_refine+1)*(nyc*y_refine+1)*sizeof(double));
-      start[0] = jsc*y_refine; start[1] = isc*x_refine;
-      nread[0] = nyc*y_refine+1; nread[1] = nxc*x_refine+1;
-      ni       = nxc*x_refine+1;
-      g_fid = mpp_open(tile_files[n], MPP_READ);
-      vid = mpp_get_varid(g_fid, "x");
-      mpp_get_var_value_block(g_fid, vid, start, nread, tmp);
-      for(j = 0; j < nyc+1; j++) for(i = 0; i < nxc+1; i++)
-	x[j*(nxc+1)+i] = tmp[(j*y_refine)*ni+i*x_refine];
-      vid = mpp_get_varid(g_fid, "y");
-      mpp_get_var_value_block( g_fid, vid, start, nread, tmp);
-      mpp_close(g_fid);
-      for(j = 0; j < nyc+1; j++) for(i = 0; i < nxc+1; i++)
-	y[j*(nxc+1)+i] = tmp[(j*y_refine)*ni+i*x_refine];
-      if (strcmp(topog_type,"rectangular_basin") == 0)
-	create_rectangular_topog(nx[n], ny[n], basin_depth, depth);
-      else if (strcmp(topog_type,"gaussian") == 0)
-	create_gaussian_topog(nx[n], ny[n], x, y, bottom_depth, min_depth,
-			      gauss_amp, gauss_scale, slope_x, slope_y, depth);
-      else if (strcmp(topog_type,"bowl") == 0)
-	create_bowl_topog(nx[n], ny[n], x, y, bottom_depth, min_depth, bowl_east,
-			  bowl_south, bowl_west, bowl_north, depth);
-      else if (strcmp(topog_type,"idealized") == 0)
-	create_idealized_topog( nx[n], ny[n], x, y, bottom_depth, min_depth, depth);
-      else if (strcmp(topog_type,"realistic") == 0)
-	create_realistic_topog(nxc, nyc, x, y, topog_file, topog_field, scale_factor,
-			       fill_first_row, filter_topog, num_filter_pass,
-			       smooth_topo_allow_deepening, round_shallow, fill_shallow,
-			       deepen_shallow, min_depth, depth );
-      gdata = (double *)malloc(nx[n]*ny[n]*sizeof(double));
-      mpp_global_field_double(domain, nxc, nyc, depth, gdata);
-      mpp_put_var_value(t_fid[n], id_depth[n], gdata);
-      free(x);
-      free(y);
-      free(tmp);
-      free(depth);
-      free(gdata);
-      mpp_delete_domain2d(&domain);
-      mpp_close(t_fid[n]);
-    }
-
-    for(i=0; i<4; i++) {
-      start[i] = 0; nwrite[i] = 1;
-    }
-    nwrite[0] = strlen(mosaic_file_name);
-    mpp_put_var_value_block(fid, id_mosaic, start, nwrite, mosaic_file_name);
-    nwrite[0] = 1;
-    for(n=0; n<ntiles; n++) {
-      start[0]=n;
-      nwrite[1]=strlen(topog_files[n]);
-      mpp_put_var_value_block(fid, id_childfile, start, nwrite, topog_files[n]);
-    }
-    mpp_close(fid);
-  
-    /*release memory */
-    free(id_depth);
-    for(n=0; n<ntiles; n++) {
-      free(tile_files[n]);
-      free(topog_files[n]);
-    }
-    free(tile_files);
-    free(topog_files);
-    free(t_fid);
-    free(nx);
-    free(ny);
-    free(nxp);
-    free(nyp);
-  }
-  return 0;
-}
-
-#include "create_vgrid.h"
-
-int 
-gs_make_vgrid(char *history, int nbnds, double *bnds, int n1, 
-	      int n2, int *nz, char *gridname, char *center)
-{
-   int i, nk;
-   char filename[128];
-   double *zeta;
-   int c, option_index = 0;
-
-   /* check the command-line arguments to make sure the value are suitable */
-   if( nbnds < 2 ) mpp_error("number of bounds specified through -nbnd should be an integer greater than 1");
-   if( nbnds != n1 ) mpp_error("nbnds does not equal number entry specified through -bnd");
-   if( nbnds-1 != n2 ) mpp_error("nbnds-1 does not match number entry specified through -nz");
-
-   /* generate grid */
-   nk = 0;
-   for(i=0; i<nbnds-1; i++) nk += nz[i];
-   zeta = (double *)malloc((nk+1)*sizeof(double));
-   create_vgrid(nbnds, bnds, nz, zeta, center);
-
-   sprintf(filename, "%s.nc", gridname);
-  
-   /* write out vertical grid into a netcdf file */
-   {
-      int fid, dim, varid;
-    
-      fid = mpp_open(filename, MPP_WRITE);
-      dim  = mpp_def_dim(fid, NZV_NAME, nk+1);
-      varid = mpp_def_var(fid, ZETA_NAME, NC_DOUBLE, 1, &dim, 2, "standard_name", "vertical_grid_vertex",
-	  		"units", "meters");
-      mpp_def_global_att(fid, GRID_VERSION_NAME, grid_version);
-      mpp_def_global_att(fid, CODE_VERSION_NAME, tagname);
-      mpp_def_global_att(fid, HISTORY_NAME, history);          
-      mpp_end_def(fid);
-      mpp_put_var_value(fid, varid, zeta);
-  
-      mpp_close(fid);
-   }
-
-   if(mpp_pe() == mpp_root_pe()) printf("Successfully generate vertical grid file %s\n", filename);
-   return 0;
-}
-
-#include "make_boundary_contact.h"
-#include "make_xgrid_contact.h"
-#define MAXCHILD  100
-
-int gs_make_mosaic(char *history, int ntile, char *mosaic_name, int nmosaic, char mosaicfile[][STRING],
-		   char *grid_descriptor, int n_tilefile, char tilefile[][STRING], double periodx, double periody,
-		   int  generate_contact, char *tile_dir )
-{
-  char gridfile[MAXCHILD][STRING];
-  char contact_file[STRING], overlap_file[STRING];
-  char basefile[STRING];
-  char congruence[STRING];
-  char grid_type[STRING];
-  int  ncontact=0, noverlap=0;
-  int n, i;
-
-  
-  if(ntile > MAXCHILD) {
-    mpp_error("make_mosaic: number of tiles is greater than MAXCHILD.");
-  }
-
-  /* ntile2 should equal ntile or ntile2 should be 1
-     if ntile2 is 1 and ntile is greater than 1, the tile file name is only the base file name,
-     need to add .tile#.nc at the end of the file
-  */
-  if(n_tilefile == ntile) {
-    /* do nothing */
-  }
-  else if(n_tilefile == 1) {
-    strcpy(basefile, tilefile[0]);
-    for(n=0; n<ntile; n++) sprintf(tilefile[n], "%s.tile%d.nc", basefile, n+1);
-  }
-  else {
-    mpp_error("make_mosaic: number of files (>1) specified through --child_file does not equal to num_tiles");
-  }
-  
-  if(tile_dir) {
-    n = strlen(tile_dir);
-    if( tile_dir[n-1] != '/') strcat(tile_dir, "/");
-    for(n=0; n<ntile; n++) sprintf(gridfile[n], "%s%s", tile_dir, tilefile[n]);
-  }
-  else {
-    for(n=0; n<ntile; n++) strcpy(gridfile[n], tilefile[n]);
-  }
-
-  /*
-    if num_mosaic is greater than 0, then number of entry specified through --mosaic_file
-    must equal to num_mosaic
-  */
-  if(nmosaic>0) {
-    if(nmosaic > MAXCHILD) mpp_error("make_mosaic: number of child mosaic is greater than MAXCHILD.");
-  } 
-  
-  ncontact = 0;
-
-  sprintf(contact_file, "%s.boundary_contact.nc", mosaic_name);
-  ncontact = make_boundary_contact(mosaic_name, ntile, gridfile, contact_file, periodx,
-				   periody, history, grid_type, congruence);
-  if(nmosaic > 0 && generate_contact ) {
-    int fid, vid;
-    char mosaic1_name[STRING], mosaic2_name[STRING];
-    /* when generating the overlap between mosaic, the number of mosaic must be two. */
-    if(nmosaic != 2) mpp_error("make_mosaic: num_mosaic must be 2 when generate_contact is specified");
-    fid = mpp_open(mosaicfile[0], MPP_READ);
-    vid = mpp_get_varid(fid, "mosaic");    
-    mpp_get_var_value(fid, vid, mosaic1_name);
-    mpp_close(fid);
-    fid = mpp_open(mosaicfile[1], MPP_READ);
-    vid = mpp_get_varid(fid, "mosaic");    
-    mpp_get_var_value(fid, vid, mosaic2_name);
-    mpp_close(fid);
-      
-    sprintf(contact_file, "%sX%s.nc", mosaic1_name, mosaic2_name);
-    noverlap = make_xgrid_contact(mosaicfile[0], mosaicfile[1], overlap_file, history);
-  }
-  
-  /* write out mosaic */
-  {
-    char outfile[STRING];
-    size_t start[4], nwrite[4];
-    int dim_ntile, dim_nmosaic, dim_ncontact, dim_string, id_mosaic, id_contact;
-    int fid, dim[2], id_tilefile, id_mosaicfile, id_overlap;
-    
-    sprintf(outfile, "%s.nc", mosaic_name);
-    fid = mpp_open(outfile, MPP_WRITE);
-    /* define dimenison */
-    dim_ntile = mpp_def_dim(fid, NTILES_NAME, ntile);
-    if(nmosaic>0)  dim_nmosaic = mpp_def_dim(fid, NMOSAIC_NAME, nmosaic);
-    dim_string = mpp_def_dim(fid, STRING_NAME, STRING);    
-    /* define variable */
-    id_mosaic = mpp_def_var(fid, MOSAIC_NAME, MPP_CHAR, 1, &dim_string, 6, "standard_name",
-			    "grid_mosaic_spec", "grid_type", grid_type, "children", "gridtiles",
-			    "contact_regions", "contacts", "grid_descriptor", grid_descriptor,
-			    CONGRUCENCE_NAME, congruence);
-    dim[0] = dim_ntile; dim[1] = dim_string;
-    id_tilefile = mpp_def_var(fid, TILE_FILES_NAME, MPP_CHAR, 2, dim, 0);
-
-    if(nmosaic>0) {
-      dim[0] = dim_nmosaic;
-      id_mosaicfile = mpp_def_var(fid, MOSAIC_FILES_NAME, MPP_CHAR, 2, dim, 0);
-    }
-    
-    if(ncontact>0) {
-      id_contact = mpp_def_var(fid, CONTACT_FILES_NAME, MPP_CHAR, 1, &dim_string, 2, "standard_name", "mosaic boundary contact",
-			       "contact_type", "boundary_contact");
-    }
-    if(noverlap>0) {
-      id_overlap = mpp_def_var(fid, OVERLAP_FILES_NAME, MPP_CHAR, 1, &dim_string, 2, "standard_name", "overlap between mosaic",
-			       "contact_type", "overlap");
-    }
-    mpp_def_global_att(fid, GRID_VERSION_NAME, grid_version);
-    mpp_def_global_att(fid, CODE_VERSION_NAME, tagname);
-    mpp_def_global_att(fid, HISTORY_NAME, history);
-    mpp_end_def(fid);
-
-    /* write out data */
-    for(i=0; i<4; i++) {
-      start[i] = 0; nwrite[i] = 1;
-    }
-    nwrite[0] = strlen(mosaic_name);
-    mpp_put_var_value_block(fid, id_mosaic, start, nwrite, mosaic_name);
-    nwrite[0] = 1;
-    if(ncontact>0) {
-      nwrite[0]=strlen(contact_file); 
-      mpp_put_var_value_block(fid, id_contact, start, nwrite, contact_file);
-    }
-    if(noverlap>0) {
-      nwrite[0]=strlen(overlap_file); 
-      mpp_put_var_value_block(fid, id_overlap, start, nwrite, overlap_file);
-    }
-
-    for(n=0; n<ntile; n++) {
-      start[0]=n; nwrite[0] =1;
-      nwrite[1] = strlen(tilefile[n]);
-      mpp_put_var_value_block(fid, id_tilefile, start, nwrite, tilefile[n]);
-    }
-
-    for(n=0; n<nmosaic; n++) {
-      start[0]=n;
-      nwrite[1] = strlen(mosaicfile[n]);
-      mpp_put_var_value_block(fid, id_mosaicfile, start, nwrite, mosaicfile[n]);
-    }
-    
-    mpp_close(fid);
-  }
-    
-  
-  printf("congradulation: You have successfully run make_mosaic\n");
-      
-  return 0;
-  
-}
-
-#include "create_xgrid.h"
-#define D2R (M_PI/180.)
-#define MAXXGRIDFILE 100 
-#define MX 2000  
-#define AREA_RATIO_THRESH (1.e-6)
-#define TINY_VALUE (1.e-7)
-#define TOLORENCE (1.e-4)
-#define MIN_AREA_FRAC (1.e-4)
-
-
-
-int gs_make_coupler_mosaic(char *history, char *amosaic, char *lmosaic, 
-                           char *omosaic, char *imosaic, char *itopog, int interp_order, 
-                           double sea_level, char *mosaic_name, int check)
-{
-  int c, i, same_mosaic;
-   char mosaic_file[STRING];
-   char imosaic_name[STRING], amosaic_name[STRING], lmosaic_name[STRING];
-  char **otile_name=NULL, **atile_name=NULL, **ltile_name=NULL;
-  int x_refine = 2, y_refine = 2;
-  int nfile_lxo=0, nfile_axo=0, nfile_axl=0;
-  char lxo_file[MAXXGRIDFILE][STRING];
-  char axo_file[MAXXGRIDFILE][STRING];
-  char axl_file[MAXXGRIDFILE][STRING];
-  char amosaicxlmosaic_file[STRING];
-  char amosaicximosaic_file[STRING];
-  char lmosaicximosaic_file[STRING];
-  char amosaic_dir[STRING], amosaic_file[STRING];
-  char lmosaic_dir[STRING], lmosaic_file[STRING];
-  char imosaic_dir[STRING], imosaic_file[STRING];
-  char omosaic_dir[STRING], omosaic_file[STRING];
-  char itopog_dir [STRING], itopog_file[STRING];
-  int    ntile_ocn, ntile_atm, ntile_lnd;
-  int    *nxo = NULL, *nyo = NULL, *nxa = NULL, *nya = NULL, *nxl = NULL, *nyl = NULL;
-  double **xocn = NULL, **yocn = NULL, **xatm = NULL, **yatm = NULL, **xlnd = NULL, **ylnd = NULL;
-  double **area_ocn = NULL, **area_lnd = NULL, **area_atm = NULL;
-  double **omask = NULL;
-  int    lnd_same_as_atm = 0;
-  int    option_index = 0;
-  double axo_area_sum = 0, axl_area_sum = 0;
-  int    ocn_south_ext = 0;
-    
-  /*mosaic_file can not have the same name as amosaic, lmosaic or imosaic, also the file name of
-    amosaic, lmosaic, imosaic can not be "mosaic.nc"
-  */
-  sprintf(mosaic_file, "%s.nc", mosaic_name);
-  get_file_dir_and_name(amosaic, amosaic_dir, amosaic_file);
-  get_file_dir_and_name(lmosaic, lmosaic_dir, lmosaic_file);
-  get_file_dir_and_name(omosaic, omosaic_dir, omosaic_file);
-  get_file_dir_and_name(imosaic, imosaic_dir, imosaic_file);
-  get_file_dir_and_name(itopog,  itopog_dir,  itopog_file);
-  
-  if( !strcmp(mosaic_file, amosaic) || !strcmp(mosaic_file, lmosaic) || !strcmp(mosaic_file, imosaic) ) 
-    mpp_error("make_coupler_mosaic: mosaic_file can not have the same name as amosaic, lmosaic or imosaic"); 
-  if( !strcmp(amosaic, "mosaic.nc") || !strcmp(lmosaic, "mosaic.nc") || !strcmp(imosaic, "mosaic.nc") ) 
-    mpp_error("make_coupler_mosaic: the file name of amosaic, lmosaic or imosaic can not be mosaic.nc"); 
-
-  
-  /*
-   * Read atmosphere grid
-   */
-  {
-    int n, m_fid, g_fid, vid, gid, tid;
-    size_t start[4], nread[4];
-    char filename[STRING], file[2*STRING];    
-
-    for(n=0; n<4; n++) {
-      start[n] = 0;
-      nread[n] = 1;
-    }
-
-    m_fid = mpp_open(amosaic, MPP_READ);
-    vid = mpp_get_varid(m_fid, MOSAIC_NAME);    
-    mpp_get_var_value(m_fid, vid, amosaic_name);
-    ntile_atm  = mpp_get_dimlen(m_fid, NTILES_NAME);
-    nxa        = (int *) malloc (ntile_atm*sizeof(int));
-    nya        = (int *) malloc (ntile_atm*sizeof(int));
-    xatm       = (double **) malloc( ntile_atm*sizeof(double *));
-    yatm       = (double **) malloc( ntile_atm*sizeof(double *));
-    area_atm   = (double **) malloc( ntile_atm*sizeof(double *));
-    atile_name = (char **)malloc(ntile_atm*sizeof(char *));
-    /* grid should be located in the same directory of mosaic file */
-    gid = mpp_get_varid(m_fid, TILE_FILES_NAME);
-    for(n=0; n<ntile_atm; n++) {
-      double *tmpx, *tmpy;
-      int i, j;
-      
-      start[0] = n; start[1] = 0; nread[0] = 1; nread[1] = STRING;
-      mpp_get_var_value_block(m_fid, gid, start, nread, filename);
-      atile_name[n] = (char *)malloc(STRING*sizeof(char));
-      sprintf(file, "%s/%s", amosaic_dir, filename);
-      g_fid = mpp_open(file, MPP_READ);
-      tid   = mpp_get_varid(g_fid, TILE_NAME);
-      mpp_get_var_value(g_fid, tid, atile_name[n]);
-      nxa[n] = mpp_get_dimlen(g_fid, NX_NAME);
-      nya[n] = mpp_get_dimlen(g_fid, NY_NAME);
-      if(nxa[n]%x_refine != 0 ) mpp_error("make_coupler_mosaic: atmos supergrid x-size can not be divided by x_refine");
-      if(nya[n]%y_refine != 0 ) mpp_error("make_coupler_mosaic: atmos supergrid y-size can not be divided by y_refine");
-      nxa[n] /= x_refine;
-      nya[n] /= y_refine;
-      xatm[n]     = (double *)malloc((nxa[n]+1)*(nya[n]+1)*sizeof(double));
-      yatm[n]     = (double *)malloc((nxa[n]+1)*(nya[n]+1)*sizeof(double));
-      area_atm[n] = (double *)malloc((nxa[n]  )*(nya[n]  )*sizeof(double));
-      tmpx        = (double *)malloc((nxa[n]*x_refine+1)*(nya[n]*y_refine+1)*sizeof(double));
-      tmpy        = (double *)malloc((nxa[n]*x_refine+1)*(nya[n]*y_refine+1)*sizeof(double));
-      vid = mpp_get_varid(g_fid,  X_NAME);
-      mpp_get_var_value(g_fid, vid, tmpx);
-      vid = mpp_get_varid(g_fid,  Y_NAME);
-      mpp_get_var_value(g_fid, vid, tmpy);      
-      for(j = 0; j < nya[n]+1; j++) for(i = 0; i < nxa[n]+1; i++) {
-	xatm[n][j*(nxa[n]+1)+i] = tmpx[(j*y_refine)*(nxa[n]*x_refine+1)+i*x_refine];
-	yatm[n][j*(nxa[n]+1)+i] = tmpy[(j*y_refine)*(nxa[n]*x_refine+1)+i*x_refine];
-      }
-      free(tmpx);
-      free(tmpy);      
-      /*scale grid from degree to radian, because create_xgrid assume the grid is in radians */
-      for(i=0; i<(nxa[n]+1)*(nya[n]+1); i++) {
-	xatm[n][i] *= D2R;
-	yatm[n][i] *= D2R;
-      }
-      get_grid_area(nxa+n, nya+n, xatm[n], yatm[n], area_atm[n]);
-      mpp_close(g_fid);
-    }
-    mpp_close(m_fid);
-  }
-
-  /*
-   * Read land grid
-   */
-  if (strcmp(lmosaic, amosaic) ) { /* land mosaic is different from atmosphere mosaic */
-    int n, m_fid, g_fid, vid, gid, tid;
-    size_t start[4], nread[4];
-    char filename[STRING], file[2*STRING];   
-
-    for(n=0; n<4; n++) {
-      start[n] = 0;
-      nread[n] = 1;
-    }
-    m_fid = mpp_open(lmosaic, MPP_READ);
-    vid = mpp_get_varid(m_fid, MOSAIC_NAME);    
-    mpp_get_var_value(m_fid, vid, lmosaic_name);
-    ntile_lnd  = mpp_get_dimlen(m_fid, NTILES_NAME);
-    nxl        = (int *) malloc (ntile_lnd*sizeof(int));
-    nyl        = (int *) malloc (ntile_lnd*sizeof(int));
-    xlnd       = (double **) malloc( ntile_lnd*sizeof(double *));
-    ylnd       = (double **) malloc( ntile_lnd*sizeof(double *));
-    area_lnd   = (double **) malloc( ntile_lnd*sizeof(double *));
-    ltile_name = (char **)malloc(ntile_lnd*sizeof(char *));
-    /* grid should be located in the same directory of mosaic file */
-    gid = mpp_get_varid(m_fid, TILE_FILES_NAME);
-    for(n=0; n<ntile_lnd; n++) {
-      double *tmpx, *tmpy;
-      int i, j;
-      
-      start[0] = n; start[1] = 0; nread[0] = 1; nread[1] = STRING;
-      mpp_get_var_value_block(m_fid, gid, start, nread, filename);
-      ltile_name[n] = (char *)malloc(STRING*sizeof(char));
-      mpp_get_var_value_block(m_fid, tid, start, nread,  ltile_name[n]);
-      sprintf(file, "%s/%s", lmosaic_dir, filename);
-      g_fid = mpp_open(file, MPP_READ);
-      tid   = mpp_get_varid(g_fid, TILE_NAME);
-      mpp_get_var_value(g_fid, tid, ltile_name[n]);
-      nxl[n] = mpp_get_dimlen(g_fid, NX_NAME);
-      nyl[n] = mpp_get_dimlen(g_fid, NY_NAME);
-      if(nxl[n]%x_refine != 0 ) mpp_error("make_coupler_mosaic: land supergrid x-size can not be divided by x_refine");
-      if(nyl[n]%y_refine != 0 ) mpp_error("make_coupler_mosaic: land supergrid y-size can not be divided by y_refine");
-      nxl[n]      /= x_refine;
-      nyl[n]      /= y_refine;
-      xlnd[n]     = (double *)malloc((nxl[n]+1)*(nyl[n]+1)*sizeof(double));
-      ylnd[n]     = (double *)malloc((nxl[n]+1)*(nyl[n]+1)*sizeof(double));
-      area_lnd[n] = (double *)malloc((nxl[n]  )*(nyl[n]  )*sizeof(double));
-      tmpx        = (double *)malloc((nxl[n]*x_refine+1)*(nyl[n]*y_refine+1)*sizeof(double));
-      tmpy        = (double *)malloc((nxl[n]*x_refine+1)*(nyl[n]*y_refine+1)*sizeof(double));
-      vid = mpp_get_varid(g_fid, X_NAME);
-      mpp_get_var_value(g_fid, vid, tmpx);
-      vid = mpp_get_varid(g_fid, Y_NAME);
-      mpp_get_var_value(g_fid, vid, tmpy);     
-      for(j = 0; j < nyl[n]+1; j++) for(i = 0; i < nxl[n]+1; i++) {
-	xlnd[n][j*(nxl[n]+1)+i] = tmpx[(j*y_refine)*(nxl[n]*x_refine+1)+i*x_refine];
-	ylnd[n][j*(nxl[n]+1)+i] = tmpy[(j*y_refine)*(nxl[n]*x_refine+1)+i*x_refine];
-      }
-      free(tmpx);
-      free(tmpy);
-      /*scale grid from degree to radian, because create_xgrid assume the grid is in radians */
-      for(i=0; i<(nxl[n]+1)*(nyl[n]+1); i++) {
-	xlnd[n][i] *= D2R;
-	ylnd[n][i] *= D2R;
-      }
-      get_grid_area(nxl+n, nyl+n, xlnd[n], ylnd[n], area_lnd[n]);
-      mpp_close(g_fid);
-    }
-    mpp_close(m_fid);
-  }
-  else { /* land mosaic is same as atmosphere mosaic */
-    ntile_lnd = ntile_atm;
-    nxl = nxa;
-    nyl = nya;
-    xlnd = xatm;
-    ylnd = yatm;
-    area_lnd = area_atm;
-    lnd_same_as_atm = 1;
-    strcpy(lmosaic_name, amosaic_name);
-    ltile_name = atile_name;
-  }
-
-  /*
-   * Read ocean grid boundaries and mask (where water is) for each tile within the mosaic.
-   */
-  {
-    int n, ntiles, m_fid, g_fid, t_fid, vid, gid, tid, fid;
-    size_t start[4], nread[4];
-    char filename[STRING], file[2*STRING];
-    
-    for(n=0; n<4; n++) {
-      start[n] = 0;
-      nread[n] = 1;
-    }
-    fid = mpp_open(itopog, MPP_READ);
-    ntile_ocn  = mpp_get_dimlen(fid, NTILES_NAME);
-    m_fid = mpp_open(imosaic, MPP_READ);
-    ntiles = mpp_get_dimlen(m_fid, NTILES_NAME);
-    if(ntile_ocn != ntiles) mpp_error("make_coupler_mosaic: dimlen ntiles in ocean topog mosaic file is not the same as in ocean grid mosaic file");
-    
-    nxo      = (int     *) malloc(ntile_ocn*sizeof(int));
-    nyo      = (int     *) malloc(ntile_ocn*sizeof(int));
-    xocn     = (double **) malloc(ntile_ocn*sizeof(double *));
-    yocn     = (double **) malloc(ntile_ocn*sizeof(double *));
-    area_ocn = (double **) malloc(ntile_ocn*sizeof(double *));
-    otile_name = (char **) malloc(ntile_ocn*sizeof(char *));
-    
-    vid = mpp_get_varid(m_fid, MOSAIC_NAME);    
-    mpp_get_var_value(m_fid, vid, imosaic_name);
-    
-    gid = mpp_get_varid(m_fid, TILE_FILES_NAME);
-
-    /* For the purpose of reproducing between processor count, the layout
-       is set to (1, npes). */
-
-    for(n=0; n<ntile_ocn; n++) {
-      double *tmpx, *tmpy;
-      int i, j;
-      double min_atm_lat, min_lat;
-      
-      start[0] = n; start[1] = 0; nread[0] = 1; nread[1] = STRING;
-      mpp_get_var_value_block(m_fid, gid, start, nread, filename);
-      otile_name[n] = (char *)malloc(STRING*sizeof(char));
-      sprintf(file, "%s/%s", imosaic_dir, filename);
-      g_fid = mpp_open(file, MPP_READ);
-      tid   = mpp_get_varid(g_fid, TILE_NAME);
-      mpp_get_var_value(g_fid, tid, otile_name[n]);      
-      nxo[n] = mpp_get_dimlen(g_fid, NX_NAME);
-      nyo[n] = mpp_get_dimlen(g_fid, NY_NAME);
-      if(nxo[n]%x_refine != 0 ) mpp_error("make_coupler_mosaic: ocean supergrid x-size can not be divided by x_refine");
-      if(nyo[n]%y_refine != 0 ) mpp_error("make_coupler_mosaic: ocean supergrid y-size can not be divided by y_refine");
-      tmpx        = (double *)malloc((nxo[n]+1)*(nyo[n]+1)*sizeof(double));
-      tmpy        = (double *)malloc((nxo[n]+1)*(nyo[n]+1)*sizeof(double));
-      vid = mpp_get_varid(g_fid, X_NAME);
-      mpp_get_var_value(g_fid, vid, tmpx);
-      vid = mpp_get_varid(g_fid, Y_NAME);
-      mpp_get_var_value(g_fid, vid, tmpy);     
-   
-      /* sometimes the ocean is only covered part of atmosphere, especially not cover
-	 the south pole region. In order to get all the exchange grid between atmosXland,
-	 we need to extend one point to cover the whole atmosphere. This need the
-	 assumption of one-tile ocean. Also we assume the latitude is the along j=0
-      */
-      if(ntile_ocn == 1) {
-	int na;
-	for(i=1; i<=nxo[n]; i++) 
-	  if(tmpy[i] != tmpy[i-1]) mpp_error("make_coupler_mosaic: latitude is not uniform along j=0");
-	/* calculate the minimum of latitude of atmosphere grid */
-	min_atm_lat = 9999; /* dummy large value */
-	for(na=0; na<ntile_atm; na++) {
-	  min_lat = minval_double((nxa[na]+1)*(nya[na]+1), yatm[na]);
-	  if(min_atm_lat > min_lat) min_atm_lat = min_lat;
-	}
-	if(tmpy[0]*D2R > min_atm_lat + TINY_VALUE) { /* extend one point in south direction*/
-	  ocn_south_ext = 1;
-	}
-      }      
-      nxo[n] /= x_refine;
-      nyo[n] /= y_refine;
-      nyo[n] += ocn_south_ext;
-      xocn[n]     = (double *)malloc((nxo[n]+1)*(nyo[n]+1)*sizeof(double));
-      yocn[n]     = (double *)malloc((nxo[n]+1)*(nyo[n]+1)*sizeof(double));
-      area_ocn[n] = (double *)malloc((nxo[n]  )*(nyo[n]  )*sizeof(double));
-
-      for(j = 0; j < nyo[n]+1; j++) for(i = 0; i < nxo[n]+1; i++) {
-	xocn[n][(j+ocn_south_ext)*(nxo[n]+1)+i] = tmpx[(j*y_refine)*(nxo[n]*x_refine+1)+i*x_refine] * D2R;
-	yocn[n][(j+ocn_south_ext)*(nxo[n]+1)+i] = tmpy[(j*y_refine)*(nxo[n]*x_refine+1)+i*x_refine] * D2R;
-      }
-      if(ocn_south_ext==1) {
-	for(i=0; i<nxo[n]+1; i++) {
-	  xocn[n][i] = xocn[n][nxo[n]+1+i];
-	  yocn[n][i] = min_atm_lat;
-	}
-      }
-      free(tmpx);
-      free(tmpy);
-      get_grid_area(nxo+n, nyo+n, xocn[n], yocn[n], area_ocn[n]);
-      mpp_close(g_fid);
-    }
-    mpp_close(m_fid);
-    
-    /* read ocean topography */
-    tid= mpp_get_varid(fid, "tile_files"); 
-    
-    omask = (double **)malloc(ntile_ocn*sizeof(double *));
-    for(n=0; n<ntile_ocn; n++) {
-      char name[128];
-      char topog_file[256];
-      int nx, ny, i, j;
-      double *depth;
-
-      start[0] = n; start[1] = 0; nread[0] = 1; nread[1] = STRING;
-      mpp_get_var_value_block(fid, tid, start, nread, filename);
-      sprintf(topog_file, "%s/%s", itopog_dir, filename);
-      t_fid = mpp_open(topog_file, MPP_READ);
-      
-      nx = mpp_get_dimlen(t_fid, NX_NAME);
-      ny = mpp_get_dimlen(t_fid, NY_NAME);
-      if( nx != nxo[n] || ny+ocn_south_ext != nyo[n]) mpp_error("make_coupler_mosaic: grid size mismatch between mosaic file and topog file");
-      omask[n] = (double *)malloc(nxo[n]*nyo[n]*sizeof(double));
-      if(mpp_var_exist(t_fid, MASK_NAME)) {
-	if(mpp_pe() == mpp_root_pe()) printf("\nNOTE from make_coupler_mosaic: the ocean land/sea mask will be "
-					     "determined by field area_frac from file %s\n", itopog);
-        vid = mpp_get_varid(t_fid, MASK_NAME);
-	mpp_get_var_value(t_fid, vid, omask[n]);
-      }
-      else {
-	if(mpp_pe() == mpp_root_pe()) printf("\nNOTE from make_coupler_mosaic: the ocean land/sea mask will be "
-					     "determined by field depth from file %s\n", itopog);
-	depth    = (double *)malloc(nx*ny*sizeof(double));
-	vid = mpp_get_varid(t_fid, DEPTH_NAME);
-	mpp_get_var_value(t_fid, vid, depth);
-	for(i=0; i<nxo[n]*nyo[n]; i++) omask[n][i] = 0;
-	for(j=0; j<ny; j++) for(i=0; i<nx; i++) {
-	  if(depth[j*nx+i] >sea_level) omask[n][(j+ocn_south_ext)*nx+i] = 1;
-	}
-	free(depth);
-      }
-      mpp_close(t_fid);
-    }
-    mpp_close(fid);
-  }    
-
-  
-  /* Either imosaic is different from both lmosaic and amosaic,
-     or all the three mosaic are the same
-  */
-  if(strcmp(imosaic_name, amosaic_name)) { /* imosaic is different from amosaic */
-    if(!strcmp(imosaic_name, lmosaic_name)) mpp_error("make_coupler_mosaic: imosaic is the same as lmosaic, "
-						      "but different from amosaic.");
-    same_mosaic = 0;
-  }
-  else { /* imosaic is same as amosaic */
-    if(strcmp(imosaic_name, lmosaic_name)) mpp_error("make_coupler_mosaic: imosaic is the same as amosaic, "
-						      "but different from lmosaic.");
-    same_mosaic = 1;
-  }
-    
-    
-  /***************************************************************************************
-     First generate the exchange grid between atmos mosaic and land/ocean mosaic              
-  ***************************************************************************************/
-  nfile_axo = 0;
-  nfile_axl = 0;
-  nfile_lxo = 0;
-  {
-    int no, nl, na, n;
-    size_t  **naxl, **naxo;
-    int     ***atmxlnd_ia,   ***atmxlnd_ja,   ***atmxlnd_il,   ***atmxlnd_jl;
-    int     ***atmxocn_ia,   ***atmxocn_ja,   ***atmxocn_io,   ***atmxocn_jo;
-    double  ***atmxlnd_area, ***atmxlnd_dia,  ***atmxlnd_dja,  ***atmxlnd_dil,  ***atmxlnd_djl;
-    double  ***atmxocn_area, ***atmxocn_dia,  ***atmxocn_dja,  ***atmxocn_dio,  ***atmxocn_djo;
-    double  ***atmxocn_clon, ***atmxocn_clat, ***atmxlnd_clon, ***atmxlnd_clat;
-    double   min_area; 
-
-    naxl         = (size_t ** )malloc(ntile_atm*sizeof(size_t *));
-    naxo         = (size_t ** )malloc(ntile_atm*sizeof(size_t *));
-    atmxlnd_area = (double ***)malloc(ntile_atm*sizeof(double **));
-    atmxlnd_ia   = (int    ***)malloc(ntile_atm*sizeof(int    **));
-    atmxlnd_ja   = (int    ***)malloc(ntile_atm*sizeof(int    **));
-    atmxlnd_il   = (int    ***)malloc(ntile_atm*sizeof(int    **));
-    atmxlnd_jl   = (int    ***)malloc(ntile_atm*sizeof(int    **));
-    atmxocn_area = (double ***)malloc(ntile_atm*sizeof(double **));
-    atmxocn_ia   = (int    ***)malloc(ntile_atm*sizeof(int    **));
-    atmxocn_ja   = (int    ***)malloc(ntile_atm*sizeof(int    **));
-    atmxocn_io   = (int    ***)malloc(ntile_atm*sizeof(int    **));
-    atmxocn_jo   = (int    ***)malloc(ntile_atm*sizeof(int    **));
-
-    if(interp_order == 2 ) {
-      atmxlnd_dia  = (double ***)malloc(ntile_atm*sizeof(double **));
-      atmxlnd_dja  = (double ***)malloc(ntile_atm*sizeof(double **));
-      atmxlnd_dil  = (double ***)malloc(ntile_atm*sizeof(double **));
-      atmxlnd_djl  = (double ***)malloc(ntile_atm*sizeof(double **));
-      atmxocn_dia  = (double ***)malloc(ntile_atm*sizeof(double **));
-      atmxocn_dja  = (double ***)malloc(ntile_atm*sizeof(double **));
-      atmxocn_dio  = (double ***)malloc(ntile_atm*sizeof(double **));
-      atmxocn_djo  = (double ***)malloc(ntile_atm*sizeof(double **));      
-      atmxlnd_clon = (double ***)malloc(ntile_atm*sizeof(double **));
-      atmxlnd_clat = (double ***)malloc(ntile_atm*sizeof(double **));
-      atmxocn_clon = (double ***)malloc(ntile_atm*sizeof(double **));
-      atmxocn_clat = (double ***)malloc(ntile_atm*sizeof(double **));      
-    }
-    
-    for(na=0; na<ntile_atm; na++) {
-      naxl[na]         = (size_t * )malloc(ntile_lnd*sizeof(size_t));
-      naxo[na]         = (size_t * )malloc(ntile_ocn*sizeof(size_t));
-      atmxlnd_area[na] = (double **)malloc(ntile_lnd*sizeof(double *));
-      atmxlnd_ia[na]   = (int    **)malloc(ntile_lnd*sizeof(int    *));
-      atmxlnd_ja[na]   = (int    **)malloc(ntile_lnd*sizeof(int    *));
-      atmxlnd_il[na]   = (int    **)malloc(ntile_lnd*sizeof(int    *));
-      atmxlnd_jl[na]   = (int    **)malloc(ntile_lnd*sizeof(int    *));
-      atmxocn_area[na] = (double **)malloc(ntile_ocn*sizeof(double *));
-      atmxocn_ia[na]   = (int    **)malloc(ntile_ocn*sizeof(int    *));
-      atmxocn_ja[na]   = (int    **)malloc(ntile_ocn*sizeof(int    *));
-      atmxocn_io[na]   = (int    **)malloc(ntile_ocn*sizeof(int    *));
-      atmxocn_jo[na]   = (int    **)malloc(ntile_ocn*sizeof(int    *));
-    
-      if(interp_order == 2 ) {
-	atmxlnd_dia [na] = (double **)malloc(ntile_lnd*sizeof(double *));
-	atmxlnd_dja [na] = (double **)malloc(ntile_lnd*sizeof(double *));
-	atmxlnd_dil [na] = (double **)malloc(ntile_lnd*sizeof(double *));
-	atmxlnd_djl [na] = (double **)malloc(ntile_lnd*sizeof(double *));
-	atmxocn_dia [na] = (double **)malloc(ntile_ocn*sizeof(double *));
-	atmxocn_dja [na] = (double **)malloc(ntile_ocn*sizeof(double *));
-	atmxocn_dio [na] = (double **)malloc(ntile_ocn*sizeof(double *));
-	atmxocn_djo [na] = (double **)malloc(ntile_ocn*sizeof(double *));
-	atmxlnd_clon[na] = (double **)malloc(ntile_lnd*sizeof(double *));
-	atmxlnd_clat[na] = (double **)malloc(ntile_lnd*sizeof(double *));
-	atmxocn_clon[na] = (double **)malloc(ntile_ocn*sizeof(double *));
-	atmxocn_clat[na] = (double **)malloc(ntile_ocn*sizeof(double *));      
-      }
-
-      for(nl=0; nl<ntile_lnd; nl++) {
-	atmxlnd_area[na][nl] = (double *)malloc(MAXXGRID*sizeof(double));
-	atmxlnd_ia  [na][nl] = (int    *)malloc(MAXXGRID*sizeof(int   ));
-	atmxlnd_ja  [na][nl] = (int    *)malloc(MAXXGRID*sizeof(int   ));
-	atmxlnd_il  [na][nl] = (int    *)malloc(MAXXGRID*sizeof(int   ));
-	atmxlnd_jl  [na][nl] = (int    *)malloc(MAXXGRID*sizeof(int   ));
-	if(interp_order == 2 ) {
-	  atmxlnd_clon[na][nl] = (double *)malloc(MAXXGRID*sizeof(double));
-	  atmxlnd_clat[na][nl] = (double *)malloc(MAXXGRID*sizeof(double));
-	  atmxlnd_dia [na][nl] = (double *)malloc(MAXXGRID*sizeof(double));
-	  atmxlnd_dja [na][nl] = (double *)malloc(MAXXGRID*sizeof(double));
-	  atmxlnd_dil [na][nl] = (double *)malloc(MAXXGRID*sizeof(double));
-	  atmxlnd_djl [na][nl] = (double *)malloc(MAXXGRID*sizeof(double));
-	}
-      }
- 
-      for(no=0; no<ntile_ocn; no++) {
-	atmxocn_area[na][no] = (double *)malloc(MAXXGRID*sizeof(double));
-	atmxocn_ia  [na][no] = (int    *)malloc(MAXXGRID*sizeof(int   ));
-	atmxocn_ja  [na][no] = (int    *)malloc(MAXXGRID*sizeof(int   ));
-	atmxocn_io  [na][no] = (int    *)malloc(MAXXGRID*sizeof(int   ));
-	atmxocn_jo  [na][no] = (int    *)malloc(MAXXGRID*sizeof(int   ));          
-	if(interp_order == 2 ) {
-	  atmxocn_clon[na][no] = (double *)malloc(MAXXGRID*sizeof(double));
-	  atmxocn_clat[na][no] = (double *)malloc(MAXXGRID*sizeof(double));
-	  atmxocn_dia [na][no] = (double *)malloc(MAXXGRID*sizeof(double));
-	  atmxocn_dja [na][no] = (double *)malloc(MAXXGRID*sizeof(double));
-	  atmxocn_dio [na][no] = (double *)malloc(MAXXGRID*sizeof(double));
-	  atmxocn_djo [na][no] = (double *)malloc(MAXXGRID*sizeof(double));
-	}
-      }
-    }
-      
-    for(na=0; na<ntile_atm; na++) {
-      
-      int      l, is, ie, js, je, la, ia, ja, il, jl, io, jo, layout[2];
-      int      n0, n1, n2, n3, na_in, nl_in, no_in, n_out, n_out2;
-      double   xa_min, ya_min, xo_min, yo_min, xl_min, yl_min, xa_avg;
-      double   xa_max, ya_max, xo_max, yo_max, xl_max, yl_max;
-      double   xarea;
-      double   xa[MV], ya[MV], xl[MV], yl[MV], xo[MV], yo[MV];
-      double   x_out[MV], y_out[MV];
-      double   atmxlnd_x[MX][MV], atmxlnd_y[MX][MV];
-      int      num_v[MX];
-      int      axl_i[MX], axl_j[MX], axl_t[MX];
-      double   axl_xmin[MX], axl_xmax[MX], axl_ymin[MX], axl_ymax[MX];
-      double   axl_area[MX], axl_clon[MX], axl_clat[MX];
-      size_t   count;
-      domain2D Dom;
-      
-      for(nl=0; nl<ntile_lnd; nl++) naxl[na][nl] = 0;
-      for(no=0; no<ntile_ocn; no++) naxo[na][no] = 0;
-      layout[0] = mpp_npes();
-      layout[1] = 1;
-        
-      mpp_define_domain2d(nxa[na]*nya[na], 1, layout, 0, 0, &Dom);
-      mpp_get_compute_domain2d(Dom, &is, &ie, &js, &je );
-      for(la=is;la<=ie;la++) {
-	
-	ia = la%nxa[na];
-	ja = la/nxa[na];
-	n0 = ja    *(nxa[na]+1) + ia;
-	n1 = ja    *(nxa[na]+1) + ia+1;
-	n2 = (ja+1)*(nxa[na]+1) + ia+1;
-	n3 = (ja+1)*(nxa[na]+1) + ia;
-	xa[0] = xatm[na][n0]; ya[0] = yatm[na][n0];
-        xa[1] = xatm[na][n1]; ya[1] = yatm[na][n1];
-	xa[2] = xatm[na][n2]; ya[2] = yatm[na][n2];
-        xa[3] = xatm[na][n3]; ya[3] = yatm[na][n3];
-	ya_min  = minval_double(4, ya);
-	ya_max  = maxval_double(4, ya);
-	na_in   = fix_lon(xa, ya, 4, M_PI);
-	xa_min  = minval_double(na_in, xa);
-	xa_max  = maxval_double(na_in, xa);
-	xa_avg  = avgval_double(na_in, xa);
-	count = 0;
-	for(nl=0; nl<ntile_lnd; nl++) {
-	  for(jl = 0; jl < nyl[nl]; jl ++) for(il = 0; il < nxl[nl]; il++) {
-	    n0 = jl    *(nxl[nl]+1) + il;
-	    n1 = jl    *(nxl[nl]+1) + il+1;
-	    n2 = (jl+1)*(nxl[nl]+1) + il+1;
-	    n3 = (jl+1)*(nxl[nl]+1) + il;
-	    xl[0] = xlnd[nl][n0]; yl[0] = ylnd[nl][n0];
-	    xl[1] = xlnd[nl][n1]; yl[1] = ylnd[nl][n1];
-	    xl[2] = xlnd[nl][n2]; yl[2] = ylnd[nl][n2];
-	    xl[3] = xlnd[nl][n3]; yl[3] = ylnd[nl][n3];
-	    yl_min = minval_double(4, yl);
-	    yl_max = maxval_double(4, yl);
-            if(yl_min >= ya_max || yl_max <= ya_min ) continue;	    
-	    nl_in  = fix_lon(xl, yl, 4, xa_avg);
-	    xl_min = minval_double(nl_in, xl);
-	    xl_max = maxval_double(nl_in, xl);
-	    /* xl should in the same range as xa after lon_fix, so no need to
-	       consider cyclic condition
-	    */
-	      	    
-	    if(xa_min >= xl_max || xa_max <= xl_min ) continue;	
-	    if (  (n_out = clip_2dx2d( xa, ya, na_in, xl, yl, nl_in, x_out, y_out )) > 0 ) {
-	      xarea = poly_area(x_out, y_out, n_out);
-	      min_area = min(area_lnd[nl][jl*nxl[nl]+il], area_atm[na][la]);
-	      if( xarea/min_area > AREA_RATIO_THRESH ) {
-		/*  remember the exchange grid vertices */
-		for(n=0; n<n_out; n++) {
-		  atmxlnd_x[count][n] = x_out[n];
-		  atmxlnd_y[count][n] = y_out[n];
-		}
-		axl_i[count]    = il;
-		axl_j[count]    = jl;
-		axl_t[count]    = nl;
-		num_v[count]    = n_out;
-		axl_xmin[count] = minval_double(n_out, x_out);
-		axl_xmax[count] = maxval_double(n_out, x_out);
-		axl_ymin[count] = minval_double(n_out, y_out);
-		axl_ymax[count] = maxval_double(n_out, y_out);
-		axl_area[count] = 0;
-		if(interp_order == 2) {
-		  axl_clon[count] = 0;
-		  axl_clat[count] = 0;
-		}
-		++count;
-		if(count>MX) mpp_error("make_coupler_mosaic: count is greater than MX, increase MX");
-      	      }
-	    }
-	  }
-	}
-
-	/* calculate atmos/ocean x-cells */
-	for(no=0; no<ntile_ocn; no++) {
-	  for(jo = 0; jo < nyo[no]; jo++) for(io = 0; io < nxo[no]; io++) {
-	    double ocn_frac, lnd_frac;
-	    n0 = jo    *(nxo[no]+1) + io;
-	    n1 = jo    *(nxo[no]+1) + io+1;
-	    n2 = (jo+1)*(nxo[no]+1) + io+1;
-	    n3 = (jo+1)*(nxo[no]+1) + io;
-	    xo[0] = xocn[no][n0]; yo[0] = yocn[no][n0];
-	    xo[1] = xocn[no][n1]; yo[1] = yocn[no][n1];
-	    xo[2] = xocn[no][n2]; yo[2] = yocn[no][n2];
-	    xo[3] = xocn[no][n3]; yo[3] = yocn[no][n3];
-	    yo_min = minval_double(4, yo);
-	    yo_max = maxval_double(4, yo);
-	    no_in  = fix_lon(xo, yo, 4, xa_avg);
-	    xo_min = minval_double(no_in, xo);
-	    xo_max = maxval_double(no_in, xo);
-	    ocn_frac = omask[no][jo*nxo[no]+io];
-	    lnd_frac = 1 - ocn_frac;
-	    if(ocn_frac > MIN_AREA_FRAC) { /* over sea/ice */
-	      /* xo should in the same range as xa after lon_fix, so no need to
-		 consider cyclic condition
-	      */
-              if(xa_min >= xo_max || xa_max <= xo_min || yo_min >= ya_max || yo_max <= ya_min ) continue;	    
-
-	      if (  (n_out = clip_2dx2d( xa, ya, na_in, xo, yo, no_in, x_out, y_out )) > 0) {
-		xarea = poly_area(x_out, y_out, n_out )*ocn_frac;
-		min_area = min(area_ocn[no][jo*nxo[no]+io], area_atm[na][la]);
-		if(xarea/min_area > AREA_RATIO_THRESH) {
-	    
-		  atmxocn_area[na][no][naxo[na][no]] = xarea;
-		  atmxocn_io[na][no][naxo[na][no]]   = io;
-		  atmxocn_jo[na][no][naxo[na][no]]   = jo;
-		  atmxocn_ia[na][no][naxo[na][no]]   = ia;
-		  atmxocn_ja[na][no][naxo[na][no]]   = ja;
-		  if(interp_order == 2) {
-		    atmxocn_clon[na][no][naxo[na][no]] = poly_ctrlon ( x_out, y_out, n_out, xa_avg)*ocn_frac;
-		    atmxocn_clat[na][no][naxo[na][no]] = poly_ctrlat ( x_out, y_out, n_out )*ocn_frac;		
-		  }
-		  ++(naxo[na][no]);
-		  if(naxo[na][no] > MAXXGRID) mpp_error("naxo is greater than MAXXGRID, increase MAXXGRID");
-		}
-	      }
-	    }
-	    if(lnd_frac > MIN_AREA_FRAC) { /* over land */
-	      /* find the overlap of atmxlnd and ocean cell */
-	      for(l=0; l<count; l++) {
-		if(axl_xmin[l] >= xo_max || axl_xmax[l] <= xo_min || axl_ymin[l] >= ya_max || axl_ymax[l] <= ya_min ) continue;	  
-		if((n_out = clip_2dx2d( atmxlnd_x[l], atmxlnd_y[l], num_v[l], xo, yo, no_in, x_out, y_out )) > 0) {
-		  xarea = poly_area(x_out, y_out, n_out )*lnd_frac;
-		  min_area = min(area_lnd[axl_t[l]][axl_j[l]*nxl[axl_t[l]]+axl_i[l]], area_atm[na][la]);
-		  if(xarea/min_area > AREA_RATIO_THRESH) {
-		    axl_area[l] += xarea;
-		    if(interp_order == 2) {
-		      axl_clon[l] += poly_ctrlon ( x_out, y_out, n_out, xa_avg)*lnd_frac;
-		      axl_clat[l] += poly_ctrlat ( x_out, y_out, n_out)*lnd_frac;
-		    }
-		  }
-		}
-	      }
-	    }
-	  }
-	}
-	/* get the exchange grid between land and atmos. */
-	for(l=0; l<count; l++) {
-	  nl = axl_t[l];
-	  min_area = min(area_lnd[nl][axl_j[l]*nxl[nl]+axl_i[l]], area_atm[na][la]);
-	  if(axl_area[l]/min_area > AREA_RATIO_THRESH) {
-	    atmxlnd_area[na][nl][naxl[na][nl]] = axl_area[l];
-	    atmxlnd_ia  [na][nl][naxl[na][nl]] = ia;
-	    atmxlnd_ja  [na][nl][naxl[na][nl]] = ja;
-	    atmxlnd_il  [na][nl][naxl[na][nl]] = axl_i[l];
-	    atmxlnd_jl  [na][nl][naxl[na][nl]] = axl_j[l];
-	    if(interp_order == 2) {
-	      atmxlnd_clon[na][nl][naxl[na][nl]] = axl_clon[l];
-	      atmxlnd_clat[na][nl][naxl[na][nl]] = axl_clat[l];
-	    }
-	    ++(naxl[na][nl]);
-	    if(naxl[na][nl] > MAXXGRID) mpp_error("naxl is greater than MAXXGRID, increase MAXXGRID");
-	  }
-	}   
-      }/* end of la loop */
-
-      mpp_delete_domain2d(&Dom);
-    } /* end of na loop */
-
-    /* calculate the centroid of model grid, as well as land_mask and ocean_mask */
-    {
-      double **l_area, **o_area;
-      int    nl, no, ll, lo;
-      l_area = (double **)malloc(ntile_lnd*sizeof(double *));
-      o_area = (double **)malloc(ntile_ocn*sizeof(double *));
-      for(nl =0; nl<ntile_lnd; nl++) {
-	l_area[nl] = (double *)malloc(nxl[nl]*nyl[nl]*sizeof(double));
-	for(ll=0; ll<nxl[nl]*nyl[nl]; ll++) {
-	  l_area[nl][ll] = 0;
-	}
-      }
-      for(no =0; no<ntile_ocn; no++) {
-	o_area[no] = (double *)malloc(nxo[no]*nyo[no]*sizeof(double));
-	for(lo=0; lo<nxo[no]*nyo[no]; lo++) {
-	  o_area[no][lo] = 0;
-	}
-      }
-            
-      if(interp_order == 1) {
-	for(na=0; na<ntile_atm; na++) {
-	  for(nl=0; nl<ntile_lnd; nl++) {
-	    int nxgrid;
-	  
-	    nxgrid = naxl[na][nl];
-	    mpp_sum_int(1, &nxgrid);
-	    if(nxgrid > 0) {
-	      double *g_area;
-	      int    *g_il, *g_jl;
-	      int    ii;
-	      g_il = (int    *)malloc(nxgrid*sizeof(int   ));
-	      g_jl = (int    *)malloc(nxgrid*sizeof(int   ));	
-	      g_area = (double *)malloc(nxgrid*sizeof(double));
-	      mpp_gather_field_int   (naxl[na][nl], atmxlnd_il[na][nl], g_il);
-	      mpp_gather_field_int   (naxl[na][nl], atmxlnd_jl[na][nl], g_jl);
-	      mpp_gather_field_double(naxl[na][nl], atmxlnd_area[na][nl], g_area);
-	      for(i=0; i<nxgrid; i++) {
-		ii = g_jl[i]*nxl[nl]+g_il[i];
-		l_area[nl][ii] += g_area[i];
-	      }
-	      free(g_il);
-	      free(g_jl);
-	      free(g_area);
-	    }
-	  }
-
-	  for(no=0; no<ntile_ocn; no++) {
-	    int nxgrid;
-	    nxgrid = naxo[na][no];
-	    mpp_sum_int(1, &nxgrid);
-	    if(nxgrid > 0) {
-	      double *g_area;
-	      int    *g_io, *g_jo;
-	      int    ii;
-	      g_io = (int    *)malloc(nxgrid*sizeof(int   ));
-	      g_jo = (int    *)malloc(nxgrid*sizeof(int   ));	
-	      g_area = (double *)malloc(nxgrid*sizeof(double));
-	      mpp_gather_field_int   (naxo[na][no], atmxocn_io[na][no], g_io);
-	      mpp_gather_field_int   (naxo[na][no], atmxocn_jo[na][no], g_jo);
-	      mpp_gather_field_double(naxo[na][no], atmxocn_area[na][no], g_area);
-	      for(i=0; i<nxgrid; i++) {	      
-		ii = g_jo[i]*nxo[no]+g_io[i];
-		o_area[no][ii] += g_area[i];
-	      }
-	      free(g_io);
-	      free(g_jo);
-	      free(g_area);
-	    }
-	  }
-	}
-      }
-      else { /* interp_order == 2 */
-	double **l_clon, **l_clat;
-	double **o_clon, **o_clat;
-	double  *a_area,  *a_clon,  *a_clat;
-	int la;
-      
-	l_clon = (double **)malloc(ntile_lnd*sizeof(double *));
-	l_clat = (double **)malloc(ntile_lnd*sizeof(double *));
-	for(nl =0; nl<ntile_lnd; nl++) {
-	  l_clon[nl] = (double *)malloc(nxl[nl]*nyl[nl]*sizeof(double));
-	  l_clat[nl] = (double *)malloc(nxl[nl]*nyl[nl]*sizeof(double));
-	  for(ll=0; ll<nxl[nl]*nyl[nl]; ll++) {
-	    l_clon[nl][ll] = 0;
-	    l_clat[nl][ll] = 0;
-	  }
-	}
-	o_clon = (double **)malloc(ntile_ocn*sizeof(double *));
-	o_clat = (double **)malloc(ntile_ocn*sizeof(double *));
-	for(no =0; no<ntile_ocn; no++) {
-	  o_clon[no] = (double *)malloc(nxo[no]*nyo[no]*sizeof(double));
-	  o_clat[no] = (double *)malloc(nxo[no]*nyo[no]*sizeof(double));
-	  for(lo=0; lo<nxo[no]*nyo[no]; lo++) {
-	    o_clon[no][lo] = 0;
-	    o_clat[no][lo] = 0;
-	  }
-	}	
-	for(na=0; na<ntile_atm; na++) {
-	  //	double *area, *clon, *clat;
-      
-	  a_area = (double *)malloc(nxa[na]*nya[na]*sizeof(double));
-	  a_clon = (double *)malloc(nxa[na]*nya[na]*sizeof(double));
-	  a_clat = (double *)malloc(nxa[na]*nya[na]*sizeof(double));
-	  for(la=0; la<nxa[na]*nya[na]; la++) {
-	    a_area[la] = 0;
-	    a_clon[la] = 0;
-	    a_clat[la] = 0;
-	  }
-
-	  for(nl=0; nl<ntile_lnd; nl++) {
-	    int nxgrid;
-	  
-	    nxgrid = naxl[na][nl];
-	    mpp_sum_int(1, &nxgrid);
-	    if(nxgrid > 0) {
-	      double *g_area, *g_clon, *g_clat;
-	      int    *g_ia,   *g_ja,   *g_il, *g_jl;
-	      int    ii;
-	      g_ia = (int    *)malloc(nxgrid*sizeof(int   ));
-	      g_ja = (int    *)malloc(nxgrid*sizeof(int   ));
-	      g_il = (int    *)malloc(nxgrid*sizeof(int   ));
-	      g_jl = (int    *)malloc(nxgrid*sizeof(int   ));	
-	      g_area = (double *)malloc(nxgrid*sizeof(double));
-	      g_clon = (double *)malloc(nxgrid*sizeof(double));
-	      g_clat = (double *)malloc(nxgrid*sizeof(double));
-	      mpp_gather_field_int   (naxl[na][nl], atmxlnd_ia[na][nl], g_ia);
-	      mpp_gather_field_int   (naxl[na][nl], atmxlnd_ja[na][nl], g_ja);
-	      mpp_gather_field_int   (naxl[na][nl], atmxlnd_il[na][nl], g_il);
-	      mpp_gather_field_int   (naxl[na][nl], atmxlnd_jl[na][nl], g_jl);
-	      mpp_gather_field_double(naxl[na][nl], atmxlnd_area[na][nl], g_area);
-	      mpp_gather_field_double(naxl[na][nl], atmxlnd_clon[na][nl], g_clon);
-	      mpp_gather_field_double(naxl[na][nl], atmxlnd_clat[na][nl], g_clat);
-	      for(i=0; i<nxgrid; i++) {
-		ii = g_ja[i]*nxa[na]+g_ia[i];
-		a_area[ii] += g_area[i];
-		a_clon[ii] += g_clon[i];
-		a_clat[ii] += g_clat[i];
-		ii = g_jl[i]*nxl[nl]+g_il[i];
-		l_area[nl][ii] += g_area[i];
-		l_clon[nl][ii] += g_clon[i];
-		l_clat[nl][ii] += g_clat[i];
-	      }
-	      free(g_ia);
-	      free(g_ja);
-	      free(g_il);
-	      free(g_jl);
-	      free(g_area);
-	      free(g_clon);
-	      free(g_clat);
-	    }
-	  }
-
-	  for(no=0; no<ntile_ocn; no++) {
-	    int nxgrid;
-	    nxgrid = naxo[na][no];
-	    mpp_sum_int(1, &nxgrid);
-	    if(nxgrid > 0) {
-	      double *g_area, *g_clon, *g_clat;
-	      int    *g_ia,   *g_ja,   *g_io, *g_jo;
-	      int    ii;
-	      g_ia = (int    *)malloc(nxgrid*sizeof(int   ));
-	      g_ja = (int    *)malloc(nxgrid*sizeof(int   ));
-	      g_io = (int    *)malloc(nxgrid*sizeof(int   ));
-	      g_jo = (int    *)malloc(nxgrid*sizeof(int   ));	
-	      g_area = (double *)malloc(nxgrid*sizeof(double));
-	      g_clon = (double *)malloc(nxgrid*sizeof(double));
-	      g_clat = (double *)malloc(nxgrid*sizeof(double));
-	      mpp_gather_field_int   (naxo[na][no], atmxocn_ia[na][no], g_ia);
-	      mpp_gather_field_int   (naxo[na][no], atmxocn_ja[na][no], g_ja);
-	      mpp_gather_field_int   (naxo[na][no], atmxocn_io[na][no], g_io);
-	      mpp_gather_field_int   (naxo[na][no], atmxocn_jo[na][no], g_jo);
-	      mpp_gather_field_double(naxo[na][no], atmxocn_area[na][no], g_area);
-	      mpp_gather_field_double(naxo[na][no], atmxocn_clon[na][no], g_clon);
-	      mpp_gather_field_double(naxo[na][no], atmxocn_clat[na][no], g_clat);
-	      for(i=0; i<nxgrid; i++) {	      
-		ii = g_ja[i]*nxa[na]+g_ia[i];
-		a_area[ii] += g_area[i];
-		a_clon[ii] += g_clon[i];
-		a_clat[ii] += g_clat[i];
-		ii = g_jo[i]*nxo[no]+g_io[i];
-		o_area[no][ii] += g_area[i];
-		o_clon[no][ii] += g_clon[i];
-		o_clat[no][ii] += g_clat[i];
-	      }
-	      free(g_ia);
-	      free(g_ja);
-	      free(g_io);
-	      free(g_jo);
-	      free(g_area);
-	      free(g_clon);
-	      free(g_clat);
-	    }
-	  }
-
-	  for(la=0; la<nxa[na]*nya[na]; la++) {
-	    if(a_area[la] > 0) {
-	      a_clon[la] /= a_area[la];
-	      a_clat[la] /= a_area[la];
-	    }
-	  }
-	
-	  /* substract atmos centroid to get the centroid distance between atmos grid and exchange grid. */
-	  for(nl=0; nl<ntile_lnd; nl++) {
-	    for(i=0; i<naxl[na][nl]; i++) {
-	      la = atmxlnd_ja[na][nl][i]*nxa[na] + atmxlnd_ia[na][nl][i];
-	      atmxlnd_dia[na][nl][i] = atmxlnd_clon[na][nl][i]/atmxlnd_area[na][nl][i] - a_clon[la];
-	      atmxlnd_dja[na][nl][i] = atmxlnd_clat[na][nl][i]/atmxlnd_area[na][nl][i] - a_clat[la];
-	    }
-	  }
-	  for(no=0; no<ntile_ocn; no++) {
-	    for(i=0; i<naxo[na][no]; i++) {
-	      la = atmxocn_ja[na][no][i]*nxa[na] + atmxocn_ia[na][no][i];
-	      atmxocn_dia[na][no][i] = atmxocn_clon[na][no][i]/atmxocn_area[na][no][i] - a_clon[la];
-	      atmxocn_dja[na][no][i] = atmxocn_clat[na][no][i]/atmxocn_area[na][no][i] - a_clat[la];
-	    }
-	  }
-	
-	  free(a_area);
-	  free(a_clon);
-	  free(a_clat);
-	}
-
-      
-	/* centroid distance from exchange grid to land grid */
-	for(nl=0; nl<ntile_lnd; nl++) {
-	  for(ll=0; ll<nxl[nl]*nyl[nl]; ll++) {
-	    if(l_area[nl][ll] > 0) {
-	      l_clon[nl][ll] /= l_area[nl][ll];
-	      l_clat[nl][ll] /= l_area[nl][ll];
-	    }
-	  }
-	  for(na=0; na<ntile_atm; na++) {
-	    for(i=0; i<naxl[na][nl]; i++) {
-	      ll = atmxlnd_jl[na][nl][i]*nxl[nl] + atmxlnd_il[na][nl][i];
-	      atmxlnd_dil[na][nl][i] = atmxlnd_clon[na][nl][i]/atmxlnd_area[na][nl][i] - l_clon[nl][ll];
-	      atmxlnd_djl[na][nl][i] = atmxlnd_clat[na][nl][i]/atmxlnd_area[na][nl][i] - l_clat[nl][ll];
-	    }
-	  }
-	  free(l_clon[nl]);
-	  free(l_clat[nl]);
-	}
-
-	/* centroid distance from exchange grid to ocean grid */
-	for(no=0; no<ntile_ocn; no++) {
-	  for(lo=0; lo<nxo[no]*nyo[no]; lo++) {
-	    if(o_area[no][lo] > 0) {
-	      o_clon[no][lo] /= o_area[no][lo];
-	      o_clat[no][lo] /= o_area[no][lo];
-	    }
-	  }
-	  for(na=0; na<ntile_atm; na++) {
-	    for(i=0; i<naxo[na][no]; i++) {
-	      lo = atmxocn_jo[na][no][i]*nxo[no] + atmxocn_io[na][no][i];
-	      atmxocn_dio[na][no][i] = atmxocn_clon[na][no][i]/atmxocn_area[na][no][i] - o_clon[no][lo];
-	      atmxocn_djo[na][no][i] = atmxocn_clat[na][no][i]/atmxocn_area[na][no][i] - o_clat[no][lo];
-	    }
-	  }
-	  free(o_clon[no]);
-	  free(o_clat[no]);
-	}
-	free(o_clon);
-	free(o_clat);
-	free(l_clon);
-	free(l_clat);  
-      }
-
-      /* calculate ocean_frac and compare ocean_frac with omask */
-      /* also write out ocn_frac */
-      {
-	int    io, jo;
-	double ocn_frac;
-	int    id_mask, fid, dims[2];
-	char ocn_mask_file[STRING];
-	double *mask;
-	int ny;
-
-
-	for(no=0; no<ntile_ocn; no++) {
-	  ny = nyo[no]-ocn_south_ext;
-	  mask = (double *)malloc(nxo[no]*ny*sizeof(double));
-	  for(jo=0; jo<ny; jo++) for(io=0; io<nxo[no]; io++) {
-	    i = (jo+ocn_south_ext)*nxo[no]+io;
-	    ocn_frac = o_area[no][i]/area_ocn[no][i];
-	    if( fabs(omask[no][i] - ocn_frac) > TOLORENCE ) {
-	      printf("at ocean point (%d,%d), omask = %f, ocn_frac = %f, diff = %f\n",
-		     io, jo, omask[no][i], ocn_frac, omask[no][i] - ocn_frac);
-	      mpp_error("make_coupler_mosaic: omask is not equal ocn_frac");
-	    }
-	    mask[jo*nxo[no]+io] = ocn_frac;
-	  }
-	  if(ntile_ocn > 1)
-	    sprintf(ocn_mask_file, "ocean_mask_tile%d.nc", no+1);
-	  else
-	    strcpy(ocn_mask_file, "ocean_mask.nc");
-	  fid = mpp_open(ocn_mask_file, MPP_WRITE);
-	  mpp_def_global_att(fid, GRID_VERSION_NAME, grid_version);
-	  mpp_def_global_att(fid, CODE_VERSION_NAME, tagname);
-	  mpp_def_global_att(fid, HISTORY_NAME, history);
-          	  
-
-	  dims[1] = mpp_def_dim(fid, NX_NAME, nxo[no]); 
-	  dims[0] = mpp_def_dim(fid, NY_NAME, ny);
-	  id_mask = mpp_def_var(fid, "mask", MPP_DOUBLE, 2, dims,  2, "standard_name",
-				"ocean fraction at T-cell centers", "units", "none");
-	  mpp_end_def(fid);
-	  mpp_put_var_value(fid, id_mask, mask);
-	  mpp_close(fid);
-	  free(mask);
-	}
-      }
-
-      /* calculate land_frac and  write out land_frac */
-      {
-	int    il, jl;
-	int    id_mask, fid, dims[2];
-	char lnd_mask_file[STRING];
-	double *mask;
-	
-	for(nl=0; nl<ntile_lnd; nl++) {
-	  mask = (double *)malloc(nxl[nl]*nyl[nl]*sizeof(double));
-	  for(jl=0; jl<nyl[nl]; jl++) for(il=0; il<nxl[nl]; il++) {
-	    i = jl*nxl[nl]+il;
-	    mask[i] = l_area[nl][i]/area_lnd[nl][i];
-	  }
-	  if(ntile_lnd > 1)
-	    sprintf(lnd_mask_file, "land_mask_tile%d.nc", nl+1);
-	  else
-	    strcpy(lnd_mask_file, "land_mask.nc");
-	  fid = mpp_open(lnd_mask_file, MPP_WRITE);
-	  mpp_def_global_att(fid, GRID_VERSION_NAME, grid_version);
-	  mpp_def_global_att(fid, CODE_VERSION_NAME, tagname);
-	  mpp_def_global_att(fid, HISTORY_NAME, history);
-	  dims[1] = mpp_def_dim(fid, NX_NAME, nxl[nl]); 
-	  dims[0] = mpp_def_dim(fid, NY_NAME, nyl[nl]);
-	  id_mask = mpp_def_var(fid, "mask", MPP_DOUBLE, 2, dims,  2, "standard_name",
-				"land fraction at T-cell centers", "units", "none");
-	  mpp_end_def(fid);
-	  mpp_put_var_value(fid, id_mask, mask);
-	  free(mask);
-	  mpp_close(fid);
-	}
-      }        
-      
-      for(nl=0; nl<ntile_lnd; nl++) free(l_area[nl]);
-      for(no=0; no<ntile_ocn; no++) free(o_area[no]);      
-      free(o_area);
-      free(l_area);
-    }
-    
-    for(na=0; na<ntile_atm; na++) {
-    /* write out atmXlnd data*/
-      for(nl = 0; nl < ntile_lnd; nl++) {
-	int nxgrid;
-	nxgrid = naxl[na][nl];
-	mpp_sum_int(1, &nxgrid);
-	if(nxgrid>0) {
-	  size_t start[4], nwrite[4];
-	  int *gdata_int;
-	  double *gdata_dbl;
-	  
-	  int fid, dim_string, dim_ncells, dim_two, dims[4];
-	  int id_xgrid_area, id_contact, n;
-	  int id_tile1_cell, id_tile2_cell, id_tile1_dist, id_tile2_dist;
-	  char contact[STRING];
-
-	  for(i=0; i<4; i++) {
-	    start[i] = 0; nwrite[i] = 1;
-	  }	  	  
-	  if(same_mosaic)
-	    sprintf(axl_file[nfile_axl], "atm_%s_%sXlnd_%s_%s.nc", amosaic_name, atile_name[na], lmosaic_name, ltile_name[nl]);
-	  else
-	    sprintf(axl_file[nfile_axl], "%s_%sX%s_%s.nc", amosaic_name, atile_name[na], lmosaic_name, ltile_name[nl]);
-	  sprintf(contact, "%s:%s::%s:%s", amosaic_name, atile_name[na], lmosaic_name, ltile_name[nl]);
-	  fid = mpp_open(axl_file[nfile_axl], MPP_WRITE);
-	  mpp_def_global_att(fid, GRID_VERSION_NAME, grid_version);
-	  mpp_def_global_att(fid, CODE_VERSION_NAME, tagname);
-	  mpp_def_global_att(fid, HISTORY_NAME, history);
-	  dim_string = mpp_def_dim(fid, STRING_NAME, STRING);
-	  dim_ncells = mpp_def_dim(fid, "ncells", nxgrid);
-	  dim_two    = mpp_def_dim(fid, "two", 2);
-	  if(interp_order == 2) {
-	    id_contact = mpp_def_var(fid, "contact", MPP_CHAR, 1, &dim_string, 7, "standard_name", "grid_contact_spec",
-				     "contact_type", "exchange", "parent1_cell",
-				     "tile1_cell", "parent2_cell", "tile2_cell", "xgrid_area_field", "xgrid_area", 
-				     "distant_to_parent1_centroid", "tile1_distance", "distant_to_parent2_centroid", "tile2_distance");
-	  }
-	  else {
-	    id_contact = mpp_def_var(fid, "contact", MPP_CHAR, 1, &dim_string, 5, "standard_name", "grid_contact_spec",
-				     "contact_type", "exchange", "parent1_cell",
-				     "tile1_cell", "parent2_cell", "tile2_cell", "xgrid_area_field", "xgrid_area");
-	  }
-	    
-	  dims[0] = dim_ncells; dims[1] = dim_two;
-	  id_tile1_cell = mpp_def_var(fid, "tile1_cell", MPP_INT, 2, dims, 1, "standard_name", "parent_cell_indices_in_mosaic1");
-	  id_tile2_cell = mpp_def_var(fid, "tile2_cell", MPP_INT, 2, dims, 1, "standard_name", "parent_cell_indices_in_mosaic2");
-	  id_xgrid_area = mpp_def_var(fid, "xgrid_area", MPP_DOUBLE, 1, &dim_ncells, 2, "standard_name",
-				      "exchange_grid_area", "units", "m2");
-	  if(interp_order == 2) {
-	    id_tile1_dist = mpp_def_var(fid, "tile1_distance", MPP_DOUBLE, 2, dims, 1, "standard_name", "distance_from_parent1_cell_centroid");
-	    id_tile2_dist = mpp_def_var(fid, "tile2_distance", MPP_DOUBLE, 2, dims, 1, "standard_name", "distance_from_parent2_cell_centroid");
-	  }
-	  mpp_end_def(fid);
-
-	  /* the index will start from 1, instead of 0 ( fortran index) */
-	  for(i = 0;i < naxl[na][nl]; i++) {
-	    ++(atmxlnd_ia[na][nl][i]);
-	    ++(atmxlnd_ja[na][nl][i]);
-	    ++(atmxlnd_il[na][nl][i]);
-	    ++(atmxlnd_jl[na][nl][i]);
-	  }
-	  nwrite[0] = strlen(contact);
-	  mpp_put_var_value_block(fid, id_contact, start, nwrite, contact);
-     	  nwrite[0] = nxgrid;
-
-	  gdata_int = (int *)malloc(nxgrid*sizeof(int));
-	  gdata_dbl = (double *)malloc(nxgrid*sizeof(double));
-
-	  mpp_gather_field_double(naxl[na][nl], atmxlnd_area[na][nl], gdata_dbl);
-	  if(check) {
-	    for(n=0; n<nxgrid; n++) axl_area_sum += gdata_dbl[n];
-	  }
-	  mpp_put_var_value(fid, id_xgrid_area, gdata_dbl);
-	  mpp_gather_field_int(naxl[na][nl], atmxlnd_ia[na][nl], gdata_int);
-	  mpp_put_var_value_block(fid, id_tile1_cell, start, nwrite, gdata_int);
-	  mpp_gather_field_int(naxl[na][nl], atmxlnd_il[na][nl], gdata_int);
-	  mpp_put_var_value_block(fid, id_tile2_cell, start, nwrite, gdata_int);
-	  start[1] = 1;
-	  mpp_gather_field_int(naxl[na][nl], atmxlnd_ja[na][nl], gdata_int);
-	  mpp_put_var_value_block(fid, id_tile1_cell, start, nwrite, gdata_int);
-	  mpp_gather_field_int(naxl[na][nl], atmxlnd_jl[na][nl], gdata_int);
-	  mpp_put_var_value_block(fid, id_tile2_cell, start, nwrite, gdata_int);
-	  if(interp_order == 2) {
-	    start[1] = 0;
-  	    mpp_gather_field_double(naxl[na][nl], atmxlnd_dia[na][nl], gdata_dbl);
-	    mpp_put_var_value_block(fid, id_tile1_dist, start, nwrite, gdata_dbl);
-	    mpp_gather_field_double(naxl[na][nl], atmxlnd_dil[na][nl], gdata_dbl);
-	    mpp_put_var_value_block(fid, id_tile2_dist, start, nwrite, gdata_dbl);
-	    start[1] = 1;
-  	    mpp_gather_field_double(naxl[na][nl], atmxlnd_dja[na][nl], gdata_dbl);
-	    mpp_put_var_value_block(fid, id_tile1_dist, start, nwrite, gdata_dbl);
-	    mpp_gather_field_double(naxl[na][nl], atmxlnd_djl[na][nl], gdata_dbl);
-	    mpp_put_var_value_block(fid, id_tile2_dist, start, nwrite, gdata_dbl);
-	  }
-	  mpp_close(fid);
-	  free(gdata_int);
-	  free(gdata_dbl);
-	  ++nfile_axl;
-	}
-      } /* end of nl loop */
-
-      /* write out atmXocn data */
-      for(no = 0; no < ntile_ocn; no++) {
-	int nxgrid;
-	
-	nxgrid = naxo[na][no];
-	mpp_sum_int(1, &nxgrid);
-	if(nxgrid>0) {
-	  size_t start[4], nwrite[4];
-	  int *gdata_int;
-	  double *gdata_dbl;
-	  int fid, dim_string, dim_ncells, dim_two, dims[4];
-	  int id_xgrid_area, id_contact, n;
-	  int id_tile1_cell, id_tile2_cell, id_tile1_dist, id_tile2_dist;	  
-	  char contact[STRING];
-
-	  for(i=0; i<4; i++) {
-	    start[i] = 0; nwrite[i] = 1;
-	  }
-	  
-	  if(same_mosaic)
-	    sprintf(axo_file[nfile_axo], "atm_%s_%sXocn_%s_%s.nc", amosaic_name, atile_name[na], imosaic_name, otile_name[no]);
-	  else
-	    sprintf(axo_file[nfile_axo], "%s_%sX%s_%s.nc", amosaic_name, atile_name[na], imosaic_name, otile_name[no]);
-	  
-	  sprintf(contact, "%s:%s::%s:%s", amosaic_name, atile_name[na], imosaic_name, otile_name[no]);
-	  fid = mpp_open(axo_file[nfile_axo], MPP_WRITE);
-	  mpp_def_global_att(fid, GRID_VERSION_NAME, grid_version);
-          mpp_def_global_att(fid, CODE_VERSION_NAME, tagname);
-	  mpp_def_global_att(fid, HISTORY_NAME, history);
-	  dim_string = mpp_def_dim(fid, STRING_NAME, STRING);
-	  dim_ncells = mpp_def_dim(fid, "ncells", nxgrid);
-	  dim_two    = mpp_def_dim(fid, "two", 2);
-	  if(interp_order == 2) {
-	    id_contact = mpp_def_var(fid, "contact", MPP_CHAR, 1, &dim_string, 7, "standard_name", "grid_contact_spec",
-				   "contact_type", "exchange", "parent1_cell",
-				   "tile1_cell", "parent2_cell", "tile2_cell", "xgrid_area_field", "xgrid_area", 
-				   "distant_to_parent1_centroid", "tile1_distance", "distant_to_parent2_centroid", "tile2_distance");
-	  }
-	  else {
-	    id_contact = mpp_def_var(fid, "contact", MPP_CHAR, 1, &dim_string, 5, "standard_name", "grid_contact_spec",
-				   "contact_type", "exchange", "parent1_cell",
-				   "tile1_cell", "parent2_cell", "tile2_cell", "xgrid_area_field", "xgrid_area" );
-	  }
-	  dims[0] = dim_ncells; dims[1] = dim_two;
-	  id_tile1_cell = mpp_def_var(fid, "tile1_cell", MPP_INT, 2, dims, 1, "standard_name", "parent_cell_indices_in_mosaic1");
-	  id_tile2_cell = mpp_def_var(fid, "tile2_cell", MPP_INT, 2, dims, 1, "standard_name", "parent_cell_indices_in_mosaic2");
-	  id_xgrid_area = mpp_def_var(fid, "xgrid_area", MPP_DOUBLE, 1, &dim_ncells, 2, "standard_name",
-				      "exchange_grid_area", "units", "m2");
-	  if(interp_order == 2) {
-	    id_tile1_dist = mpp_def_var(fid, "tile1_distance", MPP_DOUBLE, 2, dims, 1, "standard_name",
-					"distance_from_parent1_cell_centroid");
-	    id_tile2_dist = mpp_def_var(fid, "tile2_distance", MPP_DOUBLE, 2, dims, 1, "standard_name",
-					"distance_from_parent2_cell_centroid");
-	  }
-	  mpp_end_def(fid);
-
-	  /* the index will start from 1, instead of 0 ( fortran index) */
-	  for(i = 0;i < naxo[na][no]; i++) {
-	    ++(atmxocn_ia[na][no][i]);
-	    ++(atmxocn_ja[na][no][i]);
-	    ++(atmxocn_io[na][no][i]);
-	    atmxocn_jo[na][no][i] += 1-ocn_south_ext; /* possible one artificial j-level is added at south end */
-	  }
-
-          nwrite[0] = strlen(contact);
-	  mpp_put_var_value_block(fid, id_contact, start, nwrite, contact);
-	
-	  nwrite[0] = nxgrid;
-
-	  gdata_int = (int *)malloc(nxgrid*sizeof(int));
-	  gdata_dbl = (double *)malloc(nxgrid*sizeof(double));
-
-	  mpp_gather_field_double(naxo[na][no], atmxocn_area[na][no], gdata_dbl);
-	  if(check) {
-	    for(n=0; n<nxgrid; n++) axo_area_sum += gdata_dbl[n];
-	  }
-	  mpp_put_var_value_block(fid, id_xgrid_area, start, nwrite, gdata_dbl);
-	  mpp_gather_field_int(naxo[na][no], atmxocn_ia[na][no], gdata_int);
-	  mpp_put_var_value_block(fid, id_tile1_cell, start, nwrite, gdata_int);
-	  mpp_gather_field_int(naxo[na][no], atmxocn_io[na][no], gdata_int);
-	  mpp_put_var_value_block(fid, id_tile2_cell, start, nwrite, gdata_int);
-	  start[1] = 1;
-	  mpp_gather_field_int(naxo[na][no], atmxocn_ja[na][no], gdata_int);
-	  mpp_put_var_value_block(fid, id_tile1_cell, start, nwrite, gdata_int);
-	  mpp_gather_field_int(naxo[na][no], atmxocn_jo[na][no], gdata_int);
-	  mpp_put_var_value_block(fid, id_tile2_cell, start, nwrite, gdata_int);
-	  if(interp_order == 2) {
-	    start[1] = 0;
-  	    mpp_gather_field_double(naxo[na][no], atmxocn_dia[na][no], gdata_dbl);
-	    mpp_put_var_value_block(fid, id_tile1_dist, start, nwrite, gdata_dbl);
-	    mpp_gather_field_double(naxo[na][no], atmxocn_dio[na][no], gdata_dbl);
-	    mpp_put_var_value_block(fid, id_tile2_dist, start, nwrite, gdata_dbl);
-	    start[1] = 1;
-  	    mpp_gather_field_double(naxo[na][no], atmxocn_dja[na][no], gdata_dbl);
-	    mpp_put_var_value_block(fid, id_tile1_dist, start, nwrite, gdata_dbl);
-	    mpp_gather_field_double(naxo[na][no], atmxocn_djo[na][no], gdata_dbl);
-	    mpp_put_var_value_block(fid, id_tile2_dist, start, nwrite, gdata_dbl);
-	  }
-	  mpp_close(fid);
-     	  free(gdata_int);
-	  free(gdata_dbl);
-	  ++nfile_axo;
-	}
-      } /* end of no loop */
-      
-    } /* end of na loop */
-
-    { /* write out atmos_mosaicXlnd_mosaic */
-      int fid, dim_nmosaic, dim_ncontact, id_mosaic, id_contact, dim_string, dims[4];
-      size_t start[4], nwrite[4];
-      if(same_mosaic)
-	sprintf(amosaicxlmosaic_file, "atm_%sXlnd_%s.nc", amosaic_name, lmosaic_name);
-      else
-        sprintf(amosaicxlmosaic_file, "%sX%s.nc", amosaic_name, lmosaic_name);
-      fid = mpp_open(amosaicxlmosaic_file, MPP_WRITE);
-      dim_nmosaic = mpp_def_dim(fid, NMOSAIC_NAME, 2);
-      dim_ncontact = mpp_def_dim(fid, NCONTACT_NAME, nfile_axl);
-      dim_string = mpp_def_dim(fid, STRING_NAME, STRING);
-      dims[0] = dim_nmosaic;
-      dims[1] = dim_string;
-      id_mosaic = mpp_def_var(fid, MOSAIC_FILES_NAME, MPP_CHAR, 2, dims, 0);
-      dims[0] = dim_ncontact;
-      id_contact = mpp_def_var(fid, CONTACT_FILES_NAME, MPP_CHAR, 2, dims, 0);
-      mpp_def_global_att(fid, GRID_VERSION_NAME, grid_version);
-      mpp_def_global_att(fid, CODE_VERSION_NAME, tagname);
-      mpp_def_global_att(fid, HISTORY_NAME, history);
-      mpp_end_def(fid);
-      for(i=0; i<4; i++) {
-	start[i] = 0; nwrite[i] = 1;
-      }
-      start[0] = 0; nwrite[1] = strlen(amosaic_file);
-      mpp_put_var_value_block(fid, id_mosaic, start, nwrite, amosaic_file);
-      start[0] = 1; nwrite[1] = strlen(lmosaic_file);
-      mpp_put_var_value_block(fid, id_mosaic, start, nwrite, lmosaic_file);
-      for(n=0; n<nfile_axl; n++) {
-	start[0]=n;
-	nwrite[1] = strlen(axl_file[n]);
-	mpp_put_var_value_block(fid, id_contact, start, nwrite, axl_file[n]);
-      }
-      mpp_close(fid);
-    }
-
-    { /* write out atmos_mosaicXocean_mosaic */
-      int fid, dim_nmosaic, dim_ncontact, id_mosaic, id_contact, dim_string, dims[4];
-      size_t start[4], nwrite[4];
-
-      if(same_mosaic)
-	sprintf(amosaicximosaic_file, "atm_%sXocn_%s.nc", amosaic_name, imosaic_name);
-      else	  
-        sprintf(amosaicximosaic_file, "%sX%s.nc", amosaic_name, imosaic_name);
-      fid = mpp_open(amosaicximosaic_file, MPP_WRITE);
-      dim_nmosaic = mpp_def_dim(fid, NMOSAIC_NAME, 2);
-      dim_ncontact = mpp_def_dim(fid, NCONTACT_NAME, nfile_axo);
-      dim_string = mpp_def_dim(fid, STRING_NAME, STRING);
-      dims[0] = dim_nmosaic;
-      dims[1] = dim_string;
-      id_mosaic = mpp_def_var(fid, MOSAIC_FILES_NAME, MPP_CHAR, 2, dims, 0);
-      dims[0] = dim_ncontact;
-      id_contact = mpp_def_var(fid, CONTACT_FILES_NAME, MPP_CHAR, 2, dims, 0);
-      mpp_def_global_att(fid, GRID_VERSION_NAME, grid_version);
-      mpp_def_global_att(fid, CODE_VERSION_NAME, tagname);
-      mpp_def_global_att(fid, HISTORY_NAME, history);
-      mpp_end_def(fid);
-      for(i=0; i<4; i++) {
-	start[i] = 0; nwrite[i] = 1;
-      }
-      start[0] = 0; nwrite[1] = strlen(amosaic_file);
-      mpp_put_var_value_block(fid, id_mosaic, start, nwrite, amosaic_file);
-      start[0] = 1; nwrite[1] = strlen(imosaic_file);
-      mpp_put_var_value_block(fid, id_mosaic, start, nwrite, imosaic_file);
-      for(n=0; n<nfile_axo; n++) {
-	start[0]=n;
-	nwrite[1] = strlen(axo_file[n]);
-	mpp_put_var_value_block(fid, id_contact, start, nwrite, axo_file[n]);
-      }
-      mpp_close(fid);
-    }
-
-    
-    /*release the memory */
-    for(na=0; na<ntile_atm; na++) {
-      for(nl=0; nl<ntile_lnd; nl++) {
-	free(atmxlnd_area[na][nl]);
-	free(atmxlnd_ia  [na][nl]);
-	free(atmxlnd_ja  [na][nl]);
-	free(atmxlnd_il  [na][nl]);
-	free(atmxlnd_jl  [na][nl]);
-	if(interp_order == 2) {
-	  free(atmxlnd_clon[na][nl]);
-	  free(atmxlnd_clat[na][nl]);
-	  free(atmxlnd_dia [na][nl]);
-	  free(atmxlnd_dja [na][nl]);
-	  free(atmxlnd_dil [na][nl]);
-	  free(atmxlnd_djl [na][nl]);
-	}
-      }
-      free(atmxlnd_area[na]);
-      free(atmxlnd_ia  [na]);
-      free(atmxlnd_ja  [na]);
-      free(atmxlnd_il  [na]);
-      free(atmxlnd_jl  [na]);
-      if(interp_order == 2) {
-	free(atmxlnd_clon[na]);
-	free(atmxlnd_clat[na]);
-	free(atmxlnd_dia [na]);
-	free(atmxlnd_dja [na]);
-	free(atmxlnd_dil [na]);
-	free(atmxlnd_djl [na]);
-      }
-      for(no=0; no<ntile_ocn; no++) {
-	free(atmxocn_area[na][no]);
-	free(atmxocn_ia  [na][no]);
-	free(atmxocn_ja  [na][no]);
-	free(atmxocn_io  [na][no]);
-	free(atmxocn_jo  [na][no]);
-	if(interp_order == 2) {
-	  free(atmxocn_clon[na][no]);
-	  free(atmxocn_clat[na][no]);
-	  free(atmxocn_dia [na][no]);
-	  free(atmxocn_dja [na][no]);
-	  free(atmxocn_dio [na][no]);
-	  free(atmxocn_djo [na][no]);
-	}
-      }
-      free(atmxocn_area[na]);
-      free(atmxocn_ia  [na]);
-      free(atmxocn_ja  [na]);
-      free(atmxocn_io  [na]);
-      free(atmxocn_jo  [na]);
-      if(interp_order == 2) {
-	free(atmxocn_clon[na]);
-	free(atmxocn_clat[na]);
-	free(atmxocn_dia [na]);
-	free(atmxocn_dja [na]);
-	free(atmxocn_dio [na]);
-	free(atmxocn_djo [na]);
-      }
-      free(naxl[na]);
-      free(naxo[na]);
-    }    
-    free(atmxlnd_area);
-    free(atmxlnd_ia  );
-    free(atmxlnd_ja  );
-    free(atmxlnd_il  );
-    free(atmxlnd_jl  );
-    free(atmxocn_area);
-    free(atmxocn_ia  );
-    free(atmxocn_ja  );
-    free(atmxocn_io  );
-    free(atmxocn_jo  );   
-    if(interp_order == 2) {
-      free(atmxlnd_clon);
-      free(atmxlnd_clat);
-      free(atmxlnd_dja );
-      free(atmxlnd_dia );
-      free(atmxlnd_dil );
-      free(atmxlnd_djl );
-      free(atmxocn_clon);
-      free(atmxocn_clat);
-      free(atmxocn_dia );
-      free(atmxocn_dja );
-      free(atmxocn_dio );
-      free(atmxocn_djo );
-    }
-    free(naxl);
-    free(naxo);
-  }
-  if(mpp_pe() == mpp_root_pe()) printf("\nNOTE from make_coupler_mosaic: Complete the process to create exchange grids "
-				       "for fluxes between atmosphere and surface (sea ice and land)\n" );
-  
-  /***************************************************************************************
-     Then generate the exchange grid between land mosaic and ocean mosaic
-     if land mosaic is different from atmos mosaic
-  ***************************************************************************************/
-  nfile_lxo = 0;
-  if( !lnd_same_as_atm ) {
-    int     no, nl, ll, lo;
-    size_t  **nlxo;
-    int     ***lndxocn_il, ***lndxocn_jl, ***lndxocn_io, ***lndxocn_jo;
-    double  ***lndxocn_area, ***lndxocn_dil, ***lndxocn_djl, ***lndxocn_dio, ***lndxocn_djo;
-    double  ***lndxocn_clon, ***lndxocn_clat;
-    double  min_area;
-
-    nlxo         = (size_t ** )malloc(ntile_lnd*sizeof(size_t * ));
-    lndxocn_area = (double ***)malloc(ntile_lnd*sizeof(double **));
-    lndxocn_il   = (int    ***)malloc(ntile_lnd*sizeof(int    **));
-    lndxocn_jl   = (int    ***)malloc(ntile_lnd*sizeof(int    **));
-    lndxocn_io   = (int    ***)malloc(ntile_lnd*sizeof(int    **));
-    lndxocn_jo   = (int    ***)malloc(ntile_lnd*sizeof(int    **));
-    if(interp_order == 2) {
-      lndxocn_dil  = (double ***)malloc(ntile_lnd*sizeof(double **));
-      lndxocn_djl  = (double ***)malloc(ntile_lnd*sizeof(double **));
-      lndxocn_dio  = (double ***)malloc(ntile_lnd*sizeof(double **));
-      lndxocn_djo  = (double ***)malloc(ntile_lnd*sizeof(double **));
-      lndxocn_clon = (double ***)malloc(ntile_lnd*sizeof(double **));
-      lndxocn_clat = (double ***)malloc(ntile_lnd*sizeof(double **));
-    }
-    for(nl=0; nl<ntile_lnd; nl++) {
-      nlxo        [nl] = (size_t * )malloc(ntile_ocn*sizeof(size_t  ));
-      lndxocn_area[nl] = (double **)malloc(ntile_ocn*sizeof(double *));
-      lndxocn_il  [nl] = (int    **)malloc(ntile_ocn*sizeof(int    *));
-      lndxocn_jl  [nl] = (int    **)malloc(ntile_ocn*sizeof(int    *));
-      lndxocn_io  [nl] = (int    **)malloc(ntile_ocn*sizeof(int    *));
-      lndxocn_jo  [nl] = (int    **)malloc(ntile_ocn*sizeof(int    *));
-      if(interp_order == 2) {
-	lndxocn_dil [nl] = (double **)malloc(ntile_ocn*sizeof(double *));
-	lndxocn_djl [nl] = (double **)malloc(ntile_ocn*sizeof(double *));
-	lndxocn_dio [nl] = (double **)malloc(ntile_ocn*sizeof(double *));
-	lndxocn_djo [nl] = (double **)malloc(ntile_ocn*sizeof(double *));
-	lndxocn_clon[nl] = (double **)malloc(ntile_ocn*sizeof(double *));
-	lndxocn_clat[nl] = (double **)malloc(ntile_ocn*sizeof(double *));
-      }
-      for(no=0; no<ntile_ocn; no++) {
-	lndxocn_area[nl][no] = (double *)malloc(MAXXGRID*sizeof(double));
-	lndxocn_il  [nl][no] = (int    *)malloc(MAXXGRID*sizeof(int   ));
-	lndxocn_jl  [nl][no] = (int    *)malloc(MAXXGRID*sizeof(int   ));
-	lndxocn_io  [nl][no] = (int    *)malloc(MAXXGRID*sizeof(int   ));
-	lndxocn_jo  [nl][no] = (int    *)malloc(MAXXGRID*sizeof(int   ));          
-	if(interp_order == 2 ) {  
-	  lndxocn_dil[nl][no]  = (double *)malloc(MAXXGRID*sizeof(double));
-	  lndxocn_djl[nl][no]  = (double *)malloc(MAXXGRID*sizeof(double));
-	  lndxocn_dio[nl][no]  = (double *)malloc(MAXXGRID*sizeof(double));
-	  lndxocn_djo[nl][no]  = (double *)malloc(MAXXGRID*sizeof(double));
-	  lndxocn_clon[nl][no] = (double *)malloc(MAXXGRID*sizeof(double *));
-	  lndxocn_clat[nl][no] = (double *)malloc(MAXXGRID*sizeof(double *));
-	}
-      }
-    }
- 
-    for(nl=0; nl<ntile_lnd; nl++) {
-      int      il, jl, io, jo, is, ie, js, je, layout[2];
-      int      n0, n1, n2, n3, nl_in, no_in, n_out, nxgrid;
-      double   xarea, xctrlon, xctrlat;
-      double   xl_min, yl_min, xo_min, yo_min, xl_avg;
-      double   xl_max, yl_max, xo_max, yo_max;
-      double   xl[MV], yl[MV], xo[MV], yo[MV], x_out[MV], y_out[MV];
-      domain2D Dom;
-
-      for(no=0; no<ntile_ocn; no++) nlxo[nl][no] = 0;
-      
-      layout[0] = mpp_npes();
-      layout[1] = 1;
-        
-      mpp_define_domain2d(nxl[nl]*nyl[nl], 1, layout, 0, 0, &Dom);
-      mpp_get_compute_domain2d(Dom, &is, &ie, &js, &je );
-      for(ll=is;ll<=ie;ll++) {
-	il = ll%nxl[nl];
-	jl = ll/nxl[nl];
-	n0 = jl    *(nxl[nl]+1) + il;
-	n1 = jl    *(nxl[nl]+1) + il+1;
-	n2 = (jl+1)*(nxl[nl]+1) + il+1;
-	n3 = (jl+1)*(nxl[nl]+1) + il;
-	xl[0] = xlnd[nl][n0]; yl[0] = ylnd[nl][n0];
-	xl[1] = xlnd[nl][n1]; yl[1] = ylnd[nl][n1];
-	xl[2] = xlnd[nl][n2]; yl[2] = ylnd[nl][n2];
-	xl[3] = xlnd[nl][n3]; yl[3] = ylnd[nl][n3];
-	yl_min  = minval_double(4, yl);
-	yl_max  = maxval_double(4, yl);
-	nl_in   = fix_lon(xl, yl, 4, M_PI);
-	xl_min  = minval_double(nl_in, xl);
-	xl_max  = maxval_double(nl_in, xl);
-	xl_avg  = avgval_double(nl_in, xl);      
-	for(no=0; no<ntile_ocn; no++) {
-	  for(jo = 0; jo < nyo[no]; jo++) for(io = 0; io < nxo[no]; io++) if(omask[no][jo*nxo[no]+io] > MIN_AREA_FRAC) {
-	    double ocn_frac;
-	    n0 = jo    *(nxo[no]+1) + io;
-	    n1 = jo    *(nxo[no]+1) + io+1;
-	    n2 = (jo+1)*(nxo[no]+1) + io+1;
-	    n3 = (jo+1)*(nxo[no]+1) + io;
-	    xo[0] = xocn[no][n0]; yo[0] = yocn[no][n0];
-	    xo[1] = xocn[no][n1]; yo[1] = yocn[no][n1];
-	    xo[2] = xocn[no][n2]; yo[2] = yocn[no][n2];
-	    xo[3] = xocn[no][n3]; yo[3] = yocn[no][n3];
-	    yo_min = minval_double(4, yo);
-	    yo_max = maxval_double(4, yo);
-            if(yo_min >= yl_max || yo_max <= yl_min ) continue;	    
-	    no_in  = fix_lon(xo, yo, 4, xl_avg);
-	    xo_min = minval_double(no_in, xo);
-	    xo_max = maxval_double(no_in, xo);
-	    /* xo should in the same range as xa after lon_fix, so no need to
-	       consider cyclic condition
-	    */
-	    if(xl_min >= xo_max || xl_max <= xo_min ) continue;
-	    ocn_frac = omask[no][jo*nxo[no]+io];
-	    if (  (n_out = clip_2dx2d( xl, yl, nl_in, xo, yo, no_in, x_out, y_out )) > 0 ){
-	      xarea = poly_area(x_out, y_out, n_out )*ocn_frac;
-	      min_area = min(area_ocn[no][jo*nxo[no]+io], area_lnd[nl][ll] );
-	      if(xarea/min_area > AREA_RATIO_THRESH ) {
-		lndxocn_area[nl][no][nlxo[nl][no]] = xarea;
-		lndxocn_io[nl][no][nlxo[nl][no]]   = io;
-		lndxocn_jo[nl][no][nlxo[nl][no]]   = jo;
-		lndxocn_il[nl][no][nlxo[nl][no]]   = il;
-		lndxocn_jl[nl][no][nlxo[nl][no]]   = jl;
-		if(interp_order == 2) {
-		  lndxocn_clon[nl][no][nlxo[nl][no]] = poly_ctrlon ( x_out, y_out, n_out, xl_avg)*ocn_frac;
-		  lndxocn_clat[nl][no][nlxo[nl][no]] = poly_ctrlat ( x_out, y_out, n_out )*ocn_frac;
-		}
-		++(nlxo[nl][no]);
-		if(nlxo[nl][no] > MAXXGRID) mpp_error("nlxo is greater than MAXXGRID, increase MAXXGRID");
-	      }
-	    }
-	  } /* end of io, jo loop */
-	} 
-      } /* end of ll( or il, jl) loop */
-      mpp_delete_domain2d(&Dom);
-    }/* for(nl=0; nl<ntile_lnd; nl++) */
-
-    /* calculate the centroid of model grid. */
-    if(interp_order == 2) {
-      double *l_area, *l_clon, *l_clat;
-      double **o_area, **o_clon, **o_clat;
- 
-      o_area = (double **)malloc(ntile_ocn*sizeof(double *));
-      o_clon = (double **)malloc(ntile_ocn*sizeof(double *));
-      o_clat = (double **)malloc(ntile_ocn*sizeof(double *));
-      for(no =0; no<ntile_ocn; no++) {
-	o_area[no] = (double *)malloc(nxo[no]*nyo[no]*sizeof(double));
-	o_clon[no] = (double *)malloc(nxo[no]*nyo[no]*sizeof(double));
-	o_clat[no] = (double *)malloc(nxo[no]*nyo[no]*sizeof(double));
-	for(lo=0; lo<nxo[no]*nyo[no]; lo++) {
-	  o_area[no][lo] = 0;
-	  o_clon[no][lo] = 0;
-	  o_clat[no][lo] = 0;
-	}
-      }
-
-      for(nl=0; nl<ntile_lnd; nl++) {
-	l_area = (double *)malloc(nxl[nl]*nyl[nl]*sizeof(double));
-	l_clon = (double *)malloc(nxl[nl]*nyl[nl]*sizeof(double));
-	l_clat = (double *)malloc(nxl[nl]*nyl[nl]*sizeof(double));
-	for(ll=0; ll<nxl[nl]*nyl[nl]; ll++) {
-	  l_area[ll] = 0;
-	  l_clon[ll] = 0;
-	  l_clat[ll] = 0;
-	}
-
-	for(no=0; no<ntile_ocn; no++) {
-	  int nxgrid;
-	  nxgrid = nlxo[nl][no];
-	  mpp_sum_int(1, &nxgrid);
-	  if(nxgrid > 0) {
-	    double *g_area, *g_clon, *g_clat;
-	    int    *g_il,   *g_jl,   *g_io, *g_jo;
-	    int    ii;
-	    g_il = (int    *)malloc(nxgrid*sizeof(int   ));
-	    g_jl = (int    *)malloc(nxgrid*sizeof(int   ));
-	    g_io = (int    *)malloc(nxgrid*sizeof(int   ));
-	    g_jo = (int    *)malloc(nxgrid*sizeof(int   ));	
-	    g_area = (double *)malloc(nxgrid*sizeof(double));
-	    g_clon = (double *)malloc(nxgrid*sizeof(double));
-	    g_clat = (double *)malloc(nxgrid*sizeof(double));
-	    mpp_gather_field_int   (nlxo[nl][no], lndxocn_il[nl][no], g_il);
-	    mpp_gather_field_int   (nlxo[nl][no], lndxocn_jl[nl][no], g_jl);
-	    mpp_gather_field_int   (nlxo[nl][no], lndxocn_io[nl][no], g_io);
-	    mpp_gather_field_int   (nlxo[nl][no], lndxocn_jo[nl][no], g_jo);
-	    mpp_gather_field_double(nlxo[nl][no], lndxocn_area[nl][no], g_area);
-	    mpp_gather_field_double(nlxo[nl][no], lndxocn_clon[nl][no], g_clon);
-	    mpp_gather_field_double(nlxo[nl][no], lndxocn_clat[nl][no], g_clat);
-	    for(i=0; i<nxgrid; i++) {	      
-	      ii = g_jl[i]*nxl[nl]+g_il[i];
-	      l_area[ii] += g_area[i];
-	      l_clon[ii] += g_clon[i];
-	      l_clat[ii] += g_clat[i];
-	      ii = g_jo[i]*nxo[no]+g_io[i];
-	      o_area[no][ii] += g_area[i];
-	      o_clon[no][ii] += g_clon[i];
-	      o_clat[no][ii] += g_clat[i];
-	    }
-	    free(g_il);
-	    free(g_jl);
-	    free(g_io);
-	    free(g_jo);
-	    free(g_area);
-	    free(g_clon);
-	    free(g_clat);
-	  }
-	}
-	for(ll=0; ll<nxl[nl]*nyl[nl]; ll++) {
-	  if(l_area[ll] > 0) {
-	    l_clon[ll] /= l_area[ll];
-	    l_clat[ll] /= l_area[ll];
-	  }
-	}
-	/* substract land centroid to get the centroid distance between land grid and exchange grid. */
-	for(no=0; no<ntile_ocn; no++) {
-	  for(i=0; i<nlxo[nl][no]; i++) {
-	    ll = lndxocn_jl[nl][no][i]*nxl[nl] + lndxocn_il[nl][no][i];
-	    lndxocn_dil[nl][no][i] = lndxocn_clon[nl][no][i]/lndxocn_area[nl][no][i] - l_clon[ll];
-	    lndxocn_djl[nl][no][i] = lndxocn_clat[nl][no][i]/lndxocn_area[nl][no][i] - l_clat[ll];
-	  }
-	}
-	
-	free(l_area);
-	free(l_clon);
-	free(l_clat);	
-      }
-
-      /* centroid distance from exchange grid to ocean grid */
-      for(no=0; no<ntile_ocn; no++) {
-	for(lo=0; lo<nxo[no]*nyo[no]; lo++) {
-	  if(o_area[no][lo] > 0) {
-	    o_clon[no][lo] /= o_area[no][lo];
-	    o_clat[no][lo] /= o_area[no][lo];
-	  }
-	}
-	for(nl=0; nl<ntile_lnd; nl++) {
-	  for(i=0; i<nlxo[nl][no]; i++) {
-	    lo = lndxocn_jo[nl][no][i]*nxo[no] + lndxocn_io[nl][no][i];
-	    lndxocn_dio[nl][no][i] = lndxocn_clon[nl][no][i]/lndxocn_area[nl][no][i] - o_clon[no][lo];
-	    lndxocn_djo[nl][no][i] = lndxocn_clat[nl][no][i]/lndxocn_area[nl][no][i] - o_clat[no][lo];
-	  }
-	}
-	free(o_area[no]);
-	free(o_clon[no]);
-	free(o_clat[no]);
-      }
-
-      free(o_area);
-      free(o_clon);
-      free(o_clat);
-    }
-
-    /* write out lndXocn data */
-    for(nl = 0; nl < ntile_lnd; nl++) {
-       for(no = 0; no < ntile_ocn; no++) {
-	 int nxgrid;
-	 
-	/* get total number of exchange grid on all the pes */
-	 nxgrid = nlxo[nl][no];
-	mpp_sum_int(1, &nxgrid);
-	
-	if(nxgrid >0) {
-	  size_t start[4], nwrite[4];
-	  int *gdata_int;
-	  double *gdata_dbl;
-	  
-	  char contact[STRING];
-	  int fid, dim_string, dim_ncells, dim_two, dims[4];
-	  int id_contact, id_xgrid_area, n;
-	  int id_tile1_cell, id_tile2_cell, id_tile1_dist, id_tile2_dist;
-
-	  for(i=0; i<4; i++) {
-	    start[i] = 0; nwrite[i] = 1;
-	  }	  	  
-	  
-	  if(same_mosaic)
-	    sprintf(lxo_file[nfile_lxo], "lnd_%s_%sXocn_%s_%s.nc", lmosaic_name, ltile_name[nl], imosaic_name, otile_name[no]);
-	  else
-	    sprintf(lxo_file[nfile_lxo], "%s_%sX%s_%s.nc", lmosaic_name, ltile_name[nl], imosaic_name, otile_name[no]);
-	  sprintf(contact, "%s:%s::%s:%s", lmosaic_name, ltile_name[nl], imosaic_name, otile_name[no]);
-
-	  fid = mpp_open(lxo_file[nfile_lxo], MPP_WRITE);
-	  mpp_def_global_att(fid, GRID_VERSION_NAME, grid_version);
-          mpp_def_global_att(fid, CODE_VERSION_NAME, tagname);
-	  mpp_def_global_att(fid, HISTORY_NAME, history);
-	  dim_string = mpp_def_dim(fid, STRING_NAME, STRING);
-	  dim_ncells = mpp_def_dim(fid, "ncells", nxgrid);
-	  dim_two    = mpp_def_dim(fid, "two", 2);
-	  if(interp_order == 2) {
-	    id_contact = mpp_def_var(fid, "contact", MPP_CHAR, 1, &dim_string, 7, "standard_name", "grid_contact_spec",
-				     "contact_type", "exchange", "parent1_cell",
-				     "tile1_cell", "parent2_cell", "tile2_cell", "xgrid_area_field", "xgrid_area", 
-				     "distant_to_parent1_centroid", "tile1_distance", "distant_to_parent2_centroid", "tile2_distance");
-	  }
-	  else {
-	    id_contact = mpp_def_var(fid, "contact", MPP_CHAR, 1, &dim_string, 5, "standard_name", "grid_contact_spec",
-				     "contact_type", "exchange", "parent1_cell",
-				     "tile1_cell", "parent2_cell", "tile2_cell", "xgrid_area_field", "xgrid_area" );
-	  }
-	  dims[0] = dim_ncells; dims[1] = dim_two;
-	  id_tile1_cell = mpp_def_var(fid, "tile1_cell", MPP_INT, 2, dims, 1, "standard_name", "parent1_cell_indices");
-	  id_tile2_cell = mpp_def_var(fid, "tile2_cell", MPP_INT, 2, dims, 1, "standard_name", "parent2_cell_indices");
-	  id_xgrid_area = mpp_def_var(fid, "xgrid_area", MPP_DOUBLE, 1, &dim_ncells, 2, "standard_name",
-				      "exchange_grid_area", "units", "m2");
-
-	  if(interp_order == 2) {
-	    id_tile1_dist = mpp_def_var(fid, "tile1_distance", MPP_DOUBLE, 2, dims, 1, "standard_name", "distance_from_parent1_cell_centroid");
-	    id_tile2_dist = mpp_def_var(fid, "tile2_distance", MPP_DOUBLE, 2, dims, 1, "standard_name", "distance_from_parent2_cell_centroid");
-	  }
-	  mpp_end_def(fid);
-
-	  /* the index will start from 1, instead of 0 ( fortran index) */
-	  for(i = 0;i < nlxo[nl][no]; i++) {
-	    ++(lndxocn_il[nl][no][i]);
-	    ++(lndxocn_jl[nl][no][i]);
-	    ++(lndxocn_io[nl][no][i]);
-	    lndxocn_jo[nl][no][i] += 1 - ocn_south_ext; /* one artificial j-level may be added in the south end */
-	  }
-
-	  nwrite[0] = strlen(contact);
-	  mpp_put_var_value_block(fid, id_contact, start, nwrite, contact);
-	  nwrite[0] = nxgrid;
-
-	  gdata_int = (int *)malloc(nxgrid*sizeof(int));
-	  gdata_dbl = (double *)malloc(nxgrid*sizeof(double));
-
-	  mpp_gather_field_double(nlxo[nl][no], lndxocn_area[nl][no], gdata_dbl);
-	  mpp_put_var_value(fid, id_xgrid_area, gdata_dbl);
-	  mpp_gather_field_int(nlxo[nl][no], lndxocn_il[nl][no], gdata_int);
-	  mpp_put_var_value_block(fid, id_tile1_cell, start, nwrite, gdata_int);
-	  mpp_gather_field_int(nlxo[nl][no], lndxocn_io[nl][no], gdata_int);
-	  mpp_put_var_value_block(fid, id_tile2_cell, start, nwrite, gdata_int);
-	  start[1] = 1;
-	  mpp_gather_field_int(nlxo[nl][no], lndxocn_jl[nl][no], gdata_int);
-	  mpp_put_var_value_block(fid, id_tile1_cell, start, nwrite, gdata_int);
-	  mpp_gather_field_int(nlxo[nl][no], lndxocn_jo[nl][no], gdata_int);
-	  mpp_put_var_value_block(fid, id_tile2_cell, start, nwrite, gdata_int);
-	  if(interp_order == 2) {
-	    start[1] = 0;
-  	    mpp_gather_field_double(nlxo[nl][no], lndxocn_dil[nl][no], gdata_dbl);
-	    mpp_put_var_value_block(fid, id_tile1_dist, start, nwrite, gdata_dbl);
-	    mpp_gather_field_double(nlxo[nl][no], lndxocn_dio[nl][no], gdata_dbl);
-	    mpp_put_var_value_block(fid, id_tile2_dist, start, nwrite, gdata_dbl);
-	    start[1] = 1;
-  	    mpp_gather_field_double(nlxo[nl][no], lndxocn_djl[nl][no], gdata_dbl);
-	    mpp_put_var_value_block(fid, id_tile1_dist, start, nwrite, gdata_dbl);
-	    mpp_gather_field_double(nlxo[nl][no], lndxocn_djo[nl][no], gdata_dbl);
-	    mpp_put_var_value_block(fid, id_tile2_dist, start, nwrite, gdata_dbl);
-	  }
-	  mpp_close(fid);
-	  free(gdata_int);
-	  free(gdata_dbl);
-	  ++nfile_lxo;
-	}
-       } /* for(no=0; no<ntile_ocn; no++) */
-    } /* for(nl=0; nl<ntile_lnd; nl++) */
-
-    { /* write out land_mosaicXocean_mosaic */
-      int fid, dim_nmosaic, dim_ncontact, id_mosaic, id_contact, dim_string, dims[4], n;
-	size_t start[4], nwrite[4];
-	  
-
-	sprintf(lmosaicximosaic_file, "%sX%s.nc", lmosaic_name, imosaic_name);
-	fid = mpp_open(lmosaicximosaic_file, MPP_WRITE);
-        dim_nmosaic = mpp_def_dim(fid, NMOSAIC_NAME, 2);
-	dim_ncontact = mpp_def_dim(fid, NCONTACT_NAME, nfile_lxo);
-	dim_string = mpp_def_dim(fid, STRING_NAME, STRING);
-	dims[0] = dim_nmosaic;
-	dims[1] = dim_string;
-	id_mosaic = mpp_def_var(fid, MOSAIC_FILES_NAME, MPP_CHAR, 2, dims, 0);
-	dims[0] = dim_ncontact;
-	id_contact = mpp_def_var(fid, CONTACT_FILES_NAME, MPP_CHAR, 2, dims, 0);
-	mpp_def_global_att(fid, GRID_VERSION_NAME, grid_version);
-	mpp_def_global_att(fid, CODE_VERSION_NAME, tagname);
-	mpp_def_global_att(fid, HISTORY_NAME, history);
-	mpp_end_def(fid);
-	for(i=0; i<4; i++) {
-	  start[i] = 0; nwrite[i] = 1;
-	}
-	start[0] = 0; nwrite[1] = strlen(lmosaic_file);
-	mpp_put_var_value_block(fid, id_mosaic, start, nwrite, lmosaic_file);
-	start[0] = 1; nwrite[1] = strlen(imosaic_file);
-	mpp_put_var_value_block(fid, id_mosaic, start, nwrite, imosaic_file);
-	for(n=0; n<nfile_lxo; n++) {
-	  start[0]=n;
-	  nwrite[1] = strlen(lxo_file[n]);
-	  mpp_put_var_value_block(fid, id_contact, start, nwrite, lxo_file[n]);
-	}
-	mpp_close(fid);
-      }
-    
-    /* release the memory */
-    for(nl=0; nl<ntile_lnd; nl++) {
-      for(no=0; no<ntile_ocn; no++) {
-	free(lndxocn_area[nl][no]);
-	free(lndxocn_il  [nl][no]);
-	free(lndxocn_jl  [nl][no]);
-	free(lndxocn_io  [nl][no]);
-	free(lndxocn_jo  [nl][no]);
-	if(interp_order == 2) {
-	  free(lndxocn_clon[nl][no]);
-	  free(lndxocn_clat[nl][no]);
-	  free(lndxocn_dil [nl][no]);
-	  free(lndxocn_djl [nl][no]);
-	  free(lndxocn_dio [nl][no]);
-	  free(lndxocn_djo [nl][no]);
-	}
-      }
-      free(lndxocn_area[nl]);
-      free(lndxocn_il  [nl]);
-      free(lndxocn_jl  [nl]);
-      free(lndxocn_io  [nl]);
-      free(lndxocn_jo  [nl]);
-      if(interp_order == 2) {
-	free(lndxocn_clon[nl]);
-	free(lndxocn_clat[nl]);
-	free(lndxocn_dil [nl]);
-	free(lndxocn_djl [nl]);
-	free(lndxocn_dio [nl]);
-	free(lndxocn_djo [nl]);
-      }
-      free(nlxo[nl]);
-    }
-    free(nlxo);
-    free(lndxocn_area);
-    free(lndxocn_il  );
-    free(lndxocn_jl  );
-    free(lndxocn_io  );
-    free(lndxocn_jo  );   
-    if(interp_order == 2) {
-      free(lndxocn_clon);
-      free(lndxocn_clat);
-      free(lndxocn_dil );
-      free(lndxocn_djl );
-      free(lndxocn_dio );
-      free(lndxocn_djo );
-    }
-
-    if(mpp_pe() == mpp_root_pe()) printf("\nNOTE from make_coupler_mosaic: Complete the process to create exchange grids "
-					 "for runoff between land and sea ice.\n" );
-  }
-  else {
-    strcpy(lmosaicximosaic_file, amosaicximosaic_file);
-    nfile_lxo = nfile_axo;
-    for(i=0; i<nfile_axo; i++) strcpy(lxo_file[i], axo_file[i]);
-    if(mpp_pe() == mpp_root_pe()) printf("\nNOTE from make_coupler_mosaic: Since lmosaic is the same as amosaic, "
-					 "no need to compute the exchange grid between lmosaic and imosaic, "
-					 "simply use the exchange grid between amosaic and imosaic.\n");    
-  }
-
-  if(mpp_pe() == mpp_root_pe()) {
-    int n, i;
-    double axo_area_frac;
-    double axl_area_frac;
-    double tiling_area;
-    double *atm_area;
-    double atm_area_sum;
-
-    if(check) {
-      /* for cubic grid, when number of model points is odd, some grid cell area will be negative,
-	 need to think about how to solve this issue in the future */
-      /*      atm_area_sum = 4*M_PI*RADIUS*RADIUS; */
-      atm_area_sum = 0;
-      for(n=0; n<ntile_atm; n++) {
-	atm_area = (double *)malloc(nxa[n]*nya[n]*sizeof(double));
-	get_grid_area(&nxa[n], &nya[n], xatm[n], yatm[n], atm_area);
-	for(i=0; i<nxa[n]*nya[n]; i++) atm_area_sum += atm_area[i];
-	free(atm_area);
-      }
-      axo_area_frac = axo_area_sum/atm_area_sum*100;
-      axl_area_frac = axl_area_sum/atm_area_sum*100;
-      tiling_area   = (atm_area_sum-axo_area_sum-axl_area_sum)/atm_area_sum*100;    
-      printf("\nNOTE: axo_area_sum is %f and ocean fraction is %f%%\n", axo_area_sum, axo_area_frac);
-      printf("NOTE: axl_area_sum is %f and land  fraction is %f%%\n", axl_area_sum, axl_area_frac);
-      printf("NOTE: tiling error is %f%%\n", tiling_area );
-    }
-  }
-  
-  /*Fianlly create the coupler mosaic file mosaic_name.nc */
-  {
-    int fid, dim_string, dim_ncontact, dim_nmosaic, dims[4], n;
-    size_t start[4], nwrite[4];
-    int id_mosaic_file, id_contact_file, id_ocean_topog;
-    
-    fid = mpp_open(mosaic_file, MPP_WRITE);
-    mpp_def_global_att(fid, GRID_VERSION_NAME, grid_version);
-    mpp_def_global_att(fid, CODE_VERSION_NAME, tagname);
-    mpp_def_global_att(fid, HISTORY_NAME, history);
-    dim_nmosaic = mpp_def_dim(fid, NMOSAIC_NAME, 4);
-    dim_ncontact = mpp_def_dim(fid, NCONTACT_NAME, 3);
-    dim_string = mpp_def_dim(fid, STRING_NAME, STRING);
-    dims[0] = dim_nmosaic;
-    dims[1] = dim_string;
-    id_mosaic_file = mpp_def_var(fid, MOSAIC_FILES_NAME, MPP_CHAR, 2, dims,
-				  1, "standard_name", "mosaic_file_name");
-    dims[0] = dim_ncontact;
-    id_contact_file = mpp_def_var(fid, CONTACT_FILES_NAME, MPP_CHAR, 2, dims,
-				  1, "standard_name", "contact_file_name");
-    id_ocean_topog = mpp_def_var(fid, "ocean_topog_mosaic", MPP_CHAR, 1, &dim_string,
-				 1, "standard_name", "ocean_topog_mosaic_file_name");
-    
-    mpp_end_def(fid);
-    for(i=0; i<4; i++) { start[i] = 0; nwrite[i] = 1; }
-    start[0] = 0; nwrite[1] = strlen(amosaic_file);
-    mpp_put_var_value_block(fid, id_mosaic_file, start, nwrite, amosaic_file);
-    start[0] = 1; nwrite[1] = strlen(lmosaic_file);
-    mpp_put_var_value_block(fid, id_mosaic_file, start, nwrite, lmosaic_file);
-    start[0] = 2; nwrite[1] = strlen(imosaic_file);
-    mpp_put_var_value_block(fid, id_mosaic_file, start, nwrite, imosaic_file);
-    start[0] = 3; nwrite[1] = strlen(omosaic_file);
-    mpp_put_var_value_block(fid, id_mosaic_file, start, nwrite, omosaic_file);
-    
-    start[0] = 0; nwrite[1] = strlen(amosaicxlmosaic_file);
-    mpp_put_var_value_block(fid, id_contact_file, start, nwrite, amosaicxlmosaic_file);
-    start[0] = 1; nwrite[1] = strlen(amosaicximosaic_file);
-    mpp_put_var_value_block(fid, id_contact_file, start, nwrite, amosaicximosaic_file);
-    start[0] = 2; nwrite[1] = strlen(lmosaicximosaic_file);
-    mpp_put_var_value_block(fid, id_contact_file, start, nwrite, lmosaicximosaic_file);
-    start[0] = 0; nwrite[0] = strlen(itopog_file); nwrite[1] = 1;
-    mpp_put_var_value_block(fid, id_ocean_topog, start, nwrite, itopog_file);
-    mpp_close(fid);
-  }
-
-  return 0;
-  
-}
-  
-
-  
-  
diff --git a/gridspec/tools/shared/tool_util.h b/gridspec/tools/shared/tool_util.h
deleted file mode 100644
index 8682b66..0000000
--- a/gridspec/tools/shared/tool_util.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/***********************************************************************
-                      tool_util.h
-    This header file provide some utilities routine that will be used in many tools.
-    
-    contact: Zhi.Liang at noaa.gov
-***********************************************************************/
-#ifndef TOOL_UTIL_H_
-#define TOOL_UTIL_H_
-#define grid_version ("0.3")
-#include "constant.h"
-double* get_subregion(int ni, double *data, int is, int ie, int js, int je);
-void get_file_path(const char *file, char *dir);
-int get_int_entry(char *line, int *value); 
-int get_double_entry(char *line, double *value);
-double spherical_dist(double x1, double y1, double x2, double y2);
-double spherical_area(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4 ); 
-double bipolar_dist(double x1, double y1, double x2, double y2, double bpeq, double bpsp, double bpnp, double rp );
-double bipolar_area(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4 );
-void tp_trans(double *lon, double *lat, double lon_ref, double lon_start, 
-              double lam0, double bpeq, double bpsp, double bpnp, double rp );
-double* compute_grid_bound(int nb, const double *bnds, const int *npts, int *grid_size, const char *center);
-int gs_make_vgrid(char *history, int nbnds, double *bnds, int n1, 
-	      int n2, int *nz, char *gridname, char *center);
-
-int gs_make_hgrid(char *grid_type, int *nlat, int *nlon, 
-	      int nxbnds0, int nybnds0, int nxbnds1, int nybnds1, 
-	      int nxbnds2, int nybnds2, double lat_join, int nratio, 
-	      double simple_dx, double simple_dy, int ntilex, int *ndivx, 
-              int ntiley, int *ndivy,
-              char *gridname, char *center, char *history, double *xbnds, 
-	      double *ybnds);
-
-int gs_make_mosaic(char *history, int ntile, char *mosaic_name, int nmosaic, char mosaicfile[][STRING],
-		   char *grid_descriptor, int n_tilefile, char tilefile[][STRING], double periodx, double periody,
-		   int  generate_contact, char *dir );
-
-int gs_make_coupler_mosaic(char *history, char *amosaic, char *lmosaic, 
-                           char *omosaic, char *imosaic, char *itopog, int interp_order, 
-                           double sea_level, char *mosaic_name, int check);
-
-int gs_make_topog(char *history, char *mosaic_file, char *topog_type, 
-              int x_refine, int y_refine, 
-              double basin_depth, char *topog_file, char *topog_field, double bottom_depth, 
-              double min_depth, double scale_factor, int num_filter_pass, 
-              double gauss_amp, double gauss_scale, double slope_x,
-              double slope_y, double bowl_south, double bowl_north, 
-              double bowl_west, double bowl_east, int fill_first_row, 
-              int filter_topog, int round_shallow, int fill_shallow, 
-              int deepen_shallow, int smooth_topo_allow_deepening, 
-              char *topog_mosaic);
-
-int gs_fregrid(char *history, char *mosaic_in, char *mosaic_out, char *dir_in, 
-           char *dir_out, char input_file[][STRING], int nfiles, char output_file[][STRING], 
-           int nfiles_out, char *remap_file, char scalar_name[][STRING], int nscalar,
-           char u_name[][STRING], int nvector, char v_name[][STRING], int nvector2, 
-           char *interp_method, char *test_case, double test_param, 
-           unsigned int opcode, int grid_type, unsigned int finer_step,
-           int fill_missing, int nlon, int nlat, int check_conserve, 
-           int y_at_center, double lonbegin, double lonend, double latbegin,
-           double latend, int kbegin, int kend, int lbegin, int lend);
-
-#endif
diff --git a/gridspec/tools/shared/topog.c b/gridspec/tools/shared/topog.c
deleted file mode 100644
index fc021fb..0000000
--- a/gridspec/tools/shared/topog.c
+++ /dev/null
@@ -1,544 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include "topog.h"
-#include "create_xgrid.h"
-#include "mosaic_util.h"
-#include "interp.h"
-#include "mpp_io.h"
-#include "mpp.h"
-
-#define D2R (M_PI/180.)
-
-void filter_topo( int nx, int ny, int num_pass, int smooth_topo_allow_deepening, double *depth);
-void set_depth(int nx, int ny, const double *xbnd, const double *ybnd, double alat1, double slon1,
-	       double elon1, double alat2, double slon2, double elon2, double depth_in, double *depth);
-void enforce_min_depth(int nx, int ny, int round_shallow, int deepen_shallow,
-		       int fill_shallow, double min_depth, double *depth);
-
-/*********************************************************************
-   void create_rectangular_topog()
-   Constructing a rectangular basin with a flat bottom, basin_depth can be 0 ( all land).
- ********************************************************************/
-void create_rectangular_topog(int nx, int ny, double basin_depth, double *depth)
-{
-  int i;
-
-  for(i=0; i<nx*ny; i++)  depth[i] = basin_depth;
-}; /* create_rectangular_topog  */
-
-/*********************************************************************
-   void create_bowl_topog()
-   From "Simulation of density-driven frictional downslope flow
-   in z-coordinate mocean models"
-   Winton et al. JPO, Vol 28, No 11, 2163-2174, November 1998
- ********************************************************************/
-void create_bowl_topog(int nx, int ny, const double *x, const double *y, double bottom_depth,
-		       double min_depth, double bowl_east, double bowl_south, double bowl_west,
-		       double bowl_north, double *depth)
-{
-  double bottom, xx, yy;
-  int i, j, nxp, nyp;
-
-  nxp = nx+1;
-  nyp = ny+1;
-  
-  for(j=0;j<ny;j++){
-    for(i=0;i<nx;i++){
-      xx = (x[j*nxp+i]+x[j*nxp+i+1]+x[(j+1)*nxp+i]+x[(j+1)*nxp+i+1])*0.25;
-      yy = (y[j*nxp+i]+y[j*nxp+i+1]+y[(j+1)*nxp+i]+y[(j+1)*nxp+i+1])*0.25;	    
-      if (xx <= bowl_west  || xx >= bowl_east || yy <= bowl_south || yy >= bowl_north)            
-	bottom = min_depth;
-      else
-	bottom = min_depth + bottom_depth*(1.0-exp(-pow((yy-bowl_south)/2.0,2)))
-	  *(1.0-exp(-pow((yy-bowl_north)/2.0,2)))
-	  *(1.0-exp(-pow((xx-bowl_west)/4.0,2)))
-	  *(1.0-exp(-pow((xx-bowl_east)/4.0,2)));
-      depth[j*nx+i] = bottom;
-    }
-  }
-}; /* create_bowl_topog */
-
-
-/*********************************************************************
-   void create_gaussian_topog()
-   Constructing a gaussian bump
- ********************************************************************/
-void create_gaussian_topog(int nx, int ny, const double *x, const double *y, double bottom_depth,
-			   double min_depth, double gauss_amp, double gauss_scale, double slope_x,
-			   double slope_y, double *depth)
-{
-  double bump_height, bump_scale, xcent, ycent, arg, bottom;
-  double xe, xw, ys, yn;
-  double *xt, *yt;
-  int i, j, nxp, nyp;
-
-  xt = (double *)malloc(nx*ny*sizeof(double));
-  yt = (double *)malloc(nx*ny*sizeof(double));
-  for(j=0; j<ny; j++) {
-    for(i=0; i<nx; i++) {
-      xt[j*nx+i] = (x[j*nxp+i] + x[j*nxp+i+1] + x[(j+1)*nxp+i] + x[(j+1)*nxp+i+1])*0.25;
-      yt[j*nx+i] = (y[j*nxp+i] + y[j*nxp+i+1] + y[(j+1)*nxp+i] + y[(j+1)*nxp+i+1])*0.25;
-    }
-  }
-  
-  xw = xt[0];
-  ys = yt[0];
-  xe = xw;
-  yn = ys;
-
-  for(j=1;j<ny;j++){
-    for(i=1;i<nx;i++){
-      xw = min(xt[j*nx+i],xw); xe = max(xt[j*nx+i],xe);
-      ys = min(yt[j*nx+i],ys); yn = max(yt[j*nx+i],yn);
-    }
-  }
-
-  bump_height = gauss_amp*bottom_depth;
-  bump_scale = gauss_scale*min(xe-xw, yn-ys);
-  xcent = 0.5*(xe+xw);
-  ycent = 0.5*(yn+ys);
-
-  printf("Constructing a gaussian bump of height = %f meters with a scale width of %f degrees.\n",
-	 bump_height, bump_scale);
-  printf("The bump is centered at (lon,lat) = (%f,%f) deg.\n", xcent, ycent);
-  printf("The ocean floor rises with a slope of %f meters/deg towards the east and %f "
-	 " meters/deg to the north.", slope_x, slope_y) ;
-
-  for(j=0;i<nx*ny;j++){
-      arg = pow(xt[i]-xcent,2) + pow(yt[i]-ycent,2);
-      bottom = bottom_depth - bump_height*exp(-arg/pow(bump_scale,2));
-      bottom = bottom - slope_x*(xt[i]-xw)- slope_y*(yt[i]-ys);
-      depth[i] = max(bottom,min_depth);
-  }
-
-  free(xt);
-  free(yt);
-  
-}; /* create_gaussian_topog */
-
-
-/*********************************************************************
-
-  void create_idealized_topog
-   construct a highly "idealized" world ... piece by piece
-
-   note: the purpose of this geometry/topography is to automatically
-         map into arbitrary resolution as grid dimensions are
-         changed, thereby facilitating the implementation
-         and verification of the model on various computer platforms
-         without referencing the topographic database.  Although it
-         somewhat resembles the real world, it is NOT realistic.
-   Note: this routine needs to be re-thought for generalized curvilinear coordinates
-
- ********************************************************************/
-void create_idealized_topog( int nx, int ny, const double *x, const double *y,
-			     double bottom_depth, double min_depth, double *depth)
-{
-  int i, j, nxp, nyp;
-  double arg;
-  double *xbnd, *ybnd;
-  
-  for(j=0;j<ny;j++){
-    for(i=0;i<nx;i++) depth[j*nx+i]=bottom_depth;
-  }
-  
-  //antarctica
-  xbnd = (double *)malloc(nx*sizeof(double));
-  ybnd = (double *)malloc(ny*sizeof(double));
-  for(i=0; i<nx; i++) xbnd[i] = (x[i]+x[i+1])*0.5;
-  for(j=0; j<ny; j++) ybnd[j] = (y[j*nxp]+y[(j+1)*nxp])*0.5;
-  
-  set_depth (nx, ny, xbnd, ybnd, -90.0, 0.0, 360.0, -80.0, 0.0, 360.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, -80.0, 360.0-25.0, 360.0, -70.0, 360.0, 360.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, -80.0, 0.0, 360.0, -70.0, 0.0, 170.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, -80.0, 360.0-135.0, 360.0-60.0, -68.0, 360.0-75.0, 360.0-60.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, -70.0, 0.0, 155.0, -67.0, 50.0, 145.0, 0.0, depth);
-
-  // australia
-
-  set_depth (nx, ny, xbnd, ybnd, -35.0, 116.0, 120.0, -31.0, 114.0, 130.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, -38.0, 140.0, 151.0, -31.0, 130.0, 151.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, -31.0, 115.0, 153.0, -20.0, 113.0, 149.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, -20.0, 113.0, 149.0, -11.0, 131.0, 143.0, 0.0, depth);
-
-  // south america
-
-  set_depth (nx, ny, xbnd, ybnd, -50.0, 360.0-74.0, 360.0-68.0, -40.0, 360.0-73.0, 360.0-62.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, -40.0, 360.0-73.0, 360.0-62.0, -20.0, 360.0-70.0, 360.0-40.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, -20.0, 360.0-70.0, 360.0-40.0, -16.0, 360.0-81.0, 360.0-35.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, -16.0, 360.0-81.0, 360.0-35.0, 0.0, 360.0-80.0, 360.0-50.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 0.0, 360.0-80.0, 360.0-50.0, 11.0, 360.0-75.0, 360.0-60.0, 0.0, depth);
-
-  // central america
-
-  set_depth (nx, ny, xbnd, ybnd, 6.0, 360.0-78.0, 360.0-75.0, 20.0, 360.0-105.0, 360.0-97.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 20.0, 360.0-105.0, 360.0-97.0, 30.0, 360.0-115.0, 360.0-94.0, 0.0, depth);
-
-  // north america
-
-  set_depth (nx, ny, xbnd, ybnd, 25.0, 360.0-82.0, 360.0-80.0, 30.0, 360.0-85.0, 360.0-81.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 30.0, 360.0-115.0, 360.0-80.0, 40.0, 360.0-124.0, 360.0-74.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 40.0, 360.0-124.0, 360.0-74.0, 50.0, 360.0-124.0, 360.0-57.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 50.0, 360.0-124.0, 360.0-57.0, 60.0, 360.0-140.0, 360.0-64.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 60.0, 360.0-165.0, 360.0-64.0, 65.0, 360.0-140.0, 360.0-64.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 65.0, 360.0-140.0, 360.0-64.0, 70.0, 360.0-162.0, 360.0-72.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 70.0, 360.0-162.0, 360.0-140.0, 72.0, 360.0-157.0, 360.0-157.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 70.0, 360.0-130.0, 360.0-70.0, 75.0, 360.0-120.0, 360.0-80.0, 0.0, depth);
-
-  // greenland
-
-  set_depth (nx, ny, xbnd, ybnd, 60.0, 360.0-45.0, 360.0-45.0, 75.0, 360.0-58.0, 360.0-19.0, 0.0, depth);
-
-  // africa
-
-  set_depth (nx, ny, xbnd, ybnd, -35.0, 19.0, 28.0, 6.0, 8.0, 50.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 6.0, 0.0, 50.0, 18.0, 0.0, 56.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 18.0, 0.0, 56.0, 26.0, 0.0, 59.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 6.0, 360.0-10.0, 360.0, 18.0, 360.0-18.0, 360.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 18.0, 360.0-18.0, 360.0, 26.0,  360.0-15.0, 360.0, 0.0, depth);
-
-  // northern africa and europe and asia
-
-  set_depth (nx, ny, xbnd, ybnd, 26.0, 360.0-15.0, 360.0, 40.0, 360.0-7.0, 360.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 40.0, 360.0-7.0, 360.0, 50.0, 360.0, 360.0, 0.0, depth);
-
-  set_depth (nx, ny, xbnd, ybnd, 8.0, 77.0, 78.0, 26.0, 65.0, 90.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 4.0, 99.0, 100.0, 26.0, 90.0, 115.0, 0.0, depth);
-
-  set_depth (nx, ny, xbnd, ybnd, 26.0, 0.0, 126.0, 40.0, 0.0, 122.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 40.0, 0.0, 130.0, 50.0, 0.0, 140.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 50.0, 0.0, 140.0, 60.0, 8.0, 140.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 60.0, 8.0, 163.0, 65.0, 13.0, 180.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 65.0, 13.0, 188.0, 70.0, 20.0, 180.0, 0.0, depth);
-  set_depth (nx, ny, xbnd, ybnd, 70.0, 70.0, 180.0, 75.0, 90.0, 100.0, 0.0, depth);
-
-  // add an "idealized" undulating topography
-
-  nxp = nx+1;
-  nyp = ny+1;
-  for(j=0;j<ny;j++){
-    for(i=0;i<nx;i++){
-      if (depth[j*nx+i] > 0.0 ) {
-	arg = bottom_depth*(1-0.4*fabs(cos(((j+1)*M_PI)/nyp)*sin(((i+1)*2*M_PI)/nxp)));
-        arg = max(arg, min_depth);      
-        depth[j*nx+i] = arg;
-      }
-    }
-  }
-
-  // add "idealized" ridges
-
-  arg = 0.666*bottom_depth;
-  
-  set_depth (nx, ny, xbnd, ybnd, -20.0, 360.0-20.0, 360.0-10.0, 30.0, 360.0-45.0, 360.0-35.0, arg, depth);
-  set_depth (nx, ny, xbnd, ybnd, 30.0, 360.0-45.0, 360.0-35.0, 60.0, 360.0-20.0,  360.0-30.0, arg, depth);
-  set_depth (nx, ny, xbnd, ybnd, -60.0,360.0-100.0, 360.0-130.0, 40.0, 360.0-160.0, 180.0, arg, depth);
-
-  arg = 0.5*bottom_depth;
-  
-  set_depth (nx, ny, xbnd, ybnd, -50.0, 360.0-120.0, 360.0-120.0, 30.0, 190.0, 190.0, arg, depth);
-
-  free(xbnd);
-  free(ybnd);
-  
-} /* create_idealized_topog */
-
-/*********************************************************************
-   void set_depth(double alat1, double slon1, double elon1, double alat2,
-                  double slon2, double elon2, double depth_in )
-        set the topography depth "depth[i][j](i,j)" = "depth_in" within the area of
-        the trapezoid bounded by vertices:
-        (alat1,slon1), (alat1,elon1), (alat2,slon2), and (alat2,elon2)
-   
-        inputs:
-   
-        alat1 = southern latitude of trapezoid (degrees)
-        slon1 = starting longitude of southern edge of trapezoid (deg)
-        elon1 = ending longitude of southern edge of trapezoid (deg)
-        alat2 = northern latitude of trapezoid (degrees)
-        slon2 = starting longitude of northern edge of trapezoid (deg)
-        elon2 = ending longitude of northern edge of trapezoid (deg)
-        depth_in = constant depth value
-   
- ********************************************************************/
-void set_depth(int nx, int ny, const double *xbnd, const double *ybnd, double alat1, double slon1, double elon1, double alat2,
-                      double slon2, double elon2, double depth_in, double *depth)
-{
-  double rdj, d;
-  int i, j, i1, i2, j1, j2, is, ie, js, je, is1, ie1, is2, ie2;
-  
-  j1 = nearest_index(alat1, ybnd, ny );
-  j2 = nearest_index(alat2, ybnd, ny );
-  js = min(j1,j2);
-  je = max(j1,j2);
-
-  i1  = nearest_index(slon1, xbnd, nx);
-  i2  = nearest_index(elon1, xbnd, nx);
-  is1 = min(i1,i2);
-  ie1 = max(i1,i2);
-
-  i1  = nearest_index(slon2, xbnd, nx );
-  i2  = nearest_index(elon2, xbnd, ny );
-  is2 = min(i1,i2);
-  ie2 = max(i1,i2);
-
-  is = is1;
-  ie = ie1;
-
-  // fill in the area bounded by (js,is1), (js,ie1), (je,is2), (je,ie2)
-  // the nudging of 1.e-5 is to insure that the test case resolution
-  // generates the same topography and geometry on various computers.
-
-  if (js == je) 
-    rdj = 1.0;
-  else
-    rdj = 1.0/(je-js);
-
-  for(j=js;j<=je;j++){
-    for(i=is;i<=ie;i++) depth[j*nx+i] = depth_in;
-    d = rdj*((j-js)*is2 + (je-j)*is1) + 1.0e-5;
-    is = ceil(d);
-    if( is - d > 0.5) is = is -1;
-    d = rdj*((j-js)*ie2 + (je-j)*ie1) + 1.0e-5;
-    ie = ceil(d);
-    if( ie - d > 0.5) ie = ie -1;
-  }
-
-}; /* set_depth */
-
-/*********************************************************************
-   void create_realistic_topog( )
-   reading data from source data file topog_file and remap it onto current grid
- ********************************************************************/
-void create_realistic_topog(int nx_dst, int ny_dst, const double *x_dst, const double *y_dst,
-			    const char* topog_file, const char* topog_field, double scale_factor,
-			    double fill_first_row, int filter_topog, int num_filter_pass,
-			    int smooth_topo_allow_deepening, int round_shallow, int fill_shallow,
-			    int deepen_shallow, double min_depth, double *depth )
-{
-  char xname[128], yname[128];
-  int nx_src, ny_src, nxp_src, nyp_src, i, j, count, n;
-  double *depth_src, *mask_src, *xt_src, *yt_src, *x_src, *y_src;
-  double *x_out, *y_out;
-  double missing;
-  int fid, vid;
-  
-  /* first read source topography data to get source grid and source topography */
-  fid = mpp_open(topog_file, MPP_READ);
-  vid = mpp_get_varid(fid, topog_field);
-  mpp_get_var_dimname(fid, vid, 1, xname);
-  mpp_get_var_dimname(fid, vid, 0, yname);
-  nx_src = mpp_get_dimlen( fid, xname );
-  ny_src = mpp_get_dimlen( fid, yname );
-  nxp_src = nx_src + 1;
-  nyp_src = ny_src + 1;
-  depth_src = (double *)malloc(nx_src*ny_src*sizeof(double));
-  mask_src = (double *)malloc(nx_src*ny_src*sizeof(double));
-  xt_src    = (double *)malloc(nx_src*sizeof(double));
-  yt_src    = (double *)malloc(ny_src*sizeof(double));
-  x_src    = (double *)malloc(nxp_src*nyp_src*sizeof(double)); 
-  y_src    = (double *)malloc(nxp_src*nyp_src*sizeof(double));
-
-  mpp_get_var_att(fid, vid, "missing_value", &missing);
-  mpp_get_var_value(fid, vid, depth_src);
-  vid = mpp_get_varid(fid, xname);
-  mpp_get_var_value(fid, vid, xt_src);
-  vid = mpp_get_varid(fid, yname);
-  mpp_get_var_value(fid, vid, yt_src);
-  mpp_close(fid);
-  
-  for(j=0; j<nyp_src; j++) {
-     for(i=1; i<nx_src; i++) x_src[j*nxp_src+i] = (xt_src[i-1] + xt_src[i])*0.5;
-     x_src[j*nxp_src] = 2*xt_src[0] - x_src[j*nxp_src+1];
-     x_src[j*nxp_src+nx_src] = 2*xt_src[nx_src-1] - x_src[j*nxp_src+nx_src-1];
-  }
-  for(i=0; i<nxp_src; i++) {
-    for(j=1; j<ny_src; j++) y_src[j*nxp_src+i] = (yt_src[j-1] + yt_src[j])*0.5;
-    y_src[i] = 2*yt_src[0] - y_src[nxp_src+i];
-    y_src[ny_src*nxp_src+i] = 2*yt_src[ny_src-1] - y_src[(ny_src-1)*nxp_src+i];
-  }
-    
-
-  for(i=0; i<nx_src*ny_src; i++) {
-    if(depth_src[i] == missing)
-      mask_src[i] = 0.0;
-    else {
-      depth_src[i] = depth_src[i]*scale_factor;
-      if( depth_src[i] <= 0.0)
-	mask_src[i] = 0.0;
-      else
-	mask_src[i] = 1.0;
-    }
-  }
-
-  /* scale grid to radius */
-  for(i=0; i<nxp_src*nyp_src; i++) {
-    x_src[i] = x_src[i]*D2R;
-    y_src[i] = y_src[i]*D2R;
-  }
-  x_out = (double *)malloc((nx_dst+1)*(ny_dst+1)*sizeof(double));
-  y_out = (double *)malloc((nx_dst+1)*(ny_dst+1)*sizeof(double));
-  for(i=0; i<(nx_dst+1)*(ny_dst+1); i++) {
-    x_out[i] = x_dst[i]*D2R;
-    y_out[i] = y_dst[i]*D2R;
-  }
-  
-  /* doing the conservative interpolation */
-  conserve_interp(nx_src, ny_src, nx_dst, ny_dst, x_src, y_src, x_out, y_out,
-		  mask_src, depth_src, depth );
-  
-  /* make first row of ocean model all land points for ice model */
-
-  if(fill_first_row) {
-    for(i=0;i<nx_dst;i++) {
-      depth[i] = 0.0;
-    }
-  }
-
-  if (filter_topog) filter_topo(nx_dst, ny_dst, num_filter_pass, smooth_topo_allow_deepening, depth);
-  /* enforce minimum depth when one of round_shallow, deepen_shallow or fill_shallow
-     is true ( At most one ).         */
-  count = 0;
-  if(round_shallow) count++;
-  if(fill_shallow) count++;
-  if(deepen_shallow) count++;
-  if(count > 1) mpp_error("topog: at most one of round_shallow/deepen_shallow/fill_shallow can be set to true");
-     
-  if(count>0) enforce_min_depth(nx_dst, ny_dst, round_shallow, deepen_shallow, fill_shallow,
-				min_depth, depth);
-
-  free(depth_src);
-  free(mask_src);
-  free(x_src);
-  free(y_src);
-  free(xt_src);
-  free(yt_src);
-  free(x_out);
-  free(y_out);
-  
-}; /* create_realistic_topog */
-
-
-/*********************************************************************
-
-    void filter_topo( int nx, int ny, int num_pass, double *depth)
-
-       smooth topographic depth "d" with "num_pass" applications of a 2D
-       version of a shapiro filter (weights = 1/4, 1/2, 1/4) . 
-       allow filtering to decrease the bottom depth but not increase it.
-       do not allow original geometry to change.
-       note: depth "d" should be on a grid of uniformly constant spacing
-
-********************************************************************/
-void filter_topo( int nx, int ny, int num_pass, int smooth_topo_allow_deepening, double *depth)
-{
-  double *rmask, *s;  
-  double f[9], d_old;
-  int n1, n2, i, j, n, m, ip, jp;
-  size_t *dims;
-  
-  rmask = (double *)malloc(nx*ny*sizeof(double));
-  s     = (double *)malloc(nx*ny*sizeof(double));
-
-  /* 2D symmetric filter weights */
-
-  f[0] = 1.0/16.0;
-  f[1] = 1.0/8.0;
-  f[2] = 1.0/16.0;
-  f[3] = 1.0/8.0;
-  f[4] = 1.0/4.0;
-  f[5] = 1.0/8.0;
-  f[6] = 1.0/16.0;
-  f[7] = 1.0/8.0;
-  f[8] = 1.0/16.0;
-  
-  /* geometry mask */
-  for(i=0; i<nx*ny; i++) {
-    if(depth[i] == 0.0)
-      rmask[i] = 0.0;
-    else
-      rmask[i] = 1.0;
-  }
-
-  for(n=1;n<=num_pass;n++) {
-    for(j=1;j<ny-1;j++) {
-      for(i=1;i<nx-1;i++) {
-	s[j*nx+i] = 0.0;
-	d_old = depth[j*nx+i];
-	for(ip=-1;ip<=1;ip++) {
-	  for(jp=-1;jp<=1;jp++) {
-	    m = (ip+1)*3 + jp+1;
-	    if (rmask[(j+jp)*nx+i+ip] == 0.0) 
-	      s[j*nx+i] = s[j*nx+i] + depth[j*nx+i]*f[m];
-            else
-	      s[j*nx+i] = s[j*nx+i] + depth[(j+jp)*nx+i+ip]*f[m];
-	  }
-	}
-	if (! smooth_topo_allow_deepening) {
-	  if (s[j*nx+i] > d_old)  s[j*nx+i] = d_old;
-	}
-	s[j*nx+i] = s[j*nx+i]*rmask[j*nx+i];
-      }
-    }
-    for(i=0; i<nx*ny; i++) depth[i] = s[i];
-  }
-  
-}; /* filter_topog */
-
-/*********************************************************************
-  void enforce_min_depth()
-  ! limit the minimum value of depth, depth should be >= min_depth. 
- ********************************************************************/
-void enforce_min_depth(int nx, int ny, int round_shallow, int deepen_shallow,
-			   int fill_shallow, double min_depth, double *depth)
-{
-  int i, j, n, l;
-  
-  if(mpp_pe() == mpp_root_pe() ) printf(" Enforcing the minimum topography depth to be %f\n",min_depth);
-
-  n = 0;
-  if(round_shallow) {    
-    for(j=0;j<ny;j++){
-      for(i=0;i<nx;i++){
-	l = j*nx+i;
-	if (depth[l] != 0 && depth[l] < min_depth) {
-	  n = n + 1;
-	  if ( depth[l] < 0.5*min_depth) {
-	    printf("Making location i,j,depth= %d,%d,%f to land.\n",i, j, depth[l]);
-	    depth[l] = 0.0;
-	  }
-	  else {
-	    printf("Setting location i,j,depth= %d,%d,%f to minimum ocean depth.\n",i,j, depth[l]);
-	    depth[l] = min_depth;
-	  }
-	}
-      }
-    }
-  }
-  else if (fill_shallow) {
-    for(j=0;j<ny;j++){
-      for(i=0;i<nx;i++){
-	l = j*nx+i;
-	if (depth[l] != 0 && depth[l] < min_depth) {
-	  n = n + 1;
-	  printf("Making location i,j,depth= %d,%d,%f to land.\n",i, j, depth[l]);
-	  depth[l] = 0.0;
-	}
-      }
-    }
-  }
-  else if (deepen_shallow) {
-    for(j=0;j<ny;j++){
-      for(i=0;i<nx;i++){
-	l = j*nx+i;
-	if (depth[l] != 0 && depth[l] < min_depth) {
-	  n = n + 1;
-	  printf("Setting location i,j,depth= %d,%d,%f to minimum ocean depth.\n",i,j, depth[l]);
-	  depth[l] = min_depth;
-	}
-      }
-    }
-  }
-
-}; /* enforce_min_depth */
diff --git a/gridspec/tools/shared/topog.h b/gridspec/tools/shared/topog.h
deleted file mode 100644
index 291710c..0000000
--- a/gridspec/tools/shared/topog.h
+++ /dev/null
@@ -1,14 +0,0 @@
-void create_rectangular_topog(int nx, int ny, double basin_depth, double *depth);
-void create_bowl_topog(int nx, int ny, const double *x, const double *y, double bottom_depth,
-		       double min_depth, double bowl_east, double bowl_south, double bowl_west,
-		       double bowl_north, double *depth);
-void create_gaussian_topog(int nx, int ny, const double *x, const double *y, double bottom_depth,
-			   double min_depth, double gauss_amp, double gauss_scale, double slope_x,
-			   double slope_y, double *depth);
-void create_idealized_topog( int nx, int ny, const double *x, const double *y,
-			     double bottom_depth, double min_depth, double *depth);
-void create_realistic_topog(int nx_dst, int ny_dst, const double *x_dst, const double *y_dst,
-			    const char* topog_file, const char* topog_field, double scale_factor,
-			    double fill_first_row, int filter_topog, int num_filter_pass,
-			    int smooth_topo_allow_deepening, int round_shallow, int fill_shallow,
-			    int deepen_shallow, double min_depth, double *depth );
diff --git a/gridspec/tools/test.sh b/gridspec/tools/test.sh
deleted file mode 100755
index 2d330fc..0000000
--- a/gridspec/tools/test.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/sh -f
-
-set -e
-echo ""
-echo "*** Testing gridspec grid commands."
-
-echo "*** make_vgrid will make a grid file with 30 grid cells..."
-../tools/make_vgrid/make_vgrid --nbnds 3 --bnds 10,200,1000 --nz 10,20
-
-echo "*** make a torus mosaic..."
-#../tools/make_hgrid/make_hgrid --grid_type regular_lonlat_grid --nxbnd 2 --nybnd 2 --xbnd 0,360 --ybnd -90,90 --nlon 160 --nlat 180 --grid_name torus_grid
-
-#../tools/make_mosaic/make_mosaic --num_tiles 1 --tile_file torus_grid.nc --periodx 360 --periody 180 --mosaic_name torus_mosaic
-
-echo "*** make a simple mosaic with four tiles..."
-
-#../tools/make_hgrid/make_hgrid --grid_type regular_lonlat_grid --nxbnd 2 --nybnd 2 --xbnd 0,360 --ybnd -90,90 --nlon 160 --nlat 180 --grid_name four_tile_grid --ndivx 2 --ndivy 2
-#../tools/make_mosaic/make_mosaic --num_tiles 4 --tile_file four_tile_grid --periodx 360 --mosaic_name four_tile_mosaic
-
-#echo "*** make a coupler mosaic with C48 atmosphere grid, N45 land grid and "
-#echo "    2 degree tripolar grid for ice and ocean model..."
-
-echo "*** make_hgrid and make_solo_mosaic C48 atmos grid..."
-../tools/make_hgrid/make_hgrid --grid_type gnomonic_ed --nlon 96 --grid_name C48_grid
-#../tools/make_mosaic/make_mosaic --num_tiles 6 --tile_file C48_grid --mosaic_name C48_mosaic 
-
-#echo "*** make_hgrid and make_solo_mosaic N45 land grid..."
-#../tools/make_hgrid/make_hgrid --grid_type regular_lonlat_grid --nxbnd 2 --nybnd 2 --xbnd 0,360 --ybnd -90,90 --nlon 288 --nlat 180 --grid_name N45_grid
-#../tools/make_mosaic/make_mosaic --num_tiles 1 --mosaic_name N45_mosaic --tile_file N45_grid.nc --periodx 360
-
-#echo "*** make_hgrid and make_solo_mosaic 2-degree tripolar.."
-#../tools/make_hgrid/make_hgrid --grid_type tripolar_grid --nxbnd 2 --nybnd 2 --xbnd -280,80 --ybnd -90,90 --nlon 360 --nlat 180 --grid_name tripolar_grid 
-#../tools/make_mosaic/make_mosaic --num_tiles 1 --mosaic_name tripolar_mosaic --tile_file tripolar_grid --periodx 360
-
-#echo "*** make_topog of tripolar grid..."
-#../tools/make_topog/make_topog --mosaic  tripolar_mosaic.nc --topog_file $indir/OCCAM_p5degree.nc --topog_field TOPO --scale_factor -1 --topog_mosaic tripolar_topog_mosaic
-
-#echo "*** make_coupler_mosaic..."
-#../tools/make_coupler_mosaic/make_coupler_mosaic --atmos_mosaic  $outdir/C48_mosaic.nc --land_mosaic  $outdir/N45_mosaic.nc --ice_mosaic  $outdir/tripolar_mosaic.nc --ice_topog_mosaic  $outdir/tripolar_topog_mosaic.nc 
-
-#echo "*** use fregrid to remap data from C48 onto N45 using first-order conservative interpolation..."
-#../tools/fregrid/fregrid --input_mosaic C48_mosaic.nc --input_dir $srcdir/../input --input_file 19800101.atmos_daily --scalar_field zsurf,temp,t_surf --output_mosaic N45_mosaic.nc --interp_method conserve_order2 --output_file 19800101.atmos_daily.N45.order1 --remap_file C48_to_N45_remap.order1.nc
-
-echo "*** All gridspec tests passed!"
-exit 0
diff --git a/gridspec/tools/test_all.sh b/gridspec/tools/test_all.sh
deleted file mode 100755
index 0534de1..0000000
--- a/gridspec/tools/test_all.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh 
-set -e
-
-#river_regrid
-# cd $river_regrid_outdir
-# $tooldir/river_regrid --mosaic $indir/M45/mosaic.nc --river_src $indir/z1l_river_output_M45_tripolar_aug24.nc --output river_data_M45
-
-# $tooldir/river_regrid --mosaic $indir/C48/mosaic.nc --river_src $indir/z1l_river_output_M45_tripolar_aug24.nc --output river_data_C48
-
-# #transfer_to_mosaic_grid
-# cd $transfer_outdir
-# $tooldir/transfer_to_mosaic_grid --input_file $indir/M45.tripolar.grid_spec.nc
-
-# cd $outdir
-
-# #make_vgrid will make a grid file with 60 supergrid cells.
-
-# $tooldir/make_vgrid --nbnds 3 --bnds 10,200,1000 --nz 10,20
-
-# #make_hgrid and make_solo_mosaic C48
-# $tooldir/make_hgrid --grid_type gnomonic_ed --nlon 96
-
-# $tooldir/make_solo_mosaic --num_tiles 6 --dir $PWD --mosaic C48_mosaic
-
-# #make_hgrid and make_solo_mosaic N45
-# $tooldir/make_hgrid --grid_type regular_lonlat_grid --nxbnd 2 --nybnd 2 --xbnd 0,360 --ybnd -90,90 --nlon 288 --nlat 180 --grid_name N45_grid
-# $tooldir/make_solo_mosaic --num_tiles 1 --dir $PWD --mosaic N45_mosaic --tile_file N45_grid.nc --periodx 360
-
-# #make_hgrid and make_solo_mosaic 2-degree tripolar
-# $tooldir/make_hgrid --grid_type tripolar_grid --nxbnd 2 --nybnd 2 --xbnd -280,80 --ybnd -90,90 --nlon 360 --nlat 180 --grid_name tripolar_grid 
-
-# $tooldir/make_solo_mosaic --num_tiles 1 --dir $PWD --mosaic tripolar_mosaic --tile_file tripolar_grid --periodx 360
-
-# #make_topog of tripolar grid
-# $tooldir/make_topog --mosaic  $outdir/tripolar_mosaic.nc --topog_file $indir/OCCAM_p5degree.nc --topog_field TOPO --scale_factor -1 --output tripolar_topog.nc
-
-# #make_coupler_mosaic
-# $tooldir/make_coupler_mosaic --atmos_mosaic  $outdir/C48_mosaic.nc --land_mosaic  $outdir/N45_mosaic.nc --ocean_mosaic  $outdir/tripolar_mosaic.nc --ocean_topog  $outdir/tripolar_topog.nc 
-
-# mpirun -np 10 $tooldir/make_topog_parallel --mosaic $outdir/tripolar_mosaic.nc --topog_file $indir/OCCAM_p5degree.nc --topog_field TOPO --scale_factor -1 --output tripolar_topog.nc
-
-# mpirun -np 10 $tooldir/make_coupler_mosaic_parallel --atmos_mosaic $outdir/C48_mosaic.nc --land_mosaic $outdir/N45_mosaic.nc --ocean_mosaic $outdir/tripolar_mosaic.nc --ocean_topog $outdir/tripolar_topog.nc 
-
-# #compare data
-# foreach ncfile (`ls *.nc`)
-#   nccmp -md $ncfile ../$ncfile
-# end
diff --git a/gridspec_api/Makefile.am b/gridspec_api/Makefile.am
new file mode 100644
index 0000000..58461b5
--- /dev/null
+++ b/gridspec_api/Makefile.am
@@ -0,0 +1,8 @@
+# $Id: Makefile.am 780 2011-07-01 00:45:51Z edhartnett $
+
+SUBDIRS = global axis coord grid data regrid mosaic host
+
+EXTRADIST = nccf_generate_strerror.py
+
+include_HEADERS = libcf_gridspec.h
+
diff --git a/gridspec/Makefile.in b/gridspec_api/Makefile.in
similarity index 82%
rename from gridspec/Makefile.in
rename to gridspec_api/Makefile.in
index 1051cd5..95118dc 100644
--- a/gridspec/Makefile.in
+++ b/gridspec_api/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,12 +15,8 @@
 
 @SET_MAKE@
 
-# This is an automake file, part of libcf, a NetCDF CF Library
-# package. Libcf is developed by Ed Hartnett at Unidata, copyright
-# 2009; GRIDSPEC code is developed by Zhi Liang, GFDL, copyright 2008.
-# See the COPYRIGHT file for more information.
+# $Id: Makefile.am 780 2011-07-01 00:45:51Z edhartnett $
 
-# $Id: Makefile.am,v 1.2 2009/11/21 12:58:06 ed Exp $
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -40,8 +36,9 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = gridspec
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+subdir = gridspec_api
+DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -50,7 +47,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
+CONFIG_HEADER = $(top_builddir)/cf_config.h \
+	$(top_builddir)/nfconfig.inc
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 SOURCES =
@@ -62,6 +60,29 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
+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__installdirs = "$(DESTDIR)$(includedir)"
+HEADERS = $(include_HEADERS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
 AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@@ -100,7 +121,6 @@ ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
 AR = @AR@
-AS = @AS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -121,15 +141,19 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-F77 = @F77@
 FC = @FC@
 FCFLAGS = @FCFLAGS@
 FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
+FCLIBS = @FCLIBS@
 FGREP = @FGREP@
 GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
+HAVE_DARWIN = @HAVE_DARWIN@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_LAPACK_LIB = @HAVE_LAPACK_LIB@
+HAVE_LAPACK_NO_UNDERSCORE = @HAVE_LAPACK_NO_UNDERSCORE@
+HAVE_LAPACK_UNDERSCORE = @HAVE_LAPACK_UNDERSCORE@
+HAVE_SHARED = @HAVE_SHARED@
+HAVE_UUID = @HAVE_UUID@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -144,8 +168,10 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 MOD_FLAG = @MOD_FLAG@
+NCDUMP = @NCDUMP@
 NCDUMPDIR = @NCDUMPDIR@
 NETCDFDIR = @NETCDFDIR@
 NM = @NM@
@@ -159,23 +185,23 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
 VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
 ac_ct_FC = @ac_ct_FC@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -207,7 +233,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -223,7 +248,9 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-SUBDIRS = shared tools
+SUBDIRS = global axis coord grid data regrid mosaic host
+EXTRADIST = nccf_generate_strerror.py
+include_HEADERS = libcf_gridspec.h
 all: all-recursive
 
 .SUFFIXES:
@@ -236,9 +263,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec_api/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign gridspec/Makefile
+	  $(AUTOMAKE) --foreign gridspec_api/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -263,6 +290,26 @@ mostlyclean-libtool:
 
 clean-libtool:
 	-rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	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|^.*/||'`; \
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(includedir)" && rm -f $$files
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -271,7 +318,7 @@ clean-libtool:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -296,7 +343,7 @@ $(RECURSIVE_TARGETS):
 	fi; test -z "$$fail"
 
 $(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -459,9 +506,12 @@ distdir: $(DISTFILES)
 	done
 check-am: all-am
 check: check-recursive
-all-am: Makefile
+all-am: Makefile $(HEADERS)
 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
@@ -507,7 +557,7 @@ info: info-recursive
 
 info-am:
 
-install-data-am:
+install-data-am: install-includeHEADERS
 
 install-dvi: install-dvi-recursive
 
@@ -551,7 +601,7 @@ ps: ps-recursive
 
 ps-am:
 
-uninstall-am:
+uninstall-am: uninstall-includeHEADERS
 
 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
 	install-am install-strip tags-recursive
@@ -562,13 +612,14 @@ uninstall-am:
 	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 \
+	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 \
+	installdirs installdirs-am maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-generic \
 	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
-	uninstall uninstall-am
+	uninstall uninstall-am uninstall-includeHEADERS
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/gridspec_api/axis/Makefile.am b/gridspec_api/axis/Makefile.am
new file mode 100644
index 0000000..553307c
--- /dev/null
+++ b/gridspec_api/axis/Makefile.am
@@ -0,0 +1,28 @@
+#
+# $Id: Makefile.am 779 2011-06-30 20:37:50Z edhartnett $
+#
+
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include	\
+-I$(top_srcdir)/src
+
+include_HEADERS = nccf_axis.h
+
+noinst_LTLIBRARIES = libnccf_axis.la
+libnccf_axis_la_SOURCES = nccf_def_axis.c nccf_put_axis.c           \
+nccf_free_axis.c nccf_def_axis_from_file.c nccf_inq_axis_len.c      \
+nccf_add_axis_att.c nccf_inq_axis_datatype.c nccf_inq_axis_name.c   \
+nccf_get_axis_datapointer.c
+
+INTLIBS = libnccf_axis.la ../../src/libcf_src.la
+
+EXTLIBS = -lnetcdf
+
+check_PROGRAMS = tst_axis
+
+TESTS = $(check_PROGRAMS)
+
+tst_axis_SOURCES = tst_axis.c
+tst_axis_LDADD = $(INTLIBS) $(EXTLIBS)
+
+# files generated by tests
+CLEANFILES = tst_*.nc
diff --git a/gridspec/tools/make_hgrid/Makefile.in b/gridspec_api/axis/Makefile.in
similarity index 70%
copy from gridspec/tools/make_hgrid/Makefile.in
copy to gridspec_api/axis/Makefile.in
index bc1e628..ebfe2b7 100644
--- a/gridspec/tools/make_hgrid/Makefile.in
+++ b/gridspec_api/axis/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,10 +15,10 @@
 
 @SET_MAKE@
 
-# This automake file is in charge of building the gridspec make_hgrid
-# tools.
+#
+# $Id: Makefile.am 779 2011-06-30 20:37:50Z edhartnett $
+#
 
-# $Id: Makefile.am,v 1.4 2009/11/16 14:14:02 zhi Exp $
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
@@ -39,37 +39,10 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-bin_PROGRAMS = make_hgrid$(EXEEXT)
- at USE_NETCDF_DIR_TRUE@am__append_1 = -I at NETCDFDIR@/include
- at USE_NETCDF_DIR_TRUE@am__append_2 = -L at NETCDFDIR@/lib
- at USE_NETCDF_DIR_TRUE@am__append_3 = -lnetcdf
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_4 = ../../../../libsrc4/libnetcdf.la 
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_5 = -I$(top_srcdir)/../libsrc4
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_6 = -L../../../../libsrc4
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_7 = ../../../../libsrc/libnetcdf.la 
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_8 = -I$(top_srcdir)/../libsrc
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_9 = -L../../../../libsrc
- at USE_NETCDF4_TRUE@am__append_10 = -lhdf5_hl -lhdf5 -lz 
- at USE_HDF4_TRUE@am__append_11 = -lmfhdf -ldf -ljpeg
-
-# If the user specified a root for HDF5, use it.
- at USE_HDF5_DIR_TRUE@am__append_12 = -I at HDF5DIR@/include
- at USE_HDF5_DIR_TRUE@am__append_13 = -L at HDF5DIR@/lib
-
-# If the user specified a prefix for the HDF4 library location, use it.
- at USE_HDF4_DIR_TRUE@am__append_14 = -I at HDF4DIR@/include
- at USE_HDF4_DIR_TRUE@am__append_15 = -L at HDF4DIR@/lib
-
-# If the user specified a root location for ZLIB, use it.
- at USE_ZLIB_DIR_TRUE@am__append_16 = -I at ZLIBDIR@/include
- at USE_ZLIB_DIR_TRUE@am__append_17 = -L at ZLIBDIR@/lib
-
-# If the user specified a root location for SZLIB, use it.
- at USE_SZLIB_DIR_TRUE@am__append_18 = -I at SZLIBDIR@/include
- at USE_SZLIB_DIR_TRUE@am__append_19 = -L at SZLIBDIR@/lib
-subdir = gridspec/tools/make_hgrid
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
-	$(srcdir)/run_tests.in
+check_PROGRAMS = tst_axis$(EXEEXT)
+subdir = gridspec_api/axis
+DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -78,17 +51,22 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
-CONFIG_CLEAN_FILES = run_tests
+CONFIG_HEADER = $(top_builddir)/cf_config.h \
+	$(top_builddir)/nfconfig.inc
+CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = "$(DESTDIR)$(bindir)"
-PROGRAMS = $(bin_PROGRAMS)
-am_make_hgrid_OBJECTS = make_hgrid.$(OBJEXT)
-make_hgrid_OBJECTS = $(am_make_hgrid_OBJECTS)
-make_hgrid_LDADD = $(LDADD)
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libnccf_axis_la_LIBADD =
+am_libnccf_axis_la_OBJECTS = nccf_def_axis.lo nccf_put_axis.lo \
+	nccf_free_axis.lo nccf_def_axis_from_file.lo \
+	nccf_inq_axis_len.lo nccf_add_axis_att.lo \
+	nccf_inq_axis_datatype.lo nccf_inq_axis_name.lo \
+	nccf_get_axis_datapointer.lo
+libnccf_axis_la_OBJECTS = $(am_libnccf_axis_la_OBJECTS)
+am_tst_axis_OBJECTS = tst_axis.$(OBJEXT)
+tst_axis_OBJECTS = $(am_tst_axis_OBJECTS)
 am__DEPENDENCIES_1 =
-make_hgrid_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__append_4) \
-	$(am__append_7) $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+tst_axis_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -102,8 +80,31 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(make_hgrid_SOURCES)
-DIST_SOURCES = $(make_hgrid_SOURCES)
+SOURCES = $(libnccf_axis_la_SOURCES) $(tst_axis_SOURCES)
+DIST_SOURCES = $(libnccf_axis_la_SOURCES) $(tst_axis_SOURCES)
+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__installdirs = "$(DESTDIR)$(includedir)"
+HEADERS = $(include_HEADERS)
 ETAGS = etags
 CTAGS = ctags
 am__tty_colors = \
@@ -113,7 +114,6 @@ ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
 AR = @AR@
-AS = @AS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -134,15 +134,19 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-F77 = @F77@
 FC = @FC@
 FCFLAGS = @FCFLAGS@
 FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
+FCLIBS = @FCLIBS@
 FGREP = @FGREP@
 GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
+HAVE_DARWIN = @HAVE_DARWIN@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_LAPACK_LIB = @HAVE_LAPACK_LIB@
+HAVE_LAPACK_NO_UNDERSCORE = @HAVE_LAPACK_NO_UNDERSCORE@
+HAVE_LAPACK_UNDERSCORE = @HAVE_LAPACK_UNDERSCORE@
+HAVE_SHARED = @HAVE_SHARED@
+HAVE_UUID = @HAVE_UUID@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -157,8 +161,10 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 MOD_FLAG = @MOD_FLAG@
+NCDUMP = @NCDUMP@
 NCDUMPDIR = @NCDUMPDIR@
 NETCDFDIR = @NETCDFDIR@
 NM = @NM@
@@ -172,23 +178,23 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
 VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
 ac_ct_FC = @ac_ct_FC@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -220,7 +226,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -236,25 +241,24 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-make_hgrid_SOURCES = make_hgrid.c
-
-# Initalize these.
-AM_CPPFLAGS = -I../shared -I$(top_srcdir)/gridspec/tools/shared \
-	-I../../shared/mosaic -I$(top_srcdir)/gridspec/shared/mosaic \
-	$(am__append_1) $(am__append_5) $(am__append_8) \
-	$(am__append_12) $(am__append_14) $(am__append_16) \
-	$(am__append_18)
-AM_LDFLAGS = -L../shared -L../../shared/mosaic $(am__append_2) \
-	$(am__append_6) $(am__append_9) $(am__append_13) \
-	$(am__append_15) $(am__append_17) $(am__append_19)
-LDADD = -ltoolsshared -lshared -lm $(am__append_3) $(am__append_4) \
-	$(am__append_7) $(am__append_10) $(am__append_11)
-TESTS = run_tests
-EXTRA_DIST = run_tests.in
-CLEANFILES = horizontal_grid.nc gs_horizontal_grid.nc	\
-horizontal_grid.cdl gs_horizontal_grid.cdl
-
-DISTCLEANFILES = run_tests
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include	\
+-I$(top_srcdir)/src
+
+include_HEADERS = nccf_axis.h
+noinst_LTLIBRARIES = libnccf_axis.la
+libnccf_axis_la_SOURCES = nccf_def_axis.c nccf_put_axis.c           \
+nccf_free_axis.c nccf_def_axis_from_file.c nccf_inq_axis_len.c      \
+nccf_add_axis_att.c nccf_inq_axis_datatype.c nccf_inq_axis_name.c   \
+nccf_get_axis_datapointer.c
+
+INTLIBS = libnccf_axis.la ../../src/libcf_src.la
+EXTLIBS = -lnetcdf
+TESTS = $(check_PROGRAMS)
+tst_axis_SOURCES = tst_axis.c
+tst_axis_LDADD = $(INTLIBS) $(EXTLIBS)
+
+# files generated by tests
+CLEANFILES = tst_*.nc
 all: all-am
 
 .SUFFIXES:
@@ -268,9 +272,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec/tools/make_hgrid/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec_api/axis/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign gridspec/tools/make_hgrid/Makefile
+	  $(AUTOMAKE) --foreign gridspec_api/axis/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -289,54 +293,29 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-run_tests: $(top_builddir)/config.status $(srcdir)/run_tests.in
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-install-binPROGRAMS: $(bin_PROGRAMS)
-	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	for p in $$list; do echo "$$p $$p"; done | \
-	sed 's/$(EXEEXT)$$//' | \
-	while read p p1; do if test -f $$p || test -f $$p1; \
-	  then echo "$$p"; echo "$$p"; else :; fi; \
-	done | \
-	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
-	sed 'N;N;N;s,\n, ,g' | \
-	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
-	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
-	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
-	    else { print "f", $$3 "/" $$4, $$1; } } \
-	  END { for (d in files) print "f", d, files[d] }' | \
-	while read type dir files; do \
-	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
-	    test -z "$$files" || { \
-	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
-	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
-	    } \
-	; done
-
-uninstall-binPROGRAMS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	files=`for p in $$list; do echo "$$p"; done | \
-	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-	      -e 's/$$/$(EXEEXT)/' `; \
-	test -n "$$list" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(bindir)" && rm -f $$files
-
-clean-binPROGRAMS:
-	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libnccf_axis.la: $(libnccf_axis_la_OBJECTS) $(libnccf_axis_la_DEPENDENCIES) 
+	$(LINK)  $(libnccf_axis_la_OBJECTS) $(libnccf_axis_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
-make_hgrid$(EXEEXT): $(make_hgrid_OBJECTS) $(make_hgrid_DEPENDENCIES) 
-	@rm -f make_hgrid$(EXEEXT)
-	$(LINK) $(make_hgrid_OBJECTS) $(make_hgrid_LDADD) $(LIBS)
+tst_axis$(EXEEXT): $(tst_axis_OBJECTS) $(tst_axis_DEPENDENCIES) 
+	@rm -f tst_axis$(EXEEXT)
+	$(LINK) $(tst_axis_OBJECTS) $(tst_axis_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -344,7 +323,16 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/make_hgrid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_add_axis_att.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_axis.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_axis_from_file.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_free_axis.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_get_axis_datapointer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_axis_datatype.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_axis_len.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_axis_name.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_put_axis.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_axis.Po at am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -375,6 +363,26 @@ mostlyclean-libtool:
 
 clean-libtool:
 	-rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	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|^.*/||'`; \
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(includedir)" && rm -f $$files
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -551,11 +559,12 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
-all-am: Makefile $(PROGRAMS)
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
 installdirs:
-	for dir in "$(DESTDIR)$(bindir)"; do \
+	for dir in "$(DESTDIR)$(includedir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-am
@@ -580,14 +589,14 @@ 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-am
 
-clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -607,13 +616,13 @@ info: info-am
 
 info-am:
 
-install-data-am:
+install-data-am: install-includeHEADERS
 
 install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am: install-binPROGRAMS
+install-exec-am:
 
 install-html: install-html-am
 
@@ -653,23 +662,24 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-binPROGRAMS
+uninstall-am: uninstall-includeHEADERS
 
 .MAKE: check-am install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
-	clean-binPROGRAMS clean-generic clean-libtool ctags distclean \
-	distclean-compile distclean-generic distclean-libtool \
-	distclean-tags distdir dvi dvi-am html html-am info info-am \
-	install install-am install-binPROGRAMS 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 pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-binPROGRAMS
+	clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES ctags 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 \
+	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 pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am uninstall-includeHEADERS
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/gridspec_api/axis/nccf_add_axis_att.c b/gridspec_api/axis/nccf_add_axis_att.c
new file mode 100644
index 0000000..d1be34b
--- /dev/null
+++ b/gridspec_api/axis/nccf_add_axis_att.c
@@ -0,0 +1,28 @@
+/*
+ * $Id: nccf_add_axis_att.c 766 2011-06-06 21:18:56Z pletzer $
+ */
+
+#include "nccf_axis.h"
+#include <stdlib.h>
+#include <string.h>
+
+/**
+ * \ingroup gs_axis_grp
+ * Add attribute to axis.
+ *
+ * \param axisid axis ID
+ * \param name name of attribute
+ * \param value value of attribute
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_add_axis_att(int axisid, const char *name, const char *value) {
+
+  int status = NC_NOERR;
+  struct nccf_axis_type *self;
+  self = nccf_li_find(&CFLIST_AXIS, axisid);
+  nccf_varSetAttribText(&self->axisVar, name, value);
+
+  return status;
+}
diff --git a/gridspec_api/axis/nccf_axis.h b/gridspec_api/axis/nccf_axis.h
new file mode 100644
index 0000000..477f3b1
--- /dev/null
+++ b/gridspec_api/axis/nccf_axis.h
@@ -0,0 +1,75 @@
+/*
+ * API for axes.
+ *
+ * $Id: nccf_axis.h 834 2011-09-14 21:21:07Z pletzer $
+ */
+
+#ifndef _NCCF_AXIS_H
+#define _NCCF_AXIS_H
+
+#include <netcdf.h>
+#include <libcf_src.h>
+#include <cflistitem.h>
+#include <nccf_varObj.h>
+#include <nccf_handle_error.h>
+#include <nccf_constants.h>
+
+extern const int nccf_num_axis_types;
+extern const char* nccf_axis_type_name[];
+
+extern struct CFLISTITEM *CFLIST_AXIS;
+
+struct nccf_axis_type {
+
+  /* dimension length */
+  int len;
+
+  /* name of this coordinate, eg "lon" */
+  char *axis_name;
+
+  /* netcdf-like object */
+  struct nccf_var_obj *axisVar;
+
+  /* pointer to the data */
+  void *data;
+
+  /* type of data */
+  nc_type xtype;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int nccf_def_axis(const char *name, int len, nc_type xtype, 
+                  const void *data, const char *standard_name,
+                  const char *units, int cdm_axis_type, 
+                  const char *axis, int positive_up,  
+                  const char *formula_terms, int *axisid);
+
+int nccf_def_axis_from_file(const char *filename, const char *name,
+                            int *axisid);
+
+int nccf_free_axis(int axisid);
+
+int nccf_put_axis(int axisid, int ncid);
+
+int nccf_inq_axis_datatype(int axisid, nc_type *xtype);
+
+int nccf_inq_axis_name(int axisid, char *name);
+
+int nccf_inq_axis_len(int axisid, int *len);
+
+int nccf_add_axis_att(int axisid, const char *name, const char *value);
+
+int nccf_get_axis_datapointer(int axisid, void **datapp);
+                    
+/*!@}*/
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* _NCCF_AXIS_H */
+
diff --git a/gridspec_api/axis/nccf_def_axis.c b/gridspec_api/axis/nccf_def_axis.c
new file mode 100644
index 0000000..43f6d30
--- /dev/null
+++ b/gridspec_api/axis/nccf_def_axis.c
@@ -0,0 +1,155 @@
+/*
+ * $Id: nccf_def_axis.c 851 2011-11-08 14:37:20Z pletzer $
+ */
+
+#include "nccf_axis.h"
+#include <stdlib.h>
+#include <string.h>
+
+#include <nccf_handle_error.h>
+#include <nccf_varObj.h>
+
+struct CFLISTITEM *CFLIST_AXIS;
+
+const int nccf_num_axis_types = 13;
+const char* nccf_axis_type_name[] = {"", "Lat", "Lon", "GeoX", "GeoY", "GeoZ", 
+                                     "Height", "Height", "Pressure", "Time", 
+                                     "RadialAzimuth", "RadialElevation", 
+                                     "RadialDistance"};
+
+
+/** \defgroup gs_axis_grp Coordinate axes
+    \ingroup gridspec_grp
+
+Coordinate axes are one-dimensional objects with monotonically 
+increasing or decreasing values. The dimension of a coordinate 
+axis has the same name as the corresponding variable. 
+
+*/
+
+/**
+ * \ingroup gs_axis_grp
+ * Define a coordinate axis (constructor).
+ *
+ * \param name name of the object
+ * \param len number of elements
+ * \param xtype netCDF data type
+ * \param data pointer to the data
+ * \param standard_name CF standard_name (or NULL if empty)
+ * \param units CF units (or NULL if empty)
+ * \param cdm_axis_type one of NCCF_NOAXISTYPE, NCCF_LONGITUDE, NCCF_LATITUDE, NCCF_GEOX, NCCF_GEOY, NCCF_GEOZ, NCCF_PRESSURE, NCCF_HEIGHT_UP, NCCF_HEIGHT_DOWN, NCCF_TIME, NCCF_RADAZ, NCCF_RADEL, NCCF_RADDIST
+ * \param axis axis attribute (e.g. "X", "Y", "Z", or "T", or NULL)
+ * \param positive_up 1 if pointing up, 0 otherwise
+ * \param formula_terms optional attribute, can be NULL
+ * \param axisid object ID (output)
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer (Tech-X Corp.) and Ed Hartnett (UCAR).
+ */
+
+int nccf_def_axis(const char *name, int len, nc_type xtype, 
+                  const void *data, const char *standard_name,
+                  const char *units, int cdm_axis_type, 
+                  const char *axis, int positive_up,  
+                  const char *formula_terms, int *axisid) {
+
+  int i;  
+
+  /* allocate objet */
+  struct nccf_axis_type *self;
+  self = (struct nccf_axis_type *) malloc(sizeof(struct nccf_axis_type));
+  
+  /* default initialization */
+  self->axis_name = NULL;
+  self->len = 0;
+  self->axisVar = NULL;
+  self->data = NULL;
+  self->xtype = NC_NAT;
+
+  /* fill in object */
+
+  self->axis_name = strdup(name);
+  nccf_varCreate(&self->axisVar, name);
+  nccf_varSetDims(&self->axisVar, 1, &len, &name); // dim has same name as var
+  /* fill in attributes */
+  if (standard_name != NULL) {
+    nccf_varSetAttribText(&self->axisVar, CF_ATTNAME_STANDARD_NAME, 
+			  standard_name);
+  }
+  if (units != NULL) {
+    nccf_varSetAttribText(&self->axisVar, CF_ATTNAME_UNITS, 
+			  units);
+  }
+  if (cdm_axis_type)
+    {
+      /* Is the axis type valid? */
+      if (cdm_axis_type < 0 || cdm_axis_type > NCCF_RADDIST)
+        return NC_EINVAL;
+      nccf_varSetAttribText(&self->axisVar, COORDINATE_AXIS_TYPE, 
+                            nccf_axis_type_name[cdm_axis_type]);
+    }
+  if ( (axis && (strcmp(axis, "X") == 0)) || (strcmp(axis, "Y") == 0) || 
+      (strcmp(axis, "Z") == 0) || (strcmp(axis, "T") == 0) ) 
+    {
+      nccf_varSetAttribText(&self->axisVar, CF_AXIS, axis);
+    }
+  if (positive_up)
+    {
+      nccf_varSetAttribText(&self->axisVar, CF_POSITIVE, CF_UP);
+    }
+  else
+    {
+      nccf_varSetAttribText(&self->axisVar, CF_POSITIVE, CF_DOWN);
+    }
+  if (formula_terms)
+    {
+      nccf_varSetAttribText(&self->axisVar, CF_FORMULA_TERMS, formula_terms);
+    }
+
+   /* copy the data */
+  self->xtype = xtype;
+  self->len = len;
+  if (xtype == NC_DOUBLE) {
+    double *dDouble = (double *) malloc(len*sizeof(double));
+    double *d = (double *) data;
+    for (i = 0; i < len; ++i) {
+      dDouble[i] = d[i];
+    }
+    self->data = (void *) dDouble;
+  }
+  else if (xtype == NC_FLOAT) {
+    float *dFloat = (float *) malloc(len*sizeof(float));
+    float *d = (float *) data;
+    for (i = 0; i < len; ++i) {
+      dFloat[i] = d[i];
+    }
+    self->data = (void *) dFloat;
+  }
+  else if (xtype == NC_INT) {
+    int *dInt = (int *) malloc(len*sizeof(int));
+    int *d = (int *) data;
+    for (i = 0; i < len; ++i) {
+      dInt[i] = d[i];
+    }
+    self->data = (void *) dInt;
+  }
+  else if (xtype == NC_SHORT) {
+    short *dShort = (short *) malloc(len*sizeof(short));
+    short *d = (short *) data;
+    for (i = 0; i < len; ++i) {
+      dShort[i] = d[i];
+    }
+    self->data = (void *) dShort;
+  }
+  else {
+    return CF_EBADTYPE;
+  }
+  /* attach the pointer */
+  nccf_varSetDataPtr(&self->axisVar, xtype, self->data);
+
+  /* add object to list */
+  if (CFLIST_AXIS == NULL) nccf_li_new(&CFLIST_AXIS);
+  *axisid = nccf_li_add(&CFLIST_AXIS, self);
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/axis/nccf_def_axis_from_file.c b/gridspec_api/axis/nccf_def_axis_from_file.c
new file mode 100644
index 0000000..d257b0d
--- /dev/null
+++ b/gridspec_api/axis/nccf_def_axis_from_file.c
@@ -0,0 +1,93 @@
+/*
+ * $Id: nccf_def_axis_from_file.c 869 2011-11-29 20:12:54Z pletzer $
+ */
+
+#include "nccf_axis.h"
+#include <stdlib.h>
+#include <string.h>
+
+#include <nccf_handle_error.h>
+#include <nccf_varObj.h>
+
+/**
+ * \ingroup gs_axis_grp
+ * Define a coordinate axis from file (constructor).
+ *
+ * \param filename file name
+ * \param name name of the object
+ * \param axisid object ID (output)
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer (Tech-X Corp.) and Ed Hartnett (UCAR).
+ */
+
+int nccf_def_axis_from_file(const char *filename, const char *name,
+                            int *axisid) {
+
+  int totError = NC_NOERR;
+  int ncid, status = NC_NOERR;
+  struct nccf_var_obj *v;
+
+  // read the variable
+  status = nc_open(filename, NC_NOWRITE, &ncid);
+  if (status) return status;
+  totError += abs(status);
+  // note: data will be cast as doubles
+  nccf_varCreateFromFile(&v, name, ncid, 1, 1);
+  status = nc_close(ncid);
+  totError += abs(status);
+
+  // build the object
+  nc_type xtype = NC_NAT;
+  void *data = NULL;
+  int *dims;
+  const char *standard_name;
+  const char *units;
+  int positive_up = 1;
+  const char *axis = NULL;
+  const char *axis_type = NULL;
+  const char *axis_up = NULL;
+  const char *formula_terms = NULL;
+  
+  nccf_varGetDimsPtr(&v, &dims);
+
+  /* Read the rest of the variable */
+  nccf_varGetDataType(&v, &xtype);
+  nccf_varGetDataPtr(&v, &data);
+  nccf_varGetAttribPtr(&v, CF_ATTNAME_STANDARD_NAME, 
+		       (const void **) &standard_name);
+  nccf_varGetAttribPtr(&v, CF_ATTNAME_UNITS, 
+		       (const void **) &units);
+  nccf_varGetAttribPtr(&v, COORDINATE_AXIS_TYPE, 
+                       (const void **) &axis_type);
+  nccf_varGetAttribPtr(&v, CF_AXIS, 
+                       (const void **) &axis);
+  nccf_varGetAttribPtr(&v, CF_POSITIVE, 
+                       (const void **) &axis_up);
+  nccf_varGetAttribPtr(&v, CF_FORMULA_TERMS, 
+		       (const void **) &formula_terms);
+  
+  /* find axis type index */
+  int axis_index = 0;
+  while (axis_index < nccf_num_axis_types && 
+         strcmp(nccf_axis_type_name[axis_index],axis_type) != 0) {
+    axis_index++;
+  }
+  if (axis_index >= nccf_num_axis_types) {
+    // invalid axis type
+    return NC_EINVAL;
+  }
+  if (strcmp(axis_up, CF_DOWN) == 0) {
+    positive_up = 0;
+  }
+
+  status = nccf_def_axis(name, dims[0], xtype, data, standard_name,
+                         units, axis_index, axis, positive_up, 
+                         formula_terms, axisid);
+  totError += abs(status);
+
+  // clean up
+  nccf_varDestroy(&v);
+
+  return totError;
+}
diff --git a/gridspec_api/axis/nccf_free_axis.c b/gridspec_api/axis/nccf_free_axis.c
new file mode 100644
index 0000000..18f9a63
--- /dev/null
+++ b/gridspec_api/axis/nccf_free_axis.c
@@ -0,0 +1,41 @@
+/*
+ * $Id: nccf_free_axis.c 918 2012-02-07 22:10:36Z pletzer $
+ * */
+
+#include "nccf_axis.h"
+#include <stdlib.h>
+
+#include <netcdf.h>
+#include <nccf_varObj.h>
+
+/**
+ * \ingroup gs_axis_grp
+ * Free object (destructor).
+ *
+ * \param axisid coordinate ID
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer (Tech-X Corp.) and Ed Hartnett (UCAR).
+ */
+int nccf_free_axis(int axisid) {
+
+    struct nccf_axis_type *self;
+    self = nccf_li_remove(&CFLIST_AXIS, axisid);
+    if( nccf_li_get_nelem( &CFLIST_AXIS ) == 0 )
+        nccf_li_del( &CFLIST_AXIS );
+
+    /* free memory */
+    if (self->data) {
+      free(self->data);
+      self->data = NULL;
+    }
+    if (self->axis_name) {
+      free(self->axis_name);
+      self->axis_name = NULL;
+    }
+    nccf_varDestroy(&self->axisVar);
+    free(self);
+    self = NULL;
+
+    return NC_NOERR;
+}
diff --git a/gridspec_api/axis/nccf_get_axis_datapointer.c b/gridspec_api/axis/nccf_get_axis_datapointer.c
new file mode 100644
index 0000000..defc0a6
--- /dev/null
+++ b/gridspec_api/axis/nccf_get_axis_datapointer.c
@@ -0,0 +1,28 @@
+/*
+ * $Id: nccf_get_axis_datapointer.c 772 2011-06-13 15:00:28Z pletzer $
+ */
+
+#include "nccf_axis.h"
+#include <stdlib.h>
+#include <string.h>
+
+/**
+ * \ingroup gs_axis_grp
+ * Get the pointer to the axis data
+ *
+ * \param axisid axis ID
+ * \param data pointer to the axis values
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_get_axis_datapointer(int axisid, void **data) {
+
+  int status = NC_NOERR;
+  struct nccf_axis_type *self;
+  self = nccf_li_find(&CFLIST_AXIS, axisid);
+
+  *data = self->data;
+
+  return status;
+}
diff --git a/gridspec_api/axis/nccf_inq_axis_datatype.c b/gridspec_api/axis/nccf_inq_axis_datatype.c
new file mode 100644
index 0000000..4e01da7
--- /dev/null
+++ b/gridspec_api/axis/nccf_inq_axis_datatype.c
@@ -0,0 +1,28 @@
+/*
+ * $Id: nccf_inq_axis_datatype.c 772 2011-06-13 15:00:28Z pletzer $
+ */
+
+#include "nccf_axis.h"
+#include <stdlib.h>
+#include <string.h>
+
+/**
+ * \ingroup gs_axis_grp
+ * Inquire the axis data type.
+ *
+ * \param axisid axis ID
+ * \param xtype data type
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_axis_datatype(int axisid, nc_type *xtype) {
+
+  int status = NC_NOERR;
+  struct nccf_axis_type *self;
+  self = nccf_li_find(&CFLIST_AXIS, axisid);
+
+  *xtype = self->xtype;
+
+  return status;
+}
diff --git a/gridspec_api/axis/nccf_inq_axis_len.c b/gridspec_api/axis/nccf_inq_axis_len.c
new file mode 100644
index 0000000..f2fe244
--- /dev/null
+++ b/gridspec_api/axis/nccf_inq_axis_len.c
@@ -0,0 +1,28 @@
+/*
+ * $Id: nccf_inq_axis_len.c 766 2011-06-06 21:18:56Z pletzer $
+ */
+
+#include "nccf_axis.h"
+#include <stdlib.h>
+#include <string.h>
+
+/**
+ * \ingroup gs_axis_grp
+ * Inquire number of elements.
+ *
+ * \param axisid axis ID
+ * \param len number of elements 
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_axis_len(int axisid, int *len) {
+
+  int status = NC_NOERR;
+  struct nccf_axis_type *self;
+  self = nccf_li_find(&CFLIST_AXIS, axisid);
+
+  *len = self->len;
+
+  return status;
+}
diff --git a/gridspec_api/axis/nccf_inq_axis_name.c b/gridspec_api/axis/nccf_inq_axis_name.c
new file mode 100644
index 0000000..e69680e
--- /dev/null
+++ b/gridspec_api/axis/nccf_inq_axis_name.c
@@ -0,0 +1,30 @@
+/*
+ * $Id: nccf_inq_axis_name.c 772 2011-06-13 15:00:28Z pletzer $
+ */
+
+#include "nccf_axis.h"
+#include <stdlib.h>
+#include <string.h>
+
+/**
+ * \ingroup gs_axis_grp
+ * Inquire the name of the axis.
+ *
+ * \param axisid axis ID
+ * \param name name of object, also dimension name
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ * \note container name should be large enough the receive the 
+ *       name of the axis
+ */
+int nccf_inq_axis_name(int axisid, char *name) {
+
+  int status = NC_NOERR;
+  struct nccf_axis_type *self;
+  self = nccf_li_find(&CFLIST_AXIS, axisid);
+
+  strcpy(name, self->axis_name);
+
+  return status;
+}
diff --git a/gridspec_api/axis/nccf_put_axis.c b/gridspec_api/axis/nccf_put_axis.c
new file mode 100644
index 0000000..1164abf
--- /dev/null
+++ b/gridspec_api/axis/nccf_put_axis.c
@@ -0,0 +1,31 @@
+/*
+ * $Id: nccf_put_axis.c 767 2011-06-06 23:20:19Z pletzer $
+ */
+
+#include "nccf_axis.h"
+#include <stdlib.h>
+#include <string.h>
+
+#include <netcdf.h>
+
+/**
+ * \ingroup gs_axis_grp
+ * Write object to netcdf file.
+ *
+ * \param axisid axis ID
+ * \param ncid netcdf file ID
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_put_axis(int axisid, int ncid) {
+
+  int status = NC_NOERR;
+  struct nccf_axis_type *self;
+  self = nccf_li_find(&CFLIST_AXIS, axisid);
+
+  // Write data to file
+  status = nccf_writeListOfVars(ncid, 1, self->axisVar);
+
+  return status;
+}
diff --git a/gridspec_api/axis/tst_axis.c b/gridspec_api/axis/tst_axis.c
new file mode 100644
index 0000000..aa8677a
--- /dev/null
+++ b/gridspec_api/axis/tst_axis.c
@@ -0,0 +1,55 @@
+/*
+ * Test axis creation
+ * $Id: tst_axis.c 768 2011-06-07 03:32:37Z pletzer $
+ */
+
+#include <nccf_axis.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <netcdf.h>
+#include <nccf_handle_error.h>
+
+int main() {
+  int status, axisid, i, ncid, axisid2, ncid2;
+
+  const char standard_name[] = "longitude";
+  const char units[] = "degrees_east";
+  const int cdm_axis_type = NCCF_LONGITUDE;
+  const char axis[] = "X";
+  const int positive_up = 1;
+  const char *formula_terms = NULL;
+  
+  const int n = 11;
+  float *data = (float *) malloc(n * sizeof(float));
+  for (i = 0; i < n; ++i) {
+    data[i] = 0.0f + (360.0f/(float)(n - 1)) * (float)(i);
+  }
+
+  if ((status = nccf_def_axis("lon", n, NC_FLOAT, data, standard_name, 
+                              units, cdm_axis_type, axis, positive_up, 
+                              formula_terms, &axisid))) ERR;
+
+  if ((status = nccf_add_axis_att(axisid, "axis", "X"))) ERR;
+  
+
+  if ((status = nc_create("tst_axis.nc", NC_CLOBBER, &ncid))) ERR;
+  if ((status = nccf_put_axis(axisid, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+
+  if ((status = nccf_def_axis_from_file("tst_axis.nc", "lon", &axisid2))) ERR;
+
+  if ((status = nc_create("tst_axis2.nc", NC_CLOBBER, &ncid2))) ERR;
+  if ((status = nccf_put_axis(axisid2, ncid2))) ERR;
+  if ((status = nc_close(ncid2))) ERR;
+
+  /* checks */
+  int len, len2;
+  if ((status = nccf_inq_axis_len(axisid, &len))) ERR;
+  if ((status = nccf_inq_axis_len(axisid, &len2))) ERR;
+  assert(len == len2);
+
+  if ((status = nccf_free_axis(axisid))) ERR;
+  if ((status = nccf_free_axis(axisid2))) ERR;
+  free(data);
+  return 0;
+}
diff --git a/gridspec_api/coord/Makefile.am b/gridspec_api/coord/Makefile.am
new file mode 100644
index 0000000..4cb473b
--- /dev/null
+++ b/gridspec_api/coord/Makefile.am
@@ -0,0 +1,48 @@
+#
+# $Id: Makefile.am 775 2011-06-13 20:36:52Z pletzer $
+#
+
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include	\
+-I$(top_srcdir)/gridspec_api/axis
+
+include_HEADERS = nccf_coord.h
+
+noinst_LTLIBRARIES = libnccf_coord.la
+libnccf_coord_la_SOURCES = nccf_def_coord.c nccf_put_coord.c		\
+nccf_free_coord.c nccf_add_coord_att.c nccf_inq_coord_bound.c		\
+nccf_inq_coord_bound_slice.c nccf_get_coord_data_pointer.c		\
+nccf_inq_coord_ndims.c nccf_inq_coord_name.c nccf_inq_coord_units.c	\
+nccf_def_coord_from_file.c nccf_inq_coord_dims.c			\
+nccf_inq_coord_dimnames.c nccf_is_coord.c nccf_def_coord_from_axes.c
+
+INTLIBS =                   \
+libnccf_coord.la            \
+../axis/libnccf_axis.la     \
+../global/libnccf_global.la \
+../../src/libcf_src.la
+
+EXTLIBS = -lnetcdf
+
+noinst_PROGRAMS = tst_1d_boundary_slice
+
+check_PROGRAMS = tst_lon tst_lonlat tst_bound1 tst_lonlat_from_axes
+
+tst_lon_SOURCES = tst_lon.c
+tst_lon_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_lonlat_SOURCES = tst_lonlat.c
+tst_lonlat_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_lonlat_from_axes_SOURCES = tst_lonlat_from_axes.c
+tst_lonlat_from_axes_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_bound1_SOURCES = tst_bound1.c
+tst_bound1_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_1d_boundary_slice_SOURCES = tst_1d_boundary_slice.c
+tst_1d_boundary_slice_LDADD = $(INTLIBS) $(EXTLIBS)
+
+TESTS = $(check_PROGRAMS)
+
+# files generated by tests
+CLEANFILES = tst_lon.nc
diff --git a/gridspec/tools/make_hgrid/Makefile.in b/gridspec_api/coord/Makefile.in
similarity index 62%
rename from gridspec/tools/make_hgrid/Makefile.in
rename to gridspec_api/coord/Makefile.in
index bc1e628..2b2186a 100644
--- a/gridspec/tools/make_hgrid/Makefile.in
+++ b/gridspec_api/coord/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,10 +15,11 @@
 
 @SET_MAKE@
 
-# This automake file is in charge of building the gridspec make_hgrid
-# tools.
+#
+# $Id: Makefile.am 775 2011-06-13 20:36:52Z pletzer $
+#
+
 
-# $Id: Makefile.am,v 1.4 2009/11/16 14:14:02 zhi Exp $
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
@@ -39,37 +40,12 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-bin_PROGRAMS = make_hgrid$(EXEEXT)
- at USE_NETCDF_DIR_TRUE@am__append_1 = -I at NETCDFDIR@/include
- at USE_NETCDF_DIR_TRUE@am__append_2 = -L at NETCDFDIR@/lib
- at USE_NETCDF_DIR_TRUE@am__append_3 = -lnetcdf
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_4 = ../../../../libsrc4/libnetcdf.la 
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_5 = -I$(top_srcdir)/../libsrc4
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_6 = -L../../../../libsrc4
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_7 = ../../../../libsrc/libnetcdf.la 
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_8 = -I$(top_srcdir)/../libsrc
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_9 = -L../../../../libsrc
- at USE_NETCDF4_TRUE@am__append_10 = -lhdf5_hl -lhdf5 -lz 
- at USE_HDF4_TRUE@am__append_11 = -lmfhdf -ldf -ljpeg
-
-# If the user specified a root for HDF5, use it.
- at USE_HDF5_DIR_TRUE@am__append_12 = -I at HDF5DIR@/include
- at USE_HDF5_DIR_TRUE@am__append_13 = -L at HDF5DIR@/lib
-
-# If the user specified a prefix for the HDF4 library location, use it.
- at USE_HDF4_DIR_TRUE@am__append_14 = -I at HDF4DIR@/include
- at USE_HDF4_DIR_TRUE@am__append_15 = -L at HDF4DIR@/lib
-
-# If the user specified a root location for ZLIB, use it.
- at USE_ZLIB_DIR_TRUE@am__append_16 = -I at ZLIBDIR@/include
- at USE_ZLIB_DIR_TRUE@am__append_17 = -L at ZLIBDIR@/lib
-
-# If the user specified a root location for SZLIB, use it.
- at USE_SZLIB_DIR_TRUE@am__append_18 = -I at SZLIBDIR@/include
- at USE_SZLIB_DIR_TRUE@am__append_19 = -L at SZLIBDIR@/lib
-subdir = gridspec/tools/make_hgrid
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
-	$(srcdir)/run_tests.in
+noinst_PROGRAMS = tst_1d_boundary_slice$(EXEEXT)
+check_PROGRAMS = tst_lon$(EXEEXT) tst_lonlat$(EXEEXT) \
+	tst_bound1$(EXEEXT) tst_lonlat_from_axes$(EXEEXT)
+subdir = gridspec_api/coord
+DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -78,17 +54,38 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
-CONFIG_CLEAN_FILES = run_tests
+CONFIG_HEADER = $(top_builddir)/cf_config.h \
+	$(top_builddir)/nfconfig.inc
+CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = "$(DESTDIR)$(bindir)"
-PROGRAMS = $(bin_PROGRAMS)
-am_make_hgrid_OBJECTS = make_hgrid.$(OBJEXT)
-make_hgrid_OBJECTS = $(am_make_hgrid_OBJECTS)
-make_hgrid_LDADD = $(LDADD)
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libnccf_coord_la_LIBADD =
+am_libnccf_coord_la_OBJECTS = nccf_def_coord.lo nccf_put_coord.lo \
+	nccf_free_coord.lo nccf_add_coord_att.lo \
+	nccf_inq_coord_bound.lo nccf_inq_coord_bound_slice.lo \
+	nccf_get_coord_data_pointer.lo nccf_inq_coord_ndims.lo \
+	nccf_inq_coord_name.lo nccf_inq_coord_units.lo \
+	nccf_def_coord_from_file.lo nccf_inq_coord_dims.lo \
+	nccf_inq_coord_dimnames.lo nccf_is_coord.lo \
+	nccf_def_coord_from_axes.lo
+libnccf_coord_la_OBJECTS = $(am_libnccf_coord_la_OBJECTS)
+PROGRAMS = $(noinst_PROGRAMS)
+am_tst_1d_boundary_slice_OBJECTS = tst_1d_boundary_slice.$(OBJEXT)
+tst_1d_boundary_slice_OBJECTS = $(am_tst_1d_boundary_slice_OBJECTS)
 am__DEPENDENCIES_1 =
-make_hgrid_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__append_4) \
-	$(am__append_7) $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+tst_1d_boundary_slice_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_bound1_OBJECTS = tst_bound1.$(OBJEXT)
+tst_bound1_OBJECTS = $(am_tst_bound1_OBJECTS)
+tst_bound1_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_lon_OBJECTS = tst_lon.$(OBJEXT)
+tst_lon_OBJECTS = $(am_tst_lon_OBJECTS)
+tst_lon_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_lonlat_OBJECTS = tst_lonlat.$(OBJEXT)
+tst_lonlat_OBJECTS = $(am_tst_lonlat_OBJECTS)
+tst_lonlat_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_lonlat_from_axes_OBJECTS = tst_lonlat_from_axes.$(OBJEXT)
+tst_lonlat_from_axes_OBJECTS = $(am_tst_lonlat_from_axes_OBJECTS)
+tst_lonlat_from_axes_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -102,8 +99,36 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(make_hgrid_SOURCES)
-DIST_SOURCES = $(make_hgrid_SOURCES)
+SOURCES = $(libnccf_coord_la_SOURCES) $(tst_1d_boundary_slice_SOURCES) \
+	$(tst_bound1_SOURCES) $(tst_lon_SOURCES) $(tst_lonlat_SOURCES) \
+	$(tst_lonlat_from_axes_SOURCES)
+DIST_SOURCES = $(libnccf_coord_la_SOURCES) \
+	$(tst_1d_boundary_slice_SOURCES) $(tst_bound1_SOURCES) \
+	$(tst_lon_SOURCES) $(tst_lonlat_SOURCES) \
+	$(tst_lonlat_from_axes_SOURCES)
+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__installdirs = "$(DESTDIR)$(includedir)"
+HEADERS = $(include_HEADERS)
 ETAGS = etags
 CTAGS = ctags
 am__tty_colors = \
@@ -113,7 +138,6 @@ ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
 AR = @AR@
-AS = @AS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -134,15 +158,19 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-F77 = @F77@
 FC = @FC@
 FCFLAGS = @FCFLAGS@
 FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
+FCLIBS = @FCLIBS@
 FGREP = @FGREP@
 GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
+HAVE_DARWIN = @HAVE_DARWIN@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_LAPACK_LIB = @HAVE_LAPACK_LIB@
+HAVE_LAPACK_NO_UNDERSCORE = @HAVE_LAPACK_NO_UNDERSCORE@
+HAVE_LAPACK_UNDERSCORE = @HAVE_LAPACK_UNDERSCORE@
+HAVE_SHARED = @HAVE_SHARED@
+HAVE_UUID = @HAVE_UUID@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -157,8 +185,10 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 MOD_FLAG = @MOD_FLAG@
+NCDUMP = @NCDUMP@
 NCDUMPDIR = @NCDUMPDIR@
 NETCDFDIR = @NETCDFDIR@
 NM = @NM@
@@ -172,23 +202,23 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
 VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
 ac_ct_FC = @ac_ct_FC@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -220,7 +250,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -236,25 +265,39 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-make_hgrid_SOURCES = make_hgrid.c
-
-# Initalize these.
-AM_CPPFLAGS = -I../shared -I$(top_srcdir)/gridspec/tools/shared \
-	-I../../shared/mosaic -I$(top_srcdir)/gridspec/shared/mosaic \
-	$(am__append_1) $(am__append_5) $(am__append_8) \
-	$(am__append_12) $(am__append_14) $(am__append_16) \
-	$(am__append_18)
-AM_LDFLAGS = -L../shared -L../../shared/mosaic $(am__append_2) \
-	$(am__append_6) $(am__append_9) $(am__append_13) \
-	$(am__append_15) $(am__append_17) $(am__append_19)
-LDADD = -ltoolsshared -lshared -lm $(am__append_3) $(am__append_4) \
-	$(am__append_7) $(am__append_10) $(am__append_11)
-TESTS = run_tests
-EXTRA_DIST = run_tests.in
-CLEANFILES = horizontal_grid.nc gs_horizontal_grid.nc	\
-horizontal_grid.cdl gs_horizontal_grid.cdl
-
-DISTCLEANFILES = run_tests
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include	\
+-I$(top_srcdir)/gridspec_api/axis
+
+include_HEADERS = nccf_coord.h
+noinst_LTLIBRARIES = libnccf_coord.la
+libnccf_coord_la_SOURCES = nccf_def_coord.c nccf_put_coord.c		\
+nccf_free_coord.c nccf_add_coord_att.c nccf_inq_coord_bound.c		\
+nccf_inq_coord_bound_slice.c nccf_get_coord_data_pointer.c		\
+nccf_inq_coord_ndims.c nccf_inq_coord_name.c nccf_inq_coord_units.c	\
+nccf_def_coord_from_file.c nccf_inq_coord_dims.c			\
+nccf_inq_coord_dimnames.c nccf_is_coord.c nccf_def_coord_from_axes.c
+
+INTLIBS = \
+libnccf_coord.la            \
+../axis/libnccf_axis.la     \
+../global/libnccf_global.la \
+../../src/libcf_src.la
+
+EXTLIBS = -lnetcdf
+tst_lon_SOURCES = tst_lon.c
+tst_lon_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_lonlat_SOURCES = tst_lonlat.c
+tst_lonlat_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_lonlat_from_axes_SOURCES = tst_lonlat_from_axes.c
+tst_lonlat_from_axes_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_bound1_SOURCES = tst_bound1.c
+tst_bound1_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_1d_boundary_slice_SOURCES = tst_1d_boundary_slice.c
+tst_1d_boundary_slice_LDADD = $(INTLIBS) $(EXTLIBS)
+TESTS = $(check_PROGRAMS)
+
+# files generated by tests
+CLEANFILES = tst_lon.nc
 all: all-am
 
 .SUFFIXES:
@@ -268,9 +311,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec/tools/make_hgrid/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec_api/coord/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign gridspec/tools/make_hgrid/Makefile
+	  $(AUTOMAKE) --foreign gridspec_api/coord/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -289,54 +332,50 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-run_tests: $(top_builddir)/config.status $(srcdir)/run_tests.in
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-install-binPROGRAMS: $(bin_PROGRAMS)
-	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	for p in $$list; do echo "$$p $$p"; done | \
-	sed 's/$(EXEEXT)$$//' | \
-	while read p p1; do if test -f $$p || test -f $$p1; \
-	  then echo "$$p"; echo "$$p"; else :; fi; \
-	done | \
-	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
-	sed 'N;N;N;s,\n, ,g' | \
-	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
-	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
-	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
-	    else { print "f", $$3 "/" $$4, $$1; } } \
-	  END { for (d in files) print "f", d, files[d] }' | \
-	while read type dir files; do \
-	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
-	    test -z "$$files" || { \
-	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
-	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
-	    } \
-	; done
-
-uninstall-binPROGRAMS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	files=`for p in $$list; do echo "$$p"; done | \
-	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-	      -e 's/$$/$(EXEEXT)/' `; \
-	test -n "$$list" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(bindir)" && rm -f $$files
-
-clean-binPROGRAMS:
-	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libnccf_coord.la: $(libnccf_coord_la_OBJECTS) $(libnccf_coord_la_DEPENDENCIES) 
+	$(LINK)  $(libnccf_coord_la_OBJECTS) $(libnccf_coord_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
-make_hgrid$(EXEEXT): $(make_hgrid_OBJECTS) $(make_hgrid_DEPENDENCIES) 
-	@rm -f make_hgrid$(EXEEXT)
-	$(LINK) $(make_hgrid_OBJECTS) $(make_hgrid_LDADD) $(LIBS)
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_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
+tst_1d_boundary_slice$(EXEEXT): $(tst_1d_boundary_slice_OBJECTS) $(tst_1d_boundary_slice_DEPENDENCIES) 
+	@rm -f tst_1d_boundary_slice$(EXEEXT)
+	$(LINK) $(tst_1d_boundary_slice_OBJECTS) $(tst_1d_boundary_slice_LDADD) $(LIBS)
+tst_bound1$(EXEEXT): $(tst_bound1_OBJECTS) $(tst_bound1_DEPENDENCIES) 
+	@rm -f tst_bound1$(EXEEXT)
+	$(LINK) $(tst_bound1_OBJECTS) $(tst_bound1_LDADD) $(LIBS)
+tst_lon$(EXEEXT): $(tst_lon_OBJECTS) $(tst_lon_DEPENDENCIES) 
+	@rm -f tst_lon$(EXEEXT)
+	$(LINK) $(tst_lon_OBJECTS) $(tst_lon_LDADD) $(LIBS)
+tst_lonlat$(EXEEXT): $(tst_lonlat_OBJECTS) $(tst_lonlat_DEPENDENCIES) 
+	@rm -f tst_lonlat$(EXEEXT)
+	$(LINK) $(tst_lonlat_OBJECTS) $(tst_lonlat_LDADD) $(LIBS)
+tst_lonlat_from_axes$(EXEEXT): $(tst_lonlat_from_axes_OBJECTS) $(tst_lonlat_from_axes_DEPENDENCIES) 
+	@rm -f tst_lonlat_from_axes$(EXEEXT)
+	$(LINK) $(tst_lonlat_from_axes_OBJECTS) $(tst_lonlat_from_axes_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -344,7 +383,26 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/make_hgrid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_add_coord_att.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_coord.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_coord_from_axes.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_coord_from_file.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_free_coord.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_get_coord_data_pointer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_coord_bound.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_coord_bound_slice.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_coord_dimnames.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_coord_dims.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_coord_name.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_coord_ndims.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_coord_units.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_is_coord.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_put_coord.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_1d_boundary_slice.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_bound1.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_lon.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_lonlat.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_lonlat_from_axes.Po at am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -375,6 +433,26 @@ mostlyclean-libtool:
 
 clean-libtool:
 	-rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	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|^.*/||'`; \
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(includedir)" && rm -f $$files
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -551,11 +629,12 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
-all-am: Makefile $(PROGRAMS)
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
 installdirs:
-	for dir in "$(DESTDIR)$(bindir)"; do \
+	for dir in "$(DESTDIR)$(includedir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-am
@@ -580,14 +659,14 @@ 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-am
 
-clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES clean-noinstPROGRAMS mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -607,13 +686,13 @@ info: info-am
 
 info-am:
 
-install-data-am:
+install-data-am: install-includeHEADERS
 
 install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am: install-binPROGRAMS
+install-exec-am:
 
 install-html: install-html-am
 
@@ -653,23 +732,24 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-binPROGRAMS
+uninstall-am: uninstall-includeHEADERS
 
 .MAKE: check-am install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
-	clean-binPROGRAMS clean-generic clean-libtool ctags distclean \
+	clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES clean-noinstPROGRAMS ctags distclean \
 	distclean-compile distclean-generic distclean-libtool \
 	distclean-tags distdir dvi dvi-am html html-am info info-am \
-	install install-am install-binPROGRAMS install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
+	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 installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-binPROGRAMS
+	tags uninstall uninstall-am uninstall-includeHEADERS
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/gridspec_api/coord/nccf_add_coord_att.c b/gridspec_api/coord/nccf_add_coord_att.c
new file mode 100644
index 0000000..c212dc3
--- /dev/null
+++ b/gridspec_api/coord/nccf_add_coord_att.c
@@ -0,0 +1,27 @@
+/**
+ * Add attribute
+ *
+ * $Id: nccf_add_coord_att.c 804 2011-09-12 03:59:08Z pletzer $
+ */
+
+#include "nccf_coord.h"
+
+/**
+ * \ingroup gs_coord_grp
+ * Add attribute to object.
+ *
+ * \param coordid coordinate ID
+ * \param name attribute name
+ * \param value attribute value
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_add_coord_att(int coordid, const char *name, const char *value) {
+
+  struct nccf_coord_type *self;
+  self = nccf_li_find(&CFLIST_COORDINATE, coordid);
+  nccf_varSetAttribText(&self->coordVar, name, value);
+  
+  return NC_NOERR;
+}
diff --git a/gridspec_api/coord/nccf_coord.h b/gridspec_api/coord/nccf_coord.h
new file mode 100644
index 0000000..a8318b5
--- /dev/null
+++ b/gridspec_api/coord/nccf_coord.h
@@ -0,0 +1,106 @@
+/**
+ * API to define a structured grid for the gridspec convention to libcf.
+ *
+ * $Id: nccf_coord.h 895 2011-12-22 13:12:38Z pletzer $
+ */
+
+#ifndef _NCCF_COORDINATE_H
+#define _NCCF_COORDINATE_H
+
+#include <netcdf.h>
+#include <libcf_src.h>
+#include <cflistitem.h>
+#include <nccf_varObj.h>
+#include <nccf_handle_error.h>
+#include <nccf_constants.h>
+
+extern struct CFLISTITEM *CFLIST_COORDINATE;
+
+#define CF_COORD_LON_VARNAME "lon"
+#define CF_COORD_LON_STNAME "longitude"
+#define CF_COORD_LON_UNITS "degrees_east"
+#define CF_COORD_LAT_VARNAME "lat"
+#define CF_COORD_LAT_STNAME "latitude"
+#define CF_COORD_LAT_UNITS "degrees_north"
+
+struct nccf_coord_type {
+
+  /* name of this coordinate, eg "lon" */
+  char *coord_name;
+
+  /* netcdf-like object */
+  struct nccf_var_obj *coordVar;
+
+  /* pointer to the data, only double supported */
+  double *data;
+
+  /* whether or not data are copy-saved (!= 0) by the object. If copy
+     saved then the object owns the data, the data will be deallocated
+     when destroying the object. Otherwise, the caller owns the data
+     and is responsible for their destruction (after freeing this object.)
+  */
+  int save;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int nccf_def_coord(int ndims, const int *dims, const char **dimnames,
+		   const double *data, int save, const char *name, 
+		   const char *standard_name, const char *units,
+		   int *coordid);
+
+int nccf_def_lon_coord(int ndims, const int *dims, const char **dimnames,
+		       const double *data, int save, int *coordid );
+
+int nccf_def_lat_coord(int ndims, const int *dims, const char **dimnames,
+		       const double *data, int save, int *coordid);
+
+int nccf_def_coord_from_file(const char *filename, 
+			     const char *coord_name, int *coordid);
+
+int nccf_def_coord_from_axes(int ndims, const int *axisids, 
+                             int index_pos, const char *name, 
+                             const char *standard_name, 
+                             const char *units, int *coordid);
+
+int nccf_free_coord(int coordid);
+
+int nccf_put_coord(int ncid, int coordid);
+
+int nccf_add_coord_att(int coordid, const char *name, const char *value);
+
+int nccf_inq_coord_bound(int coordid, const int norm_vect[],
+         int *start_indices, int *end_indices);
+
+int nccf_inq_coord_bound_slice(int coordid, const int norm_vect[],
+			       int flip, const char *format, char *slice);
+
+int nccf_get_coord_data_pointer(int coordid, double **data);
+
+int nccf_inq_coord_ndims(int coordid, int *ndims);
+
+int nccf_inq_coord_dims(int coordid, int *dims);
+
+int nccf_inq_coord_dimnames(int coordid, char **dimnames);
+
+int nccf_inq_coord_name(int coordid, char *coord_name);
+
+int nccf_inq_coord_units(int coordid, char *unit);
+
+int nccf_is_coord_lon(int coordid, int *yesno);
+
+int nccf_is_coord_lat(int coordid, int *yesno);
+
+int nccf_is_coord_vert(int coordid, int *yesno);
+
+/*!@}*/
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* _NCCF_COORDINATE_H */
+
diff --git a/gridspec_api/coord/nccf_def_coord.c b/gridspec_api/coord/nccf_def_coord.c
new file mode 100644
index 0000000..368e1b1
--- /dev/null
+++ b/gridspec_api/coord/nccf_def_coord.c
@@ -0,0 +1,151 @@
+/**
+ * API to define a coordinate for the gridspec convention of libcf.
+ *
+ * $Id: nccf_def_coord.c 895 2011-12-22 13:12:38Z pletzer $
+ */
+
+#include "nccf_coord.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <nccf_handle_error.h>
+#include <nccf_varObj.h>
+
+struct CFLISTITEM *CFLIST_COORDINATE;
+
+/** \defgroup gs_coord_grp Structured coordinates
+    \ingroup gridspec_grp
+
+Structured curvilinear coordinates are in-memory objects that associate 
+a position to a set of indices. The positions can be irregular in space. 
+However, indexing is assumed to be regular.
+
+*/
+
+/**
+ * \ingroup gs_coord_grp
+ * Define a generic, structured grid coordinate (constructor).
+ *
+ * \param ndims number of space dimensions
+ * \param dims dimensions along each axis
+ * \param dimnames user defined dimension names
+ * \param data pointer to the data
+ * \param save != 0 in order to copy-save the data
+ * \param name name of coordinate (e.g. "lon")
+ * \param standard_name CF standard_name (or NULL if empty)
+ * \param units CF units (or NULL if empty)
+ * \param coordid (output) ID
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ * \note copy-save means this object makes a copy of the data, other
+ *       it will take the pointer and the caller is responsible for 
+ *       releasing the data memory.
+ */
+int nccf_def_coord(int ndims, const int *dims, const char **dimnames,
+         const double *data,  int save,
+         const char *name, const char *standard_name, 
+         const char *units, int *coordid){
+
+  int i, nvertex;
+  struct nccf_coord_type *self;
+  self = (struct nccf_coord_type *)
+    malloc(sizeof(struct nccf_coord_type));
+  nc_type type = NC_DOUBLE;
+
+  /* initialization */
+  self->coord_name = (char *) calloc(STRING_SIZE, sizeof(char));
+  sprintf(self->coord_name, "%s", name);
+
+  /* fill in the tile information */
+  nccf_varCreate(&self->coordVar, name);
+  nccf_varSetDims(&self->coordVar, ndims, dims, (const char **)dimnames);
+  if (standard_name != NULL) {
+    nccf_varSetAttribText(&self->coordVar, CF_ATTNAME_STANDARD_NAME, 
+			  standard_name);
+  }
+  if (units != NULL) {
+    nccf_varSetAttribText(&self->coordVar, CF_ATTNAME_UNITS, units);
+  }
+  //nccf_varSetAttribText(&self->coordVar, CF_ATTNAME_BOUNDS, name); /* coordinates are assumed nodal */
+
+  /* take a reference to the data, or copy */
+  self->save = save;
+  if (save) {
+    /* number of vertices */
+    nvertex = 1;
+    for (i = 0; i < ndims; ++i) {
+      nvertex *= dims[i];
+    }
+    self->data = (double *) malloc(nvertex * sizeof(double));
+    for (i = 0; i < nvertex; ++i) {
+      /* copy */
+      self->data[i] = data[i];
+    }
+  }
+  else {
+    /* set pointer */
+    self->data = (double *) data;
+  }
+
+  /* set the pointer */
+  nccf_varSetDataPtr(&self->coordVar, type, self->data);
+
+  /* add an element to the linked list */
+  if (CFLIST_COORDINATE == NULL) nccf_li_new(&CFLIST_COORDINATE);
+
+  *coordid = nccf_li_add(&CFLIST_COORDINATE, self);
+
+  return NC_NOERR;
+}
+
+/**
+ * \ingroup gs_coord_grp
+ * Define a longitude, structured grid coordinate (constructor).
+ *
+ * \param ndims number of space dimensions
+ * \param dims dimensions along each axis
+ * \param dimnames user defined dimension names
+ * \param data pointer to the data
+ * \param save != 0 in order to copy-save the data
+ * \param coordid (output) ID
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ * \note copy-save means this object makes a copy of the data, other
+ *       it will take the pointer and the caller is responsible for 
+ *       releasing the data memory.
+ */
+int nccf_def_lon_coord(int ndims, const int *dims, const char **dimnames,
+             const double *data,  int save, int *coordid){
+
+  return nccf_def_coord(ndims, dims, dimnames, data, save, 
+              CF_COORD_LON_VARNAME, CF_COORD_LON_STNAME, CF_COORD_LON_UNITS, 
+              coordid);
+}
+
+/**
+ * \ingroup gs_coord_grp
+ * Define a latitude,  structured grid coordinate (constructor).
+ *
+ * \param ndims number of space dimensions
+ * \param dims dimensions along each axis
+ * \param dimnames user defined dimension names
+ * \param data pointer to the data
+ * \param save != 0 in order to copy-save the data
+ * \param coordid (output) ID
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ * \note copy-save means this object makes a copy of the data, other
+ *       it will take the pointer and the caller is responsible for 
+ *       releasing the data memory.
+ */
+int nccf_def_lat_coord(int ndims, const int *dims, const char **dimnames, 
+             const double *data, int save, int *coordid){
+
+  return nccf_def_coord(ndims, dims, dimnames, data, save, 
+              CF_COORD_LAT_VARNAME, CF_COORD_LAT_STNAME, CF_COORD_LAT_UNITS, 
+              coordid);
+}
diff --git a/gridspec_api/coord/nccf_def_coord_from_axes.c b/gridspec_api/coord/nccf_def_coord_from_axes.c
new file mode 100644
index 0000000..cf06605
--- /dev/null
+++ b/gridspec_api/coord/nccf_def_coord_from_axes.c
@@ -0,0 +1,105 @@
+/*
+ * $Id: nccf_def_coord_from_axes.c 851 2011-11-08 14:37:20Z pletzer $
+ */
+
+#include <nccf_utility_functions.h>
+#include <nccf_axis.h>
+#include "nccf_coord.h"
+#include <stdlib.h>
+#include <string.h>
+
+/**
+ * \ingroup gs_coord_grp
+ * Create a curvilinear coordinate from a set of axes
+ * (constructor).
+ *
+ * \param ndims number of space dimensions
+ * \param axisids array of axis IDs
+ * \param index_pos the coordinate values will vary along index_pos
+ *                  and be the same along any other index axis
+ * \param name name of coordinate (e.g. "lon")
+ * \param standard_name CF standard_name (or NULL if empty)
+ * \param units CF units (or NULL if empty)
+ * \param coordid (output) ID
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_def_coord_from_axes(int ndims, const int *axisids, 
+                             int index_pos, const char *name, 
+                             const char *standard_name, 
+                             const char *units, int *coordid){
+
+  int tot_error = 0;
+  const int save = 1;
+  int dims[ndims];
+  char **dimnames;
+  double *data;
+  int i, j, ntot, status;
+  int ijk[ndims];
+  void *axis_data;
+  nc_type axis_data_type;
+
+  dimnames = malloc(ndims * sizeof(char *));
+ 
+  // get the dimensions and the dimension names
+  for (i = 0; i < ndims; ++i) {
+    dimnames[i] = calloc(STRING_SIZE, sizeof(char));
+    status = nccf_inq_axis_len(axisids[i], &dims[i]);
+    tot_error += abs(status);
+    // dimension name is same as axis name
+    status = nccf_inq_axis_name(axisids[i], dimnames[i]);
+    tot_error += abs(status);
+  }
+
+  // 
+  // construct the coordinate data
+  //
+
+  ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+
+  data = malloc(ntot * sizeof(double));
+
+  status = nccf_get_axis_datapointer(axisids[index_pos], &axis_data);
+  status = nccf_inq_axis_datatype(axisids[index_pos], &axis_data_type);
+  if (axis_data_type == NC_DOUBLE) {
+    double *axis_data_double = (double *) axis_data;
+    for (j = 0; j < ntot; ++j) {
+      nccf_get_multi_index(ndims, dims, j, ijk);
+      data[j] = axis_data_double[ijk[index_pos]];
+    }
+  }
+  else if (axis_data_type == NC_FLOAT) {
+    float *axis_data_float = (float *) axis_data;
+    for (j = 0; j < ntot; ++j) {
+      nccf_get_multi_index(ndims, dims, j, ijk);
+      data[j] = axis_data_float[ijk[index_pos]];
+    }
+  }
+  else if (axis_data_type == NC_INT) {
+    int *axis_data_int = (int *) axis_data;
+    for (j = 0; j < ntot; ++j) {
+      nccf_get_multi_index(ndims, dims, j, ijk);
+      data[j] = axis_data_int[ijk[index_pos]];
+    }
+  }
+  else {
+    // error?
+  }
+
+  status = nccf_def_coord(ndims, dims, (const char **)dimnames, 
+                          data, save, name, standard_name, 
+                          units, coordid);
+  tot_error += abs(status);
+
+  free(data);
+  for (i = 0; i < ndims; ++i) {
+    free(dimnames[i]);
+  }
+  free(dimnames);
+
+  return tot_error;
+}
diff --git a/gridspec_api/coord/nccf_def_coord_from_file.c b/gridspec_api/coord/nccf_def_coord_from_file.c
new file mode 100644
index 0000000..7b2846f
--- /dev/null
+++ b/gridspec_api/coord/nccf_def_coord_from_file.c
@@ -0,0 +1,59 @@
+/*
+ * $Id: nccf_def_coord_from_file.c 895 2011-12-22 13:12:38Z pletzer $
+ *
+ */
+
+#include "nccf_coord.h"
+#include <netcdf.h>
+#include <string.h>
+#include <stdlib.h>
+#include "nccf_varObj.h"
+
+/**
+ * \ingroup gs_coord_grp
+ * Define (construct) a coordinate object from a netcdf file.
+ *
+ * \param filename name of the netcdf file
+ * \param coord_name name of coordinate in file
+ * \param coordid (output) ID
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ * \note the coordinate data will be cast into doubles, regardless
+ * of what the stored data type is.
+ */
+int nccf_def_coord_from_file(const char *filename,
+              const char *coord_name,
+              int *coordid){
+
+  int totError = NC_NOERR;
+  int ncid, status = NC_NOERR;
+  const int read_data = 1;
+  const int cast_as_doubles = 1;
+  struct nccf_coord_type *self;
+  self = (struct nccf_coord_type *)
+    malloc(sizeof(struct nccf_coord_type));
+  
+  // read the variable
+  status = nc_open(filename, NC_NOWRITE, &ncid);
+  if (status) return status;
+  totError += abs(status);
+
+  // note: data will be cast as doubles
+  nccf_varCreateFromFile(&self->coordVar, coord_name, ncid, 
+                         read_data, cast_as_doubles);
+  status = nc_close(ncid);
+  totError += abs(status);
+
+  /* add an element to the linked list */
+  if (CFLIST_COORDINATE == NULL) nccf_li_new(&CFLIST_COORDINATE);
+
+  *coordid = nccf_li_add(&CFLIST_COORDINATE, self);
+
+  // this will be removed
+  self->coord_name = strdup(coord_name);
+  nccf_varGetDataPtr(&self->coordVar, (void **)&self->data);
+  self->save = 0;
+
+  return totError;
+}
diff --git a/gridspec_api/coord/nccf_free_coord.c b/gridspec_api/coord/nccf_free_coord.c
new file mode 100644
index 0000000..4e54d76
--- /dev/null
+++ b/gridspec_api/coord/nccf_free_coord.c
@@ -0,0 +1,47 @@
+/*
+ * API to define a structured grid for the gridspec convention to libcf.
+ *
+ * $Id: nccf_free_coord.c 918 2012-02-07 22:10:36Z pletzer $
+ * */
+
+#include "nccf_coord.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <netcdf.h>
+#include <nccf_varObj.h>
+
+/**
+ * \ingroup gs_coord_grp
+ * Free object (destructor).
+ *
+ * \param coordid coordinate ID
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_free_coord(int coordid) {
+
+    struct nccf_coord_type *self;
+    self = nccf_li_remove(&CFLIST_COORDINATE, coordid);
+    if( nccf_li_get_nelem( &CFLIST_COORDINATE ) == 0 )
+        nccf_li_del( &CFLIST_COORDINATE );
+
+    /* free memory */
+    if (self->coord_name) {
+      free(self->coord_name);
+      self->coord_name = NULL;
+    }
+
+    if (self->save) {
+      free(self->data);
+      self->data = NULL;
+    }
+
+    nccf_varDestroy(&self->coordVar);
+
+    free(self);
+    self = NULL;
+
+    return NC_NOERR;
+}
diff --git a/gridspec_api/coord/nccf_get_coord_data_pointer.c b/gridspec_api/coord/nccf_get_coord_data_pointer.c
new file mode 100644
index 0000000..c49b577
--- /dev/null
+++ b/gridspec_api/coord/nccf_get_coord_data_pointer.c
@@ -0,0 +1,22 @@
+/*
+ * $Id: nccf_get_coord_data_pointer.c 757 2011-05-13 22:37:50Z pletzer $
+ */
+
+#include "nccf_coord.h"
+
+/**
+ * \ingroup gs_coord_grp
+ * Get the pointer to the coordinate data.
+ *
+ * \param coordid coordinate ID
+ * \param data (output) a pointer to the data, returned as a flat array
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_get_coord_data_pointer(int coordid, double **data) {
+  struct nccf_coord_type *self;
+  self = nccf_li_find(&CFLIST_COORDINATE, coordid);
+  nccf_varGetDataPtr(&self->coordVar, (void **) data);
+  return NC_NOERR;
+}
diff --git a/gridspec_api/coord/nccf_inq_coord_bound.c b/gridspec_api/coord/nccf_inq_coord_bound.c
new file mode 100644
index 0000000..89d285d
--- /dev/null
+++ b/gridspec_api/coord/nccf_inq_coord_bound.c
@@ -0,0 +1,42 @@
+/**
+ * $Id: nccf_inq_coord_bound.c 737 2011-05-06 17:48:14Z edhartnett $
+ * 
+ */
+
+#include "nccf_coord.h"
+#include <stdlib.h>
+#include <nccf_utility_functions.h>
+
+/**
+ * \ingroup gs_coord_grp
+ * Get boundary contact ranges.
+ *
+ * \param coordid coordinate ID
+ * \param norm_vect an array of -1, 0, 1 elements uniquely denoting the boundary (e.g. 1, 0 for north)
+ * \param start_indices (output) start set of indices in the coordinate data
+ * \param end_indices (output) inclusive end set of indices in the coordinate data
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_inq_coord_bound(int coordid, const int norm_vect[], 
+				 int *start_indices, int *end_indices ) {
+
+  int ndims, status;
+  int *dims;
+
+  status = nccf_inq_coord_ndims(coordid, &ndims);
+  dims = (int *) malloc(ndims * sizeof(int));
+  status = nccf_inq_coord_dims(coordid, dims);
+
+  /* 
+     Compute the starting/ending positions in index space
+     The endingIndices are inclusive (is,...ie)
+   */
+  nccf_get_start_end_bound_indices(ndims, dims, norm_vect, 0,
+				      start_indices, end_indices);
+  
+  free(dims);
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/coord/nccf_inq_coord_bound_slice.c b/gridspec_api/coord/nccf_inq_coord_bound_slice.c
new file mode 100644
index 0000000..a4b7297
--- /dev/null
+++ b/gridspec_api/coord/nccf_inq_coord_bound_slice.c
@@ -0,0 +1,103 @@
+/**
+ * $Id: nccf_inq_coord_bound_slice.c 828 2011-09-14 20:05:08Z pletzer $
+ */
+
+#include "cf_config.h"
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <nccf_coord.h>
+#include <nccf_constants.h>
+#include <nccf_utility_functions.h>
+
+/**
+ * \ingroup gs_coord_grp
+ * Get boundary slice string.
+ *
+ * \param coordid coordinate ID
+ * \param norm_vect an array of -1, 0, 1 elements uniquely denoting the boundary (e.g. 1,0 for north)
+ * \param flip if !=0 then reverse order of beginning and end indices 
+ * \param format either "Fortran" or "C"
+ * \param slice (output) aka "0:11 10:11"
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_inq_coord_bound_slice(int coordid, const int norm_vect[], 
+			       int flip, const char *format, 
+			       char *slice) {
+
+  int ndims, i, status;
+  const char rangeSeparator[STRING_SIZE] = CF_RANGE_SEPARATOR;
+  const char indexSeparator[STRING_SIZE] = CF_INDEX_SEPARATOR;
+  char iBegStr[STRING_SIZE];
+  char iEndStr[STRING_SIZE];
+  char range[STRING_SIZE];
+
+  status = nccf_inq_coord_ndims(coordid, &ndims);
+  int dims[ndims];
+  status = nccf_inq_coord_dims(coordid, dims);
+
+  int start_indices[ndims];
+  int end_indices[ndims];
+  int start_indices_tmp[ndims];
+  int end_indices_tmp[ndims];
+
+  /* 
+     Compute the starting/ending positions in index space
+     The endingIndices are exclusive (is, ... ie(
+   */
+  const int exclusive = 0;
+  nccf_get_start_end_bound_indices(ndims, dims, 
+				   norm_vect, 
+				   exclusive,
+				   start_indices, 
+				   end_indices);
+
+  if (format[0] == 'F' || format[0] == 'f'){
+    /* Fortran */
+
+    /* revert order (..., k, j, i) -> (i, j, k, ...) */
+    for (i = 0; i < ndims; ++i) {
+      /* add one to start and end */
+      start_indices_tmp[i] = start_indices[ndims - 1 - i] + 1;
+      end_indices_tmp[i] = end_indices[ndims - 1 - i] + 1;
+    }
+    /* store */
+    for (i = 0; i < ndims; ++i) {
+      start_indices[i] = start_indices_tmp[i];
+      end_indices[i] = end_indices_tmp[i];
+    }
+  }
+
+  /* A tile is flipped relative to the other, switch the start and end indices
+   * but keep the values */
+  if(flip){
+
+    /* reverse order (..., k, j, i) -> (i, j, k, ...) */
+    for (i = 0; i < ndims; ++i) {
+      start_indices_tmp[i] = end_indices[i];
+      end_indices_tmp[i] = start_indices[i];
+    }
+    for (i = 0; i < ndims; ++i) {
+      start_indices[i] = start_indices_tmp[i];
+      end_indices[i] = end_indices_tmp[i];
+    }
+  }
+
+  /* Convert the start_indices/end_indices into a string slice */
+  slice[0] = '\0';
+  for (i = 0; i < ndims; ++i) {
+    sprintf(iBegStr, "%d", start_indices[i]);
+    sprintf(iEndStr, "%d", end_indices[i]);
+    strcpy(range, iBegStr);
+    strcat(range, rangeSeparator);
+    strcat(range, iEndStr);
+    if (i < ndims - 1) {
+      strcat(range, indexSeparator);
+    }
+    strcat(slice, range);
+  }
+  
+  return NC_NOERR;
+}
diff --git a/gridspec_api/coord/nccf_inq_coord_dimnames.c b/gridspec_api/coord/nccf_inq_coord_dimnames.c
new file mode 100644
index 0000000..b301229
--- /dev/null
+++ b/gridspec_api/coord/nccf_inq_coord_dimnames.c
@@ -0,0 +1,29 @@
+/**
+ * $Id: nccf_inq_coord_dimnames.c 895 2011-12-22 13:12:38Z pletzer $
+ */
+
+#include "cf_config.h"
+#include <nccf_varObj.h>
+#include <nccf_coord.h>
+#include <string.h>
+
+/**
+ * \ingroup gs_coord_grp
+ * Fill in the dimension names.
+ *
+ * \param coordid coordinate ID
+ * \param dimnames (output) array of dimension names for each axis
+ * \return NC_NOERR on success
+ */
+int nccf_inq_coord_dimnames(int coordid, char **dimnames) {
+  int i, status, ndims;
+  struct nccf_coord_type *self;
+  const char *dimName;
+  self = nccf_li_find(&CFLIST_COORDINATE, coordid);
+  status = nccf_varGetNumDims(&self->coordVar, &ndims);
+  for (i = 0; i < ndims; ++i) {
+    nccf_varGetDimNamePtr(&self->coordVar, i, &dimName);
+    strncpy(dimnames[i], dimName, STRING_SIZE);
+  }
+  return status;
+}
diff --git a/gridspec_api/coord/nccf_inq_coord_dims.c b/gridspec_api/coord/nccf_inq_coord_dims.c
new file mode 100644
index 0000000..62bbbcf
--- /dev/null
+++ b/gridspec_api/coord/nccf_inq_coord_dims.c
@@ -0,0 +1,30 @@
+/**
+ * Get the space dimensions
+ *
+ * $Id: nccf_inq_coord_dims.c 895 2011-12-22 13:12:38Z pletzer $
+ */
+
+#include "nccf_coord.h"
+
+/**
+ * \ingroup gs_coord_grp
+ * Fill in the dimensions.
+ *
+ * \param coordid coordinate ID
+ * \param dims (output) array of dimensions for each axis
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_inq_coord_dims(int coordid, int *dims) {
+  int i, status, ndims;
+  int *dimsPtr;
+  struct nccf_coord_type *self;
+  self = nccf_li_find(&CFLIST_COORDINATE, coordid);
+  status = nccf_varGetNumDims(&self->coordVar, &ndims);
+  status = nccf_varGetDimsPtr(&self->coordVar, &dimsPtr);
+  for (i = 0; i < ndims; ++i) {
+    dims[i] = dimsPtr[i];
+  }
+  return status;
+}
diff --git a/gridspec_api/coord/nccf_inq_coord_name.c b/gridspec_api/coord/nccf_inq_coord_name.c
new file mode 100644
index 0000000..adc350d
--- /dev/null
+++ b/gridspec_api/coord/nccf_inq_coord_name.c
@@ -0,0 +1,24 @@
+/**
+ * $Id: nccf_inq_coord_name.c 737 2011-05-06 17:48:14Z edhartnett $
+ */
+
+#include "nccf_coord.h"
+#include <string.h>
+
+/**
+ * \ingroup gs_coord_grp
+ * Fill in the coordinate name.
+ *
+ * \param coordid coordinate ID
+ * \param coord_name The coordinate name, should be of size NC_MAX_NAME at least
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_inq_coord_name(int coordid, char *coord_name) {
+
+  struct nccf_coord_type *self;
+  self = nccf_li_find(&CFLIST_COORDINATE, coordid);
+  strcpy(coord_name, self->coord_name);
+  return NC_NOERR;
+}
diff --git a/gridspec_api/coord/nccf_inq_coord_ndims.c b/gridspec_api/coord/nccf_inq_coord_ndims.c
new file mode 100644
index 0000000..fe17c83
--- /dev/null
+++ b/gridspec_api/coord/nccf_inq_coord_ndims.c
@@ -0,0 +1,25 @@
+/**
+ * Get the number of space dimensions
+ *
+ * $Id: nccf_inq_coord_ndims.c 895 2011-12-22 13:12:38Z pletzer $
+ */
+
+#include "nccf_coord.h"
+
+/**
+ * \ingroup gs_coord_grp
+ * Get the the number of dimensions.
+ *
+ * \param coordid coordinate ID
+ * \param ndims (output) number of space dims
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_inq_coord_ndims(int coordid, int *ndims) {
+  int status;
+  struct nccf_coord_type *self;
+  self = nccf_li_find(&CFLIST_COORDINATE, coordid);
+  status = nccf_varGetNumDims(&self->coordVar, ndims);
+  return status;
+}
diff --git a/gridspec_api/coord/nccf_inq_coord_units.c b/gridspec_api/coord/nccf_inq_coord_units.c
new file mode 100644
index 0000000..3f96573
--- /dev/null
+++ b/gridspec_api/coord/nccf_inq_coord_units.c
@@ -0,0 +1,32 @@
+/**
+ * $Id: nccf_inq_coord_units.c 851 2011-11-08 14:37:20Z pletzer $
+ */
+
+#include "nccf_coord.h"
+#include <string.h>
+
+/**
+ * \ingroup gs_coord_grp
+ * Fill in the units attribute name.
+ *
+ * \param coordid coordinate ID
+ * \param units The units string, should be of size NC_MAX_NAME at least 
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_inq_coord_units(int coordid, char *units) {
+
+  const char *units_attr;
+  struct nccf_coord_type *self;
+  self = nccf_li_find(&CFLIST_COORDINATE, coordid);
+  nccf_varGetAttribPtr(&self->coordVar, CF_ATTNAME_UNITS, 
+                       (const void **)&units_attr);
+  if (units_attr) {
+    strcpy(units, units_attr);
+  }
+  else {
+    strcpy(units, "");
+  }
+  return NC_NOERR;
+}
diff --git a/gridspec_api/coord/nccf_is_coord.c b/gridspec_api/coord/nccf_is_coord.c
new file mode 100644
index 0000000..dc4bc12
--- /dev/null
+++ b/gridspec_api/coord/nccf_is_coord.c
@@ -0,0 +1,164 @@
+/* $Id: nccf_is_coord.c 876 2011-12-16 18:24:04Z pletzer $ */
+
+#include <nccf_constants.h>
+#include "nccf_coord.h"
+#include <string.h>
+
+/**
+ * \ingroup gs_coord_grp
+ * Check if coordinate is a longitude 
+ * 
+ * \param coordid coordinate ID
+ * \param yesno (output) 1=yes 0=no
+ */
+int nccf_is_coord_lon(int coordid, int *yesno) {
+  *yesno = 0;
+  struct nccf_coord_type *self;
+  self = nccf_li_find(&CFLIST_COORDINATE, coordid);
+  const char *units;
+  const char *standard_name;
+  const char *axis;
+  nccf_varGetAttribPtr(&self->coordVar, CF_ATTNAME_UNITS,
+		       (const void **) &units);
+  nccf_varGetAttribPtr(&self->coordVar, CF_ATTNAME_STANDARD_NAME,
+		       (const void **) &standard_name);
+  nccf_varGetAttribPtr(&self->coordVar, CF_ATTNAME_AXIS,
+		       (const void **) &axis);
+  /* CF convention document:
+     Variables representing longitude must always explicitly include the 
+     units attribute; there is no default value. The units attribute will 
+     be a string formatted as per the udunits.dat file. The recommended 
+     unit of longitude is degrees_east. Also acceptable are degree_east, 
+     degree_E, degrees_E, degreeE, and degreesE. Optionally, the longitude 
+     type may be indicated additionally by providing the standard_name 
+     attribute with the value longitude, and/or the axis attribute with 
+     the value X. 
+  */
+  if (units) {
+    if (strstr(units, "degrees_east") || strstr(units, "degree_east") || 
+        strstr(units, "degrees_E") || strstr(units, "degree_E") ||
+        strstr(units, "degreesE") || strstr(units, "degreeE")) {
+      *yesno = 1;
+    }
+  }
+  if (units && standard_name) {
+    if (strstr(standard_name, "longitude") || 
+        strstr(standard_name, "grid_longitude")) {
+      *yesno = 1;
+    }
+  }
+  if (units && axis) {
+    if (strstr(axis, "X")) {
+      *yesno = 1;
+    }
+  }
+  return NC_NOERR;
+}
+
+/**
+ * \ingroup gs_coord_grp
+ * Check if coordinate is a latitude 
+ * 
+ * \param coordid coordinate ID
+ * \param yesno (output) 1=yes 0=no
+ */
+int nccf_is_coord_lat(int coordid, int *yesno) {
+  *yesno = 0;
+  struct nccf_coord_type *self;
+  self = nccf_li_find(&CFLIST_COORDINATE, coordid);
+  const char *units;
+  const char *standard_name;
+  const char *axis;
+  nccf_varGetAttribPtr(&self->coordVar, CF_ATTNAME_UNITS,
+		       (const void **) &units);
+  nccf_varGetAttribPtr(&self->coordVar, CF_ATTNAME_STANDARD_NAME,
+		       (const void **) &standard_name);
+  nccf_varGetAttribPtr(&self->coordVar, CF_ATTNAME_AXIS,
+		       (const void **) &axis);
+  if (units) {
+    if (strstr(units, "degrees_north") || strstr(units, "degree_north") || 
+        strstr(units, "degrees_N") || strstr(units, "degree_N") ||
+        strstr(units, "degreesN") || strstr(units, "degreeN")) {
+      *yesno = 1;
+    }
+  }
+  if (units && standard_name) {
+    if (strstr(standard_name, "latitude") || 
+        strstr(standard_name, "grid_latitude")) {
+      *yesno = 1;
+    }
+  }
+  if (units && axis) {
+    if (strstr(axis, "Y")) {
+      *yesno = 1;
+    }
+  }
+  return NC_NOERR;
+}
+
+/**
+ * \ingroup gs_coord_grp
+ * Check if coordinate is depth/height 
+ * 
+ * \param coordid coordinate ID
+ * \param yesno (output) 1=yes 0=no
+ */
+int nccf_is_coord_vert(int coordid, int *yesno) {
+  *yesno = 0;
+  struct nccf_coord_type *self;
+  self = nccf_li_find(&CFLIST_COORDINATE, coordid);
+  const char *units;
+  const char *standard_name;
+  const char *axis;
+  const char *positive;
+  nccf_varGetAttribPtr(&self->coordVar, CF_ATTNAME_UNITS,
+		       (const void **) &units);
+  nccf_varGetAttribPtr(&self->coordVar, CF_ATTNAME_STANDARD_NAME,
+		       (const void **) &standard_name);
+  nccf_varGetAttribPtr(&self->coordVar, CF_ATTNAME_AXIS,
+		       (const void **) &axis);
+  nccf_varGetAttribPtr(&self->coordVar, CF_ATTNAME_POSITIVE,
+		       (const void **) &positive);
+  if (units) {
+    if (strstr(units, "bar") || 
+        strstr(units, "millibar") || 
+        strstr(units, "decibar") ||
+        strstr(units, "atmosphere") || 
+        strstr(units, "atm") ||
+        strstr(units, "pascal") || 
+        strstr(units, "Pa") || 
+        strstr(units, "hPa")) {
+      *yesno = 1;
+    }
+    else if (positive) {
+      /* positive attr is required for other than pressure units */
+      if (strstr(units, "meter") || 
+          strstr(units, "metre") || 
+          strstr(units, "m") || 
+          strstr(units, "km")) {
+        *yesno = 1;
+      }
+    }
+  }
+  if (standard_name) {
+    /* dimensionless vertical axes, units attribute is not required */
+    if (strstr(standard_name, "atmosphere_ln_pressure_coordinate") || 
+        strstr(standard_name, "atmosphere_sigma_coordinate") ||
+        strstr(standard_name, "atmosphere_sigma_pressure_coordinate") ||
+        strstr(standard_name, "atmosphere_hybrid_height_coordinate") ||
+        strstr(standard_name, "atmosphere_sleve_coordinate") ||
+        strstr(standard_name, "ocean_sigma_coordinate") ||
+        strstr(standard_name, "ocean_s_coordinate") ||
+        strstr(standard_name, "ocean_sigma_z_coordinate") ||
+        strstr(standard_name, "ocean_double_sigma_coordinate")) {
+      *yesno = 1;
+    }
+  }
+  if (axis) {
+    if (strstr(axis, "Z")) {
+      *yesno = 1;
+    }
+  }
+  return NC_NOERR;
+}
+
diff --git a/gridspec_api/coord/nccf_put_coord.c b/gridspec_api/coord/nccf_put_coord.c
new file mode 100644
index 0000000..4e14c37
--- /dev/null
+++ b/gridspec_api/coord/nccf_put_coord.c
@@ -0,0 +1,34 @@
+/**
+ * Write a coordinate to file.
+ *
+ * $Id: nccf_put_coord.c 767 2011-06-06 23:20:19Z pletzer $
+ */
+
+#include "nccf_coord.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <netcdf.h>
+
+/**
+ * \ingroup gs_coord_grp
+ * Write object to netcdf file.
+ *
+ * \param coordid coordinate ID
+ * \param ncid netcdf file ID
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_put_coord(int coordid, int ncid) {
+
+  int status = NC_NOERR;
+  struct nccf_coord_type *self;
+  self = nccf_li_find(&CFLIST_COORDINATE, coordid);
+
+  // Write data to file
+  status = nccf_writeListOfVars(ncid, 1, self->coordVar);
+
+  return status;
+}
diff --git a/gridspec_api/coord/tst_1d_boundary_slice.c b/gridspec_api/coord/tst_1d_boundary_slice.c
new file mode 100644
index 0000000..ec23b99
--- /dev/null
+++ b/gridspec_api/coord/tst_1d_boundary_slice.c
@@ -0,0 +1,61 @@
+/**
+ * Test the boundary indexing in 1D
+ *
+ * $Id: tst_1d_boundary_slice.c 719 2011-04-26 17:39:51Z srinath22 $
+ * 
+ */
+
+#include "nccf_coord.h"
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#include <nccf_handle_error.h>
+#include <nccf_varObj.h>
+
+int main() {
+  
+  double l0[3], l1[3];
+  int *dim;
+  int ngrids = 2, ndim = 1;
+  int coordid[ngrids];
+  int *normVec0, *normVec1;
+  int i;
+  int save = 1, status;
+  char slice0[STRING_SIZE], slice1[STRING_SIZE];
+  char *gs_slice_format = "F";
+  const char *dimnames[] = {"ni"};
+
+  dim = ( int * )malloc( ndim * sizeof( int ));
+  normVec0 = ( int * )malloc( ndim * sizeof( int ));
+  normVec1 = ( int * )malloc( ndim * sizeof( int ));
+  dim[0] = 3;
+
+  for( i = 0; i < 3; i++ ){
+    l0[i] = i;
+    l1[i] = i+2;
+  }
+
+/* Create a coordinate for grid0 */
+  nccf_def_lon_coord( ndim, dim, dimnames, l0, save, &coordid[0] );
+
+/* Create a coordinate for grid1 */
+  nccf_def_lon_coord( ndim, dim, dimnames, l1, save, &coordid[1] );
+
+  normVec0[0] =  1;
+  normVec1[0] = -1;
+  
+  status = nccf_inq_coord_bound_slice(coordid[0],
+                    normVec0, 0,
+                    gs_slice_format, slice0);
+  status = nccf_inq_coord_bound_slice(coordid[1],
+                    normVec1, 0,
+                    gs_slice_format, slice1);
+
+  nccf_free_coord( coordid[0] );
+  nccf_free_coord( coordid[1] );
+  free( dim );
+  free( normVec0 );
+  free( normVec1 );
+  return 0;
+}
diff --git a/gridspec_api/coord/tst_bound1.c b/gridspec_api/coord/tst_bound1.c
new file mode 100644
index 0000000..caaca47
--- /dev/null
+++ b/gridspec_api/coord/tst_bound1.c
@@ -0,0 +1,147 @@
+/**
+ * Test the boundary indexing in 1D and 2D
+ *
+ * $Id: tst_bound1.c 719 2011-04-26 17:39:51Z srinath22 $
+ * 
+ */
+
+#include "nccf_coord.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include <nccf_handle_error.h>
+
+int main(int argc, char *argv[]) {
+
+  const int save = 0;
+  const int ndimsMax = 3;
+  const int dims[] = {10, 11, 12};
+  double *data = NULL; // no data
+  int coordids[ndimsMax];
+  int norm_vec[ndimsMax];
+  int status, ndims;
+  int is[ndimsMax], ie[ndimsMax];
+  char slice[STRING_SIZE];
+
+  const char *dimname1[] = {"ni"};
+  const char *dimname2[] = {"ni", "nj", "nk"};
+  const int notflipped = 0;
+
+  printf("Running %s\n", argv[0]);
+
+  /* 1d */
+  ndims = 1;
+  if ((status = nccf_def_lon_coord(ndims, dims, dimname1, data, save, 
+					&coordids[ndims - 1]))) ERR;
+
+  norm_vec[0] = -1; // low end
+  if ((status = nccf_inq_coord_bound(coordids[ndims - 1], norm_vec,
+					     is, ie))) ERR;
+  assert(is[0] == 0);
+  assert(ie[0] == 0);
+  if ((status = nccf_inq_coord_bound_slice(coordids[ndims - 1], 
+						   norm_vec, notflipped,  
+						   "C", slice))) ERR;
+  assert(!strcmp(slice, "0:0"));
+  if ((status = nccf_inq_coord_bound_slice(coordids[ndims - 1], 
+						   norm_vec, notflipped, 
+						   "Fortran", slice))) ERR;
+  assert(!strcmp(slice, "1:1"));
+
+
+  norm_vec[0] = +1; // high end
+  if ((status = nccf_inq_coord_bound(coordids[ndims - 1], norm_vec,
+					     is, ie))) ERR;
+  assert(is[0] == dims[0] - 1);
+  assert(ie[0] == dims[0] - 1);
+  if ((status = nccf_inq_coord_bound_slice(coordids[ndims - 1], 
+						   norm_vec, notflipped,  
+						   "C", slice))) ERR;
+  assert(!strcmp(slice, "9:9"));
+  if ((status = nccf_inq_coord_bound_slice(coordids[ndims - 1], 
+						   norm_vec, notflipped, 
+						   "Fortran", slice))) ERR;
+  assert(!strcmp(slice, "10:10"));
+  
+
+  /* 2d */
+  ndims = 2;
+  if ((status = nccf_def_lon_coord(ndims, dims, dimname2, data, save, 
+					&coordids[ndims - 1]))) ERR;
+
+  norm_vec[0] = -1; norm_vec[1] = 0;
+  if ((status = nccf_inq_coord_bound(coordids[ndims - 1], 
+					     norm_vec,
+					     is, ie))) ERR;
+  assert(is[0] == 0);
+  assert(is[1] == 0);
+  assert(ie[0] == 0);
+  assert(ie[1] == dims[1] - 1);
+  if ((status = nccf_inq_coord_bound_slice(coordids[ndims - 1], 
+						   norm_vec, notflipped,  
+						   "C", slice))) ERR;
+  assert(!strcmp(slice, "0:0 0:10"));
+  if ((status = nccf_inq_coord_bound_slice(coordids[ndims - 1], 
+						   norm_vec, notflipped, 
+						   "Fortran", slice))) ERR;
+  assert(!strcmp(slice, "1:11 1:1"));
+
+  norm_vec[0] = +1; norm_vec[1] = 0;
+  if ((status = nccf_inq_coord_bound(coordids[ndims - 1], 
+					     norm_vec,
+					     is, ie))) ERR;
+  assert(is[0] == dims[0] - 1);
+  assert(is[1] == 0);
+  assert(ie[0] == dims[0] - 1);
+  assert(ie[1] == dims[1] - 1);
+  if ((status = nccf_inq_coord_bound_slice(coordids[ndims - 1], 
+						   norm_vec, notflipped, 
+						   "C", slice))) ERR;
+  assert(!strcmp(slice, "9:9 0:10"));
+  if ((status = nccf_inq_coord_bound_slice(coordids[ndims - 1], 
+						   norm_vec, notflipped, 
+						   "Fortran", slice))) ERR;
+  assert(!strcmp(slice, "1:11 10:10"));
+  
+  norm_vec[0] = 0; norm_vec[1] = -1;
+  if ((status = nccf_inq_coord_bound(coordids[ndims - 1], 
+					     norm_vec,
+					     is, ie))) ERR;
+  assert(is[0] == 0);
+  assert(is[1] == 0);
+  assert(ie[0] == dims[0] - 1);
+  assert(ie[1] == 0);
+  if ((status = nccf_inq_coord_bound_slice(coordids[ndims - 1], 
+						   norm_vec, notflipped,
+						   "C", slice))) ERR;
+  assert(!strcmp(slice, "0:9 0:0"));
+  if ((status = nccf_inq_coord_bound_slice(coordids[ndims - 1], 
+						   norm_vec, notflipped,
+						   "Fortran", slice))) ERR;
+  assert(!strcmp(slice, "1:1 1:10"));
+
+  norm_vec[0] = 0; norm_vec[1] = +1;
+  if ((status = nccf_inq_coord_bound(coordids[ndims - 1], 
+					     norm_vec,
+					     is, ie))) ERR;
+  assert(is[0] == 0);
+  assert(is[1] == dims[1] - 1);
+  assert(ie[0] == dims[0] - 1);
+  assert(ie[1] == dims[1] - 1);
+  if ((status = nccf_inq_coord_bound_slice(coordids[ndims - 1], 
+						   norm_vec, notflipped,
+						   "C", slice))) ERR;
+  assert(!strcmp(slice, "0:9 10:10"));
+  if ((status = nccf_inq_coord_bound_slice(coordids[ndims - 1], 
+						   norm_vec, notflipped,
+						   "Fortran", slice))) ERR;
+  assert(!strcmp(slice, "11:11 1:10"));
+
+
+  if ((status = nccf_free_coord(coordids[1]))) ERR;
+  if ((status = nccf_free_coord(coordids[0]))) ERR;
+  
+  return 0;
+}
diff --git a/gridspec_api/coord/tst_lon.c b/gridspec_api/coord/tst_lon.c
new file mode 100644
index 0000000..73a2afa
--- /dev/null
+++ b/gridspec_api/coord/tst_lon.c
@@ -0,0 +1,98 @@
+/**
+ * Test creation of a longitude curvilinear coordinate
+ *
+ * $Id: tst_lon.c 767 2011-06-06 23:20:19Z pletzer $
+ */
+
+#include "nccf_coord.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <netcdf.h>
+#include <nccf_handle_error.h>
+
+int main() {
+
+  const int save = 0;
+  const int ndims = 2;
+  const int dims[] = {10, 11};
+  const double lonMin = 0.0;
+  const double lonMax = 360.0;
+  double dLon;
+  double *data;
+  int i, j;
+  int coordid, coordid2;
+  int status;
+  int ncid;
+
+  int ndims2;
+  int *dims2;
+  double *data2;
+  
+  const char *dimnames[] = {"ni", "nj"};
+
+  data = (double *) malloc(sizeof(double) * dims[0] * dims[1]);
+  dLon = (lonMax - lonMin) / (dims[0] - 1);
+  for (j = 0; j < dims[1]; ++j) {
+    for (i = 0; i < dims[0]; ++i) {
+      data[i + dims[0] * j] = lonMin + i * dLon;
+    }
+  }
+  
+  /* Define */
+
+  if ((status = nccf_def_lon_coord( ndims, dims, dimnames, 
+                                         data, save, &coordid))) ERR;
+
+  /* Add an attribute */
+  if ((status = nccf_add_coord_att(coordid, "to", 
+					"be or not to be"))) ERR;
+
+  /* Write to file */
+
+  if ((status = nc_create("tst_lon.nc", NC_CLOBBER, &ncid))) ERR;
+  if ((status = nccf_put_coord(coordid, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+
+  /* Read from file */
+  
+  if ((status = nccf_def_coord_from_file("tst_lon.nc", 
+					      "lon", &coordid2))) ERR;
+
+  /* Check */
+
+  if ((status = nccf_inq_coord_ndims(coordid, &ndims2))) ERR;
+  assert(ndims2 == ndims);
+  if ((status = nccf_inq_coord_ndims(coordid2, &ndims2))) ERR;
+  assert(ndims2 == ndims);  
+
+  dims2 = (int *) malloc(ndims2 * sizeof(int));
+  if ((status = nccf_inq_coord_dims(coordid, dims2))) ERR;
+  for (i = 0; i < ndims; ++i) {
+    assert(dims2[i] == dims[i]);
+  }
+  if ((status = nccf_inq_coord_dims(coordid2, dims2))) ERR;
+  for (i = 0; i < ndims; ++i) {
+    assert(dims2[i] == dims[i]);
+  }
+  free(dims2);
+
+  if ((status = nccf_get_coord_data_pointer(coordid, &data2))) ERR;
+  for (j = 0; j < dims[1]; ++j) {
+    for (i = 0; i < dims[0]; ++i) {
+      assert(data[i + dims[0] * j] == data2[i + dims[0] * j]);
+    }
+  }
+  if ((status = nccf_get_coord_data_pointer(coordid2, &data2))) ERR;
+  for (j = 0; j < dims[1]; ++j) {
+    for (i = 0; i < dims[0]; ++i) {
+      assert(data[i + dims[0] * j] == data2[i + dims[0] * j]);
+    }
+  }
+  
+  /* Free */
+
+  if ((status = nccf_free_coord(coordid))) ERR;
+  if ((status = nccf_free_coord(coordid2))) ERR;
+  free(data);
+  return status;
+}
diff --git a/gridspec_api/coord/tst_lonlat.c b/gridspec_api/coord/tst_lonlat.c
new file mode 100644
index 0000000..9ab9d00
--- /dev/null
+++ b/gridspec_api/coord/tst_lonlat.c
@@ -0,0 +1,63 @@
+/**
+ * Test copy-save switch in coordinate creation
+ *
+ * $Id: tst_lonlat.c 719 2011-04-26 17:39:51Z srinath22 $
+ */
+
+#include "nccf_coord.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <netcdf.h>
+#include <nccf_handle_error.h>
+
+int main() {
+
+  const int ndims = 2;
+  const int dims[] = {10, 11};
+  const double lonMin = 0.0;
+  const double lonMax = 360.0;
+  const double latMin = -90.0;
+  const double latMax =  90.0;
+  const int save = 1;
+  double dLon, dLat;
+  double *data, *lonData, *latData;
+  int i, j;
+  int lonId,latId;
+  int status;
+
+  const char *dimnames[] = {"ni", "nj"};
+
+  data = (double *) malloc(sizeof(double) * dims[0] * dims[1]);
+
+  /* Longitudes */
+  dLon = (lonMax - lonMin) / (dims[0] - 1);
+  for (j = 0; j < dims[1]; ++j) {
+    for (i = 0; i < dims[0]; ++i) {
+      data[i + dims[0] * j] = lonMin + i * dLon;
+    }
+  }
+  if ((status = nccf_def_lon_coord( ndims, dims, dimnames, data, save, 
+					 &lonId))) ERR;
+
+  /* Latitudes */
+  dLat = (latMax - latMin) / (dims[1] - 1);
+  for (j = 0; j < dims[1]; ++j) {
+    for (i = 0; i < dims[0]; ++i) {
+      data[i + dims[0] * j] = latMin + j * dLat;
+    }
+  }
+  if ((status = nccf_def_lat_coord( ndims, dims, dimnames, data, save, 
+					 &latId))) ERR;
+
+  /* Check that the lon and lat pointers are different */
+  if ((status = nccf_get_coord_data_pointer(lonId, &lonData))) ERR;
+  if ((status = nccf_get_coord_data_pointer(latId, &latData))) ERR;
+  assert(lonData != latData);
+  
+  /* Free */
+
+  if ((status = nccf_free_coord(lonId))) ERR;
+  if ((status = nccf_free_coord(latId))) ERR;
+  free(data);
+  return status;
+}
diff --git a/gridspec_api/coord/tst_lonlat_from_axes.c b/gridspec_api/coord/tst_lonlat_from_axes.c
new file mode 100644
index 0000000..76a6c0f
--- /dev/null
+++ b/gridspec_api/coord/tst_lonlat_from_axes.c
@@ -0,0 +1,70 @@
+/**
+ * Test creation of curvilinear coordinates from axes
+ *
+ * $Id: tst_lonlat_from_axes.c 775 2011-06-13 20:36:52Z pletzer $
+ */
+
+#include <nccf_axis.h>
+#include <nccf_coord.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <netcdf.h>
+#include <nccf_handle_error.h>
+
+int main() {
+
+  const int ndims = 2;
+  const int dims[] = {10, 11};
+  const double lonMin = 0.0;
+  const double lonMax = 360.0;
+  const double latMin = -90.0;
+  const double latMax =  90.0;
+  double dLon, dLat;
+  int i;
+  int lonId, latId;
+  int status;
+  // lon and lat axes need not be of the same type
+  float *lonData;
+  double *latData;
+  int axisids[ndims];
+  const int positive_up = 1;
+
+  dLon = (lonMax - lonMin) / (dims[0] - 1);
+  lonData = malloc(dims[0]*sizeof(float));
+  for (i = 0; i < dims[0]; ++i) {
+    lonData[i] = lonMin + dLon*i;
+  }
+  status = nccf_def_axis("longitude", dims[0], NC_FLOAT, 
+                         lonData, "longitude", "degrees_east", NCCF_LONGITUDE,
+                         "Y", positive_up, NULL, &axisids[0]); 
+  if (status) ERR;
+  free(lonData);
+
+  dLat = (latMax - latMin) / (dims[1] - 1);
+  latData = malloc(dims[1]*sizeof(double));
+  for (i = 0; i < dims[1]; ++i) {
+    latData[i] = latMin + dLat*i;
+  }
+  status = nccf_def_axis("latitude", dims[1], NC_DOUBLE, 
+                         latData, "latitude", "degrees_north", NCCF_LATITUDE,
+                         "X", positive_up, NULL, &axisids[1]);
+  if (status) ERR;
+  free(latData);
+
+  status = nccf_def_coord_from_axes(ndims, axisids, 0, "lon", 
+                                      "longitude", "degrees_east", &lonId);
+  if (status) ERR;
+  status = nccf_def_coord_from_axes(ndims, axisids, 1, "lat", 
+                                      "latitude", "degrees_north", &latId);
+  if (status) ERR;
+
+  
+  /* Free */
+
+  if ((status = nccf_free_coord(lonId))) ERR;
+  if ((status = nccf_free_coord(latId))) ERR;
+  for (i = 0; i < ndims; ++i) {
+    if ((status = nccf_free_axis(axisids[i]))) ERR;
+  }
+  return status;
+}
diff --git a/gridspec_api/data/Makefile.am b/gridspec_api/data/Makefile.am
new file mode 100644
index 0000000..177cd09
--- /dev/null
+++ b/gridspec_api/data/Makefile.am
@@ -0,0 +1,38 @@
+#
+# $Id: Makefile.am 733 2011-05-04 14:31:41Z edhartnett $
+#
+
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include	\
+-I$(srcdir)/../coord -I$(srcdir)/../global -I$(srcdir)/../grid
+
+include_HEADERS = nccf_data.h
+
+noinst_LTLIBRARIES = libnccf_data.la
+libnccf_data_la_SOURCES = nccf_def_data.c nccf_free_data.c		\
+nccf_set_data.h nccf_set_data.c nccf_put_data.c nccf_add_data_att.c	\
+nccf_inq_data_type.c nccf_get_data_pointer.c nccf_inq_data_gridid.c	\
+nccf_def_data_from_file.c nccf_inq_data_ndims.c nccf_inq_data_dims.c
+
+INTLIBS = libnccf_data.la ../grid/libnccf_grid.la	\
+../coord/libnccf_coord.la ../global/libnccf_global.la	\
+../../src/libcf_src.la
+
+EXTLIBS = -lnetcdf 
+
+noinst_PROGRAMS = tst_nccf_def_SD_from_grid
+
+check_PROGRAMS = tst_statdata tst_timedata 
+
+tst_statdata_SOURCES = tst_statdata.c 
+tst_statdata_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_timedata_SOURCES = tst_timedata.c 
+tst_timedata_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_nccf_def_SD_from_grid_SOURCES  =  tst_nccf_def_SD_from_grid.c
+tst_nccf_def_SD_from_grid_LDADD = $(INTLIBS) $(EXTLIBS)
+
+TESTS = $(check_PROGRAMS)
+
+# files generated by tests
+CLEANFILES = tst_statdata.nc tst_timedata.nc
diff --git a/gridspec/tools/make_vgrid/Makefile.in b/gridspec_api/data/Makefile.in
similarity index 66%
rename from gridspec/tools/make_vgrid/Makefile.in
rename to gridspec_api/data/Makefile.in
index eb62cbc..8d91ed4 100644
--- a/gridspec/tools/make_vgrid/Makefile.in
+++ b/gridspec_api/data/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,10 +15,11 @@
 
 @SET_MAKE@
 
-# This automake file is in charge of building the gridspec
-# make_vgrid tool.
+#
+# $Id: Makefile.am 733 2011-05-04 14:31:41Z edhartnett $
+#
+
 
-# $Id: Makefile.am,v 1.4 2009/11/16 14:17:46 zhi Exp $
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
@@ -39,37 +40,11 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-bin_PROGRAMS = make_vgrid$(EXEEXT)
- at USE_NETCDF_DIR_TRUE@am__append_1 = -I at NETCDFDIR@/include
- at USE_NETCDF_DIR_TRUE@am__append_2 = -L at NETCDFDIR@/lib
- at USE_NETCDF_DIR_TRUE@am__append_3 = -lnetcdf
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_4 = ../../../../libsrc4/libnetcdf.la 
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_5 = -I$(top_srcdir)/../libsrc4
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_6 = -L../../../../libsrc4
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_7 = ../../../../libsrc/libnetcdf.la 
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_8 = -I$(top_srcdir)/../libsrc
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_9 = -L../../../../libsrc
- at USE_NETCDF4_TRUE@am__append_10 = -lhdf5_hl -lhdf5 -lz 
- at USE_HDF4_TRUE@am__append_11 = -lmfhdf -ldf -ljpeg
-
-# If the user specified a root for HDF5, use it.
- at USE_HDF5_DIR_TRUE@am__append_12 = -I at HDF5DIR@/include
- at USE_HDF5_DIR_TRUE@am__append_13 = -L at HDF5DIR@/lib
-
-# If the user specified a prefix for the HDF4 library location, use it.
- at USE_HDF4_DIR_TRUE@am__append_14 = -I at HDF4DIR@/include
- at USE_HDF4_DIR_TRUE@am__append_15 = -L at HDF4DIR@/lib
-
-# If the user specified a root location for ZLIB, use it.
- at USE_ZLIB_DIR_TRUE@am__append_16 = -I at ZLIBDIR@/include
- at USE_ZLIB_DIR_TRUE@am__append_17 = -L at ZLIBDIR@/lib
-
-# If the user specified a root location for SZLIB, use it.
- at USE_SZLIB_DIR_TRUE@am__append_18 = -I at SZLIBDIR@/include
- at USE_SZLIB_DIR_TRUE@am__append_19 = -L at SZLIBDIR@/lib
-subdir = gridspec/tools/make_vgrid
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
-	$(srcdir)/run_tests.in
+noinst_PROGRAMS = tst_nccf_def_SD_from_grid$(EXEEXT)
+check_PROGRAMS = tst_statdata$(EXEEXT) tst_timedata$(EXEEXT)
+subdir = gridspec_api/data
+DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -78,17 +53,32 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
-CONFIG_CLEAN_FILES = run_tests
+CONFIG_HEADER = $(top_builddir)/cf_config.h \
+	$(top_builddir)/nfconfig.inc
+CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = "$(DESTDIR)$(bindir)"
-PROGRAMS = $(bin_PROGRAMS)
-am_make_vgrid_OBJECTS = make_vgrid.$(OBJEXT)
-make_vgrid_OBJECTS = $(am_make_vgrid_OBJECTS)
-make_vgrid_LDADD = $(LDADD)
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libnccf_data_la_LIBADD =
+am_libnccf_data_la_OBJECTS = nccf_def_data.lo nccf_free_data.lo \
+	nccf_set_data.lo nccf_put_data.lo nccf_add_data_att.lo \
+	nccf_inq_data_type.lo nccf_get_data_pointer.lo \
+	nccf_inq_data_gridid.lo nccf_def_data_from_file.lo \
+	nccf_inq_data_ndims.lo nccf_inq_data_dims.lo
+libnccf_data_la_OBJECTS = $(am_libnccf_data_la_OBJECTS)
+PROGRAMS = $(noinst_PROGRAMS)
+am_tst_nccf_def_SD_from_grid_OBJECTS =  \
+	tst_nccf_def_SD_from_grid.$(OBJEXT)
+tst_nccf_def_SD_from_grid_OBJECTS =  \
+	$(am_tst_nccf_def_SD_from_grid_OBJECTS)
 am__DEPENDENCIES_1 =
-make_vgrid_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__append_4) \
-	$(am__append_7) $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+tst_nccf_def_SD_from_grid_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_statdata_OBJECTS = tst_statdata.$(OBJEXT)
+tst_statdata_OBJECTS = $(am_tst_statdata_OBJECTS)
+tst_statdata_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_timedata_OBJECTS = tst_timedata.$(OBJEXT)
+tst_timedata_OBJECTS = $(am_tst_timedata_OBJECTS)
+tst_timedata_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -102,8 +92,35 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(make_vgrid_SOURCES)
-DIST_SOURCES = $(make_vgrid_SOURCES)
+SOURCES = $(libnccf_data_la_SOURCES) \
+	$(tst_nccf_def_SD_from_grid_SOURCES) $(tst_statdata_SOURCES) \
+	$(tst_timedata_SOURCES)
+DIST_SOURCES = $(libnccf_data_la_SOURCES) \
+	$(tst_nccf_def_SD_from_grid_SOURCES) $(tst_statdata_SOURCES) \
+	$(tst_timedata_SOURCES)
+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__installdirs = "$(DESTDIR)$(includedir)"
+HEADERS = $(include_HEADERS)
 ETAGS = etags
 CTAGS = ctags
 am__tty_colors = \
@@ -113,7 +130,6 @@ ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
 AR = @AR@
-AS = @AS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -134,15 +150,19 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-F77 = @F77@
 FC = @FC@
 FCFLAGS = @FCFLAGS@
 FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
+FCLIBS = @FCLIBS@
 FGREP = @FGREP@
 GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
+HAVE_DARWIN = @HAVE_DARWIN@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_LAPACK_LIB = @HAVE_LAPACK_LIB@
+HAVE_LAPACK_NO_UNDERSCORE = @HAVE_LAPACK_NO_UNDERSCORE@
+HAVE_LAPACK_UNDERSCORE = @HAVE_LAPACK_UNDERSCORE@
+HAVE_SHARED = @HAVE_SHARED@
+HAVE_UUID = @HAVE_UUID@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -157,8 +177,10 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 MOD_FLAG = @MOD_FLAG@
+NCDUMP = @NCDUMP@
 NCDUMPDIR = @NCDUMPDIR@
 NETCDFDIR = @NETCDFDIR@
 NM = @NM@
@@ -172,23 +194,23 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
 VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
 ac_ct_FC = @ac_ct_FC@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -220,7 +242,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -236,26 +257,31 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-make_vgrid_SOURCES = make_vgrid.c
-
-# Initalize these.
-AM_CPPFLAGS = -I$(top_srcdir)/gridspec/tools/shared \
-	-I$(top_srcdir)/gridspec/shared/mosaic $(am__append_1) \
-	$(am__append_5) $(am__append_8) $(am__append_12) \
-	$(am__append_14) $(am__append_16) $(am__append_18)
-AM_LDFLAGS = -L../shared -L../../shared/mosaic $(am__append_2) \
-	$(am__append_6) $(am__append_9) $(am__append_13) \
-	$(am__append_15) $(am__append_17) $(am__append_19)
-LDADD = -ltoolsshared -lshared -lnetcdf -lm $(am__append_3) \
-	$(am__append_4) $(am__append_7) $(am__append_10) \
-	$(am__append_11)
-TESTS = run_tests
-EXTRA_DIST = run_tests.in
-CLEANFILES = horizontal_grid.nc gs_horizontal_grid.nc		\
-horizontal_grid.cdl gs_horizontal_grid.cdl vertical_grid.nc	\
-gs_vertical_grid.nc vertical_grid.cdl gs_vertical_grid.cdl
-
-DISTCLEANFILES = run_tests
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include	\
+-I$(srcdir)/../coord -I$(srcdir)/../global -I$(srcdir)/../grid
+
+include_HEADERS = nccf_data.h
+noinst_LTLIBRARIES = libnccf_data.la
+libnccf_data_la_SOURCES = nccf_def_data.c nccf_free_data.c		\
+nccf_set_data.h nccf_set_data.c nccf_put_data.c nccf_add_data_att.c	\
+nccf_inq_data_type.c nccf_get_data_pointer.c nccf_inq_data_gridid.c	\
+nccf_def_data_from_file.c nccf_inq_data_ndims.c nccf_inq_data_dims.c
+
+INTLIBS = libnccf_data.la ../grid/libnccf_grid.la	\
+../coord/libnccf_coord.la ../global/libnccf_global.la	\
+../../src/libcf_src.la
+
+EXTLIBS = -lnetcdf 
+tst_statdata_SOURCES = tst_statdata.c 
+tst_statdata_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_timedata_SOURCES = tst_timedata.c 
+tst_timedata_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_nccf_def_SD_from_grid_SOURCES = tst_nccf_def_SD_from_grid.c
+tst_nccf_def_SD_from_grid_LDADD = $(INTLIBS) $(EXTLIBS)
+TESTS = $(check_PROGRAMS)
+
+# files generated by tests
+CLEANFILES = tst_statdata.nc tst_timedata.nc
 all: all-am
 
 .SUFFIXES:
@@ -269,9 +295,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec/tools/make_vgrid/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec_api/data/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign gridspec/tools/make_vgrid/Makefile
+	  $(AUTOMAKE) --foreign gridspec_api/data/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -290,54 +316,44 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-run_tests: $(top_builddir)/config.status $(srcdir)/run_tests.in
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-install-binPROGRAMS: $(bin_PROGRAMS)
-	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	for p in $$list; do echo "$$p $$p"; done | \
-	sed 's/$(EXEEXT)$$//' | \
-	while read p p1; do if test -f $$p || test -f $$p1; \
-	  then echo "$$p"; echo "$$p"; else :; fi; \
-	done | \
-	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
-	sed 'N;N;N;s,\n, ,g' | \
-	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
-	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
-	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
-	    else { print "f", $$3 "/" $$4, $$1; } } \
-	  END { for (d in files) print "f", d, files[d] }' | \
-	while read type dir files; do \
-	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
-	    test -z "$$files" || { \
-	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
-	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
-	    } \
-	; done
-
-uninstall-binPROGRAMS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	files=`for p in $$list; do echo "$$p"; done | \
-	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-	      -e 's/$$/$(EXEEXT)/' `; \
-	test -n "$$list" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(bindir)" && rm -f $$files
-
-clean-binPROGRAMS:
-	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libnccf_data.la: $(libnccf_data_la_OBJECTS) $(libnccf_data_la_DEPENDENCIES) 
+	$(LINK)  $(libnccf_data_la_OBJECTS) $(libnccf_data_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
-make_vgrid$(EXEEXT): $(make_vgrid_OBJECTS) $(make_vgrid_DEPENDENCIES) 
-	@rm -f make_vgrid$(EXEEXT)
-	$(LINK) $(make_vgrid_OBJECTS) $(make_vgrid_LDADD) $(LIBS)
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_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
+tst_nccf_def_SD_from_grid$(EXEEXT): $(tst_nccf_def_SD_from_grid_OBJECTS) $(tst_nccf_def_SD_from_grid_DEPENDENCIES) 
+	@rm -f tst_nccf_def_SD_from_grid$(EXEEXT)
+	$(LINK) $(tst_nccf_def_SD_from_grid_OBJECTS) $(tst_nccf_def_SD_from_grid_LDADD) $(LIBS)
+tst_statdata$(EXEEXT): $(tst_statdata_OBJECTS) $(tst_statdata_DEPENDENCIES) 
+	@rm -f tst_statdata$(EXEEXT)
+	$(LINK) $(tst_statdata_OBJECTS) $(tst_statdata_LDADD) $(LIBS)
+tst_timedata$(EXEEXT): $(tst_timedata_OBJECTS) $(tst_timedata_DEPENDENCIES) 
+	@rm -f tst_timedata$(EXEEXT)
+	$(LINK) $(tst_timedata_OBJECTS) $(tst_timedata_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -345,7 +361,20 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/make_vgrid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_add_data_att.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_data.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_data_from_file.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_free_data.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_get_data_pointer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_data_dims.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_data_gridid.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_data_ndims.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_data_type.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_put_data.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_set_data.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_def_SD_from_grid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_statdata.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_timedata.Po at am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -376,6 +405,26 @@ mostlyclean-libtool:
 
 clean-libtool:
 	-rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	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|^.*/||'`; \
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(includedir)" && rm -f $$files
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -552,11 +601,12 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
-all-am: Makefile $(PROGRAMS)
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
 installdirs:
-	for dir in "$(DESTDIR)$(bindir)"; do \
+	for dir in "$(DESTDIR)$(includedir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-am
@@ -581,14 +631,14 @@ 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-am
 
-clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES clean-noinstPROGRAMS mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -608,13 +658,13 @@ info: info-am
 
 info-am:
 
-install-data-am:
+install-data-am: install-includeHEADERS
 
 install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am: install-binPROGRAMS
+install-exec-am:
 
 install-html: install-html-am
 
@@ -654,23 +704,24 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-binPROGRAMS
+uninstall-am: uninstall-includeHEADERS
 
 .MAKE: check-am install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
-	clean-binPROGRAMS clean-generic clean-libtool ctags distclean \
+	clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES clean-noinstPROGRAMS ctags distclean \
 	distclean-compile distclean-generic distclean-libtool \
 	distclean-tags distdir dvi dvi-am html html-am info info-am \
-	install install-am install-binPROGRAMS install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
+	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 installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-binPROGRAMS
+	tags uninstall uninstall-am uninstall-includeHEADERS
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/gridspec_api/data/nccf_add_data_att.c b/gridspec_api/data/nccf_add_data_att.c
new file mode 100644
index 0000000..da3d1f0
--- /dev/null
+++ b/gridspec_api/data/nccf_add_data_att.c
@@ -0,0 +1,42 @@
+/**
+ * $Id: nccf_add_data_att.c 923 2012-03-22 18:44:09Z dkindig $
+ */
+
+#include <nccf_data.h>
+
+/**
+ * \ingroup gs_data_grp
+ * Add attribute to object.
+ *
+ * \param dataid data ID
+ * \param name attribute name
+ * \param value attribute value
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_add_data_att(int dataid, 
+			     const char *name, const void *valuep) {
+
+  nc_type dataType;
+  struct nccf_data_type *self;
+  self = nccf_li_find(&CFLIST_STRUCTURED_DATA, dataid);
+  
+  nccf_inq_data_type( dataid, &dataType );
+
+  if( dataType == NC_CHAR ){
+    nccf_varSetAttribText(&self->dataVar, name, ( char* )valuep);
+  }
+  else if( dataType == NC_FLOAT ){
+    nccf_varSetAttribFloat(&self->dataVar, name, *(float*)valuep);
+  }
+  else if( dataType == NC_DOUBLE ){
+    nccf_varSetAttribDouble(&self->dataVar, name, *(double*)valuep);
+  }
+  else if( dataType == NC_INT ){
+    nccf_varSetAttribInt(&self->dataVar, name, *(int*)valuep);
+  }
+
+  return NC_NOERR;
+  
+}
diff --git a/gridspec_api/data/nccf_data.h b/gridspec_api/data/nccf_data.h
new file mode 100644
index 0000000..0ad78a5
--- /dev/null
+++ b/gridspec_api/data/nccf_data.h
@@ -0,0 +1,94 @@
+/**
+ * API for data on curvilinear coordinates
+ *
+ * $Id: nccf_data.h 923 2012-03-22 18:44:09Z dkindig $
+ */
+
+#ifndef _NCCF_STRUCTURED_DATA_H
+#define _NCCF_STRUCTURED_DATA_H
+
+#include <netcdf.h>
+#include <libcf_src.h>
+#include <cflistitem.h>
+#include <nccf_varObj.h>
+#include <nccf_handle_error.h>
+#include <nccf_constants.h>
+
+extern struct CFLISTITEM *CFLIST_STRUCTURED_DATA;
+
+struct nccf_data_type {
+
+  /* grid object to which the data are attach to */
+  int gridid;
+
+  /* type of data (compatible with netcdf types) */
+  nc_type dataType;
+
+  /* name of the data */
+  char *name;
+
+  /* number of dimensions */
+  int ndims;
+
+  /* netcdf-like variable object */
+  struct nccf_var_obj *dataVar;
+
+  /* whether or not data are copy-saved by the object */
+  int save;
+
+  /* number of written records */
+  int numRecords;
+
+  /* pointer to the data */
+  void *data;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int nccf_def_data(int gridid, const char *name, 
+		  const char *standard_name,
+		  const char *units, const char *time_dimname,
+		  int *dataid);
+
+int nccf_def_data_from_file(const char *filename, 
+			    int gridid, const char *varname, 
+			    int read_data, int *dataid);
+
+int nccf_free_data(int dataid);
+
+int nccf_inq_data_gridid(int dataid, int *gridid);
+
+int nccf_set_data_double(int dataid, const double *data, 
+			 int save, double fill_value);
+
+int nccf_set_data_float(int dataid, const float *data, 
+			int save, float fill_value);
+
+int nccf_set_data_int(int dataid, const int *data, 
+		      int save, int fill_value);
+
+int nccf_set_data_short(int dataid, const short *data, 
+			int save, short fill_value);
+
+int nccf_put_data(int ncid, int dataid);
+
+int nccf_add_data_att(int dataid, 
+		      const char *name, const void *value);
+
+int nccf_inq_data_type(int dataid, nc_type *dataType);
+
+int nccf_get_data_pointer(int dataid, nc_type *xtypep, 
+			  void **dataPtr, const void **fill_valuep);
+
+int nccf_inq_data_ndims(int dataid, int *nDataDims);
+  
+int nccf_inq_data_dims(int dataid, int *dataDims);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // _NCCF_STRUCTURED_DATA_H
+
diff --git a/gridspec_api/data/nccf_def_data.c b/gridspec_api/data/nccf_def_data.c
new file mode 100644
index 0000000..32637c6
--- /dev/null
+++ b/gridspec_api/data/nccf_def_data.c
@@ -0,0 +1,143 @@
+/**
+ * $Id: nccf_def_data.c 842 2011-09-30 13:41:35Z pletzer $
+ */
+
+#include <nccf_data.h>
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <string.h>
+#include <stdio.h>
+
+/*! \defgroup gs_data_grp Structured data
+  \ingroup gridspec_grp
+
+Each structured grid can have data attached. Data objects refer to grid
+objects and are defined on a per tile basis.
+*/
+
+struct CFLISTITEM *CFLIST_STRUCTURED_DATA;
+
+/**
+ * \ingroup gs_data_grp
+ * Define data object (constructor).
+ *
+ * \param gridid structured grid object Id
+ * \param name name of data object
+ * \param standard_name CF standard name attribute of the data (or NULL if no standard_name)
+ * \param units CF units attribute of the data (or NULL if no units)
+ * \param time_dimname name of time dimension (or NULL if time independent)
+ * \param dataid (output) ID
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_def_data(int gridid,
+      const char *name, const char *standard_name,
+      const char *units, const char *time_dimname, int *dataid) {
+
+  int totError = NC_NOERR;
+  int status, i;
+  const char *space = " ";
+  char coordName[STRING_SIZE];
+
+  /* Create the object */
+  struct nccf_data_type *self;
+  self = (struct nccf_data_type *)
+    malloc(sizeof(struct nccf_data_type));
+
+  /* Default initialization */
+  self->gridid = gridid;
+  self->dataType = NC_NAT;
+  self->name = NULL;
+  self->ndims = 0;
+  self->dataVar = NULL;
+  self->save = 0;
+  self->numRecords = 0;
+  self->data = NULL;
+
+  /* Fill in members */
+  self->name = (char*) calloc(STRING_SIZE, sizeof( char ));
+  sprintf(self->name, "%s", name);
+
+  /* Create and populate netcdf-like variable */
+  nccf_varCreate(&self->dataVar, name);
+  if (standard_name != NULL) {
+    nccf_varSetAttribText(&self->dataVar, CF_ATTNAME_STANDARD_NAME, 
+			  standard_name);
+  }
+  if (units != NULL) {
+    nccf_varSetAttribText(&self->dataVar, CF_ATTNAME_UNITS, units);
+  }
+
+  /* Determine the list of coordinate names */
+  status = nccf_inq_grid_ndims(gridid, &self->ndims);
+  totError += abs(status);
+  int coordIds[self->ndims];
+  status = nccf_inq_grid_coordids(gridid, coordIds);
+  totError += abs(status);
+  char *coordNames = (char *) calloc(self->ndims * STRING_SIZE, sizeof(char));
+  for (i = 0; i < self->ndims; ++i) {
+    status = nccf_inq_coord_name(coordIds[i], coordName);
+    totError += abs(status);
+    strcat(coordNames, coordName);
+    if (i < self->ndims - 1) strcat(coordNames, space);
+  }
+  nccf_varSetAttribText(&self->dataVar, CF_COORDINATES, coordNames);
+  free(coordNames);
+
+  /* Set the variable dimension names and sizes */
+  int *dims;
+  dims = malloc(self->ndims * sizeof(int));
+  status = nccf_inq_coord_dims(coordIds[0], dims);
+  totError += abs(status);
+
+  char **dimNames;
+  dimNames = (char **) malloc( self->ndims * sizeof(char *));
+  for (i = 0; i < self->ndims; ++i) {
+    dimNames[i] = (char *) calloc(STRING_SIZE, sizeof(char));
+  }
+  status = nccf_inq_coord_dimnames(coordIds[0], dimNames);
+  totError += abs(status);
+
+  if (!time_dimname || strcmp(time_dimname, "") == 0) {
+    /* static data */
+    nccf_varSetDims(&self->dataVar, self->ndims, dims, 
+		    (const char **) dimNames);
+  }
+  else {
+    /* add time axis */
+    int ndimsTime = self->ndims + 1;
+    int dimsTime[ndimsTime];
+    char **dimNamesTime = malloc( ndimsTime * sizeof(char *));
+    for (i = 0; i < ndimsTime; ++i) {
+      dimNamesTime[i] = (char *) calloc(STRING_SIZE, sizeof(char));
+    }
+
+    dimsTime[0] = NC_UNLIMITED;
+    strncpy(dimNamesTime[0], time_dimname, STRING_SIZE);
+    for (i = 0; i < self->ndims; ++i) {
+      dimsTime[i + 1] = dims[i];
+      strncpy(dimNamesTime[i + 1], dimNames[i], STRING_SIZE);
+    }
+    nccf_varSetDims(&self->dataVar, ndimsTime, dimsTime, 
+		    (const char **)dimNamesTime);
+
+    for (i = 0; i < ndimsTime; ++i) {
+      free( dimNamesTime[i] );
+    }
+    free(dimNamesTime);
+  }
+
+
+  for (i = 0; i < self->ndims; ++i) {
+    free(dimNames[i]);
+  }
+  free(dimNames);
+  free(dims);
+
+  /* Add the objet to the list */
+  if (CFLIST_STRUCTURED_DATA == NULL) nccf_li_new(&CFLIST_STRUCTURED_DATA);
+  *dataid = nccf_li_add(&CFLIST_STRUCTURED_DATA, self);
+
+  return NC_NOERR;			     
+}
diff --git a/gridspec_api/data/nccf_def_data_from_file.c b/gridspec_api/data/nccf_def_data_from_file.c
new file mode 100644
index 0000000..19c7f0e
--- /dev/null
+++ b/gridspec_api/data/nccf_def_data_from_file.c
@@ -0,0 +1,78 @@
+/**
+ * $Id: nccf_def_data_from_file.c 869 2011-11-29 20:12:54Z pletzer $
+ */
+
+#include <nccf_data.h>
+#include <stdio.h>
+#include <string.h>
+#include <nccf_grid.h>
+#include <nccf_coord.h>
+
+/**
+ * \ingroup gs_data_grp
+ * Define data object from netcdf file (constructor).
+ *
+ * \param filename name of the netcdf file
+ * \param gridid Id of the grid object associated with the data
+ * \param varname variable name of the data object stored in file
+ * \param read_data set to 1 if data should be read, 0 otherwise
+ * \param dataid (output) ID
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_def_data_from_file(const char *filename,
+                            int gridid, const char *varname,
+                            int read_data, int *dataid) {
+
+  int status;
+  int totError = 0;
+  int ncid;
+  const char *coordinates;
+  float *data;
+
+  /* Open the file read the structure */
+  status = nc_open(filename, NC_CLOBBER, &ncid );
+  if (status != NC_NOERR) return status;
+  totError += abs(status);
+
+  /* Create the object */
+  struct nccf_data_type *self;
+  self = (struct nccf_data_type *)
+    malloc(sizeof(struct nccf_data_type));
+
+  /* Default initialization */
+  self->save = 0;
+  self->data = NULL;
+  self->gridid = gridid;
+
+  /* Fill in members */
+  self->name = (char*) calloc(STRING_SIZE, sizeof( char ));
+  sprintf(self->name, "%s", varname);
+
+  /* Create the data object for the given variable */
+  const int keep_type = 0;
+  status = nccf_varCreateFromFile(&self->dataVar, varname, ncid, 
+                                  read_data, keep_type);
+  totError += abs(status);
+
+  /* Get data size information */
+  nccf_varGetNumDims( &self->dataVar, &self->ndims );
+
+  /* Get the data */
+  nccf_varGetDataPtr( &self->dataVar,( void **) &data );
+  totError += abs(status);
+
+  /* Find the coordinate object associated with the above data */
+  nccf_varGetAttribPtr(&self->dataVar, CF_COORDINATES, 
+		       (const void **) &coordinates);
+
+  if ((status = nc_close(ncid))) ERR;
+  totError += abs(status);
+
+  /* Add the objet to the list */
+  if (CFLIST_STRUCTURED_DATA == NULL) nccf_li_new(&CFLIST_STRUCTURED_DATA);
+  *dataid = nccf_li_add(&CFLIST_STRUCTURED_DATA, self);
+
+  return totError;
+}
diff --git a/gridspec_api/data/nccf_free_data.c b/gridspec_api/data/nccf_free_data.c
new file mode 100644
index 0000000..b59292a
--- /dev/null
+++ b/gridspec_api/data/nccf_free_data.c
@@ -0,0 +1,44 @@
+/**
+ * $Id: nccf_free_data.c 918 2012-02-07 22:10:36Z pletzer $
+ */
+
+#include <nccf_data.h>
+
+/**
+ * \ingroup gs_data_grp
+ * Free object (destructor).
+ *
+ * \param dataid ID
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_free_data(int dataid) {
+
+    struct nccf_data_type *self;
+    self = nccf_li_remove(&CFLIST_STRUCTURED_DATA, dataid);
+    if( nccf_li_get_nelem( &CFLIST_STRUCTURED_DATA ) == 0 )
+        nccf_li_del( &CFLIST_STRUCTURED_DATA );
+
+    /* Clean up */
+    
+    if (self->name) {
+      free(self->name);
+      self->name = NULL;
+    }
+
+    if (self->save) {
+      if (self->data) {
+        /* object owns the data */
+        free(self->data);
+        self->data = NULL;
+      }
+    }
+
+    nccf_varDestroy(&self->dataVar);
+
+    free(self);
+    self = NULL;
+
+    return NC_NOERR;
+}
diff --git a/gridspec_api/data/nccf_get_data_pointer.c b/gridspec_api/data/nccf_get_data_pointer.c
new file mode 100644
index 0000000..feaae19
--- /dev/null
+++ b/gridspec_api/data/nccf_get_data_pointer.c
@@ -0,0 +1,36 @@
+/**
+ * $Id: nccf_get_data_pointer.c 738 2011-05-06 22:26:09Z edhartnett $
+ */
+
+#include <nccf_data.h>
+
+/**
+ * \ingroup gs_data_grp
+ * Get pointer to the data.
+ *
+ * \param dataid data ID
+ * \param xtypep (output) pointer to the data type value
+ * \param dataPtr (output) pointer to the data
+ * \param fill_valuep (output) pointer to the fill (missing) value
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_get_data_pointer(int dataid, nc_type *xtypep, 
+				 void **dataPtr, const void **fill_valuep){
+
+  int status;
+  int totError = 0;
+  struct nccf_data_type *self;
+  self = nccf_li_find(&CFLIST_STRUCTURED_DATA, dataid);
+
+  int len;
+  status = nccf_varInqAttrib(&self->dataVar, "_FillValue", xtypep, &len);
+  totError += abs(status);
+  status = nccf_varGetAttribPtr(&self->dataVar, "_FillValue", fill_valuep);
+  totError += abs(status);
+  status = nccf_varGetDataPtr(&self->dataVar, dataPtr);
+  totError += abs(status);
+
+  return totError;
+}
diff --git a/gridspec_api/data/nccf_inq_data_dims.c b/gridspec_api/data/nccf_inq_data_dims.c
new file mode 100644
index 0000000..82a7952
--- /dev/null
+++ b/gridspec_api/data/nccf_inq_data_dims.c
@@ -0,0 +1,35 @@
+/**
+ * Get the number of dimensions used by data variable
+ *
+ * "$Id: nccf_inq_data_dims.c 738 2011-05-06 22:26:09Z edhartnett $"
+ */
+
+#include <nccf_data.h>
+#include <nccf_varObj.h>
+
+/**
+ * \ingroup gs_data_grp
+ * Get the dimensions of the data
+ *
+ * \param dataid data ID
+ * \param dims dimensions (sizes) along each axis
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_inq_data_dims( int dataid, int dims[] ){
+  
+  struct nccf_data_type *self;
+  self = nccf_li_find(&CFLIST_STRUCTURED_DATA, dataid);
+
+  int *dimVar;
+  nccf_varGetDimsPtr(&self->dataVar, &dimVar);
+
+  int i;
+  for( i = 0; i < self->ndims; i++ ){
+    dims[i] = dimVar[i];
+  }
+  
+  return NC_NOERR;
+}
+
diff --git a/gridspec_api/data/nccf_inq_data_gridid.c b/gridspec_api/data/nccf_inq_data_gridid.c
new file mode 100644
index 0000000..91bb654
--- /dev/null
+++ b/gridspec_api/data/nccf_inq_data_gridid.c
@@ -0,0 +1,24 @@
+/**
+ * $Id: nccf_inq_data_gridid.c 738 2011-05-06 22:26:09Z edhartnett $
+ */
+
+#include <nccf_data.h>
+
+/**
+ * \ingroup gs_data_grp
+ * Get the undelying grid Id
+ * \param dataid ID
+ * \param gridid Id of the grid
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_inq_data_gridid(int dataid, int *gridid){
+
+  struct nccf_data_type *self;
+  self = nccf_li_find(&CFLIST_STRUCTURED_DATA, dataid);
+
+  *gridid = self->gridid;
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/data/nccf_inq_data_ndims.c b/gridspec_api/data/nccf_inq_data_ndims.c
new file mode 100644
index 0000000..7a6f7a6
--- /dev/null
+++ b/gridspec_api/data/nccf_inq_data_ndims.c
@@ -0,0 +1,29 @@
+/**
+ * Get the number of dimensions used by data variable
+ *
+ * "$Id: nccf_inq_data_ndims.c 738 2011-05-06 22:26:09Z edhartnett $"
+ */
+
+#include <nccf_data.h>
+#include <nccf_varObj.h>
+
+/**
+ * \ingroup gs_data_grp
+ * Get the number of dimensions of the data
+ *
+ * \param dataid data ID
+ * \param nDataDims number of dimensions
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_inq_data_ndims( int dataid, int *nDataDims ){
+  
+   struct nccf_data_type *self;
+   self = nccf_li_find(&CFLIST_STRUCTURED_DATA, dataid);
+
+   *nDataDims = self->ndims;
+
+  return NC_NOERR;
+
+}
diff --git a/gridspec_api/data/nccf_inq_data_type.c b/gridspec_api/data/nccf_inq_data_type.c
new file mode 100644
index 0000000..e2e7025
--- /dev/null
+++ b/gridspec_api/data/nccf_inq_data_type.c
@@ -0,0 +1,25 @@
+/**
+ * $Id: nccf_inq_data_type.c 738 2011-05-06 22:26:09Z edhartnett $
+ */
+
+#include <nccf_data.h>
+
+/**
+ * \ingroup gs_data_grp
+ * Get data type.
+ *
+ * \param dataid data ID
+ * \param dataType (output) netcdf data type
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_inq_data_type(int dataid, nc_type *dataType){
+
+  struct nccf_data_type *self;
+  self = nccf_li_find(&CFLIST_STRUCTURED_DATA, dataid);
+
+  nccf_varGetDataType(&self->dataVar, dataType);
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/data/nccf_put_data.c b/gridspec_api/data/nccf_put_data.c
new file mode 100644
index 0000000..150fb19
--- /dev/null
+++ b/gridspec_api/data/nccf_put_data.c
@@ -0,0 +1,40 @@
+/**
+ * Write structured data to file
+ *
+ * $Id: nccf_put_data.c 767 2011-06-06 23:20:19Z pletzer $
+ */
+
+#include "nccf_data.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <netcdf.h>
+
+/**
+ * \ingroup gs_data_grp
+ * Write object to netcdf file.
+ *
+ * \param dataid data ID
+ * \param ncid netcdf file ID
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_put_data(int dataid, int ncid) {
+
+  int status = NC_NOERR;
+  struct nccf_data_type *self;
+  self = nccf_li_find(&CFLIST_STRUCTURED_DATA, dataid);
+
+  // Write data to file
+  if( self->numRecords == 0 ){
+    status = nccf_writeListOfVars(ncid, 1, self->dataVar);
+  } else {
+    status = nccf_writeListOfVarData(ncid, 1, self->dataVar);
+  }
+
+  self->numRecords++;
+
+  return status;
+}
diff --git a/gridspec_api/data/nccf_set_data.c b/gridspec_api/data/nccf_set_data.c
new file mode 100644
index 0000000..4c3cbef
--- /dev/null
+++ b/gridspec_api/data/nccf_set_data.c
@@ -0,0 +1,101 @@
+/*
+ * $Id: nccf_set_data.c 822 2011-09-13 14:39:33Z pletzer $
+ */
+
+#include <nccf_data.h>
+#include <nccf_grid.h>
+#include <nccf_coord.h>
+#include <stdlib.h>
+
+/**
+ * \ingroup gs_data_grp
+ * Set the data to a double array, this will add a new record if the 
+ * data are time dependent.
+ *
+ * \param dataid data ID
+ * \param data flat data array
+ * \param save != 0 in order to copy-save the data
+ * \param fill_value default value for unset data (e.g. NC_FILL_DOUBLE)
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_set_data_double(int dataid, const double *data, int save, double fill_value) {
+#define _type_ double
+#define _nc_type_ NC_DOUBLE
+#define _nccf_varSetAttribTYPE_ nccf_varSetAttribDouble
+#include "nccf_set_data.h"
+#undef _type_ 
+#undef _nc_type_ 
+#undef _nccf_varSetAttribTYPE_
+}
+
+/**
+ * \ingroup gs_data_grp
+ * Set the data to a float array, this will add a new record if the 
+ * data are time dependent.
+ *
+ * \param dataid data ID
+ * \param data flat data array
+ * \param save != 0 in order to copy-save the data
+ * \param fill_value default value for unset data (e.g. NC_FILL_FLOAT)
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_set_data_float(int dataid, const float *data, int save, float fill_value) {
+#define _type_ float
+#define _nc_type_ NC_FLOAT
+#define _nccf_varSetAttribTYPE_ nccf_varSetAttribFloat
+#include "nccf_set_data.h"
+#undef _type_ 
+#undef _nc_type_ 
+#undef _nccf_varSetAttribTYPE_
+}
+
+/**
+ * \ingroup gs_data_grp
+ * Set the data to an int array, this will add a new record if the 
+ * data are time dependent.
+ *
+ * \param dataid data ID
+ * \param data flat data array
+ * \param save != 0 in order to copy-save the data
+ * \param fill_value default value for unset data (e.g. NC_FILL_INT)
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_set_data_int(int dataid, const int *data, int save, int fill_value) {
+#define _type_ int
+#define _nc_type_ NC_INT
+#define _nccf_varSetAttribTYPE_ nccf_varSetAttribInt
+#include "nccf_set_data.h"
+#undef _type_ 
+#undef _nc_type_ 
+#undef _nccf_varSetAttribTYPE_
+}
+
+/**
+ * \ingroup gs_data_grp
+ * Set the data to a short array, this will add a new record if the 
+ * data are time dependent.
+ *
+ * \param dataid data ID
+ * \param data flat data array
+ * \param save != 0 in order to copy-save the data
+ * \param fill_value default value for unset data (e.g. NC_FILL_SHORT)
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_set_data_short(int dataid, const short *data, int save, short fill_value) {
+#define _type_ short
+#define _nc_type_ NC_SHORT
+#define _meth_name_ nccf_set_data_short
+#define _nccf_varSetAttribTYPE_ nccf_varSetAttribShort
+#include "nccf_set_data.h"
+#undef _type_ 
+#undef _nc_type_ 
+#undef _nccf_varSetAttribTYPE_
+}
diff --git a/gridspec_api/data/nccf_set_data.h b/gridspec_api/data/nccf_set_data.h
new file mode 100644
index 0000000..d2949ba
--- /dev/null
+++ b/gridspec_api/data/nccf_set_data.h
@@ -0,0 +1,62 @@
+/**
+ * $Id: nccf_set_data.h 770 2011-06-08 03:08:35Z pletzer $
+ */
+
+// generic data setter written with the idea that the preprocessor
+// will fill in anything that starts with _ and ends with _
+
+  int status = 0;
+  int totError = 0;
+  _type_ * dataBuff;
+
+  struct nccf_data_type *self;
+  self = nccf_li_find(&CFLIST_STRUCTURED_DATA, dataid);
+
+  /* set the netcdf data type */
+  self->dataType = _nc_type_;
+
+  /* set the default fill value */
+  _nccf_varSetAttribTYPE_(&self->dataVar, "_FillValue", fill_value);
+
+  nc_type dataType;
+  nccf_varGetDataType(&self->dataVar, &dataType);
+  if (!save) {
+    self->data = (void *) data;
+    nccf_varSetDataPtr(&self->dataVar, _nc_type_, self->data);
+  }
+  else if(dataType == NC_NAT || dataType == _nc_type_) {
+    /* make sure the type is not changing */
+    /* number of space dimensions */
+    int ndims;
+    status = nccf_inq_grid_ndims(self->gridid, &ndims);
+    totError += abs(status);
+    /* dimensions */
+    int coordIds[ndims];
+    status = nccf_inq_grid_coordids(self->gridid, coordIds);
+    totError += abs(status);
+    int dims[ndims];
+    status = nccf_inq_coord_dims(coordIds[0], dims);
+    totError += abs(status);
+    /* compute tot number of elements */
+    int ntot = 1;
+    int i;
+    for (i = 0; i < ndims; ++i) {
+      ntot *= dims[i];
+    }
+    /* allocate and copy the data */
+    dataBuff = (_type_ *) malloc( ntot * sizeof(_type_) );
+    for (i = 0; i < ntot; ++i) {
+      dataBuff[i] = data[i];
+    }
+    self->data = (void *) dataBuff;
+    nccf_varSetDataPtr(&self->dataVar, _nc_type_, self->data);
+    self->save = 1;
+  }
+  else {
+    /* no op, cannot reset data of a different type */
+    totError += 1;
+    return totError;
+  }
+
+  return totError;
+
diff --git a/gridspec_api/data/tst_nccf_def_SD_from_grid.c b/gridspec_api/data/tst_nccf_def_SD_from_grid.c
new file mode 100644
index 0000000..41139eb
--- /dev/null
+++ b/gridspec_api/data/tst_nccf_def_SD_from_grid.c
@@ -0,0 +1,89 @@
+/**
+ * Unit test for nccf_def_data_from_file
+ *
+ * "$Id: tst_nccf_def_SD_from_grid.c 851 2011-11-08 14:37:20Z pletzer $"
+ */
+
+#include "nccf_data.h"
+#include <assert.h>
+#include <stdio.h>
+#include "nccf_grid.h"
+#include "nccf_coord.h"
+#include "nccf_constants.h"
+
+int
+main(){
+
+  const char* filename = "tst_timedata.nc";
+  const char* varname  = "p";
+  int status = NC_NOERR, read_data = 1, i, ndims, ncid;
+  int nGrids = 1;
+  int dataid, *gridids, nDatadims, ntot;
+  nc_type type;
+  float *data;
+  char *coordNames[] = {"x", "y", "z"};
+  char tilename[STRING_SIZE];
+  float *fv = NULL;
+
+  /* Get the dimensions */
+  status = nc_open( filename, NC_NOWRITE, &ncid );
+  if ( status > 0 ) return status;
+  if ( status ) ERR;
+  if ((status = nc_inq_ndims( ncid, &ndims ))) ERR;
+  if ((status = nc_close( ncid ))) ERR;
+
+  /* Get the grids 
+   * NOTE: ndims -1 is because we only have x, y, z as defined coordinates 
+   *       time is a dimension and used in the data, but no values are given 
+   *       for the time dimension */
+  gridids = (int *) malloc(nGrids * sizeof(int));
+  if ((status = nccf_def_grid_from_file( filename,
+						ndims-1, (const char**)coordNames, tilename, &gridids[0]))) ERR;
+
+  if ((status = nccf_def_data_from_file( filename, gridids[0], varname,
+						read_data, &dataid))) ERR;
+
+  /* Inquire about the dimensionality of the data */
+  if ((status = nccf_inq_data_ndims(dataid, &nDatadims))) ERR;
+  int dataDims[nDatadims];
+  if ((status = nccf_inq_data_dims(dataid, dataDims))) ERR;
+
+  ntot = 1;
+  for( i = 0; i < nDatadims; i++ ) {
+    ntot *= dataDims[i];
+  }
+
+  /* Get the data */
+  if ((status = nccf_inq_data_type(dataid, &type))) ERR;
+  nc_type xtype;
+  if ((status = nccf_get_data_pointer(dataid, &xtype, 
+					     (void **) &data, 
+					     (const void **) &fv ))) ERR;
+
+  /* Make some assertions */
+  assert(dataid == 0);
+  assert(type   == 5);
+  assert(ntot   == 21483);
+  assert(abs( *fv - NC_FILL_FLOAT ) < 1.e-7);
+
+  /* This fails in valgrind for some reason */
+  int ind = ntot-2;
+  assert( data[ind] >= 1.99 );
+
+  /* Clean up */
+  int *coordIds;
+  coordIds = ( int* )malloc((ndims-1) * sizeof(int));
+  if ((status = nccf_inq_grid_coordids( gridids[0], coordIds))) ERR;
+  for (i = 0; i < ndims-1; i++) {
+    if ((status = nccf_free_coord(coordIds[i]))) ERR;
+  }
+  for (i = 0; i < nGrids; i++) {
+    if ((status = nccf_free_grid(gridids[i]))) ERR;
+  }
+  if ((status = nccf_free_data( dataid ))) ERR;
+
+  free(coordIds);
+  free(gridids);
+
+  return status;
+}
diff --git a/gridspec_api/data/tst_statdata.c b/gridspec_api/data/tst_statdata.c
new file mode 100644
index 0000000..ee40dac
--- /dev/null
+++ b/gridspec_api/data/tst_statdata.c
@@ -0,0 +1,91 @@
+/**
+ * Unit test exercising static data creation
+ *
+ * $Id: tst_statdata.c 767 2011-06-06 23:20:19Z pletzer $
+ */
+
+#include "nccf_data.h"
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+
+#include "nccf_utility_functions.h"
+#include "nccf_coord.h"
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_handle_error.h"
+
+int main(int argc, char *argv[]) {
+  
+  int status;
+  const int ndims = 1;
+  int coordIds[ndims];
+  int globalId;
+  const int save = 0;
+  int i;
+  char coordinates_id[36+1];
+  char data_id[36+1];
+
+  printf("Running %s\n", argv[0]);
+
+  /* generate unique ids */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+  if ((status = nccf_generate_id(456, data_id))) ERR;
+
+  /* create coordinates */
+  const int nx1 = 11;
+  const double dx = 1.0;
+  double *xs = (double *) malloc(nx1 * sizeof(double));
+  float *ps = (float *) malloc(nx1 * sizeof(float));
+  for (i = 0; i < nx1; ++i) {
+    xs[i] = dx * i; 
+    ps[i] = 0.0; //(float)(xs[nx1-1] - xs[i])/(float)(xs[nx1-1] - xs[i]); 
+  }
+  int dims[] = {nx1};
+  const char *dimNames[] = {"nx1"};
+  status = nccf_def_coord(ndims, dims, dimNames, xs, save,
+			       "x", "distance", "m", &coordIds[0]);
+  if (status) ERR;
+
+  /* create grid */
+  int gridid;
+  status = nccf_def_grid(coordIds, "x_grid", &gridid);
+  status = nccf_def_global( &globalId );
+  status = nccf_add_global_att( globalId, CF_FILETYPE, 
+                                CF_GLATT_FILETYPE_GRID, 0 );
+
+  /* create data */
+  int pId;
+  status = nccf_def_data(gridid, "p", "air_pressure", "Pa", NULL, &pId);
+  if (status) ERR;
+  status = nccf_set_data_float(pId, ps, save, NC_FILL_FLOAT);
+  if (status) ERR;
+  
+  /* Add global attributes */
+  status = nccf_add_global_att( globalId, CF_FILETYPE, 
+                                CF_GLATT_FILETYPE_GRID, 1 );
+  status = nccf_add_global_att( globalId, CF_FILETYPE, 
+                                CF_GLATT_FILETYPE_STATIC_DATA, 0 );
+  status = nccf_add_global_att( globalId, CF_COORDINATES_ID, 
+                                coordinates_id, 0 );
+  status = nccf_add_global_att( globalId, CF_DATA_ID, 
+                                data_id, 0 );
+
+  /* write everything to disk */
+  int ncid;
+  if ((status = nc_create("tst_statdata.nc", NC_CLOBBER, &ncid))) ERR;
+  if ((status = nccf_put_grid(gridid, ncid))) ERR;
+  if ((status = nccf_put_data(pId, ncid))) ERR;
+  if ((status = nccf_put_global(globalId, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+
+  /* clean up */
+  if ((status = nccf_free_data(pId))) ERR;
+  if ((status = nccf_free_grid(gridid))) ERR;
+  if ((status = nccf_free_global(globalId))) ERR;
+  if ((status = nccf_free_coord(coordIds[0]))) ERR;
+  free(xs);
+  free(ps);
+
+  return 0;
+}
diff --git a/gridspec_api/data/tst_timedata.c b/gridspec_api/data/tst_timedata.c
new file mode 100644
index 0000000..a5fd8bb
--- /dev/null
+++ b/gridspec_api/data/tst_timedata.c
@@ -0,0 +1,120 @@
+/**
+ * Unit test exercising time dependent data creation
+ *
+ * $Id: tst_timedata.c 767 2011-06-06 23:20:19Z pletzer $
+ */
+
+#include <nccf_data.h>
+#include <assert.h>
+#include <math.h>
+
+#include <nccf_utility_functions.h>
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_handle_error.h>
+
+int main() {
+  
+  int status;
+  const int ndims = 3;
+  int coordIds[ndims];
+  const int save = 0;
+  int i, j, k, bigI;
+  char coordinates_id[36+1];
+
+  /* generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+
+  /* create coordinates */
+  const int nx1 = 11;
+  const int ny1 = 21;
+  const int nz1 = 31;
+  const int ntot = nx1 * ny1 * nz1;
+  const double xmin = 0.0, xmax = 360.0;
+  const double ymin = -90.0, ymax = 90.0;
+  const double zmin = 0.0, zmax = 10000.0;
+  double dx = (xmax - xmin) / (double)(nx1 - 1);
+  double dy = (ymax - ymin) / (double)(ny1 - 1);
+  double dz = (zmax - zmin) / (double)(nz1 - 1);
+  
+  double *xs = (double *) malloc(ntot * sizeof(double));
+  double *ys = (double *) malloc(ntot * sizeof(double));
+  double *zs = (double *) malloc(ntot * sizeof(double));
+  float *ps = (float *) malloc(ntot * sizeof(float));
+
+  for (k = 0; k < nz1; ++k) {
+    double z = zmin + dz * k;
+    for (j = 0; j < ny1; ++j) {
+      double y = ymin + dy * j;
+      for (i = 0; i < nx1; ++i) {
+	double x = xmin + dx * i;
+	bigI = i + nx1*( j + ny1*k );
+	xs[bigI] = x;
+	ys[bigI] = y;
+	zs[bigI] = z;
+	ps[bigI] = 0.0; 
+      }
+    }
+  }
+  const int dims[] = {nx1, ny1, nz1};
+  const char *dimNames[] = {"nx1", "ny1", "nz1"};
+  status = nccf_def_coord(ndims, dims, dimNames, xs, save,
+			       "x", "grid_longitude", "degree", &coordIds[0]);
+  if (status) ERR;
+  status = nccf_def_coord(ndims, dims, dimNames, ys, save,
+			       "y", "grid_latitude", "degree", &coordIds[1]);
+  if (status) ERR;
+  status = nccf_def_coord(ndims, dims, dimNames, zs, save,
+			       "z", "sea_surface_elevation", "m", &coordIds[2]);
+  if (status) ERR;
+
+  /* create grid */
+  int gridid;
+  status = nccf_def_grid(coordIds, "myGrid", &gridid);
+
+  /* create data */
+  int pId;
+  status = nccf_def_data(gridid, "p", "air_pressure", "Pa", "time", &pId);
+  if (status) ERR;
+  status = nccf_set_data_float(pId, ps, save, NC_FILL_FLOAT);
+  if (status) ERR;
+
+  /* write everything to disk */
+  int ncid;
+  if ((status = nc_create("tst_timedata.nc", NC_CLOBBER, &ncid))) ERR;
+  if ((status = nccf_put_grid(gridid, ncid))) ERR;
+
+  const int nt = 3;
+  int it;
+  for (it = 0; it < nt; ++it) {
+    for (k = 0; k < nz1; ++k) {
+      double z = zmin + dz * k;
+      for (j = 0; j < ny1; ++j) {
+	double y = ymin + dy * j;
+	for (i = 0; i < nx1; ++i) {
+	  double x = xmin + dx * i;
+	  bigI = i + nx1*( j + ny1*k );
+	  xs[bigI] = x;
+	  ys[bigI] = y;
+	  zs[bigI] = z;
+	  ps[bigI] = it; 
+	}
+      }
+    }
+    if ((status = nccf_put_data(pId, ncid))) ERR;
+  }
+  if ((status = nc_close(ncid))) ERR;
+  
+  /* clean up */
+  if ((status = nccf_free_data(pId))) ERR;
+  if ((status = nccf_free_grid(gridid))) ERR;
+  for (i = 0; i < ndims; ++i) {
+    if ((status = nccf_free_coord(coordIds[i]))) ERR;
+  }
+  free(xs);
+  free(ys);
+  free(zs);
+  free(ps);
+
+  return 0;
+}
diff --git a/gridspec_api/global/Makefile.am b/gridspec_api/global/Makefile.am
new file mode 100644
index 0000000..9c63b7e
--- /dev/null
+++ b/gridspec_api/global/Makefile.am
@@ -0,0 +1,23 @@
+#
+# $Id: Makefile.am 780 2011-07-01 00:45:51Z edhartnett $
+#
+
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include
+
+include_HEADERS = nccf_global.h
+
+noinst_LTLIBRARIES = libnccf_global.la
+libnccf_global_la_SOURCES = nccf_def_global.c				\
+nccf_def_global_from_file.c nccf_free_global.c nccf_put_global.c	\
+nccf_add_global_att.c nccf_inq_global_att.c nccf_inq_global_natts.c	\
+nccf_inq_global_attval.c
+
+INTLIBS = libnccf_global.la ../../src/libcf_src.la
+EXTLIBS = -lnetcdf 
+check_PROGRAMS = tst_global
+tst_global_SOURCES = tst_global.c
+tst_global_LDADD = $(INTLIBS) $(EXTLIBS)
+TESTS = $(check_PROGRAMS)
+
+# files generated by tests
+CLEANFILES = *.nc
diff --git a/cfcheck/Makefile.in b/gridspec_api/global/Makefile.in
similarity index 71%
rename from cfcheck/Makefile.in
rename to gridspec_api/global/Makefile.in
index 48023cc..e31b35b 100644
--- a/cfcheck/Makefile.in
+++ b/gridspec_api/global/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,13 +15,10 @@
 
 @SET_MAKE@
 
-# This is part of the libcf library.
+#
+# $Id: Makefile.am 780 2011-07-01 00:45:51Z edhartnett $
+#
 
-# This automake file handles the building of cfcheck.
-
-# Ed Hartnett 11/23/06
-
-# $Id: Makefile.am,v 1.2 2009/09/08 17:14:51 ed Exp $
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
@@ -42,36 +39,10 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
- at USE_NETCDF_DIR_TRUE@am__append_1 = -I at NETCDFDIR@/include
- at USE_NETCDF_DIR_TRUE@am__append_2 = -L at NETCDFDIR@/lib
- at USE_NETCDF_DIR_TRUE@am__append_3 = -lnetcdf
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_4 = ../../libsrc4/libnetcdf.la 
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_5 = -I$(top_srcdir)/../libsrc4
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_6 = -L../../libsrc4
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_7 = ../../libsrc/libnetcdf.la 
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_8 = -I$(top_srcdir)/../libsrc
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_9 = -L../../libsrc
- at USE_NETCDF4_TRUE@am__append_10 = -lhdf5_hl -lhdf5 -lz 
- at USE_HDF4_TRUE@am__append_11 = -lmfhdf -ldf -ljpeg
-
-# If the user specified a root for HDF5, use it.
- at USE_HDF5_DIR_TRUE@am__append_12 = -I at HDF5DIR@/include
- at USE_HDF5_DIR_TRUE@am__append_13 = -L at HDF5DIR@/lib
-
-# If the user specified a prefix for the HDF4 library location, use it.
- at USE_HDF4_DIR_TRUE@am__append_14 = -I at HDF4DIR@/include
- at USE_HDF4_DIR_TRUE@am__append_15 = -L at HDF4DIR@/lib
-
-# If the user specified a root location for ZLIB, use it.
- at USE_ZLIB_DIR_TRUE@am__append_16 = -I at ZLIBDIR@/include
- at USE_ZLIB_DIR_TRUE@am__append_17 = -L at ZLIBDIR@/lib
-
-# If the user specified a root location for SZLIB, use it.
- at USE_SZLIB_DIR_TRUE@am__append_18 = -I at SZLIBDIR@/include
- at USE_SZLIB_DIR_TRUE@am__append_19 = -L at SZLIBDIR@/lib
-bin_PROGRAMS = cfcheck$(EXEEXT)
-subdir = cfcheck
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+check_PROGRAMS = tst_global$(EXEEXT)
+subdir = gridspec_api/global
+DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -80,17 +51,22 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
+CONFIG_HEADER = $(top_builddir)/cf_config.h \
+	$(top_builddir)/nfconfig.inc
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = "$(DESTDIR)$(bindir)"
-PROGRAMS = $(bin_PROGRAMS)
-am_cfcheck_OBJECTS = cfcheck.$(OBJEXT)
-cfcheck_OBJECTS = $(am_cfcheck_OBJECTS)
-cfcheck_LDADD = $(LDADD)
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libnccf_global_la_LIBADD =
+am_libnccf_global_la_OBJECTS = nccf_def_global.lo \
+	nccf_def_global_from_file.lo nccf_free_global.lo \
+	nccf_put_global.lo nccf_add_global_att.lo \
+	nccf_inq_global_att.lo nccf_inq_global_natts.lo \
+	nccf_inq_global_attval.lo
+libnccf_global_la_OBJECTS = $(am_libnccf_global_la_OBJECTS)
+am_tst_global_OBJECTS = tst_global.$(OBJEXT)
+tst_global_OBJECTS = $(am_tst_global_OBJECTS)
 am__DEPENDENCIES_1 =
-cfcheck_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__append_4) \
-	$(am__append_7) $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+tst_global_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -104,8 +80,31 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(cfcheck_SOURCES)
-DIST_SOURCES = $(cfcheck_SOURCES)
+SOURCES = $(libnccf_global_la_SOURCES) $(tst_global_SOURCES)
+DIST_SOURCES = $(libnccf_global_la_SOURCES) $(tst_global_SOURCES)
+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__installdirs = "$(DESTDIR)$(includedir)"
+HEADERS = $(include_HEADERS)
 ETAGS = etags
 CTAGS = ctags
 am__tty_colors = \
@@ -115,7 +114,6 @@ ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
 AR = @AR@
-AS = @AS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -136,15 +134,19 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-F77 = @F77@
 FC = @FC@
 FCFLAGS = @FCFLAGS@
 FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
+FCLIBS = @FCLIBS@
 FGREP = @FGREP@
 GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
+HAVE_DARWIN = @HAVE_DARWIN@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_LAPACK_LIB = @HAVE_LAPACK_LIB@
+HAVE_LAPACK_NO_UNDERSCORE = @HAVE_LAPACK_NO_UNDERSCORE@
+HAVE_LAPACK_UNDERSCORE = @HAVE_LAPACK_UNDERSCORE@
+HAVE_SHARED = @HAVE_SHARED@
+HAVE_UUID = @HAVE_UUID@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -159,8 +161,10 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 MOD_FLAG = @MOD_FLAG@
+NCDUMP = @NCDUMP@
 NCDUMPDIR = @NCDUMPDIR@
 NETCDFDIR = @NETCDFDIR@
 NM = @NM@
@@ -174,23 +178,23 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
 VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
 ac_ct_FC = @ac_ct_FC@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -222,7 +226,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -238,20 +241,22 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-
-# Find libcf.h here.
-AM_CPPFLAGS = -I${top_srcdir}/src $(am__append_1) $(am__append_5) \
-	$(am__append_8) $(am__append_12) $(am__append_14) \
-	$(am__append_16) $(am__append_18)
-AM_LDFLAGS = $(am__append_2) $(am__append_6) $(am__append_9) \
-	$(am__append_13) $(am__append_15) $(am__append_17) \
-	$(am__append_19)
-LDADD = $(am__append_3) $(am__append_4) $(am__append_7) \
-	$(am__append_10) $(am__append_11)
-EXTRA_DIST = tst_cfcheck.sh
-cfcheck_SOURCES = cfcheck.c
-TESTS = tst_cfcheck.sh
-CLEANFILES = useage.txt
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include
+include_HEADERS = nccf_global.h
+noinst_LTLIBRARIES = libnccf_global.la
+libnccf_global_la_SOURCES = nccf_def_global.c				\
+nccf_def_global_from_file.c nccf_free_global.c nccf_put_global.c	\
+nccf_add_global_att.c nccf_inq_global_att.c nccf_inq_global_natts.c	\
+nccf_inq_global_attval.c
+
+INTLIBS = libnccf_global.la ../../src/libcf_src.la
+EXTLIBS = -lnetcdf 
+tst_global_SOURCES = tst_global.c
+tst_global_LDADD = $(INTLIBS) $(EXTLIBS)
+TESTS = $(check_PROGRAMS)
+
+# files generated by tests
+CLEANFILES = *.nc
 all: all-am
 
 .SUFFIXES:
@@ -265,9 +270,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cfcheck/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec_api/global/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign cfcheck/Makefile
+	  $(AUTOMAKE) --foreign gridspec_api/global/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -286,52 +291,29 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-install-binPROGRAMS: $(bin_PROGRAMS)
-	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	for p in $$list; do echo "$$p $$p"; done | \
-	sed 's/$(EXEEXT)$$//' | \
-	while read p p1; do if test -f $$p || test -f $$p1; \
-	  then echo "$$p"; echo "$$p"; else :; fi; \
-	done | \
-	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
-	sed 'N;N;N;s,\n, ,g' | \
-	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
-	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
-	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
-	    else { print "f", $$3 "/" $$4, $$1; } } \
-	  END { for (d in files) print "f", d, files[d] }' | \
-	while read type dir files; do \
-	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
-	    test -z "$$files" || { \
-	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
-	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
-	    } \
-	; done
-
-uninstall-binPROGRAMS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	files=`for p in $$list; do echo "$$p"; done | \
-	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-	      -e 's/$$/$(EXEEXT)/' `; \
-	test -n "$$list" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(bindir)" && rm -f $$files
-
-clean-binPROGRAMS:
-	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libnccf_global.la: $(libnccf_global_la_OBJECTS) $(libnccf_global_la_DEPENDENCIES) 
+	$(LINK)  $(libnccf_global_la_OBJECTS) $(libnccf_global_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
-cfcheck$(EXEEXT): $(cfcheck_OBJECTS) $(cfcheck_DEPENDENCIES) 
-	@rm -f cfcheck$(EXEEXT)
-	$(LINK) $(cfcheck_OBJECTS) $(cfcheck_LDADD) $(LIBS)
+tst_global$(EXEEXT): $(tst_global_OBJECTS) $(tst_global_DEPENDENCIES) 
+	@rm -f tst_global$(EXEEXT)
+	$(LINK) $(tst_global_OBJECTS) $(tst_global_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -339,7 +321,15 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cfcheck.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_add_global_att.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_global.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_global_from_file.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_free_global.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_global_att.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_global_attval.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_global_natts.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_put_global.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_global.Po at am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -370,6 +360,26 @@ mostlyclean-libtool:
 
 clean-libtool:
 	-rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	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|^.*/||'`; \
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(includedir)" && rm -f $$files
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -546,11 +556,12 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
-all-am: Makefile $(PROGRAMS)
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
 installdirs:
-	for dir in "$(DESTDIR)$(bindir)"; do \
+	for dir in "$(DESTDIR)$(includedir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-am
@@ -581,7 +592,8 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -601,13 +613,13 @@ info: info-am
 
 info-am:
 
-install-data-am:
+install-data-am: install-includeHEADERS
 
 install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am: install-binPROGRAMS
+install-exec-am:
 
 install-html: install-html-am
 
@@ -647,23 +659,24 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-binPROGRAMS
+uninstall-am: uninstall-includeHEADERS
 
 .MAKE: check-am install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
-	clean-binPROGRAMS clean-generic clean-libtool ctags distclean \
-	distclean-compile distclean-generic distclean-libtool \
-	distclean-tags distdir dvi dvi-am html html-am info info-am \
-	install install-am install-binPROGRAMS 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 pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-binPROGRAMS
+	clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES ctags 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 \
+	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 pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am uninstall-includeHEADERS
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/gridspec_api/global/nccf_add_global_att.c b/gridspec_api/global/nccf_add_global_att.c
new file mode 100644
index 0000000..d544725
--- /dev/null
+++ b/gridspec_api/global/nccf_add_global_att.c
@@ -0,0 +1,89 @@
+/**
+ * Set, Append, Replace global attribute within a global object.
+ *
+ * $Id: nccf_add_global_att.c 836 2011-09-15 20:07:02Z pletzer $
+ */
+
+#include <string.h>
+
+#include "nccf_global.h"
+#include "nccf_errors.h"
+
+/**
+ * \ingroup gs_global_grp
+ * Add a global attribute
+ *
+ * \param globalid global object ID
+ * \param attname attribute name
+ * \param attvalue attribute value
+ * \param actionflag if the attribute exists, then 1 will append attvalue, 
+ *        2 will replace the existing attribute value. Any other value 
+ *        will leave the existing value untouched. 
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_add_global_att(int globalid, const char *attname, const char *attvalue,
+                        int actionflag ){
+
+  struct nccf_global_type *self;
+  self = nccf_li_find(&CFLIST_GLOBAL, globalid);
+
+  int status = NC_NOERR;
+  char *oldval = NULL;
+  char *newval = NULL;
+  int len;
+
+
+  /* Append attvalue to attname using space seperation */
+  switch( actionflag ){
+
+    case 1:  /* APPEND - attvalue to end of current value after delimeter */
+
+      status = nccf_varGetAttribPtr(&self->global, attname, 
+				    (const void**) &oldval);
+
+      /* If the attribute is empty, set it. */
+      if( oldval == NULL ){
+        nccf_varSetAttribText(&self->global, attname, attvalue);
+        break;
+      }
+
+      /* Append otherwise */
+      len = strlen( oldval );
+      len += strlen( attvalue );
+      newval = (char*)calloc(len+2, sizeof(char));
+      strcat( newval, oldval );
+      strcat( newval, " " );
+      strcat( newval, attvalue );
+      nccf_varSetAttribText(&self->global, attname, newval);
+      oldval = NULL;
+      break;
+
+    case 2: /* Replace - Overwrite */
+      status = nccf_varSetAttribText(&self->global, attname, attvalue);
+      break;
+
+    default:  /* SET - No replacement */
+      len = strlen( attvalue );
+
+      status = nccf_varGetAttribPtr( &self->global, attname, 
+				     (const void**)&oldval );
+
+      if( oldval == NULL ){
+        nccf_varSetAttribText( &self->global, attname, attvalue );
+
+      } else {
+        status = NCCF_EATTEXISTS;
+
+      }
+
+      break;
+
+  }
+
+  if( newval != NULL ) free( newval );
+  return status;
+
+}
+
diff --git a/gridspec_api/global/nccf_def_global.c b/gridspec_api/global/nccf_def_global.c
new file mode 100644
index 0000000..90407b5
--- /dev/null
+++ b/gridspec_api/global/nccf_def_global.c
@@ -0,0 +1,49 @@
+/**
+ * API to define a global object for the gridspec convention to libcf.
+ *
+ * $Id: nccf_def_global.c 738 2011-05-06 22:26:09Z edhartnett $
+ */
+
+#include "nccf_global.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <nccf_handle_error.h>
+#include <nccf_varObj.h>
+
+struct CFLISTITEM *CFLIST_GLOBAL;
+
+/*! \defgroup gs_global_grp Global attribute object
+  \ingroup gridspec_grp
+
+An object to set, append or replace global attributes. One object can be created
+per file to be written.
+*/
+
+/**
+ * \ingroup gs_global_grp
+ * Define a global attribute object (acts as a constructor).
+ *
+ * \param globalid (output) global ID
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_def_global( int *globalid ){
+ 
+  /* Instantiate object */
+    struct nccf_global_type *self;
+    self = (struct nccf_global_type *)
+             malloc(sizeof(struct nccf_global_type));
+
+    /* Global attributes */
+    nccf_varCreate(&self->global, CF_GLOBAL );
+
+    if( CFLIST_GLOBAL == NULL ) nccf_li_new( &CFLIST_GLOBAL );
+
+    *globalid = nccf_li_add( &CFLIST_GLOBAL, self );
+
+    return NC_NOERR;
+
+}
diff --git a/gridspec_api/global/nccf_def_global_from_file.c b/gridspec_api/global/nccf_def_global_from_file.c
new file mode 100644
index 0000000..98ebcd6
--- /dev/null
+++ b/gridspec_api/global/nccf_def_global_from_file.c
@@ -0,0 +1,51 @@
+/**
+ * Read the global attributes from a file and populate a global attribute 
+ * object.
+ * $Id: nccf_def_global_from_file.c 869 2011-11-29 20:12:54Z pletzer $
+ */
+
+#include "nccf_global.h"
+#include <netcdf.h>
+#include <string.h>
+#include "nccf_varObj.h"
+#include "nccf_errors.h"
+
+/**
+ * \ingroup gs_global_grp
+ * Define (construct) the global attributes from a netcdf file.
+ *
+ * \param filename Filename to retrieve the global attributes from
+ * \param globalid (output) returned global ID
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_def_global_from_file(const char *filename, int *globalid){
+
+  int totError = NC_NOERR, status = NC_NOERR;
+  int ncid;
+
+  /* Create the structure */
+  struct nccf_global_type *self;
+  self = (struct nccf_global_type *)
+          malloc(sizeof( struct nccf_global_type));
+
+  /* Initialize */
+  self->global = NULL;
+
+  /* Open file */
+  status = nc_open(filename, NC_NOWRITE, &ncid);
+  if( status ) return status;
+  totError += abs(status);
+
+  /* Get the global attributes */
+  status = nccf_varCreateFromFile(&self->global, "", ncid, 1, 0);
+  nc_close( ncid );
+
+  /* Get the ID */
+  if(CFLIST_GLOBAL == NULL) nccf_li_new(&CFLIST_GLOBAL);
+  *globalid = nccf_li_add( &CFLIST_GLOBAL, self );
+
+  return totError;
+
+}
diff --git a/gridspec_api/global/nccf_free_global.c b/gridspec_api/global/nccf_free_global.c
new file mode 100644
index 0000000..f3ed28e
--- /dev/null
+++ b/gridspec_api/global/nccf_free_global.c
@@ -0,0 +1,35 @@
+/*
+ * API to free a global attribute object for the gridspec convention to libcf.
+ *
+ * $Id: nccf_free_global.c 918 2012-02-07 22:10:36Z pletzer $
+ * */
+
+#include "nccf_global.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <nccf_varObj.h>
+
+/**
+ * \ingroup gs_global_grp
+ * Free a global attribute object.
+ *
+ * \param globalId global ID
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_free_global(int globalId) {
+
+    struct nccf_global_type *self;
+    self = nccf_li_remove(&CFLIST_GLOBAL, globalId);
+    if( nccf_li_get_nelem( &CFLIST_GLOBAL ) == 0 )
+        nccf_li_del( &CFLIST_GLOBAL );
+    /* Destroy the variables */
+    nccf_varDestroy( &self->global );
+    free(self);
+    self = NULL;
+
+    return NC_NOERR;
+}
+
diff --git a/gridspec_api/global/nccf_global.h b/gridspec_api/global/nccf_global.h
new file mode 100644
index 0000000..18dbf86
--- /dev/null
+++ b/gridspec_api/global/nccf_global.h
@@ -0,0 +1,60 @@
+/**
+ * API to define a global attribute var_obj for the gridspec convention to
+ * libcf.
+ *
+ * $Id: nccf_global.h 834 2011-09-14 21:21:07Z pletzer $
+ */
+
+#ifndef _NCCF_GLOBAL_H
+#define _NCCF_GLOBAL_H
+
+#include <netcdf.h>
+#include <libcf_src.h>
+#include <cflistitem.h>
+#include <nccf_varObj.h>
+#include <nccf_handle_error.h>
+#include <nccf_constants.h>
+
+extern struct CFLISTITEM *CFLIST_GLOBAL;
+
+/**
+ * Global attributes structure
+ */
+struct nccf_global_type {
+  /* Remember the global attribute takes a "" for a variable name
+   * Not NC_GLOBAL */
+
+  /* Global attributes */
+  struct nccf_var_obj *global;
+
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int nccf_def_global(int *globalid);
+
+int nccf_def_global_from_file(const char *filename, int *globalid);
+
+int nccf_free_global(int globalid);
+
+int nccf_put_global(int ncid, int globalid);
+
+int nccf_add_global_att(int globalid, const char *attname, 
+                        const char *attvalue, int actionflag);
+
+int nccf_inq_global_att(int globalid, const char *name, char *value);
+
+int nccf_inq_global_natts(int globalid, int *natts);
+
+int nccf_inq_global_attval(int globalid, int attid,
+                           char *attname, char *attval);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _NCCF_GLOBAL_H */
+
+
diff --git a/gridspec_api/global/nccf_inq_global_att.c b/gridspec_api/global/nccf_inq_global_att.c
new file mode 100644
index 0000000..20be95e
--- /dev/null
+++ b/gridspec_api/global/nccf_inq_global_att.c
@@ -0,0 +1,32 @@
+/**
+ * Inquire about a global attribute by name
+ *
+ * $Id: nccf_inq_global_att.c 787 2011-07-28 19:04:22Z dkindig $
+ */
+
+#include "nccf_global.h"
+#include <string.h>
+
+/**
+ * \ingroup gs_global_grp
+ * Get a global attribute value from its name
+ *
+ * \param globalid global object ID
+ * \param name attribute name to retrieve
+ * \param value attribute value, must have size NC_MAX_NAME or larger
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_global_att(int globalid, const char *name, char *value){
+
+  struct nccf_global_type *self;
+  self = nccf_li_find(&CFLIST_GLOBAL, globalid);
+  const char *tmp = NULL;
+  nccf_varGetAttribPtr(&self->global, name, (const void **) &tmp);
+  if( tmp != NULL ) strcpy( value, tmp );
+  
+  return NC_NOERR;
+}
+
+
diff --git a/gridspec_api/global/nccf_inq_global_attval.c b/gridspec_api/global/nccf_inq_global_attval.c
new file mode 100644
index 0000000..e04889c
--- /dev/null
+++ b/gridspec_api/global/nccf_inq_global_attval.c
@@ -0,0 +1,52 @@
+/**
+ * Get the name and value of a global attribute by index
+ *
+ * $Id: nccf_inq_global_attval.c 787 2011-07-28 19:04:22Z dkindig $
+ */
+
+#include "nccf_global.h"
+#include <netcdf.h>
+#include <string.h>
+
+/**
+ * \ingroup gs_global_grp
+ * Get the name and value of a global attribute by index.
+ *
+ * \param globalid global object ID
+ * \param attid attribute ID
+ * \param attname Attribute name ( Returned )
+ * \param attval Atttribute value ( Returned )
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_global_attval(int globalid, int attid, char *attname, char *attval){
+
+  int na;
+  struct nccf_global_type *self;
+  self = nccf_li_find(&CFLIST_GLOBAL, globalid);
+
+  na = 0;
+  nccf_kv_begin( &(self->global->attr) );
+  while ( nccf_kv_next( &(self->global->attr) )  ) {
+    if (na == attid) {
+      int nelem;
+      nc_type type;
+      const char *name;
+      const void *value;
+      nccf_kv_get_key( &(self->global->attr), &name);
+      nccf_kv_get_value( &(self->global->attr), name, &type, &nelem, 
+			 &value);
+      if (type == NC_CHAR) {
+      	strcpy(attname, name);
+      	strcpy(attval, value);
+      }
+      // need to be extended for other types of attributes (NC_FLOAT...)
+      break;
+    }
+    na++;
+  }
+
+  return NC_NOERR;
+}
+
diff --git a/gridspec_api/global/nccf_inq_global_natts.c b/gridspec_api/global/nccf_inq_global_natts.c
new file mode 100644
index 0000000..5063dc0
--- /dev/null
+++ b/gridspec_api/global/nccf_inq_global_natts.c
@@ -0,0 +1,35 @@
+/**
+ * Inquire about a global attribute
+ *
+ * $Id: nccf_inq_global_natts.c 738 2011-05-06 22:26:09Z edhartnett $
+ */
+
+#include "nccf_global.h"
+#include <string.h>
+
+/**
+ * \ingroup gs_global_grp
+ * Get the number of global attributes.
+ *
+ * \param globalid global object ID
+ * \param natts The number of globa attributes
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_global_natts(int globalid, int *natts){
+
+  struct nccf_global_type *self;
+  int na;
+  self = nccf_li_find(&CFLIST_GLOBAL, globalid);
+
+  na = 0;
+  nccf_kv_begin( &(self->global->attr) );
+  while ( nccf_kv_next( &(self->global->attr) ) ) {
+    na++;
+  }
+
+  *natts = na;
+  
+  return NC_NOERR;
+}
diff --git a/gridspec_api/global/nccf_put_global.c b/gridspec_api/global/nccf_put_global.c
new file mode 100644
index 0000000..9b534e8
--- /dev/null
+++ b/gridspec_api/global/nccf_put_global.c
@@ -0,0 +1,99 @@
+/*
+ * API to write global attributes to a file for the gridspec convention to
+ * libcf.
+ *
+ * $Id: nccf_put_global.c 851 2011-11-08 14:37:20Z pletzer $
+ */
+
+#include <nccf_global.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <netcdf.h>
+#include <libcf_src.h>
+#include <nccf_errors.h>
+
+int nccf_compare_values( int ncid, char *attname, const char *value );
+
+/**
+ * \ingroup gs_global_grp
+ * Write the global attributes object to a file.
+ *
+ * \param globalId global ID
+ * \param ncid NetCDF file ID created by nc_create or nc_open
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_put_global(int globalId, int ncid) {
+
+  int status, natts, i, stat0, stat1, attid;
+  int totErr = 0;
+  int catchErr = NC_NOERR;
+
+  char *attname, *attvalue;
+  attname  = (char*)calloc( STRING_SIZE, sizeof(char));
+  attvalue = (char*)calloc( STRING_SIZE, sizeof(char));
+
+  /* Open the global structure. */
+  struct nccf_global_type *self;
+  self = nccf_li_find(&CFLIST_GLOBAL, globalId);
+
+  /* Verify that the attributes are not in the file already. */
+  nccf_inq_global_natts( globalId, &natts );
+  for( i = 0; i < natts; i++ ){
+    nccf_inq_global_attval( globalId, i, attname, attvalue );
+    stat0 = nc_inq_attid( ncid, NC_GLOBAL, attname, &attid );
+
+    /* Continue if an error is thrown. i.e. Attribute doesn't exist */
+    if( stat0 == NC_ENOTATT ) continue;
+
+    stat1 = nccf_compare_values( ncid, attname, attvalue );
+
+    /* The attributes exists */
+    if( stat1 != NC_NOERR ) return stat1;
+  }
+
+  free( attname );
+  free( attvalue );
+
+  /* Write global attrubutes to the file. */
+  status = nccf_writeListOfVars(ncid, 1, self->global);
+  if (status != NC_NOERR) {
+    catchErr = status;
+  }
+
+  if (totErr != 0) {
+    if (catchErr != NC_NOERR) {
+      return catchErr;
+    }
+    else {
+      return NCCF_EPUTGRID;
+    }
+  }
+  return NC_NOERR;
+}
+
+/* This function is designed to be extended to other types */
+int nccf_compare_values( int ncid, char *attname, const char *value ){
+
+  /* Check the value */
+  int stat1, result;
+  nc_type type;
+  size_t len;
+
+  nc_inq_atttype( ncid, NC_GLOBAL, attname, &type );
+  char *curvalue = NULL;
+
+  nc_inq_attlen( ncid, NC_GLOBAL, attname, &len );
+  curvalue = (char*) calloc(len+1, sizeof(char));
+  stat1 = nc_get_att_text( ncid, NC_GLOBAL, attname, curvalue );
+  if ( stat1 ) return stat1;
+  result = strcmp( value, curvalue );
+  free( curvalue );
+  if( result == 0) return NCCF_EATTEXISTS;
+
+  return NC_NOERR;
+
+}
diff --git a/gridspec_api/global/tst_global.c b/gridspec_api/global/tst_global.c
new file mode 100644
index 0000000..c6d1d7b
--- /dev/null
+++ b/gridspec_api/global/tst_global.c
@@ -0,0 +1,74 @@
+/**
+ * Test the global attribute methoc.
+ *
+ * $Id: tst_global.c 767 2011-06-06 23:20:19Z pletzer $
+ */
+
+#include "nccf_global.h"
+#include <netcdf.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include "libcf_src.h"
+#include "nccf_varObj.h"
+#include "nccf_errors.h"
+
+int main( ){
+
+  int status = NC_NOERR, globalId, globalId2, ncid;
+  char value[STRING_SIZE];
+  char *filename = "tst_global.nc";
+  char attname[STRING_SIZE], attval[STRING_SIZE];
+  int natts, i;
+
+  status = nccf_def_global( &globalId );
+  /* SET a global */
+  status = nccf_add_global_att( globalId, "name1", "value1", 0 );
+  assert( status == NC_NOERR );
+  status = nccf_add_global_att( globalId, "name2", "value2", 0 );
+  assert( status == NC_NOERR );
+  /* Value other than 0, 1 or 2 */
+  status = nccf_add_global_att( globalId, "name3", "value3", -1 );
+  assert( status  == NC_NOERR );
+
+  /* APPEND an attribute value to an existing attribute */
+  status = nccf_add_global_att( globalId, "name3", "value4", 1 );
+  assert( status == NC_NOERR );
+
+  /* REPLACE an attribute value with a new value */
+  status = nccf_add_global_att( globalId, "name2", "value5", 2 );
+  assert( status == NC_NOERR );
+
+  if(( status = nc_create( filename, NC_CLOBBER, &ncid ))) ERR;
+  status = nccf_put_global(globalId, ncid);
+  assert( status  == NC_NOERR );
+  if(( status = nc_close( ncid ))) ERR;
+
+  status = nccf_free_global( globalId );
+  assert( status == NC_NOERR );
+
+  status = nccf_def_global_from_file( filename, &globalId2 );
+  assert( status == NC_NOERR );
+  
+  status = nccf_inq_global_att( globalId2, "name1", value );
+  assert( strcmp( value, "value3" ) != 0 );
+  assert( strcmp( value, "value1" ) == 0 );
+
+  nccf_inq_global_natts( globalId2, &natts );
+  for( i = 0; i < natts; i++ ){
+    nccf_inq_global_attval( globalId2, i, attname, attval );
+    switch( i ){
+      case 0: assert( strcmp( "name1", attname ) == 0 ); 
+              assert( strcmp( "value1", attval ) == 0 ); break;
+      case 1: assert( strcmp( "name2", attname ) == 0 ); break;
+              assert( strcmp( "value5", attval ) == 0 ); break;
+      case 2: assert( strcmp( "name3", attname ) == 0 ); break;
+              assert( strcmp( "value3", attval ) == 0 ); break;
+    }
+
+  }
+  status = nccf_free_global( globalId2 );
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/grid/Makefile.am b/gridspec_api/grid/Makefile.am
new file mode 100644
index 0000000..691aa69
--- /dev/null
+++ b/gridspec_api/grid/Makefile.am
@@ -0,0 +1,30 @@
+#
+# $Id: Makefile.am 880 2011-12-16 23:35:15Z pletzer $
+#
+
+AM_CPPFLAGS = -I at NETCDFDIR@/include -I$(top_srcdir)/src			\
+-I$(top_srcdir)/include -I$(srcdir)/../global -I$(srcdir)/../coord
+
+include_HEADERS = nccf_grid.h
+
+noinst_LTLIBRARIES = libnccf_grid.la
+libnccf_grid_la_SOURCES = nccf_def_grid.c nccf_def_grid_from_file.c	\
+nccf_free_grid.c nccf_inq_grid_coordids.c nccf_inq_grid_coordnames.c	\
+nccf_inq_grid_ndims.c nccf_inq_grid_name.c nccf_put_grid.c		\
+nccf_save_grid_scrip.c nccf_set_grid_validmask.c			\
+nccf_get_grid_mask_pointer.c nccf_detect_grid_periodicity.c             \
+nccf_inq_grid_periodicity.c
+
+INTLIBS = libnccf_grid.la ../coord/libnccf_coord.la	\
+../global/libnccf_global.la ../../src/libcf_src.la
+
+EXTLIBS = -lnetcdf 
+
+check_PROGRAMS = tst_struct_grid_latlon tst_cubesphere_makegrid \
+tst_bipolar_tripolar_grid tst_1d_grid
+
+LDADD = $(INTLIBS) $(EXTLIBS)
+TESTS = $(check_PROGRAMS)
+
+# files generated by tests
+CLEANFILES = *.nc bcf_gridspec.ps bcf_gridspec.dvi
diff --git a/gridspec/tools/make_topog/Makefile.in b/gridspec_api/grid/Makefile.in
similarity index 63%
rename from gridspec/tools/make_topog/Makefile.in
rename to gridspec_api/grid/Makefile.in
index f1146d3..29f7ad2 100644
--- a/gridspec/tools/make_topog/Makefile.in
+++ b/gridspec_api/grid/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,10 +15,10 @@
 
 @SET_MAKE@
 
-# This automake file is in charge of building the gridspec
-# make_topog tool.
+#
+# $Id: Makefile.am 880 2011-12-16 23:35:15Z pletzer $
+#
 
-# $Id: Makefile.am,v 1.4 2009/11/16 14:15:43 zhi Exp $
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
@@ -39,37 +39,12 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-bin_PROGRAMS = make_topog$(EXEEXT)
- at USE_NETCDF_DIR_TRUE@am__append_1 = -I at NETCDFDIR@/include
- at USE_NETCDF_DIR_TRUE@am__append_2 = -L at NETCDFDIR@/lib
- at USE_NETCDF_DIR_TRUE@am__append_3 = -lnetcdf
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_4 = ../../../../libsrc4/libnetcdf.la 
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_5 = -I$(top_srcdir)/../libsrc4
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_6 = -L../../../../libsrc4
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_7 = ../../../../libsrc/libnetcdf.la 
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_8 = -I$(top_srcdir)/../libsrc
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_9 = -L../../../../libsrc
- at USE_NETCDF4_TRUE@am__append_10 = -lhdf5_hl -lhdf5 -lz 
- at USE_HDF4_TRUE@am__append_11 = -lmfhdf -ldf -ljpeg
-
-# If the user specified a root for HDF5, use it.
- at USE_HDF5_DIR_TRUE@am__append_12 = -I at HDF5DIR@/include
- at USE_HDF5_DIR_TRUE@am__append_13 = -L at HDF5DIR@/lib
-
-# If the user specified a prefix for the HDF4 library location, use it.
- at USE_HDF4_DIR_TRUE@am__append_14 = -I at HDF4DIR@/include
- at USE_HDF4_DIR_TRUE@am__append_15 = -L at HDF4DIR@/lib
-
-# If the user specified a root location for ZLIB, use it.
- at USE_ZLIB_DIR_TRUE@am__append_16 = -I at ZLIBDIR@/include
- at USE_ZLIB_DIR_TRUE@am__append_17 = -L at ZLIBDIR@/lib
-
-# If the user specified a root location for SZLIB, use it.
- at USE_SZLIB_DIR_TRUE@am__append_18 = -I at SZLIBDIR@/include
- at USE_SZLIB_DIR_TRUE@am__append_19 = -L at SZLIBDIR@/lib
-subdir = gridspec/tools/make_topog
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
-	$(srcdir)/run_tests.in
+check_PROGRAMS = tst_struct_grid_latlon$(EXEEXT) \
+	tst_cubesphere_makegrid$(EXEEXT) \
+	tst_bipolar_tripolar_grid$(EXEEXT) tst_1d_grid$(EXEEXT)
+subdir = gridspec_api/grid
+DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -78,17 +53,40 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
-CONFIG_CLEAN_FILES = run_tests
+CONFIG_HEADER = $(top_builddir)/cf_config.h \
+	$(top_builddir)/nfconfig.inc
+CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = "$(DESTDIR)$(bindir)"
-PROGRAMS = $(bin_PROGRAMS)
-am_make_topog_OBJECTS = make_topog.$(OBJEXT)
-make_topog_OBJECTS = $(am_make_topog_OBJECTS)
-make_topog_LDADD = $(LDADD)
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libnccf_grid_la_LIBADD =
+am_libnccf_grid_la_OBJECTS = nccf_def_grid.lo \
+	nccf_def_grid_from_file.lo nccf_free_grid.lo \
+	nccf_inq_grid_coordids.lo nccf_inq_grid_coordnames.lo \
+	nccf_inq_grid_ndims.lo nccf_inq_grid_name.lo nccf_put_grid.lo \
+	nccf_save_grid_scrip.lo nccf_set_grid_validmask.lo \
+	nccf_get_grid_mask_pointer.lo nccf_detect_grid_periodicity.lo \
+	nccf_inq_grid_periodicity.lo
+libnccf_grid_la_OBJECTS = $(am_libnccf_grid_la_OBJECTS)
+tst_1d_grid_SOURCES = tst_1d_grid.c
+tst_1d_grid_OBJECTS = tst_1d_grid.$(OBJEXT)
+tst_1d_grid_LDADD = $(LDADD)
 am__DEPENDENCIES_1 =
-make_topog_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__append_4) \
-	$(am__append_7) $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+tst_1d_grid_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+tst_bipolar_tripolar_grid_SOURCES = tst_bipolar_tripolar_grid.c
+tst_bipolar_tripolar_grid_OBJECTS =  \
+	tst_bipolar_tripolar_grid.$(OBJEXT)
+tst_bipolar_tripolar_grid_LDADD = $(LDADD)
+tst_bipolar_tripolar_grid_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+tst_cubesphere_makegrid_SOURCES = tst_cubesphere_makegrid.c
+tst_cubesphere_makegrid_OBJECTS = tst_cubesphere_makegrid.$(OBJEXT)
+tst_cubesphere_makegrid_LDADD = $(LDADD)
+tst_cubesphere_makegrid_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+tst_struct_grid_latlon_SOURCES = tst_struct_grid_latlon.c
+tst_struct_grid_latlon_OBJECTS = tst_struct_grid_latlon.$(OBJEXT)
+tst_struct_grid_latlon_LDADD = $(LDADD)
+tst_struct_grid_latlon_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -102,8 +100,35 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(make_topog_SOURCES)
-DIST_SOURCES = $(make_topog_SOURCES)
+SOURCES = $(libnccf_grid_la_SOURCES) tst_1d_grid.c \
+	tst_bipolar_tripolar_grid.c tst_cubesphere_makegrid.c \
+	tst_struct_grid_latlon.c
+DIST_SOURCES = $(libnccf_grid_la_SOURCES) tst_1d_grid.c \
+	tst_bipolar_tripolar_grid.c tst_cubesphere_makegrid.c \
+	tst_struct_grid_latlon.c
+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__installdirs = "$(DESTDIR)$(includedir)"
+HEADERS = $(include_HEADERS)
 ETAGS = etags
 CTAGS = ctags
 am__tty_colors = \
@@ -113,7 +138,6 @@ ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
 AR = @AR@
-AS = @AS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -134,15 +158,19 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-F77 = @F77@
 FC = @FC@
 FCFLAGS = @FCFLAGS@
 FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
+FCLIBS = @FCLIBS@
 FGREP = @FGREP@
 GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
+HAVE_DARWIN = @HAVE_DARWIN@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_LAPACK_LIB = @HAVE_LAPACK_LIB@
+HAVE_LAPACK_NO_UNDERSCORE = @HAVE_LAPACK_NO_UNDERSCORE@
+HAVE_LAPACK_UNDERSCORE = @HAVE_LAPACK_UNDERSCORE@
+HAVE_SHARED = @HAVE_SHARED@
+HAVE_UUID = @HAVE_UUID@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -157,8 +185,10 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 MOD_FLAG = @MOD_FLAG@
+NCDUMP = @NCDUMP@
 NCDUMPDIR = @NCDUMPDIR@
 NETCDFDIR = @NETCDFDIR@
 NM = @NM@
@@ -172,23 +202,23 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
 VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
 ac_ct_FC = @ac_ct_FC@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -220,7 +250,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -236,23 +265,27 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-make_topog_SOURCES = make_topog.c
-
-# Initalize these.
-AM_CPPFLAGS = -I$(top_srcdir)/gridspec/tools/shared \
-	-I$(top_srcdir)/gridspec/shared/mosaic $(am__append_1) \
-	$(am__append_5) $(am__append_8) $(am__append_12) \
-	$(am__append_14) $(am__append_16) $(am__append_18)
-AM_LDFLAGS = -L../shared -L../../shared/mosaic $(am__append_2) \
-	$(am__append_6) $(am__append_9) $(am__append_13) \
-	$(am__append_15) $(am__append_17) $(am__append_19)
-LDADD = -ltoolsshared -lshared -lnetcdf -lm $(am__append_3) \
-	$(am__append_4) $(am__append_7) $(am__append_10) \
-	$(am__append_11)
-TESTS = run_tests
-EXTRA_DIST = run_tests.in
-CLEANFILES = topog.nc gs_topog.nc topog.cdl gs_topog.cdl
-DISTCLEANFILES = run_tests
+AM_CPPFLAGS = -I at NETCDFDIR@/include -I$(top_srcdir)/src			\
+-I$(top_srcdir)/include -I$(srcdir)/../global -I$(srcdir)/../coord
+
+include_HEADERS = nccf_grid.h
+noinst_LTLIBRARIES = libnccf_grid.la
+libnccf_grid_la_SOURCES = nccf_def_grid.c nccf_def_grid_from_file.c	\
+nccf_free_grid.c nccf_inq_grid_coordids.c nccf_inq_grid_coordnames.c	\
+nccf_inq_grid_ndims.c nccf_inq_grid_name.c nccf_put_grid.c		\
+nccf_save_grid_scrip.c nccf_set_grid_validmask.c			\
+nccf_get_grid_mask_pointer.c nccf_detect_grid_periodicity.c             \
+nccf_inq_grid_periodicity.c
+
+INTLIBS = libnccf_grid.la ../coord/libnccf_coord.la	\
+../global/libnccf_global.la ../../src/libcf_src.la
+
+EXTLIBS = -lnetcdf 
+LDADD = $(INTLIBS) $(EXTLIBS)
+TESTS = $(check_PROGRAMS)
+
+# files generated by tests
+CLEANFILES = *.nc bcf_gridspec.ps bcf_gridspec.dvi
 all: all-am
 
 .SUFFIXES:
@@ -266,9 +299,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec/tools/make_topog/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec_api/grid/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign gridspec/tools/make_topog/Makefile
+	  $(AUTOMAKE) --foreign gridspec_api/grid/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -287,54 +320,38 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-run_tests: $(top_builddir)/config.status $(srcdir)/run_tests.in
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-install-binPROGRAMS: $(bin_PROGRAMS)
-	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	for p in $$list; do echo "$$p $$p"; done | \
-	sed 's/$(EXEEXT)$$//' | \
-	while read p p1; do if test -f $$p || test -f $$p1; \
-	  then echo "$$p"; echo "$$p"; else :; fi; \
-	done | \
-	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
-	sed 'N;N;N;s,\n, ,g' | \
-	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
-	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
-	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
-	    else { print "f", $$3 "/" $$4, $$1; } } \
-	  END { for (d in files) print "f", d, files[d] }' | \
-	while read type dir files; do \
-	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
-	    test -z "$$files" || { \
-	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
-	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
-	    } \
-	; done
-
-uninstall-binPROGRAMS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
-	files=`for p in $$list; do echo "$$p"; done | \
-	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-	      -e 's/$$/$(EXEEXT)/' `; \
-	test -n "$$list" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(bindir)" && rm -f $$files
-
-clean-binPROGRAMS:
-	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libnccf_grid.la: $(libnccf_grid_la_OBJECTS) $(libnccf_grid_la_DEPENDENCIES) 
+	$(LINK)  $(libnccf_grid_la_OBJECTS) $(libnccf_grid_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
-make_topog$(EXEEXT): $(make_topog_OBJECTS) $(make_topog_DEPENDENCIES) 
-	@rm -f make_topog$(EXEEXT)
-	$(LINK) $(make_topog_OBJECTS) $(make_topog_LDADD) $(LIBS)
+tst_1d_grid$(EXEEXT): $(tst_1d_grid_OBJECTS) $(tst_1d_grid_DEPENDENCIES) 
+	@rm -f tst_1d_grid$(EXEEXT)
+	$(LINK) $(tst_1d_grid_OBJECTS) $(tst_1d_grid_LDADD) $(LIBS)
+tst_bipolar_tripolar_grid$(EXEEXT): $(tst_bipolar_tripolar_grid_OBJECTS) $(tst_bipolar_tripolar_grid_DEPENDENCIES) 
+	@rm -f tst_bipolar_tripolar_grid$(EXEEXT)
+	$(LINK) $(tst_bipolar_tripolar_grid_OBJECTS) $(tst_bipolar_tripolar_grid_LDADD) $(LIBS)
+tst_cubesphere_makegrid$(EXEEXT): $(tst_cubesphere_makegrid_OBJECTS) $(tst_cubesphere_makegrid_DEPENDENCIES) 
+	@rm -f tst_cubesphere_makegrid$(EXEEXT)
+	$(LINK) $(tst_cubesphere_makegrid_OBJECTS) $(tst_cubesphere_makegrid_LDADD) $(LIBS)
+tst_struct_grid_latlon$(EXEEXT): $(tst_struct_grid_latlon_OBJECTS) $(tst_struct_grid_latlon_DEPENDENCIES) 
+	@rm -f tst_struct_grid_latlon$(EXEEXT)
+	$(LINK) $(tst_struct_grid_latlon_OBJECTS) $(tst_struct_grid_latlon_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -342,7 +359,23 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/make_topog.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_grid.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_grid_from_file.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_detect_grid_periodicity.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_free_grid.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_get_grid_mask_pointer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_grid_coordids.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_grid_coordnames.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_grid_name.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_grid_ndims.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_grid_periodicity.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_put_grid.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_save_grid_scrip.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_set_grid_validmask.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_1d_grid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_bipolar_tripolar_grid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_cubesphere_makegrid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_struct_grid_latlon.Po at am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -373,6 +406,26 @@ mostlyclean-libtool:
 
 clean-libtool:
 	-rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	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|^.*/||'`; \
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(includedir)" && rm -f $$files
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -549,11 +602,12 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
-all-am: Makefile $(PROGRAMS)
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
 installdirs:
-	for dir in "$(DESTDIR)$(bindir)"; do \
+	for dir in "$(DESTDIR)$(includedir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-am
@@ -578,14 +632,14 @@ 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-am
 
-clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -605,13 +659,13 @@ info: info-am
 
 info-am:
 
-install-data-am:
+install-data-am: install-includeHEADERS
 
 install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am: install-binPROGRAMS
+install-exec-am:
 
 install-html: install-html-am
 
@@ -651,23 +705,24 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-binPROGRAMS
+uninstall-am: uninstall-includeHEADERS
 
 .MAKE: check-am install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
-	clean-binPROGRAMS clean-generic clean-libtool ctags distclean \
-	distclean-compile distclean-generic distclean-libtool \
-	distclean-tags distdir dvi dvi-am html html-am info info-am \
-	install install-am install-binPROGRAMS 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 pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-binPROGRAMS
+	clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES ctags 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 \
+	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 pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am uninstall-includeHEADERS
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/gridspec_api/grid/nccf_def_grid.c b/gridspec_api/grid/nccf_def_grid.c
new file mode 100644
index 0000000..b958efc
--- /dev/null
+++ b/gridspec_api/grid/nccf_def_grid.c
@@ -0,0 +1,88 @@
+/**
+ * API to define a structured grid for the gridspec convention to libcf.
+ *
+ * $Id: nccf_def_grid.c 891 2011-12-21 17:22:02Z pletzer $
+ */
+
+#include <nccf_constants.h>
+#include <nccf_utility_functions.h>
+#include "nccf_grid.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include <nccf_coord.h>
+#include <nccf_handle_error.h>
+#include <nccf_varObj.h>
+
+struct CFLISTITEM *CFLIST_STRUCTURED_GRID;
+
+/** \defgroup gs_grid_grp Structured grids
+    \ingroup gridspec_grp
+
+Curvilinear, structured grids are collections of coordinates, one
+for each spatial dimension. Grids keep a reference to the 
+underlying coordinate objects. Therefore, coordinate objects must 
+exist prior to the construction of a grid and coordinate objects
+should not be freed before all operations on a structured grid have 
+been completed.
+
+*/
+
+/**
+ * \ingroup gs_grid_grp
+ * Define structured grid (acts as a constructor).
+ *
+ * \param coordids coordinates IDs of the grid.
+ * \param gridname name this grid will be given
+ * \param gridid (output) grid ID
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_def_grid(const int coordids[], const char *gridname,
+                         int *gridid){
+ 
+    /* Instantiate object */
+    struct nccf_struct_grid_type *self;
+    self = (struct nccf_struct_grid_type *)
+             malloc(sizeof(struct nccf_struct_grid_type));
+
+    int i, ndims, status;
+
+    /* Initialization */
+    self->coordids = NULL;
+    self->ndims = 0;
+    self->gridname = NULL;
+    self->imask = NULL;
+    self->coord_periodicity = NULL;
+
+    /* Grid Name */
+    self->gridname = (char*)calloc( STRING_SIZE, sizeof(char));
+    strcpy( self->gridname, gridname );
+
+    /* Get the number of dimensions from the first coordinate 
+       must have at least one element */
+    if (coordids) {
+      status = nccf_inq_coord_ndims(coordids[0], &ndims);
+      self->ndims = ndims;
+
+      self->coordids = (int *) malloc(ndims * sizeof( int ));
+      for(i = 0; i < ndims; i++) {
+        /* store the coordinate ids */
+        self->coordids[i] = coordids[i];
+      }
+
+    }
+    status = nccf_detect_grid_periodicity(self);
+
+    /* Create a new, global list of grids, if need be */
+    if(CFLIST_STRUCTURED_GRID == NULL) 
+            nccf_li_new(&CFLIST_STRUCTURED_GRID);
+
+    /* Add this instance to the linked list */
+    *gridid  = nccf_li_add(&CFLIST_STRUCTURED_GRID, self);
+
+    return NC_NOERR;
+}
diff --git a/gridspec_api/grid/nccf_def_grid_from_file.c b/gridspec_api/grid/nccf_def_grid_from_file.c
new file mode 100644
index 0000000..a608138
--- /dev/null
+++ b/gridspec_api/grid/nccf_def_grid_from_file.c
@@ -0,0 +1,112 @@
+/**
+ * $Id: nccf_def_grid_from_file.c 891 2011-12-21 17:22:02Z pletzer $
+ */
+
+#include <nccf_constants.h>
+#include "nccf_grid.h"
+#include <netcdf.h>
+#include <string.h>
+#include <math.h>
+
+#include "nccf_varObj.h"
+#include "nccf_coord.h"
+#include "nccf_global.h"
+#include "nccf_errors.h"
+
+/**
+ * \ingroup gs_grid_grp
+ * Define (construct) grid from a netcdf file.
+ *
+ * \param filename name of the netcdf file
+ * \param ndims number of space dimensions
+ * \param coordnames name of each coordinate (each string should be able to hold at least NC_MAX_NAME characters)
+ * \param gridname name this grid will be given
+ * \param gridid (output) returned grid ID
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ * \note This will recusively call the define method for the coordinates.
+ */
+int nccf_def_grid_from_file(const char *filename,
+                   int ndims,
+                   const char **coordnames,
+                   char *gridname,
+                   int *gridid) {
+
+  int totError = NC_NOERR, status = NC_NOERR, globalid;
+  int ncid, i;
+
+  /* Create the structure */
+  struct nccf_struct_grid_type *self;
+  self = (struct nccf_struct_grid_type *)
+          malloc(sizeof( struct nccf_struct_grid_type));
+
+  /* Initialize */
+  self->ndims = ndims;
+  self->coordids = (int *) malloc(ndims * sizeof(int));
+  self->gridname = NULL;
+  self->imask = NULL;
+  self->coord_periodicity = NULL;
+
+  /* Open file */
+  status = nc_open(filename, NC_NOWRITE, &ncid);
+  if (status) return status;
+  totError += abs(status);
+
+  /* Read in the coordinates */
+  for (i = 0; i < ndims; ++i) {
+    status = nccf_def_coord_from_file(filename, coordnames[i], 
+                                      &self->coordids[i]);
+    totError += abs(status);
+  }
+
+  /* Read in the mask, if present */
+  int var_id;
+  if (ndims > 0 && nc_inq_varid(ncid, "imask", &var_id) == NC_NOERR) {
+    // compute number of vertices
+    int dims[ndims];
+    status = nccf_inq_coord_dims(self->coordids[0], dims);
+    totError += abs(status);
+    int nvertex = 1;
+    for (i = 0; i < ndims; ++i) {
+      nvertex *= dims[i];
+    }
+    // read the netcdf variable "imask"
+    const int read_data = 1;
+    const int keep_type = 0;
+    struct nccf_var_obj *imask_var;
+    status = nccf_varCreateFromFile(&imask_var, "imask", ncid, 
+                                    read_data, keep_type);
+    totError += abs(status);
+    // get the pointer
+    int *imask;
+    status = nccf_varGetDataPtr(&imask_var, (void **) &imask);
+    totError += abs(status);
+    // set the mask values
+    self->imask = (int *) malloc(nvertex * sizeof(int));
+    for (i = 0; i < nvertex; ++i) {
+      self->imask[i] = imask[i];
+    }
+    // clean up
+    status = nccf_varDestroy(&imask_var);
+  }
+  
+  /* Fill in the gridname */
+  self->gridname = (char*) malloc(STRING_SIZE * sizeof(char));
+  status = nccf_def_global_from_file( filename, &globalid );
+  status = nccf_inq_global_att( globalid, CF_GRIDNAME, self->gridname );
+  nccf_free_global( globalid );
+
+  /* Close the file */
+  status = nc_close( ncid );
+  totError += abs(status);
+
+  /* Get the ID */
+  if (CFLIST_STRUCTURED_GRID == NULL) nccf_li_new(&CFLIST_STRUCTURED_GRID);
+  *gridid = nccf_li_add( &CFLIST_STRUCTURED_GRID, self );
+
+  status = nccf_detect_grid_periodicity(self);
+  totError += abs(status);
+
+  return totError;
+}
diff --git a/gridspec_api/grid/nccf_detect_grid_periodicity.c b/gridspec_api/grid/nccf_detect_grid_periodicity.c
new file mode 100644
index 0000000..a3781a7
--- /dev/null
+++ b/gridspec_api/grid/nccf_detect_grid_periodicity.c
@@ -0,0 +1,45 @@
+/* $Id: nccf_detect_grid_periodicity.c 926 2012-03-23 20:08:52Z pletzer $ */
+
+#include <nccf_constants.h>
+#include <nccf_utility_functions.h>
+#include <nccf_coord.h>
+#include "nccf_grid.h"
+#include <string.h>
+#include <math.h>
+#include <stdlib.h>
+
+int nccf_detect_grid_periodicity(struct nccf_struct_grid_type *self) {
+
+  int status, i, islon;
+  int toterr = 0;
+  char units[STRING_SIZE];
+  int ijklo[self->ndims], ijkhi[self->ndims];
+
+  for (i = 0; i < self->ndims; ++i) {
+    ijklo[i] = 0;
+    ijkhi[i] = 0;
+  }
+
+  free(self->coord_periodicity);
+  self->coord_periodicity = (double *) malloc(self->ndims * sizeof(double));
+ 
+  for(i = 0; i < self->ndims; ++i) {
+    /* set the periodicity lengths, default are very large numbers  */
+    self->coord_periodicity[i] = CF_HUGE_DOUBLE;
+    islon = 0;
+    status = nccf_is_coord_lon(self->coordids[i], &islon);
+    toterr += abs(status);
+    if (islon) {
+      status = nccf_inq_coord_units(self->coordids[i], units);
+      /* units of longitudes can be radians, so test */
+      if (strncmp(units, "degree", 6) == 0)  {
+        self->coord_periodicity[i] = 360.0;
+      }
+      else {
+        self->coord_periodicity[i] = M_2_PI;
+      } 
+    }
+  }
+
+  return toterr;
+}
diff --git a/gridspec_api/grid/nccf_free_grid.c b/gridspec_api/grid/nccf_free_grid.c
new file mode 100644
index 0000000..be6a3aa
--- /dev/null
+++ b/gridspec_api/grid/nccf_free_grid.c
@@ -0,0 +1,55 @@
+/*
+ * API to free a structured grid object for the gridspec convention to
+ * libcf.
+ *
+ * $Id: nccf_free_grid.c 918 2012-02-07 22:10:36Z pletzer $
+ * */
+
+#include "nccf_grid.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <nccf_varObj.h>
+
+/**
+ * \ingroup gs_grid_grp
+ * Free structured grid object.
+ *
+ * \param gridid grid ID
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_free_grid(int gridid) {
+
+    struct nccf_struct_grid_type *self;
+    self = nccf_li_remove(&CFLIST_STRUCTURED_GRID, gridid);
+    if( nccf_li_get_nelem( &CFLIST_STRUCTURED_GRID ) == 0 )
+        nccf_li_del( &CFLIST_STRUCTURED_GRID );
+
+    /* call free below */
+    if(self->gridname){
+     free(self->gridname);
+     self->gridname = NULL;
+    }
+    if(self->coordids) {
+      free(self->coordids);
+      self->coordids = NULL;
+    }
+
+    if (self->imask) {
+      free(self->imask);
+      self->imask = NULL;
+    }
+
+    if (self->coord_periodicity) {
+      free(self->coord_periodicity);
+      self->coord_periodicity = NULL;
+    }
+
+    /* Destroy object */
+    free(self);
+    self = NULL;
+
+    return NC_NOERR;
+}
diff --git a/gridspec_api/grid/nccf_get_grid_mask_pointer.c b/gridspec_api/grid/nccf_get_grid_mask_pointer.c
new file mode 100644
index 0000000..c35cc69
--- /dev/null
+++ b/gridspec_api/grid/nccf_get_grid_mask_pointer.c
@@ -0,0 +1,23 @@
+/* $Id: nccf_get_grid_mask_pointer.c 738 2011-05-06 22:26:09Z edhartnett $ */
+
+#include <nccf_grid.h>
+#include <netcdf.h>
+#include <nccf_coord.h>
+
+/**
+ * \ingroup gs_grid_grp
+ * Get the valid data mask. 
+ *
+ * \param gridid grid object Id
+ * \param imask_ptr pointer to the mask array
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_get_grid_mask_pointer(int gridid, int **imask_ptr) {
+  struct nccf_struct_grid_type *self;
+  self = nccf_li_find(&CFLIST_STRUCTURED_GRID, gridid);
+  *imask_ptr = self->imask;
+ 
+  return NC_NOERR;
+}
diff --git a/gridspec_api/grid/nccf_grid.h b/gridspec_api/grid/nccf_grid.h
new file mode 100644
index 0000000..6a88f2f
--- /dev/null
+++ b/gridspec_api/grid/nccf_grid.h
@@ -0,0 +1,77 @@
+/*
+ * API to define a structured grid for the gridspec convention to libcf.
+ *
+ * $Id: nccf_grid.h 891 2011-12-21 17:22:02Z pletzer $
+ */
+
+#ifndef _NCCF_STRUCTURED_GRID_H
+#define _NCCF_STRUCTURED_GRID_H
+
+#include <netcdf.h>
+#include <libcf_src.h>
+#include <cflistitem.h>
+#include <nccf_varObj.h>
+#include <nccf_handle_error.h>
+#include <nccf_constants.h>
+
+extern struct CFLISTITEM *CFLIST_STRUCTURED_GRID;
+
+struct nccf_struct_grid_type {
+
+  /* Coordinate handles */
+  int *coordids;
+
+  /* Number of space dimensions */
+  int ndims;
+
+  /* Logical name of the grid */
+  char *gridname;
+
+  /* (inverse) mask array */
+  int *imask;
+
+  /* coordinate periodicity lengths */
+  double *coord_periodicity;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int nccf_def_grid(const int coordids[], const char *gridname, 
+			 int *gridid);
+
+int nccf_def_grid_from_file(const char *filename, int ndims, 
+               const char **coordnames, char *gridname, int *gridid);
+
+int nccf_free_grid(int gridid);
+
+int nccf_put_grid(int ncid, int gridid);
+
+int nccf_set_grid_validmask(int gridid, const int *imask);
+
+int nccf_get_grid_mask_pointer(int gridid, int **imask_ptr);
+
+int nccf_save_grid_scrip(int gridid, const char *filename);
+
+int nccf_inq_grid_coordids(int gridid, int coordids[]);
+
+int nccf_inq_grid_ndims(int gridid, int *ndims);
+
+int nccf_inq_grid_coordnames(int gridid, char *coordnames);
+
+int nccf_inq_grid_name(int gridid, char *gridname);
+
+int nccf_inq_grid_periodicity(int gridid, 
+                              double coord_periodicities[]);
+
+// private methods
+int nccf_detect_grid_periodicity(struct nccf_struct_grid_type *self);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _NCCF_STRUCTURED_GRID_H */
+
+
diff --git a/gridspec_api/grid/nccf_inq_grid_coordids.c b/gridspec_api/grid/nccf_inq_grid_coordids.c
new file mode 100644
index 0000000..8a9acda
--- /dev/null
+++ b/gridspec_api/grid/nccf_inq_grid_coordids.c
@@ -0,0 +1,38 @@
+/*
+ * API to define a structured grid for the gridspec convention to libcf.
+ *
+ * $Id: nccf_inq_grid_coordids.c 818 2011-09-13 01:22:33Z pletzer $
+ * */
+
+#include "nccf_grid.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <nccf_coord.h>
+#include <nccf_handle_error.h>
+#include <nccf_varObj.h>
+
+/**
+ * \ingroup gs_grid_grp
+ * Fill in coordinate ids stored in a grid object.
+ *
+ * \param gridid grid object Id
+ * \param coordids (output) list of coordinate ids
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_grid_coordids(const int gridid, int coordids[] ){
+
+   int i;
+   struct nccf_struct_grid_type *self;
+
+   self = nccf_li_find(&CFLIST_STRUCTURED_GRID, gridid);
+
+   for (i = 0; i < self->ndims; ++i) {
+     coordids[i] = self->coordids[i];
+   }
+
+   return NC_NOERR;
+}
diff --git a/gridspec_api/grid/nccf_inq_grid_coordnames.c b/gridspec_api/grid/nccf_inq_grid_coordnames.c
new file mode 100644
index 0000000..381b99e
--- /dev/null
+++ b/gridspec_api/grid/nccf_inq_grid_coordnames.c
@@ -0,0 +1,42 @@
+/*
+ * API to define a structured grid for the gridspec convention to libcf.
+ *
+ * $Id: nccf_inq_grid_coordnames.c 738 2011-05-06 22:26:09Z edhartnett $
+ * */
+
+#include "nccf_grid.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <nccf_coord.h>
+#include <nccf_handle_error.h>
+#include <nccf_varObj.h>
+
+/**
+ * \ingroup gs_grid_grp
+ * Fill in coordinate names.
+ *
+ * \param gridid grid object Id
+ * \param coordnames (output) list of coordinate object names, each name must be able to hold NC_MAX_NAME characters
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_grid_coordnames(const int gridid, 
+					   char *coordnames ){
+
+   int i;
+   char *newname;
+   struct nccf_struct_grid_type *self;
+
+   self = nccf_li_find(&CFLIST_STRUCTURED_GRID, gridid);
+
+   newname = ( char* )calloc( STRING_SIZE, sizeof( char ));
+   for (i = 0; i < self->ndims; ++i) {
+     nccf_inq_coord_name( self->coordids[i], newname );
+     sprintf( &coordnames[i * STRING_SIZE], "%s", newname );
+   }
+   free( newname );
+
+   return NC_NOERR;
+}
diff --git a/gridspec_api/grid/nccf_inq_grid_name.c b/gridspec_api/grid/nccf_inq_grid_name.c
new file mode 100644
index 0000000..2dbc348
--- /dev/null
+++ b/gridspec_api/grid/nccf_inq_grid_name.c
@@ -0,0 +1,35 @@
+/*
+ * API to define a structured grid for the gridspec convention to libcf.
+ *
+ * $Id: nccf_inq_grid_ndims.c 439 2011-01-22 22:05:36Z pletzer $
+ * */
+
+#include "nccf_grid.h"
+#include <stdio.h>
+#include <string.h>
+
+#include <nccf_coord.h>
+#include <nccf_handle_error.h>
+#include <nccf_varObj.h>
+
+/**
+ * \ingroup gs_grid_grp
+ * Fill in the grid name for a given grid ID.
+ *
+ * \param gridid grid object Id
+ * \param gridname (output) name of grid, must be able to hold NC_MAX_NAME characters
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_grid_name(const int gridid, 
+					   char *gridname ){
+
+   struct nccf_struct_grid_type *self;
+
+   self = nccf_li_find(&CFLIST_STRUCTURED_GRID, gridid);
+
+   strcpy( gridname, self->gridname );
+
+   return NC_NOERR;
+}
diff --git a/gridspec_api/grid/nccf_inq_grid_ndims.c b/gridspec_api/grid/nccf_inq_grid_ndims.c
new file mode 100644
index 0000000..8d3873f
--- /dev/null
+++ b/gridspec_api/grid/nccf_inq_grid_ndims.c
@@ -0,0 +1,32 @@
+/*
+ * API to define a structured grid for the gridspec convention to libcf.
+ *
+ * $Id: nccf_inq_grid_ndims.c 822 2011-09-13 14:39:33Z pletzer $
+ * */
+
+#include "nccf_grid.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <nccf_coord.h>
+#include <nccf_handle_error.h>
+#include <nccf_varObj.h>
+
+/**
+ * \ingroup gs_grid_grp
+ * Get number of space dimensions.
+ *
+ * \param gridid grid object Id
+ * \param ndims (output) number of space dimensions
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_grid_ndims(const int gridid, int *ndims ){
+
+   struct nccf_struct_grid_type *self;
+   self = nccf_li_find(&CFLIST_STRUCTURED_GRID, gridid);
+   *ndims = self->ndims;
+
+   return NC_NOERR;
+}
diff --git a/gridspec_api/grid/nccf_inq_grid_periodicity.c b/gridspec_api/grid/nccf_inq_grid_periodicity.c
new file mode 100644
index 0000000..8958a84
--- /dev/null
+++ b/gridspec_api/grid/nccf_inq_grid_periodicity.c
@@ -0,0 +1,36 @@
+/*
+ * API to define a structured grid for the gridspec convention to libcf.
+ *
+ * $Id: nccf_inq_grid_periodicity.c 894 2011-12-21 22:21:14Z pletzer $
+ * */
+
+#include "nccf_grid.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <nccf_coord.h>
+#include <nccf_handle_error.h>
+#include <nccf_varObj.h>
+
+/**
+ * \ingroup gs_grid_grp
+ * Get the grid periodicity lengths
+ *
+ * \param gridid grid object Id
+ * \param coord_periodicity (output) periodicity lengths in coordinate space
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ * \note very large numbers are returned for non-periodic indices/coordinates
+ */
+int nccf_inq_grid_periodicity(int gridid, 
+                              double coord_periodicity[]) {
+  struct nccf_struct_grid_type *self;
+  self = nccf_li_find(&CFLIST_STRUCTURED_GRID, gridid);
+  int i;
+  for (i = 0; i < self->ndims; ++i) {
+    coord_periodicity[i] = self->coord_periodicity[i];
+  }
+  return NC_NOERR;
+}
+
diff --git a/gridspec_api/grid/nccf_put_grid.c b/gridspec_api/grid/nccf_put_grid.c
new file mode 100644
index 0000000..10b3eab
--- /dev/null
+++ b/gridspec_api/grid/nccf_put_grid.c
@@ -0,0 +1,88 @@
+/*
+ * API to wirte a structured grid to a file for the gridspec convention 
+ * to libcf.
+ *
+ * $Id: nccf_put_grid.c 767 2011-06-06 23:20:19Z pletzer $
+ */
+
+#include <nccf_grid.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <netcdf.h>
+#include <libcf_src.h>
+#include <nccf_errors.h>
+#include <nccf_coord.h>
+
+/**
+ * \ingroup gs_grid_grp
+ * Write structured grid, including its underlying coordinates.
+ *
+ * \param gridid grid ID
+ * \param ncid NetCDF file ID created by nc_create or nc_open
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_put_grid(int gridid, int ncid) {
+
+  int status, ndims, iDim;
+  int totErr = 0;
+  int catchErr = NC_NOERR;
+
+// Open the grid structure.
+  struct nccf_struct_grid_type *self;
+  self = nccf_li_find(&CFLIST_STRUCTURED_GRID, gridid);
+
+// Get the coordinate IDs
+  int coordids[self->ndims];
+  status = nccf_inq_grid_coordids(gridid, coordids);
+  totErr += abs(status);
+
+// Get the dimensions and the coordinate IDs.
+  status = nccf_inq_coord_ndims(coordids[0], &ndims);
+  totErr += abs(status);
+
+// Write coordinate data to file
+  for(iDim = 0; iDim < ndims; iDim++) {
+    status = nccf_put_coord(coordids[iDim], ncid);
+    totErr += abs(status);
+  }
+
+// Write mask, if present
+  if (self->imask && self->ndims > 0) {
+    struct nccf_var_obj *imask_var;
+    status = nccf_varCreate(&imask_var, "imask");
+    int dims[self->ndims];
+    char **dimnames;
+    dimnames = (char **) malloc(sizeof(char *) * self->ndims);
+    for (iDim = 0; iDim < ndims; ++iDim) {
+      dimnames[iDim] = (char *) calloc(STRING_SIZE, sizeof(char));
+    }
+    status = nccf_inq_coord_dims(coordids[0], dims);
+    status = nccf_inq_coord_dimnames(coordids[0], dimnames);
+    status = nccf_varSetDims(&imask_var, self->ndims, dims, 
+			     (const char **) dimnames);
+    status = nccf_varSetAttribText(&imask_var, "units", "unitless");
+    status = nccf_varSetAttribText(&imask_var, "long_name", 
+			     "array mask (0=invalid, 1=valid)");
+    status = nccf_varSetDataPtr(&imask_var, NC_INT, self->imask);
+    status = nccf_writeListOfVars(ncid, 1, imask_var);
+    status = nccf_varDestroy(&imask_var);
+    for (iDim = 0; iDim < ndims; ++iDim) {
+      free(dimnames[iDim]);
+    }
+    free(dimnames);
+  }
+
+  if (totErr != 0) {
+    if (catchErr != NC_NOERR) {
+      return catchErr;
+    }
+    else {
+      return NCCF_EPUTGRID;
+    }
+  }
+  return NC_NOERR;
+}
diff --git a/gridspec_api/grid/nccf_save_grid_scrip.c b/gridspec_api/grid/nccf_save_grid_scrip.c
new file mode 100644
index 0000000..08ec103
--- /dev/null
+++ b/gridspec_api/grid/nccf_save_grid_scrip.c
@@ -0,0 +1,231 @@
+/* $Id: nccf_save_grid_scrip.c 738 2011-05-06 22:26:09Z edhartnett $ */
+
+#include <nccf_grid.h>
+#include <math.h>
+#include <netcdf.h>
+#include <nccf_coord.h>
+
+/**
+ * \ingroup gs_grid_grp
+ * Save grid object in SCRIP compatible file
+ *
+ * \param gridid grid object Id
+ * \param filename NetCDF file name
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_save_grid_scrip(int gridid, const char *filename) {
+  int ncid;
+  int ierr;
+  int tot_err = NC_NOERR;
+  int ilon = -1, ilat = -1;
+  int i, j, k;
+  int yesno;
+  int ncells;
+  char lon_units[STRING_SIZE];
+  char lat_units[STRING_SIZE];
+
+  struct nccf_struct_grid_type *self;
+  self = nccf_li_find(&CFLIST_STRUCTURED_GRID, gridid);
+
+  if (self->ndims != 2) {
+    // no op if not a lon-lat grid
+    return NC_NOERR;
+  }
+			
+  // locate the lon-lat coordinates
+  for (i = 0; i < self->ndims; ++i) {
+    ierr = nccf_is_coord_lon(self->coordids[i], &yesno);
+    tot_err += abs(ierr);
+    if (yesno == 1) {
+      ilon = i;
+      ierr = nccf_inq_coord_units(self->coordids[i], lon_units);
+      tot_err += abs(ierr);
+    }
+    ierr = nccf_is_coord_lat(self->coordids[i], &yesno);
+    tot_err += abs(ierr);
+    if (yesno == 1) {
+      ilat = i;
+      ierr = nccf_inq_coord_units(self->coordids[i], lat_units);
+      tot_err += abs(ierr);
+    }
+  }
+
+  // number of cells
+  int dims[self->ndims];
+  int dims_cell[self->ndims];
+  ierr = nccf_inq_coord_dims(self->coordids[0], dims);
+  tot_err += abs(ierr);
+  ncells = 1;
+  for (i = 0; i < self->ndims; ++i) {
+    dims_cell[i] = dims[i] - 1;
+    ncells *= dims_cell[i];
+  }
+  int ncorners = 2*2;
+
+  // save to netcdf file
+  ierr = nc_create(filename, NC_CLOBBER, &ncid);
+  tot_err += abs(ierr);
+
+  // create var objects
+  struct nccf_var_obj *grid_dims;
+  struct nccf_var_obj *grid_center_lon;
+  struct nccf_var_obj *grid_center_lat;
+  struct nccf_var_obj *grid_imask;
+  struct nccf_var_obj *grid_corner_lon;
+  struct nccf_var_obj *grid_corner_lat;
+  struct nccf_var_obj *global;
+
+  const char *dims_cell_names[] = {"grid_rank"};
+  const char *dims_center_names[] = {"grid_size"};
+  const char *dims_corner_names[] = {"grid_size", "grid_corners"};
+
+  const int dims_cells[] = {self->ndims};
+  const int dims_center[] = {ncells};
+  const int dims_corner[] = {ncells, pow(2, self->ndims) };
+
+  ierr = nccf_varCreate(&grid_dims, "grid_dims");
+  tot_err += abs(ierr);
+  ierr = nccf_varSetDims(&grid_dims, 1, dims_cells, dims_cell_names);
+  tot_err += abs(ierr);
+
+  ierr = nccf_varCreate(&grid_center_lon, "grid_center_lon");
+  tot_err += abs(ierr);
+  ierr = nccf_varSetDims(&grid_center_lon, 1, dims_center, dims_center_names);
+  tot_err += abs(ierr);
+  ierr = nccf_varSetAttribText(&grid_center_lon, "units", lon_units);
+  tot_err += abs(ierr);
+
+  ierr = nccf_varCreate(&grid_center_lat, "grid_center_lat");
+  tot_err += abs(ierr);
+  ierr = nccf_varSetDims(&grid_center_lat, 1, dims_center, dims_center_names);
+  tot_err += abs(ierr);
+  ierr = nccf_varSetAttribText(&grid_center_lat, "units", lat_units);
+  tot_err += abs(ierr);
+
+  ierr = nccf_varCreate(&grid_imask, "grid_imask");
+  tot_err += abs(ierr);
+  ierr = nccf_varSetDims(&grid_imask, 1, dims_center, dims_center_names);
+  tot_err += abs(ierr);
+
+  ierr = nccf_varCreate(&grid_corner_lon, "grid_corner_lon");
+  tot_err += abs(ierr);
+  ierr = nccf_varSetDims(&grid_corner_lon, 2, dims_corner, dims_corner_names);
+  tot_err += abs(ierr);
+  ierr = nccf_varSetAttribText(&grid_corner_lon, "units", lon_units);
+  tot_err += abs(ierr);
+
+  ierr = nccf_varCreate(&grid_corner_lat, "grid_corner_lat");
+  tot_err += abs(ierr);
+  ierr = nccf_varSetDims(&grid_corner_lat, 2, dims_corner, dims_corner_names);
+  tot_err += abs(ierr);
+  ierr = nccf_varSetAttribText(&grid_corner_lat, "units", lat_units);
+  tot_err += abs(ierr);
+
+  // set the data
+  ierr = nccf_varSetDataPtr(&grid_dims, NC_INT, dims_cell); // should really be NC_LONG
+  tot_err += abs(ierr);
+
+  double *lons;
+  double *lats;
+  ierr = nccf_get_coord_data_pointer(self->coordids[ilon], &lons);
+  tot_err += abs(ierr);
+  ierr = nccf_get_coord_data_pointer(self->coordids[ilat], &lats);
+  tot_err += abs(ierr);
+  double *center_lon = (double *) malloc(sizeof(double) * ncells);
+  double *center_lat = (double *) malloc(sizeof(double) * ncells);
+  int *imask = (int *) malloc(sizeof(int) * ncells);
+  double *corner_lon = (double *) malloc(sizeof(double) * ncorners * ncells);
+  double *corner_lat = (double *) malloc(sizeof(double) * ncorners * ncells);
+  k = 0;
+  for (i = 0; i < dims[0]-1; ++i){
+    for (j = 0; j < dims[1]-1; ++j) {
+
+      center_lon[k]  = lons[(j+0) + (i+0)*dims[0]];
+      center_lon[k] += lons[(j+1) + (i+0)*dims[0]];
+      center_lon[k] += lons[(j+0) + (i+1)*dims[0]];
+      center_lon[k] += lons[(j+1) + (i+1)*dims[0]];
+      center_lon[k] /= 4.0;
+
+      center_lat[k]  = lats[(j+0) + (i+0)*dims[0]];
+      center_lat[k] += lats[(j+1) + (i+0)*dims[0]];
+      center_lat[k] += lats[(j+0) + (i+1)*dims[0]];
+      center_lat[k] += lats[(j+1) + (i+1)*dims[0]];
+      center_lat[k] /= 4.0;
+
+      imask[k] = 1;
+      if (self->imask) {
+	if ( (self->imask[(j+0) + (i+0)*dims[0]] == 0) ||
+	     (self->imask[(j+1) + (i+0)*dims[0]] == 0) ||
+	     (self->imask[(j+0) + (i+1)*dims[0]] == 0) ||
+	     (self->imask[(j+1) + (i+1)*dims[0]] == 0) ) {
+	  imask[k] = 0;
+	}
+      }
+
+      corner_lon[4*k + 0] = lons[(j+0) + (i+0)*dims[0]];
+      corner_lon[4*k + 1] = lons[(j+1) + (i+0)*dims[0]];
+      corner_lon[4*k + 2] = lons[(j+1) + (i+1)*dims[0]];
+      corner_lon[4*k + 3] = lons[(j+0) + (i+1)*dims[0]];
+
+      corner_lat[4*k + 0] = lats[(j+0) + (i+0)*dims[0]];
+      corner_lat[4*k + 1] = lats[(j+1) + (i+0)*dims[0]];
+      corner_lat[4*k + 2] = lats[(j+1) + (i+1)*dims[0]];
+      corner_lat[4*k + 3] = lats[(j+0) + (i+1)*dims[0]];
+
+      k++;
+    }
+  }
+  
+  ierr = nccf_varSetDataPtr(&grid_center_lon, NC_DOUBLE, center_lon);
+  tot_err += abs(ierr);
+  ierr = nccf_varSetDataPtr(&grid_center_lat, NC_DOUBLE, center_lat);
+  tot_err += abs(ierr);
+  ierr = nccf_varSetDataPtr(&grid_imask, NC_INT, imask);
+  tot_err += abs(ierr);
+  ierr = nccf_varSetDataPtr(&grid_corner_lon, NC_DOUBLE, corner_lon);
+  tot_err += abs(ierr);
+  ierr = nccf_varSetDataPtr(&grid_corner_lat, NC_DOUBLE, corner_lat);
+  tot_err += abs(ierr);
+
+  // global attribute
+  ierr = nccf_varCreate(&global, "");
+  tot_err += abs(ierr);
+  ierr = nccf_varSetAttribText(&global, "title", 
+                               "libCF nccf_save_grid_scrip");
+
+  // write the data
+  ierr = nccf_writeListOfVars(ncid, 7, grid_dims, 
+                              grid_center_lon, grid_center_lat, grid_imask,
+                              grid_corner_lon, grid_corner_lat, global);
+  tot_err += abs(ierr);
+
+  // close file
+  ierr = nc_close(ncid);
+  tot_err += abs(ierr);
+
+  // clean up
+  free(corner_lon);
+  free(corner_lat);
+  free(imask);
+  free(center_lon);
+  free(center_lat);
+  ierr = nccf_varDestroy(&grid_dims);
+  tot_err += abs(ierr);
+  ierr = nccf_varDestroy(&grid_center_lon);
+  tot_err += abs(ierr);
+  ierr = nccf_varDestroy(&grid_center_lat);
+  tot_err += abs(ierr);
+  ierr = nccf_varDestroy(&grid_imask);
+  tot_err += abs(ierr);
+  ierr = nccf_varDestroy(&grid_corner_lon);
+  tot_err += abs(ierr);
+  ierr = nccf_varDestroy(&grid_corner_lat);
+  tot_err += abs(ierr);
+  ierr = nccf_varDestroy(&global);
+  tot_err += abs(ierr);
+
+  return tot_err;
+}
+
diff --git a/gridspec_api/grid/nccf_set_grid_validmask.c b/gridspec_api/grid/nccf_set_grid_validmask.c
new file mode 100644
index 0000000..aa55f60
--- /dev/null
+++ b/gridspec_api/grid/nccf_set_grid_validmask.c
@@ -0,0 +1,43 @@
+/* $Id: nccf_set_grid_validmask.c 738 2011-05-06 22:26:09Z edhartnett $ */
+
+#include <nccf_grid.h>
+#include <netcdf.h>
+#include <nccf_coord.h>
+
+/**
+ * \ingroup gs_grid_grp
+ * Attach valid data mask to grid. 
+ *
+ * \param gridid grid object Id
+ * \param imask array of 1's and 0's: 1 = valid, 0 = invalid data
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_set_grid_validmask(int gridid, const int *imask) {
+  int ntot, i, ierr;
+  int tot_err = NC_NOERR;
+  struct nccf_struct_grid_type *self;
+  self = nccf_li_find(&CFLIST_STRUCTURED_GRID, gridid);
+
+  /* erase */
+  if (self->imask) {
+    free(self->imask);
+  }
+
+  if (self->ndims > 0) {
+    int dims[self->ndims];
+    ierr = nccf_inq_coord_dims(self->coordids[0], dims);
+    tot_err += abs(ierr);
+    ntot = 1;
+    for (i = 0; i < self->ndims; ++i) {
+      ntot *= dims[i];
+    }
+    self->imask = (int *) malloc(sizeof(int) * ntot);
+    for (i = 0; i < ntot; ++i) {
+      self->imask[i] = imask[i];
+    }
+  }
+ 
+  return tot_err;
+}
diff --git a/gridspec_api/grid/tst_1d_grid.c b/gridspec_api/grid/tst_1d_grid.c
new file mode 100644
index 0000000..859a13f
--- /dev/null
+++ b/gridspec_api/grid/tst_1d_grid.c
@@ -0,0 +1,107 @@
+/**
+ * Test generation of a structured grid.
+ *
+ * "$Id: tst_1d_grid.c 767 2011-06-06 23:20:19Z pletzer $"
+ *
+ */
+
+#include "nccf_grid.h"
+#include <string.h>
+#include <stdio.h>
+#include <math.h>
+#include <netcdf.h>
+
+#include "nccf_global.h"
+#include "libcf_src.h"
+#include "nccf_coord.h"
+#include "nccf_handle_error.h"
+#include "nccf_utility_functions.h"
+
+int main(){
+
+  const int save = 1;
+  const int ndims = 1;
+  const int dims[] = {10};
+  const double lonMin[] = {0.0, 180.};
+  const double lonMax[] = {180.0, 360.};
+  double dLon;
+  int nvertex = dims[0];
+  double lonData[nvertex];
+  int ngrids = 2;
+  char coordinates_id[36+1];
+
+  nc_type ncmode = NC_CLOBBER;
+  int i, j;
+  int coordids[ngrids][ndims];
+  char **coordNames;
+  int gridid[ngrids], gridid2, globalId;
+  int status;
+  int ncid;
+
+  char name[STRING_SIZE];
+  char gridname[STRING_SIZE];
+  sprintf( name, "%s", "grid_1d");
+  char filename[STRING_SIZE];
+  const char *dimnames[] = {"ni"};
+
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+
+  /* Populate coordinates and create lon/lat coordinate objects */
+  for( j = 0; j < ngrids; j++ ){
+    dLon = (lonMax[j] - lonMin[j]) / (dims[0] - 1);
+    for (i = 0; i < dims[0]; ++i) {
+      lonData[i] = lonMin[j] + i * dLon;
+    }
+    if ((status = nccf_def_lon_coord(ndims, dims, dimnames, lonData, 
+                              save, &coordids[j][0]))) ERR;
+
+  /* Create grid */
+    sprintf( gridname, "%s_grid%d", name, j );
+    sprintf( filename, "%s.nc", gridname );
+    if ((status = nccf_def_grid( coordids[j], gridname, &gridid[j]))) ERR;
+    if ((status = nccf_def_global( &globalId ))) ERR;
+    if ((status = nccf_add_global_att( globalId, CF_COORDINATES_ID, 
+                                       coordinates_id, 0 ))) ERR;
+    if ((status = nccf_add_global_att( globalId, CF_FILETYPE, 
+                                       CF_GLATT_FILETYPE_GRID, 0))) ERR;
+    if ((status = nccf_add_global_att( globalId, CF_GRIDNAME, 
+                                       gridname, 0 ))) ERR;
+
+  /* Write to file */
+    if(( status = nc_create( filename, ncmode, &ncid ))) ERR;
+    if(( status = nccf_put_grid(gridid[j], ncid))) ERR;
+    if(( status = nccf_put_global(globalId, ncid))) ERR;
+    if(( status = nc_close( ncid ))) ERR;
+    if(( status = nccf_free_global( globalId ))) ERR;
+
+  }
+
+  /* Free */
+  for ( j = 0; j < ngrids; j++ ){
+    if (( status = nccf_free_grid(gridid[j]))) ERR;
+    if (( status = nccf_free_coord( coordids[j][0] ))) ERR;
+  }
+
+  /* Read from file */
+  coordNames = (char **) malloc(sizeof(char *) * ndims);
+  coordNames[0] = (char *) calloc(strlen("lon") + 1, sizeof(char));
+  strcpy(coordNames[0], "lon");
+
+  int cid[ndims];
+  for( j = 0; j < ngrids; j++ ){
+    sprintf( filename, "%s_grid%d.nc", name, j );
+    if(( status = nccf_def_grid_from_file(filename,
+               ndims, (const char**)coordNames, name, 
+               &gridid2))) ERR;
+    status = nccf_inq_grid_coordids( gridid2, cid );
+    if (( status = nccf_free_grid(gridid2))) ERR;
+    for (i = 0; i < ndims; ++i) {
+      status += nccf_free_coord( cid[i] );
+    }
+  }
+
+  free(coordNames[0]);
+  free(coordNames);
+  return 0;
+}
diff --git a/gridspec_api/grid/tst_bipolar_tripolar_grid.c b/gridspec_api/grid/tst_bipolar_tripolar_grid.c
new file mode 100644
index 0000000..476e733
--- /dev/null
+++ b/gridspec_api/grid/tst_bipolar_tripolar_grid.c
@@ -0,0 +1,114 @@
+/**
+ * Test the creation of a tripolar grid
+ * \author Dave Kinding and Lexander Pletzer, Tech-X Corp.
+ *
+ * "$Id: tst_bipolar_tripolar_grid.c 767 2011-06-06 23:20:19Z pletzer $"
+ */
+
+#include "nccf_grid.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include <libcf_src.h>
+#include <netcdf.h>
+#include "nccf_global.h"
+#include <nccf_coord.h>
+#include <nccf_handle_error.h>
+#include <nccf_utility_functions.h>
+
+int main(){
+
+  const int ndims = 2;
+  const int ngrids = 3;
+  const int bpdims[] = {6, 6}, gldims[] = {6, 6};
+  const int bpnvertex = bpdims[0] * bpdims[1];
+  const int glnvertex = gldims[0] * gldims[1];
+  const double latPerim = 60;
+  const double lonSing = 0.0;
+  double bplons[bpnvertex], bplats[bpnvertex];
+  double gllons[glnvertex], gllats[glnvertex];
+  double dLon, dLat, lonMin[] = {0, 180}, lonMax[] = {180, 360};
+  double latMin = -90, latMax = latPerim;
+  int i, j, iGrid, status, ncid;
+  const int save = 1;
+  char coordinates_id[36+1];
+
+  int gridid[ngrids], coordids[ngrids][ndims];  // 3 for the lower grid, and 2 for the bipolar grid
+  int globalId;
+
+  nc_type nc_mode = NC_CLOBBER;
+
+  const char *dimnames[] = {"ni", "nj"};
+  char *tname = "3tile_tripolar";
+  char *name, filename[STRING_SIZE];
+  name = ( char * )calloc( STRING_SIZE, sizeof( char ) );
+  sprintf( name, "%s", tname );
+
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+  
+  /* Get the bipolar cap 1 grid */
+  status = nccf_get_bipolar_cap(bpdims, latPerim, lonSing, bplons, bplats);
+
+  /* A two grids below the cap */
+  for( iGrid = 0; iGrid < ngrids-1; iGrid++ ){
+    dLon = (lonMax[iGrid] - lonMin[iGrid]) / (gldims[0] - 1);
+    dLat = (latMax    - latMin) / (gldims[1] - 1);
+    for (j = 0; j < gldims[1]; ++j) {
+      for (i = 0; i < gldims[0]; ++i) {
+        gllons[i + gldims[0] * j] = lonMin[iGrid] + i * dLon;
+        gllats[i + gldims[0] * j] = latMin    + j * dLat;
+      }
+    }
+    if ((status = nccf_def_lon_coord(ndims, gldims, dimnames, 
+                    gllons, save, &coordids[iGrid][0]))) ERR;
+    if ((status = nccf_def_lat_coord(ndims, gldims, dimnames, 
+                    gllats, save, &coordids[iGrid][1]))) ERR;
+
+    /* Write the grid */
+    sprintf( filename, "%s_grid%d.nc", name, iGrid );
+    status = nccf_def_grid( coordids[iGrid], name, &gridid[iGrid] );
+    if (status) ERR;
+    if ((status = nccf_def_global( &globalId ))) ERR;
+    if ((status = nccf_add_global_att( globalId, CF_COORDINATES_ID, 
+                                       coordinates_id, 0 ))) ERR;
+    status = nc_create( filename, nc_mode, &ncid );
+    if (status) ERR;
+    status = nccf_put_grid(gridid[iGrid], ncid);
+    status = nccf_put_global(globalId, ncid);
+    if (status) ERR;
+    status = nc_close( ncid );
+    if (status) ERR;
+    if((status = nccf_free_global( globalId ))) ERR;
+  }
+
+  if ((status = nccf_def_lon_coord(ndims, bpdims, dimnames, bplons, 
+                save, &coordids[iGrid][0]))) ERR;
+  if ((status = nccf_def_lat_coord(ndims, bpdims, dimnames, bplats, 
+                save, &coordids[iGrid][1]))) ERR;
+
+  /* Write the polar cap grid */
+  sprintf( filename, "%s_grid%d.nc", name, 2 );
+  status = nccf_def_grid( coordids[iGrid], name, &gridid[iGrid] );
+  if ((status = nccf_def_global( &globalId ))) ERR;
+  if ((status = nccf_add_global_att( globalId, CF_COORDINATES_ID, 
+                                     coordinates_id, 0 ))) ERR;
+  nc_create( filename, nc_mode, &ncid );
+  nccf_put_grid(gridid[iGrid], ncid);
+  status = nccf_put_global(globalId, ncid);
+  nc_close( ncid );
+
+  /* Free all of the grids */
+  for( iGrid = 0; iGrid < ngrids; iGrid++ ){
+    status = nccf_inq_grid_coordids( gridid[iGrid], coordids[iGrid] );
+    status += nccf_free_grid( gridid[iGrid] );
+    status += nccf_free_coord( coordids[iGrid][0] );
+    status += nccf_free_coord( coordids[iGrid][1] );
+  }
+  nccf_free_global( globalId );
+
+  free( name );
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/grid/tst_cubesphere_makegrid.c b/gridspec_api/grid/tst_cubesphere_makegrid.c
new file mode 100644
index 0000000..5c44357
--- /dev/null
+++ b/gridspec_api/grid/tst_cubesphere_makegrid.c
@@ -0,0 +1,97 @@
+/**
+ * Test the definition of a cube-sphere structured grid.
+ *
+ * "$Id: tst_cubesphere_makegrid.c 767 2011-06-06 23:20:19Z pletzer $"
+ */
+
+
+
+#include "nccf_grid.h"
+#include <stdio.h>
+#include <math.h>
+#include <netcdf.h>
+
+#include "libcf_src.h"
+#include "nccf_global.h"
+#include "nccf_coord.h"
+#include "nccf_handle_error.h"
+#include "nccf_utility_functions.h"
+
+int main(){
+
+  /* to save the data in the coordinate object */
+  const int save = 1;
+
+  /* Variables for the grid */
+  int ncid;
+  int status;
+  int iGrid; // Some counters
+
+  int ndims = 2;         // Number of x, y dims
+  int ngrids = 6;
+  int nlon = 10;         // number of x faces, gives nlon + 1 edges
+  int elon = nlon + 1;   // # of edges
+  int dims[] = {elon, elon};
+  int nvertex = elon*elon;
+  int faceVec[3] = {0, 0, 0}, pos, sign;
+  char coordinates_id[36+1];
+  int i;
+
+  nc_type nc_mode = NC_CLOBBER;
+
+  double clon[nvertex], clat[nvertex];
+
+  char *name = "cubesphere_tile";
+  char gridname[STRING_SIZE], filename[STRING_SIZE];
+  const char *dimnames[] = {"ni", "nj"};
+
+  int coordids[ngrids][ndims];
+  int gridid[ngrids];  // Each Id goes with a ncid
+  int globalId;
+
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+
+  /* Define a grid */
+  for( iGrid = 0; iGrid < ngrids; iGrid++ ){
+    pos = iGrid % 3;
+    sign = ( iGrid/3 )  == 0 ? 1 : -1;
+    faceVec[pos] = sign;
+    
+    nccf_get_cubedsphere_grid( dims, faceVec, clon, clat );
+    faceVec[pos] = 0; // reset to zero.
+
+    if(( status = nccf_def_lon_coord( ndims, dims, dimnames, clon, save,
+                                            &coordids[iGrid][0] ))) ERR;
+    if(( status = nccf_def_lat_coord( ndims, dims, dimnames, clat, save,
+                                           &coordids[iGrid][1] ))) ERR;
+    /* Define the grid for the current tile. */
+    sprintf( gridname, "%s%d", name, iGrid );
+    if(( status = nccf_def_grid( coordids[iGrid], 
+					    gridname, &gridid[iGrid] ))) ERR;
+    if ((status = nccf_def_global( &globalId ))) ERR;
+    if ((status = nccf_add_global_att( globalId, CF_COORDINATES_ID, 
+                                       coordinates_id, 0 ))) ERR;
+
+    /* Put the grid into netcdf*/
+    sprintf( filename, "%s%d.nc", name, iGrid );
+    if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+    if(( status = nccf_put_grid(gridid[iGrid], ncid)));
+    if(( status = nccf_put_global(globalId, ncid))) ERR;
+    if(( status = nc_close( ncid ))) ERR;
+
+    /* Free the global grid */
+    if(( status = nccf_free_global( globalId ))) ERR;
+
+  }
+
+  /* free the grid */
+  for( i = 0; i < ngrids; i++ ){
+    if(( status = nccf_free_grid( gridid[i] )));
+    if(( status = nccf_free_coord( coordids[i][0] ))) ERR;
+    if(( status = nccf_free_coord( coordids[i][1] ))) ERR;
+  }
+
+  /* Close the file*/
+  return NC_NOERR;
+}
diff --git a/gridspec_api/grid/tst_struct_grid_latlon.c b/gridspec_api/grid/tst_struct_grid_latlon.c
new file mode 100644
index 0000000..006c2dc
--- /dev/null
+++ b/gridspec_api/grid/tst_struct_grid_latlon.c
@@ -0,0 +1,129 @@
+/**
+ * Test generation of a simple lon-lat structured grid.
+ *
+ * "$Id: tst_struct_grid_latlon.c 893 2011-12-21 22:15:08Z pletzer $"
+ *
+ */
+
+#include "nccf_grid.h"
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <netcdf.h>
+#include <libcf_src.h>
+
+#include "nccf_global.h"
+#include "nccf_coord.h"
+#include "nccf_handle_error.h"
+#include "nccf_utility_functions.h"
+
+int main(){
+
+  const int save = 0;
+  const int ndims = 2;
+  const int dims[] = {10, 11};
+  const double lonMin = 0.0;
+  const double lonMax = 360.0;
+  const double latMin = -90.0;
+  const double latMax = +90.0;
+  double dLon, dLat;
+  int nvertex = dims[0] * dims[1];
+  double lonData[nvertex], latData[nvertex];
+  int imask[nvertex]; 
+  char coordinates_id[36+1];
+  char coordinates_id2[36+1];
+
+  nc_type ncmode = NC_CLOBBER;
+  int i, j;
+  int coordids[ndims];
+  char **coordNames;
+  int gridid, gridid2, globalId;
+  int status;
+  int ncid;
+
+  char name[STRING_SIZE];
+  sprintf( name, "%s", "lonlatgrid");
+  char filename[STRING_SIZE];
+  const char *dimnames[] = {"ni", "nj"};
+
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+
+  /* Populate coordinates and create lon/lat coordinate objects */
+  dLon = (lonMax - lonMin) / (dims[0] - 1);
+  dLat = (latMax - latMin) / (dims[1] - 1);
+  for (j = 0; j < dims[1]; ++j) {
+    for (i = 0; i < dims[0]; ++i) {
+      lonData[i + dims[0] * j] = lonMin + i * dLon;
+      latData[i + dims[0] * j] = latMin + j * dLat;
+      imask[i + dims[0] * j] = 1; // 1=valid
+    }
+  }
+  if ((status = nccf_def_lon_coord(ndims, dims, dimnames, lonData, save, 
+            &coordids[0]))) ERR;
+  if ((status = nccf_def_lat_coord(ndims, dims, dimnames, latData, save, 
+            &coordids[1]))) ERR;
+
+  /* Create grid */
+  sprintf( filename, "%s_grid.nc", name );
+  if ((status = nccf_def_grid( coordids, name, &gridid))) ERR;
+  if ((status = nccf_set_grid_validmask(gridid, imask))) ERR;
+  if ((status = nccf_def_global( &globalId ))) ERR;
+  if ((status = nccf_add_global_att( globalId, CF_COORDINATES_ID, 
+                                     coordinates_id, 0 ))) ERR;
+  if ((status = nccf_add_global_att( globalId, CF_FILETYPE,   
+                                     CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if ((status = nccf_add_global_att( globalId, CF_GRIDNAME, 
+                                     name, 0 ))) ERR;
+
+  double coord_periodicity[ndims];
+  if ((status = nccf_inq_grid_periodicity(gridid, coord_periodicity))) ERR;
+  assert(coord_periodicity[0] < CF_HUGE_DOUBLE);  // periodic
+  assert(coord_periodicity[1] == CF_HUGE_DOUBLE); // non-periodic
+ 
+  /* Write to file */
+  if(( status = nc_create( filename, ncmode, &ncid ))) ERR;
+  if(( status = nccf_put_grid(gridid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+
+  /* Free */
+  if (( status = nccf_free_grid(gridid))) ERR;
+  if (( status = nccf_free_global( globalId ))) ERR;
+  if (( status = nccf_free_coord( coordids[0] ))) ERR;
+  if (( status = nccf_free_coord( coordids[1] ))) ERR;
+
+  /* Read from file */
+  coordNames = (char **) malloc(sizeof(char *) * ndims);
+  coordNames[0] = (char *) calloc(strlen("lon") + 1, sizeof(char));
+  strcpy(coordNames[0], "lon");
+  coordNames[1] = (char *) calloc(strlen("lat") + 1, sizeof(char));
+  strcpy(coordNames[1], "lat");
+
+  if(( status = nccf_def_grid_from_file(filename, 
+               ndims, (const char**)coordNames, name, 
+               &gridid2))) ERR;
+
+  if ((status = nccf_save_grid_scrip(gridid2, 
+					    "tst_struct_grid_latlon_scrip.nc"))) ERR;
+
+  /* Test the global attribute writer */
+  if((status = nccf_def_global_from_file( filename, &globalId ))) ERR;
+  nccf_inq_global_att( globalId, CF_COORDINATES_ID, coordinates_id2 );
+  assert( strcmp( coordinates_id, coordinates_id2 ) == 0 );
+  nccf_free_global( globalId );
+
+  for (i = 0; i < ndims; ++i) {
+    free(coordNames[i]);
+  }
+  free(coordNames);
+
+  int cid[ndims];
+  status = nccf_inq_grid_coordids( gridid2, cid );
+  if (( status = nccf_free_grid(gridid2))) ERR;
+  for( i = 0; i < ndims; i++ ) status += nccf_free_coord( cid[i] );
+
+  return 0;
+}
diff --git a/gridspec_api/host/Makefile.am b/gridspec_api/host/Makefile.am
new file mode 100644
index 0000000..e0f3393
--- /dev/null
+++ b/gridspec_api/host/Makefile.am
@@ -0,0 +1,63 @@
+#
+# $Id: Makefile.am 824 2011-09-13 18:38:07Z dkindig $
+#
+
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include	\
+-I$(srcdir)/../coord -I$(srcdir)/../grid -I$(srcdir)/../global	\
+-I$(srcdir)/../data -I$(srcdir)/../mosaic -I$(srcdir)/../axis
+
+include_HEADERS = nccf_host.h
+
+noinst_LTLIBRARIES = libnccf_host.la
+libnccf_host_la_SOURCES = nccf_def_host.c nccf_def_host_from_file.c	\
+nccf_free_host.c nccf_put_host.c nccf_add_host_file.c			\
+nccf_inq_host_mosaicfilename.c			                        \
+nccf_inq_host_statfilename.c nccf_inq_host_timefilename.c		\
+nccf_inq_host_ntimeslices.c nccf_inq_host_ntimedatafiles.c	        \
+nccf_inq_host_nstatdatafiles.c nccf_inq_host_ngrids.c			\
+nccf_inq_host_gridfilename.c nccf_inq_host_gridname.c			\
+nccf_inq_host_struct_grid_ids.c nccf_inq_host_statdataids.c		\
+nccf_inq_host_timedataids.c nccf_def_host_data.c                        \
+nccf_inq_host_statfileindex.c nccf_inq_host_timefileindex.c
+
+INTLIBS = libnccf_host.la ../mosaic/libnccf_mosaic.la	\
+../data/libnccf_data.la ../grid/libnccf_grid.la		\
+../global/libnccf_global.la ../coord/libnccf_coord.la	\
+../../src/libcf_src.la
+
+EXTLIBS = -lnetcdf
+
+noinst_PROGRAMS = tst_nccf_add_host tst_real_data_case
+
+check_PROGRAMS = tst_nccf_def_host tst_three_tile_cubed_sphere	\
+tst_nccf_def_host_from_file tst_cube_sphere_multi_var		\
+tst_cube_sphere_multi_dims_in_file tst_get_host_three_tile
+
+tst_nccf_def_host_SOURCES = tst_nccf_def_host.c 
+tst_nccf_def_host_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_nccf_add_host_SOURCES = tst_nccf_add_host.c 
+tst_nccf_add_host_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_three_tile_cubed_sphere_SOURCES = tst_three_tile_cubed_sphere.c 
+tst_three_tile_cubed_sphere_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_nccf_def_host_from_file_SOURCES = tst_nccf_def_host_from_file.c 
+tst_nccf_def_host_from_file_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_cube_sphere_multi_var_SOURCES = tst_cube_sphere_multi_var.c
+tst_cube_sphere_multi_var_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_get_host_three_tile_SOURCES = tst_get_host_three_tile.c 
+tst_get_host_three_tile_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_real_data_case_SOURCES = tst_real_data_case.c 
+tst_real_data_case_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_cube_sphere_multi_dims_in_file_SOURCES = tst_cube_sphere_multi_dims_in_file.c
+tst_cube_sphere_multi_dims_in_file_LDADD = $(INTLIBS) $(EXTLIBS)
+
+# files generated by tests
+CLEANFILES = *.nc *.pt
+
+TESTS = $(check_PROGRAMS)
diff --git a/src/Makefile.in b/gridspec_api/host/Makefile.in
similarity index 56%
copy from src/Makefile.in
copy to gridspec_api/host/Makefile.in
index afcdc0d..ed46a45 100644
--- a/src/Makefile.in
+++ b/gridspec_api/host/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,11 +15,10 @@
 
 @SET_MAKE@
 
-# Copyright 2006, see the COPYRIGHT file for more information.
+#
+# $Id: Makefile.am 824 2011-09-13 18:38:07Z dkindig $
+#
 
-# THis automake file is in charge of building the src directory.
-
-# $Id: Makefile.am,v 1.5 2009/11/11 12:59:24 ed Exp $
 
 
 VPATH = @srcdir@
@@ -41,43 +40,15 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-check_PROGRAMS = tst_coords$(EXEEXT) tst_files$(EXEEXT) \
-	tst_vars$(EXEEXT) tst_cvars$(EXEEXT) tst_vert$(EXEEXT) \
-	tst_subsets$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2)
- at BUILD_F90_TRUE@am__append_1 = libcff.la
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at am__append_2 = tst_f03_file
- at BUILD_F90_TRUE@am__append_3 = libcf.la
-
-# Link to the netCDF-4, (optionally) HDF4, and the HDF5 libraries.
- at USE_NETCDF_DIR_TRUE@am__append_4 = -lnetcdf
- at USE_NETCDF_DIR_TRUE@am__append_5 = -I at NETCDFDIR@/include
- at USE_NETCDF_DIR_TRUE@am__append_6 = -L at NETCDFDIR@/lib
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_7 = ../../libsrc4/libnetcdf.la 
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_8 = -I$(top_srcdir)/../libsrc4
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_9 = -L../../libsrc4
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_10 = ../../libsrc/libnetcdf.la
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_11 = -I$(top_srcdir)/../libsrc
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_12 = -L../../libsrc
- at USE_HDF4_TRUE@am__append_13 = -lmfhdf -ldf -ljpeg
- at USE_NETCDF4_TRUE@am__append_14 = -lhdf5_hl -lhdf5 -lz 
-
-# If the user specified a root for HDF5, use it.
- at USE_HDF5_DIR_TRUE@am__append_15 = -I at HDF5DIR@/include
- at USE_HDF5_DIR_TRUE@am__append_16 = -L at HDF5DIR@/lib
-
-# If the user specified a prefix for the HDF4 library location, use it.
- at USE_HDF4_DIR_TRUE@am__append_17 = -I at HDF4DIR@/include
- at USE_HDF4_DIR_TRUE@am__append_18 = -L at HDF4DIR@/lib
-
-# If the user specified a root location for ZLIB, use it.
- at USE_ZLIB_DIR_TRUE@am__append_19 = -I at ZLIBDIR@/include
- at USE_ZLIB_DIR_TRUE@am__append_20 = -L at ZLIBDIR@/lib
-
-# If the user specified a root location for SZLIB, use it.
- at USE_SZLIB_DIR_TRUE@am__append_21 = -I at SZLIBDIR@/include
- at USE_SZLIB_DIR_TRUE@am__append_22 = -L at SZLIBDIR@/lib
- at EXTRA_DATA_TESTS_TRUE@am__append_23 = tst_example_data
-subdir = src
+noinst_PROGRAMS = tst_nccf_add_host$(EXEEXT) \
+	tst_real_data_case$(EXEEXT)
+check_PROGRAMS = tst_nccf_def_host$(EXEEXT) \
+	tst_three_tile_cubed_sphere$(EXEEXT) \
+	tst_nccf_def_host_from_file$(EXEEXT) \
+	tst_cube_sphere_multi_var$(EXEEXT) \
+	tst_cube_sphere_multi_dims_in_file$(EXEEXT) \
+	tst_get_host_three_tile$(EXEEXT)
+subdir = gridspec_api/host
 DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -88,9 +59,93 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
+CONFIG_HEADER = $(top_builddir)/cf_config.h \
+	$(top_builddir)/nfconfig.inc
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libnccf_host_la_LIBADD =
+am_libnccf_host_la_OBJECTS = nccf_def_host.lo \
+	nccf_def_host_from_file.lo nccf_free_host.lo nccf_put_host.lo \
+	nccf_add_host_file.lo nccf_inq_host_mosaicfilename.lo \
+	nccf_inq_host_statfilename.lo nccf_inq_host_timefilename.lo \
+	nccf_inq_host_ntimeslices.lo nccf_inq_host_ntimedatafiles.lo \
+	nccf_inq_host_nstatdatafiles.lo nccf_inq_host_ngrids.lo \
+	nccf_inq_host_gridfilename.lo nccf_inq_host_gridname.lo \
+	nccf_inq_host_struct_grid_ids.lo nccf_inq_host_statdataids.lo \
+	nccf_inq_host_timedataids.lo nccf_def_host_data.lo \
+	nccf_inq_host_statfileindex.lo nccf_inq_host_timefileindex.lo
+libnccf_host_la_OBJECTS = $(am_libnccf_host_la_OBJECTS)
+PROGRAMS = $(noinst_PROGRAMS)
+am_tst_cube_sphere_multi_dims_in_file_OBJECTS =  \
+	tst_cube_sphere_multi_dims_in_file.$(OBJEXT)
+tst_cube_sphere_multi_dims_in_file_OBJECTS =  \
+	$(am_tst_cube_sphere_multi_dims_in_file_OBJECTS)
+am__DEPENDENCIES_1 =
+tst_cube_sphere_multi_dims_in_file_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_cube_sphere_multi_var_OBJECTS =  \
+	tst_cube_sphere_multi_var.$(OBJEXT)
+tst_cube_sphere_multi_var_OBJECTS =  \
+	$(am_tst_cube_sphere_multi_var_OBJECTS)
+tst_cube_sphere_multi_var_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_get_host_three_tile_OBJECTS =  \
+	tst_get_host_three_tile.$(OBJEXT)
+tst_get_host_three_tile_OBJECTS =  \
+	$(am_tst_get_host_three_tile_OBJECTS)
+tst_get_host_three_tile_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_nccf_add_host_OBJECTS = tst_nccf_add_host.$(OBJEXT)
+tst_nccf_add_host_OBJECTS = $(am_tst_nccf_add_host_OBJECTS)
+tst_nccf_add_host_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_nccf_def_host_OBJECTS = tst_nccf_def_host.$(OBJEXT)
+tst_nccf_def_host_OBJECTS = $(am_tst_nccf_def_host_OBJECTS)
+tst_nccf_def_host_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_nccf_def_host_from_file_OBJECTS =  \
+	tst_nccf_def_host_from_file.$(OBJEXT)
+tst_nccf_def_host_from_file_OBJECTS =  \
+	$(am_tst_nccf_def_host_from_file_OBJECTS)
+tst_nccf_def_host_from_file_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_real_data_case_OBJECTS = tst_real_data_case.$(OBJEXT)
+tst_real_data_case_OBJECTS = $(am_tst_real_data_case_OBJECTS)
+tst_real_data_case_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_three_tile_cubed_sphere_OBJECTS =  \
+	tst_three_tile_cubed_sphere.$(OBJEXT)
+tst_three_tile_cubed_sphere_OBJECTS =  \
+	$(am_tst_three_tile_cubed_sphere_OBJECTS)
+tst_three_tile_cubed_sphere_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(libnccf_host_la_SOURCES) \
+	$(tst_cube_sphere_multi_dims_in_file_SOURCES) \
+	$(tst_cube_sphere_multi_var_SOURCES) \
+	$(tst_get_host_three_tile_SOURCES) \
+	$(tst_nccf_add_host_SOURCES) $(tst_nccf_def_host_SOURCES) \
+	$(tst_nccf_def_host_from_file_SOURCES) \
+	$(tst_real_data_case_SOURCES) \
+	$(tst_three_tile_cubed_sphere_SOURCES)
+DIST_SOURCES = $(libnccf_host_la_SOURCES) \
+	$(tst_cube_sphere_multi_dims_in_file_SOURCES) \
+	$(tst_cube_sphere_multi_var_SOURCES) \
+	$(tst_get_host_three_tile_SOURCES) \
+	$(tst_nccf_add_host_SOURCES) $(tst_nccf_def_host_SOURCES) \
+	$(tst_nccf_def_host_from_file_SOURCES) \
+	$(tst_real_data_case_SOURCES) \
+	$(tst_three_tile_cubed_sphere_SOURCES)
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -112,106 +167,7 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
-LTLIBRARIES = $(lib_LTLIBRARIES)
-libcf_la_LIBADD =
-am_libcf_la_OBJECTS = nccoord.lo cffiles.lo cfvars.lo cfcvars.lo \
-	cfsubsets.lo cferror.lo cdTimeConv.lo
-libcf_la_OBJECTS = $(am_libcf_la_OBJECTS)
-libcf_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(libcf_la_LDFLAGS) \
-	$(LDFLAGS) -o $@
-libcff_la_LIBADD =
-am__libcff_la_SOURCES_DIST = cffcvars.f90
- at BUILD_F90_TRUE@am_libcff_la_OBJECTS = cffcvars.lo
-libcff_la_OBJECTS = $(am_libcff_la_OBJECTS)
- at BUILD_F90_TRUE@am_libcff_la_rpath = -rpath $(libdir)
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at am__EXEEXT_1 =  \
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE@	tst_f03_file$(EXEEXT)
- at EXTRA_DATA_TESTS_TRUE@am__EXEEXT_2 = tst_example_data$(EXEEXT)
-am_tst_coords_OBJECTS = tst_coords.$(OBJEXT)
-tst_coords_OBJECTS = $(am_tst_coords_OBJECTS)
-tst_coords_LDADD = $(LDADD)
-am__DEPENDENCIES_1 =
-tst_coords_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_cvars_OBJECTS = tst_cvars.$(OBJEXT)
-tst_cvars_OBJECTS = $(am_tst_cvars_OBJECTS)
-tst_cvars_LDADD = $(LDADD)
-tst_cvars_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am__tst_example_data_SOURCES_DIST = tst_example_data.c nc_tests.h
- at EXTRA_DATA_TESTS_TRUE@am_tst_example_data_OBJECTS =  \
- at EXTRA_DATA_TESTS_TRUE@	tst_example_data.$(OBJEXT)
-tst_example_data_OBJECTS = $(am_tst_example_data_OBJECTS)
-tst_example_data_LDADD = $(LDADD)
-tst_example_data_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am__tst_f03_file_SOURCES_DIST = tst_f03_file.f90
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at am_tst_f03_file_OBJECTS =  \
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE@	tst_f03_file.$(OBJEXT)
-tst_f03_file_OBJECTS = $(am_tst_f03_file_OBJECTS)
-tst_f03_file_LDADD = $(LDADD)
-tst_f03_file_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_files_OBJECTS = tst_files.$(OBJEXT)
-tst_files_OBJECTS = $(am_tst_files_OBJECTS)
-tst_files_LDADD = $(LDADD)
-tst_files_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_subsets_OBJECTS = tst_subsets.$(OBJEXT)
-tst_subsets_OBJECTS = $(am_tst_subsets_OBJECTS)
-tst_subsets_LDADD = $(LDADD)
-tst_subsets_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_vars_OBJECTS = tst_vars.$(OBJEXT)
-tst_vars_OBJECTS = $(am_tst_vars_OBJECTS)
-tst_vars_LDADD = $(LDADD)
-tst_vars_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_vert_OBJECTS = tst_vert.$(OBJEXT)
-tst_vert_OBJECTS = $(am_tst_vert_OBJECTS)
-tst_vert_LDADD = $(LDADD)
-tst_vert_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
-FCCOMPILE = $(FC) $(AM_FCFLAGS) $(FCFLAGS)
-LTFCCOMPILE = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS)
-FCLD = $(FC)
-FCLINK = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
-SOURCES = $(libcf_la_SOURCES) $(libcff_la_SOURCES) \
-	$(tst_coords_SOURCES) $(tst_cvars_SOURCES) \
-	$(tst_example_data_SOURCES) $(tst_f03_file_SOURCES) \
-	$(tst_files_SOURCES) $(tst_subsets_SOURCES) \
-	$(tst_vars_SOURCES) $(tst_vert_SOURCES)
-DIST_SOURCES = $(libcf_la_SOURCES) $(am__libcff_la_SOURCES_DIST) \
-	$(tst_coords_SOURCES) $(tst_cvars_SOURCES) \
-	$(am__tst_example_data_SOURCES_DIST) \
-	$(am__tst_f03_file_SOURCES_DIST) $(tst_files_SOURCES) \
-	$(tst_subsets_SOURCES) $(tst_vars_SOURCES) $(tst_vert_SOURCES)
+am__installdirs = "$(DESTDIR)$(includedir)"
 HEADERS = $(include_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -222,7 +178,6 @@ ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
 AR = @AR@
-AS = @AS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -243,15 +198,19 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-F77 = @F77@
 FC = @FC@
 FCFLAGS = @FCFLAGS@
 FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
+FCLIBS = @FCLIBS@
 FGREP = @FGREP@
 GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
+HAVE_DARWIN = @HAVE_DARWIN@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_LAPACK_LIB = @HAVE_LAPACK_LIB@
+HAVE_LAPACK_NO_UNDERSCORE = @HAVE_LAPACK_NO_UNDERSCORE@
+HAVE_LAPACK_UNDERSCORE = @HAVE_LAPACK_UNDERSCORE@
+HAVE_SHARED = @HAVE_SHARED@
+HAVE_UUID = @HAVE_UUID@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -266,8 +225,10 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 MOD_FLAG = @MOD_FLAG@
+NCDUMP = @NCDUMP@
 NCDUMPDIR = @NCDUMPDIR@
 NETCDFDIR = @NETCDFDIR@
 NM = @NM@
@@ -281,23 +242,23 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
 VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
 ac_ct_FC = @ac_ct_FC@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -329,7 +290,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -345,65 +305,53 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-
-# Tell automake that libcf.h is a header file we want to install.
-include_HEADERS = libcf.h
-
-# Test programs will need to link to this library (libcf) and also
-# netcdf.
-LDADD = ${lib_LTLIBRARIES} $(am__append_3) $(am__append_4) \
-	$(am__append_7) $(am__append_10) $(am__append_13) \
-	$(am__append_14)
-
-# Initalize these.
-AM_CPPFLAGS = $(am__append_5) $(am__append_8) $(am__append_11) \
-	$(am__append_15) $(am__append_17) $(am__append_19) \
-	$(am__append_21)
-AM_LDFLAGS = $(am__append_6) $(am__append_9) $(am__append_12) \
-	$(am__append_16) $(am__append_18) $(am__append_20) \
-	$(am__append_22)
-
-# This is our output, the NetCDF CF Library.
-lib_LTLIBRARIES = libcf.la $(am__append_1)
- at BUILD_F90_TRUE@libcff_la_DEPENDENCIES = libcf_api.f90
- at BUILD_F90_TRUE@EXTRA_DIST = libcf_api.f90
- at BUILD_F90_TRUE@libcff_la_SOURCES = cffcvars.f90
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at tst_f03_file_SOURCES = tst_f03_file.f90
- at BUILD_F90_TRUE@@USE_NETCDF_DIR_FALSE at AM_FCFLAGS = @MOD_FLAG at ../../f90
- at BUILD_F90_TRUE@@USE_NETCDF_DIR_TRUE at AM_FCFLAGS = @MOD_FLAG@@NETCDFDIR@/include
-
-# Add the gridspec functions.
-#libcf_la_LIBADD = ../gridspec/shared/mosaic/libshared.la 
-#libcf_la_LIBADD += ../gridspec/tools/shared/libtoolsshared.la 
-
-# These linker flags specify libtool version info.
-libcf_la_LDFLAGS = -version-info 0:0:0
-
-# This is the coordinate systems stuff.
-libcf_la_SOURCES = nccoord.c libcf.h libcf_int.h cffiles.c cfvars.c	\
-cfcvars.c cfsubsets.c cferror.c cferror.h cdTimeConv.c cdmsint.h	\
-cdms.h cddrs.h drscdf.h cdunif.h
-
-
-# These files are created by the tests.
-CLEANFILES = tst_coords_classic.nc tst_coords_64bit.nc			\
-tst_coords_netcdf4_classic.nc tst_coords_netcdf4.nc tst_vars.nc		\
-tst_files.nc tst_cvars.nc tst_vert_sigma.nc tst_vert_hybrid_sigma.nc	\
-tst_subsets_simple_sigma.nc tst_subsets_nw.nc tst_subsets_sw.nc		\
-tst_subsets_se.nc tst_subsets_ne.nc tst_f03_file.nc libcf.mod
-
-tst_coords_SOURCES = tst_coords.c nc_tests.h
-tst_files_SOURCES = tst_files.c nc_tests.h
-tst_vars_SOURCES = tst_vars.c nc_tests.h
-tst_cvars_SOURCES = tst_cvars.c nc_tests.h
-tst_vert_SOURCES = tst_vert.c nc_tests.h
-tst_subsets_SOURCES = tst_subsets.c nc_tests.h
- at EXTRA_DATA_TESTS_TRUE@tst_example_data_SOURCES = tst_example_data.c nc_tests.h
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include	\
+-I$(srcdir)/../coord -I$(srcdir)/../grid -I$(srcdir)/../global	\
+-I$(srcdir)/../data -I$(srcdir)/../mosaic -I$(srcdir)/../axis
+
+include_HEADERS = nccf_host.h
+noinst_LTLIBRARIES = libnccf_host.la
+libnccf_host_la_SOURCES = nccf_def_host.c nccf_def_host_from_file.c	\
+nccf_free_host.c nccf_put_host.c nccf_add_host_file.c			\
+nccf_inq_host_mosaicfilename.c			                        \
+nccf_inq_host_statfilename.c nccf_inq_host_timefilename.c		\
+nccf_inq_host_ntimeslices.c nccf_inq_host_ntimedatafiles.c	        \
+nccf_inq_host_nstatdatafiles.c nccf_inq_host_ngrids.c			\
+nccf_inq_host_gridfilename.c nccf_inq_host_gridname.c			\
+nccf_inq_host_struct_grid_ids.c nccf_inq_host_statdataids.c		\
+nccf_inq_host_timedataids.c nccf_def_host_data.c                        \
+nccf_inq_host_statfileindex.c nccf_inq_host_timefileindex.c
+
+INTLIBS = libnccf_host.la ../mosaic/libnccf_mosaic.la	\
+../data/libnccf_data.la ../grid/libnccf_grid.la		\
+../global/libnccf_global.la ../coord/libnccf_coord.la	\
+../../src/libcf_src.la
+
+EXTLIBS = -lnetcdf
+tst_nccf_def_host_SOURCES = tst_nccf_def_host.c 
+tst_nccf_def_host_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_nccf_add_host_SOURCES = tst_nccf_add_host.c 
+tst_nccf_add_host_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_three_tile_cubed_sphere_SOURCES = tst_three_tile_cubed_sphere.c 
+tst_three_tile_cubed_sphere_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_nccf_def_host_from_file_SOURCES = tst_nccf_def_host_from_file.c 
+tst_nccf_def_host_from_file_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_cube_sphere_multi_var_SOURCES = tst_cube_sphere_multi_var.c
+tst_cube_sphere_multi_var_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_get_host_three_tile_SOURCES = tst_get_host_three_tile.c 
+tst_get_host_three_tile_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_real_data_case_SOURCES = tst_real_data_case.c 
+tst_real_data_case_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_cube_sphere_multi_dims_in_file_SOURCES = tst_cube_sphere_multi_dims_in_file.c
+tst_cube_sphere_multi_dims_in_file_LDADD = $(INTLIBS) $(EXTLIBS)
+
+# files generated by tests
+CLEANFILES = *.nc *.pt
 TESTS = $(check_PROGRAMS)
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .f90 .lo .o .obj
+.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -413,9 +361,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec_api/host/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign src/Makefile
+	  $(AUTOMAKE) --foreign gridspec_api/host/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -434,41 +382,17 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
-	@$(NORMAL_INSTALL)
-	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
-	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
-	list2=; for p in $$list; do \
-	  if test -f $$p; then \
-	    list2="$$list2 $$p"; \
-	  else :; fi; \
-	done; \
-	test -z "$$list2" || { \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
-	}
-
-uninstall-libLTLIBRARIES:
-	@$(NORMAL_UNINSTALL)
-	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
-	for p in $$list; do \
-	  $(am__strip_dir) \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
-	done
 
-clean-libLTLIBRARIES:
-	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
-	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
 	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
 	  test "$$dir" != "$$p" || dir=.; \
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libcf.la: $(libcf_la_OBJECTS) $(libcf_la_DEPENDENCIES) 
-	$(libcf_la_LINK) -rpath $(libdir) $(libcf_la_OBJECTS) $(libcf_la_LIBADD) $(LIBS)
-libcff.la: $(libcff_la_OBJECTS) $(libcff_la_DEPENDENCIES) 
-	$(FCLINK) $(am_libcff_la_rpath) $(libcff_la_OBJECTS) $(libcff_la_LIBADD) $(LIBS)
+libnccf_host.la: $(libnccf_host_la_OBJECTS) $(libnccf_host_la_DEPENDENCIES) 
+	$(LINK)  $(libnccf_host_la_OBJECTS) $(libnccf_host_la_LIBADD) $(LIBS)
 
 clean-checkPROGRAMS:
 	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
@@ -478,30 +402,39 @@ clean-checkPROGRAMS:
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	rm -f $$list
-tst_coords$(EXEEXT): $(tst_coords_OBJECTS) $(tst_coords_DEPENDENCIES) 
-	@rm -f tst_coords$(EXEEXT)
-	$(LINK) $(tst_coords_OBJECTS) $(tst_coords_LDADD) $(LIBS)
-tst_cvars$(EXEEXT): $(tst_cvars_OBJECTS) $(tst_cvars_DEPENDENCIES) 
-	@rm -f tst_cvars$(EXEEXT)
-	$(LINK) $(tst_cvars_OBJECTS) $(tst_cvars_LDADD) $(LIBS)
-tst_example_data$(EXEEXT): $(tst_example_data_OBJECTS) $(tst_example_data_DEPENDENCIES) 
-	@rm -f tst_example_data$(EXEEXT)
-	$(LINK) $(tst_example_data_OBJECTS) $(tst_example_data_LDADD) $(LIBS)
-tst_f03_file$(EXEEXT): $(tst_f03_file_OBJECTS) $(tst_f03_file_DEPENDENCIES) 
-	@rm -f tst_f03_file$(EXEEXT)
-	$(FCLINK) $(tst_f03_file_OBJECTS) $(tst_f03_file_LDADD) $(LIBS)
-tst_files$(EXEEXT): $(tst_files_OBJECTS) $(tst_files_DEPENDENCIES) 
-	@rm -f tst_files$(EXEEXT)
-	$(LINK) $(tst_files_OBJECTS) $(tst_files_LDADD) $(LIBS)
-tst_subsets$(EXEEXT): $(tst_subsets_OBJECTS) $(tst_subsets_DEPENDENCIES) 
-	@rm -f tst_subsets$(EXEEXT)
-	$(LINK) $(tst_subsets_OBJECTS) $(tst_subsets_LDADD) $(LIBS)
-tst_vars$(EXEEXT): $(tst_vars_OBJECTS) $(tst_vars_DEPENDENCIES) 
-	@rm -f tst_vars$(EXEEXT)
-	$(LINK) $(tst_vars_OBJECTS) $(tst_vars_LDADD) $(LIBS)
-tst_vert$(EXEEXT): $(tst_vert_OBJECTS) $(tst_vert_DEPENDENCIES) 
-	@rm -f tst_vert$(EXEEXT)
-	$(LINK) $(tst_vert_OBJECTS) $(tst_vert_LDADD) $(LIBS)
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_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
+tst_cube_sphere_multi_dims_in_file$(EXEEXT): $(tst_cube_sphere_multi_dims_in_file_OBJECTS) $(tst_cube_sphere_multi_dims_in_file_DEPENDENCIES) 
+	@rm -f tst_cube_sphere_multi_dims_in_file$(EXEEXT)
+	$(LINK) $(tst_cube_sphere_multi_dims_in_file_OBJECTS) $(tst_cube_sphere_multi_dims_in_file_LDADD) $(LIBS)
+tst_cube_sphere_multi_var$(EXEEXT): $(tst_cube_sphere_multi_var_OBJECTS) $(tst_cube_sphere_multi_var_DEPENDENCIES) 
+	@rm -f tst_cube_sphere_multi_var$(EXEEXT)
+	$(LINK) $(tst_cube_sphere_multi_var_OBJECTS) $(tst_cube_sphere_multi_var_LDADD) $(LIBS)
+tst_get_host_three_tile$(EXEEXT): $(tst_get_host_three_tile_OBJECTS) $(tst_get_host_three_tile_DEPENDENCIES) 
+	@rm -f tst_get_host_three_tile$(EXEEXT)
+	$(LINK) $(tst_get_host_three_tile_OBJECTS) $(tst_get_host_three_tile_LDADD) $(LIBS)
+tst_nccf_add_host$(EXEEXT): $(tst_nccf_add_host_OBJECTS) $(tst_nccf_add_host_DEPENDENCIES) 
+	@rm -f tst_nccf_add_host$(EXEEXT)
+	$(LINK) $(tst_nccf_add_host_OBJECTS) $(tst_nccf_add_host_LDADD) $(LIBS)
+tst_nccf_def_host$(EXEEXT): $(tst_nccf_def_host_OBJECTS) $(tst_nccf_def_host_DEPENDENCIES) 
+	@rm -f tst_nccf_def_host$(EXEEXT)
+	$(LINK) $(tst_nccf_def_host_OBJECTS) $(tst_nccf_def_host_LDADD) $(LIBS)
+tst_nccf_def_host_from_file$(EXEEXT): $(tst_nccf_def_host_from_file_OBJECTS) $(tst_nccf_def_host_from_file_DEPENDENCIES) 
+	@rm -f tst_nccf_def_host_from_file$(EXEEXT)
+	$(LINK) $(tst_nccf_def_host_from_file_OBJECTS) $(tst_nccf_def_host_from_file_LDADD) $(LIBS)
+tst_real_data_case$(EXEEXT): $(tst_real_data_case_OBJECTS) $(tst_real_data_case_DEPENDENCIES) 
+	@rm -f tst_real_data_case$(EXEEXT)
+	$(LINK) $(tst_real_data_case_OBJECTS) $(tst_real_data_case_LDADD) $(LIBS)
+tst_three_tile_cubed_sphere$(EXEEXT): $(tst_three_tile_cubed_sphere_OBJECTS) $(tst_three_tile_cubed_sphere_DEPENDENCIES) 
+	@rm -f tst_three_tile_cubed_sphere$(EXEEXT)
+	$(LINK) $(tst_three_tile_cubed_sphere_OBJECTS) $(tst_three_tile_cubed_sphere_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -509,20 +442,34 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdTimeConv.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cfcvars.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cferror.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cffiles.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cfsubsets.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cfvars.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccoord.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_coords.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_cvars.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_example_data.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_subsets.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vars.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vert.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_add_host_file.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_host.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_host_data.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_host_from_file.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_free_host.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_host_gridfilename.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_host_gridname.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_host_mosaicfilename.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_host_ngrids.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_host_nstatdatafiles.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_host_ntimedatafiles.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_host_ntimeslices.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_host_statdataids.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_host_statfileindex.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_host_statfilename.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_host_struct_grid_ids.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_host_timedataids.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_host_timefileindex.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_host_timefilename.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_put_host.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_cube_sphere_multi_dims_in_file.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_cube_sphere_multi_var.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_get_host_three_tile.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_add_host.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_def_host.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_def_host_from_file.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_real_data_case.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_three_tile_cubed_sphere.Po at am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -548,15 +495,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
-.f90.o:
-	$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
-
-.f90.obj:
-	$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'`
-
-.f90.lo:
-	$(LTFCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
-
 mostlyclean-libtool:
 	-rm -f *.lo
 
@@ -761,9 +699,9 @@ check-am: all-am
 	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
-all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
 installdirs:
-	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
+	for dir in "$(DESTDIR)$(includedir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-am
@@ -794,8 +732,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-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES clean-noinstPROGRAMS mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -821,7 +759,7 @@ install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am: install-libLTLIBRARIES
+install-exec-am:
 
 install-html: install-html-am
 
@@ -861,33 +799,25 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
+uninstall-am: uninstall-includeHEADERS
 
 .MAKE: check-am install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
-	clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
-	clean-libtool ctags 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 \
-	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+	clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES clean-noinstPROGRAMS ctags 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 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 pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-includeHEADERS \
-	uninstall-libLTLIBRARIES
-
-
-# Rule to build Fortran 2003 code.
-#cfcvars.o:cfcvsars.f90
-#	$(FC) -c $(AM_FCFLAGS) $(FCFLAGS) -c $? -o $@
+	tags uninstall uninstall-am uninstall-includeHEADERS
 
-tst_f03_file.o:tst_f03_file.f90
-	$(FC) -c $(AM_FCFLAGS) $(FCFLAGS) -c $? -o $@
 
 # 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/gridspec_api/host/nccf_add_host_file.c b/gridspec_api/host/nccf_add_host_file.c
new file mode 100644
index 0000000..d817b0a
--- /dev/null
+++ b/gridspec_api/host/nccf_add_host_file.c
@@ -0,0 +1,136 @@
+/**
+ * $Id: nccf_add_host_file.c 805 2011-09-12 14:55:06Z pletzer $
+ */
+
+#include <nccf_host.h>
+#include <string.h>
+
+/* Comparison function for inserting data.
+ * The user knows the data type and can therefore test equality */
+int item_comparison( const void *data1, const void *data2 ){
+  int result;
+  char *d1, *d2;
+  d1 = (char*)malloc( ( strlen( (char*)data1 )+1) * sizeof( char ));
+  d2 = (char*)malloc( ( strlen( (char*)data1 )+1) * sizeof( char ));
+
+  strcpy( d1, (char*)data1 );
+  strcpy( d2, (char*)data2 );
+
+  if( strcmp( d1, d2 )  < 0) result = -1;
+  if( strcmp( d1, d2 )  > 0) result =  1;
+  if( strcmp( d1, d2 ) == 0) result =  0;
+
+  free( d1 );
+  free( d2 );
+
+  return result;
+}
+
+/**
+ * \ingroup gs_host_grp
+ * Insert a file to the list kept in memory by host object.
+ *
+ * \param hostid the ID for the host object
+ * \param filename name of the file, can be a data file, a grid file, or a mosaic file
+ * \param force set to 1 if file should be added regardless of whether the uuid  in the file matches, otherwise uuid must match
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_add_host_file(int hostid, const char *filename, int force) {
+
+  int nelem, ncid, status = NC_NOERR, totError = NC_NOERR, addFile = force;
+  nc_type attType;
+  size_t attLen;
+  char *fileType = NULL, *fileTypes = NULL, *gridName = NULL;
+  char *buffer = NULL;
+
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+
+  status = nc_open(filename, NC_NOWRITE, &ncid);
+  if( status ) return status;
+  totError += abs(status);
+
+  fileTypes = (char*)calloc( STRING_SIZE, sizeof(char));
+
+  if (!addFile) {
+    status = nc_inq_att(ncid, NC_GLOBAL, CF_COORDINATES_ID, &attType, &attLen);
+    if (force == 1 || ( (status == NC_NOERR) && (attType == NC_CHAR))) {
+      char *coordinates_id2 = calloc(attLen, sizeof(char));
+      status = nc_get_att_text(ncid, NC_GLOBAL, CF_COORDINATES_ID, 
+                   coordinates_id2);
+      if ( strncmp(self->coordinates_id, coordinates_id2, attLen) == 0 ) {
+        addFile = 1;
+      }
+      free(coordinates_id2);
+    }
+    status = nc_inq_att(ncid, NC_GLOBAL, CF_DATA_ID, &attType, &attLen);
+    if (force == 1 || ( (status == NC_NOERR) && (attType == NC_CHAR))) {
+      char *data_id2 = calloc(attLen, sizeof(char));
+      status = nc_get_att_text(ncid, NC_GLOBAL, CF_DATA_ID, data_id2);
+      if ( strncmp(self->data_id, data_id2, attLen) == 0 ) {
+        addFile = 1;
+      }
+      else {
+        /* set to false even if coordinates_id matches */
+        addFile = 0;
+      }
+      free(data_id2);
+    }
+  }
+
+  if (addFile) {
+    status = nc_get_att_text(ncid, NC_GLOBAL, CF_FILETYPE, fileTypes);
+
+    /* Split fileType at spaces Test every instance found */
+    fileType = strtok( fileTypes, " " );
+    while( fileType != NULL ){
+      /* A file could be of several types simulaneously. So the buffer is alloc'd
+       * for each type found. */  
+      if (strstr(fileType, CF_GLATT_FILETYPE_MOSAIC)) {
+        buffer = (char*)calloc(STRING_SIZE, sizeof(char));
+        strcpy( buffer, filename );
+        self->mosaicFileBuffer = buffer;
+        self->hasMosaic = 1;
+      }
+      if (strstr(fileType, CF_GLATT_FILETYPE_STATIC_DATA)) {
+        buffer = (char*)calloc(STRING_SIZE, sizeof(char));
+        strcpy( buffer, filename );
+        nelem = nccf_li_get_nelem( &self->statDataFiles );
+        if( nelem == 0 ) nccf_li_add(&self->statDataFiles, buffer);
+        else nccf_li_insert( &self->statDataFiles, buffer, &item_comparison, 0 );
+        self->nStatDataFiles++;
+      }
+      if (strstr(fileType, CF_GLATT_FILETYPE_TIME_DATA)) {
+        buffer = (char*)calloc(STRING_SIZE, sizeof(char));
+        strcpy( buffer, filename );
+        nelem = nccf_li_get_nelem( &self->timeDataFiles );
+        if( nelem == 0 ) nccf_li_add(&self->timeDataFiles, buffer);
+        else nccf_li_insert( &self->timeDataFiles, buffer, &item_comparison, 0 );
+        self->nTimeDataFiles++;
+      }
+      if (strstr(fileType, CF_GLATT_FILETYPE_GRID)) {
+        buffer = (char*)calloc(STRING_SIZE, sizeof(char));
+        strcpy( buffer, filename );
+        nelem = nccf_li_get_nelem( &self->gridFiles );
+        if( nelem == 0 ) nccf_li_add(&self->gridFiles, buffer);
+        else nccf_li_insert( &self->gridFiles, buffer, &item_comparison, 0 );
+        gridName = (char*)calloc(STRING_SIZE, sizeof( char));
+        status = nc_get_att_text( ncid, NC_GLOBAL, CF_GRIDNAME, gridName ); 
+        nelem = nccf_li_get_nelem( &self->gridNames );
+        if( nelem == 0 ) nccf_li_add(&self->gridNames, gridName);
+        else nccf_li_insert( &self->gridNames, gridName, &item_comparison, 0 );
+        self->nGrids++;
+      }
+      fileType = strtok( NULL, " " );
+    }
+  }
+
+  if( fileTypes ) free( fileTypes );
+
+  status = nc_close(ncid);
+  totError += abs(status);
+
+  return totError;
+}
diff --git a/gridspec_api/host/nccf_def_host.c b/gridspec_api/host/nccf_def_host.c
new file mode 100644
index 0000000..b813ec4
--- /dev/null
+++ b/gridspec_api/host/nccf_def_host.c
@@ -0,0 +1,78 @@
+/**
+ * API define host file.
+ *
+ * "$Id: nccf_def_host.c 809 2011-09-12 19:45:48Z dkindig $"
+ */
+
+#include <nccf_host.h>
+#include <string.h>
+#include <stdio.h>
+#include <netcdf.h>
+
+struct CFLISTITEM *CFLIST_HOST;
+
+/*! \defgroup gs_host_grp Host file
+  \ingroup gridspec_grp
+
+  All the files composing a mosaic a linked together in a ``host'' file where
+grids files, data, and mosaic files are listed.
+
+*/
+
+/**
+ * \ingroup gs_host_grp
+ *  Define an empty host file (in memory).
+ *
+ * \param coordinates_id the unique identifier binding the coordinates together
+ * \param data_id the unique identifier binding the data together
+ * \param nTimeSlices Number of files for one grid and one time dependent variable.
+ * \param hostid (output) the created ID for the host object
+ * \return NC_NOERR on success
+ * \note nTimeSlices is the number of time files.
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_def_host(const char *coordinates_id, 
+		  const char *data_id, 
+		  int nTimeSlices, int *hostid) {
+
+  struct nccf_host_type *self;
+  self = (struct nccf_host_type *)malloc(sizeof(struct nccf_host_type));
+
+  /* initialize */
+  self->hasMosaic = 0;
+  self->nGrids = 0;
+  self->nVars  = 0;
+  self->nTimeDataFiles = 0;
+  self->nStatDataFiles = 0;
+  self->nTimeSlices = nTimeSlices;  // Refers to the number of time slice files
+
+  self->gridFiles = NULL;
+  self->gridNames = NULL;
+  self->timeDataFiles = NULL;
+  self->statDataFiles = NULL;
+  self->variables     = NULL;
+
+  self->mosaicFileBuffer = NULL;
+  self->coordinates_id   = NULL;
+  self->data_id          = NULL;
+
+  /* create */
+  nccf_li_new(&self->gridFiles);
+  nccf_li_new(&self->gridNames);
+  nccf_li_new(&self->timeDataFiles);
+  nccf_li_new(&self->statDataFiles);
+  nccf_li_new(&self->variables);
+
+  /* populate _ids */
+  self->coordinates_id = (char*)calloc( 36+1, sizeof(char));
+  self->data_id        = (char*)calloc( 36+1, sizeof(char));
+  strcpy( self->coordinates_id, coordinates_id);
+  strcpy( self->data_id, data_id);
+  
+  /* add to global list of objects */
+  if (CFLIST_HOST == NULL) nccf_li_new(&CFLIST_HOST);
+
+  *hostid = nccf_li_add( &CFLIST_HOST, self );
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/host/nccf_def_host_data.c b/gridspec_api/host/nccf_def_host_data.c
new file mode 100644
index 0000000..eeb5019
--- /dev/null
+++ b/gridspec_api/host/nccf_def_host_data.c
@@ -0,0 +1,132 @@
+/* $Id: nccf_def_host_data.c 822 2011-09-13 14:39:33Z pletzer $ */
+
+#include <nccf_host.h>
+#include <string.h>
+#include <stdlib.h>
+#include <netcdf.h>
+#include <nccf_errors.h>
+#include <nccf_global.h>
+#include <nccf_axis.h>
+#include <nccf_coord.h>
+#include <nccf_data.h>
+#include <nccf_grid.h>
+#include <nccf_constants.h>
+
+/**
+ * \ingroup gs_host_grp
+ * Define the data attached to a grid tile
+ * 
+ * \param hostid the ID for the host object
+ * \param varname the variable name
+ * \param gfindx the index of the tile
+ * \param read_data set to 0 if data should not be read from disk
+ * \param dataid the ID of the variable (output)
+ * \return NC_NOERR on success
+ * \author Alexander Pletzer and Dave Kindig, Tech-X Corp
+ * \note This is a constuctor call for the data, the underlying
+ *       grid, and the coordinate objects. Users are expected
+ *       to release the memory of the data object, the grid, and
+ *       the coordinates
+ */
+int nccf_def_host_data(int hostid, const char *varname, int gfindx, 
+		       int read_data, int *dataid) {
+
+  int toterr = 0;
+  int status;
+  *dataid = -1;
+  
+  int ngrids;
+  status = nccf_inq_host_ngrids(hostid, &ngrids);
+  toterr += abs(status);
+  if (gfindx >= ngrids) {
+    return NCCF_EBADGRIDINDEX;
+  }
+
+  /* Get the variable file index, the variable can be static
+     or time dependent */
+  int vfindx = -1;
+  char fdataname[STRING_SIZE]; fdataname[0] = '\0';
+  status = nccf_inq_host_statfileindex(hostid, varname, 
+				       &vfindx);
+  if (status == NC_NOERR && vfindx >= 0) {
+    // fetch the file name of the static variable
+    status = nccf_inq_host_statfilename(hostid, vfindx, 
+					gfindx, fdataname);
+  }
+  else {
+    // try time dependent file since varname appears
+    // not to be a static file
+    status = nccf_inq_host_timefileindex(hostid, varname, 
+					 &vfindx);
+    toterr += abs(status);
+    if (status == NC_NOERR && vfindx >= 0) {
+      int tfindx = 0;
+      status = nccf_inq_host_timefilename(hostid, tfindx, vfindx, 
+					  gfindx, fdataname);
+      toterr += abs(status);
+    }
+  }
+  if (fdataname[0] == '\0' || vfindx < 0 || status != 0) {
+    // varname does not appear to exist
+    return NCCF_EBADVAR;
+  }
+
+  /* Read the mosaic file name and build the mosaic */
+  char fname[STRING_SIZE]; fname[0] = '\0';
+  status = nccf_inq_host_mosaicfilename(hostid, fname);
+  toterr += abs(status);
+  // set mosaic name to mosaic file name minus suffix
+  char mname[STRING_SIZE]; mname[0] = '\0';
+  int i = 0;
+  while (i < STRING_SIZE-1 && fname[i] != '.') {
+    mname[i] = fname[i];
+    i++;
+  }
+  mname[i] = '\0';
+  int mosaicid;
+  status = nccf_def_mosaic_from_file(fname, mname, &mosaicid);
+  toterr += abs(status);
+  int ndims;
+  status = nccf_inq_mosaic_ndims(mosaicid, &ndims);
+  toterr += abs(status);
+  if (ndims <= 0) {
+    status = nccf_free_mosaic(mosaicid);
+    return NCCF_ENDIMS;
+  }
+  char **coordnames;
+  coordnames = malloc(ndims * sizeof(char *));
+  for (i = 0; i < ndims; ++i) {
+    coordnames[i] = calloc(STRING_SIZE, sizeof(char));
+  }
+  status = nccf_inq_mosaic_coordnames(mosaicid, coordnames);
+  toterr += abs(status);
+
+  /* Read the coordinates and build the coordinate objects, both
+     cooridnates are assumed to be in the same file */
+  status = nccf_inq_host_gridfilename(hostid, gfindx, fname);
+  int coordids[ndims];
+  for (i = 0; i < ndims; ++i) {
+    status = nccf_def_coord_from_file (fname, coordnames[i], &coordids[i]);
+  }
+
+  /* Build the grid object */
+  int gridid;
+  char *gridname = calloc(STRING_SIZE, sizeof(char));
+  status = nccf_inq_mosaic_gridname(mosaicid, gfindx, gridname);
+  status = nccf_def_grid(coordids, gridname, &gridid);
+
+  /* Build the data object */
+  status = nccf_def_data_from_file(fdataname, gridid, 
+				   varname, read_data, 
+				   dataid);
+
+  /* Clean up */
+  free(gridname);
+  for (i = 0; i < ndims; ++i) {
+    free(coordnames[i]);
+  }
+  free(coordnames);
+  status = nccf_free_mosaic(mosaicid);
+
+  return toterr;
+}
diff --git a/gridspec_api/host/nccf_def_host_from_file.c b/gridspec_api/host/nccf_def_host_from_file.c
new file mode 100644
index 0000000..4a9169c
--- /dev/null
+++ b/gridspec_api/host/nccf_def_host_from_file.c
@@ -0,0 +1,321 @@
+/**
+ * API retrieve host from a hostfile.
+ *
+ * "$Id: nccf_def_host_from_file.c 869 2011-11-29 20:12:54Z pletzer $"
+ */
+
+#include "nccf_host.h"
+#include <stdio.h>
+#include <string.h>
+
+#include <libgen.h>
+#include <netcdf.h>
+#include "nccf_global.h"
+#include "nccf_varObj.h"
+#include "nccf_errors.h"
+
+/* Some methods used for gathering variables - Currently commented out 
+ * Keeping for possible future use */
+int nccf_var_in_list( const char *varname, struct CFLISTITEM *var_info );
+int nccf_pop_variable_list( const char *filename, const char *gst_cat,
+                            struct nccf_host_type *tmp );
+
+
+/******************************************************************/
+/**
+ * \ingroup gs_host_grp
+ * Define (construct) a host file from a netcdf file.
+ *
+ * \param filename the host filename
+ * \param hostid (output) the ID for the host object
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_def_host_from_file(const char *filename, int *hostid){
+
+  int ncid, status, igrid, ifile, ii, nFiles, test;
+  int *dims, nDims;
+  char* file_type, *buffer, *buffe2, **coordNames;
+  int mosaicid, nCoordDims;
+
+  char *hostpath, *hostfile, *slash = "/", *hp;
+  char *new_path, *fn;
+
+  fn = (char*)calloc( STRING_SIZE, sizeof(char));
+  strncpy( fn, filename, strlen( filename ));
+  hp = dirname( fn );
+  hostpath = (char*)calloc( STRING_SIZE, sizeof(char) );
+  strcpy( hostpath, hp );
+  strcat( hostpath, slash );
+  hostfile = basename( fn );
+
+  status = nc_open( filename, NC_NOWRITE, &ncid );
+  if (status != NC_NOERR) return status;
+
+  struct nccf_host_type *self;
+  self = ( struct nccf_host_type *)malloc( sizeof( struct nccf_host_type ));
+
+  /* Initialize structures */
+  self->gridFiles = NULL;
+  self->gridNames = NULL;
+  self->timeDataFiles = NULL;
+  self->statDataFiles = NULL;
+  self->variables = NULL;
+  self->nVars = 0;
+  self->mosaicFileBuffer = NULL;
+  self->coordinates_id   = NULL;
+  self->data_id          = NULL;
+  self->hasMosaic = 0;
+  self->nGrids = 0;
+  self->nStatDataFiles = 0;
+  self->nTimeDataFiles = 0;
+  self->nTimeSlices = 0;
+  self->uuid = NULL;
+
+  struct nccf_var_obj *mosaicFile_var_obj;
+  struct nccf_var_obj *gridFile_var_obj;
+  struct nccf_var_obj *gridName_var_obj;
+  struct nccf_var_obj *statData_var_obj;
+  struct nccf_var_obj *timeData_var_obj;
+
+  /* Initialize the list objects */
+  nccf_li_new( &self->gridFiles );
+  nccf_li_new( &self->gridNames );
+  nccf_li_new( &self->timeDataFiles );
+  nccf_li_new( &self->statDataFiles );
+  nccf_li_new( &self->variables );
+
+  /* Get the global attributes */
+  int globalId;
+  nccf_def_global_from_file( filename, &globalId );
+  file_type = (char*)calloc( STRING_SIZE, sizeof(char));
+  self->coordinates_id = (char*)calloc( 36+1, sizeof(char));
+  self->data_id        = (char*)calloc( 36+1, sizeof(char));
+  status = nccf_inq_global_att( globalId, CF_FILETYPE, file_type );
+  status = nccf_inq_global_att( globalId, CF_COORDINATES_ID, self->coordinates_id );
+  status = nccf_inq_global_att( globalId, CF_DATA_ID, self->data_id );
+  status = nccf_free_global( globalId );
+  test = strcmp( file_type, CF_GLATT_FILETYPE_HOST );
+  free( file_type );
+  if( test != 0 ){
+    return NCCF_ENOTHOSTFILE;
+  }
+
+  /* Get the mosaic filename */
+  char *mosaicFileBuffer;
+  new_path = (char*)calloc( STRING_SIZE, sizeof(char));
+  strcpy( new_path, hostpath );
+  nccf_varCreateFromFile( &mosaicFile_var_obj, CF_HOST_MOSAIC_FILENAME, 
+                          ncid, 1, 0 );
+  nccf_varGetDataPtr( &mosaicFile_var_obj, (void**)&mosaicFileBuffer );
+  self->mosaicFileBuffer = (char*)calloc( STRING_SIZE, sizeof(char));
+  strcpy( self->mosaicFileBuffer, new_path );
+  strcat( self->mosaicFileBuffer, mosaicFileBuffer );
+  nccf_varDestroy( &mosaicFile_var_obj );
+
+  /* Get the mosaic coordinate names */
+  nccf_def_mosaic_from_file( self->mosaicFileBuffer, "", &mosaicid );
+  nccf_inq_mosaic_ndims( mosaicid, &nCoordDims );
+  coordNames = (char**)calloc( nCoordDims, STRING_SIZE * sizeof(char*));
+  for( ii = 0; ii < nCoordDims; ii++ )
+    coordNames[ii] = (char*)calloc( STRING_SIZE, sizeof(char));
+  nccf_inq_mosaic_coordnames( mosaicid, coordNames );
+  nccf_free_mosaic( mosaicid );
+
+  /* Get the grid files */
+  nccf_varCreateFromFile( &gridFile_var_obj,
+                          CF_HOST_TILE_FILENAMES, ncid, 1, 0 );
+  nccf_varGetNumDims( &gridFile_var_obj, &nDims );
+  nccf_varCreateFromFile( &gridName_var_obj,
+                          CF_MOSAIC_TILE_NAMES, ncid, 1, 0 );
+  if( nDims != 0 ){
+    char *gridFileBuffer, *gridNameBuffer;
+    nccf_varGetDimsPtr( &gridFile_var_obj, &dims );
+    self->nGrids = dims[0];
+    nccf_varGetDataPtr( &gridFile_var_obj, (void**)&gridFileBuffer );
+    nccf_varGetDataPtr( &gridName_var_obj, (void**)&gridNameBuffer );
+
+    /* Add the grid name and file to separate lists */
+    for( igrid = 0; igrid < self->nGrids; igrid++ ){
+      buffe2 = (char*)calloc( dims[1], sizeof(char));
+      strcpy( buffe2, &gridNameBuffer[igrid * dims[1]] );
+      nccf_li_add( &self->gridNames, buffe2 );
+
+      buffer = (char*)calloc( dims[1], sizeof(char));
+      strcpy( new_path, hostpath );
+      strcpy( buffer, new_path );
+      strcat( buffer, &gridFileBuffer[igrid * dims[1]] );
+      nccf_li_add( &self->gridFiles, buffer );
+
+    }
+  }
+  nccf_varDestroy( &gridFile_var_obj );
+  nccf_varDestroy( &gridName_var_obj );
+
+  /* Get the static data */
+  nccf_varCreateFromFile( &statData_var_obj,
+                          CF_HOST_STATDATA_FILENAME, ncid, 1, 0 );
+  nccf_varGetNumDims( &statData_var_obj, &nDims );
+
+  /* Dont process the variable if it has no dimensions */
+  if( nDims != 0 ){
+    char *statFileBuffer;
+    nccf_varGetDimsPtr( &statData_var_obj, &dims );
+    nccf_varGetDataPtr( &statData_var_obj, (void**)&statFileBuffer );
+
+    /* Get the number of files from nStats * nGrids */
+    self->nStatDataFiles = dims[0];
+    if( dims[1] != (self->nGrids) ) return NCCF_ENGRIDMISMATCH;
+    nFiles = 1;
+    for( ifile = 0; ifile < nDims-1; ifile++ ) nFiles *= dims[ifile];
+    for( ifile = 0; ifile < nFiles; ifile++ ){
+      buffer = (char*)calloc( dims[nDims-1], sizeof(char));
+      strcpy( buffer, new_path);
+      strcat( buffer, &statFileBuffer[ifile * dims[nDims-1]] );
+      nccf_li_add( &self->statDataFiles, buffer );
+
+      /* Add variables to var_information->varname*/
+//      nccf_pop_variable_list( buffer, "static", self );
+
+    }
+  } else {
+    self->nStatDataFiles = 0;
+  }
+  nccf_varDestroy( &statData_var_obj );
+
+  /* Get the time data */
+  nccf_varCreateFromFile( &timeData_var_obj,
+                          CF_HOST_TIMEDATA_FILENAME, ncid, 1, 0 );
+  nccf_varGetNumDims( &timeData_var_obj, &nDims );
+  if( nDims != 0 ){
+    char *timeFileBuffer;
+    nccf_varGetDimsPtr( &timeData_var_obj, &dims );
+    nccf_varGetDataPtr( &timeData_var_obj, (void**)&timeFileBuffer );
+
+    /* Get the number of files from nTimes * nVars* nGrids */
+    self->nTimeSlices = dims[0];
+    self->nTimeDataFiles = dims[1];
+    if( dims[2] != self->nGrids ) return NCCF_ENGRIDMISMATCH;
+    nFiles = 1;
+    for( ifile = 0; ifile < nDims-1; ifile++ ){
+      nFiles *= dims[ifile];
+    }
+    for( ifile = 0; ifile < nFiles; ifile++ ){
+      buffer = (char*)calloc( dims[nDims-1], sizeof(char));
+      strcpy( buffer, new_path);
+      strcat( buffer, &timeFileBuffer[ifile * dims[nDims-1]] );
+      nccf_li_add( &self->timeDataFiles, buffer );
+
+      /* Add variables to var_information->varname*/
+//      nccf_pop_variable_list( buffer, "time", self );
+
+    }
+  } else {
+    self->nTimeDataFiles = 0;
+  }
+  nccf_varDestroy( &timeData_var_obj );
+
+  status = nc_close( ncid );
+  for( ii = 0; ii < nCoordDims; ii++ ) free( coordNames[ii] );
+  free( coordNames );
+
+  /* Return an ID */
+  nccf_li_new( &CFLIST_HOST );
+  //if( CFLIST_HOST == NULL ) nccf_li_new( &CFLIST_HOST );
+  *hostid = nccf_li_add( &CFLIST_HOST, self );
+
+  /* Clean up */
+  free( hostpath );
+  free( fn );
+  free( new_path );
+  return status;
+}
+
+int nccf_var_in_list( const char *varname, struct CFLISTITEM *var_info ){
+  int varNotInList = 0;
+  int index;
+  struct var_information *vi;
+
+  nccf_li_begin( &var_info );
+  while( nccf_li_next( &var_info )){
+    index = nccf_li_get_id( &var_info );
+    vi = nccf_li_find( &var_info, index );
+    if( strcmp( vi->varname, varname ) == 0 ){
+      return 1;
+    }
+  }
+
+  return varNotInList;
+}
+
+int nccf_pop_variable_list( const char *filename, const char *gst_cat,
+                            struct nccf_host_type *tmp ){
+
+    struct var_information *var_info;
+    int ncid2, nlocal, ivar, varInList, status = NC_NOERR, id;
+    char *varname;
+
+    /* Add variables to var_information->varname*/
+    if(( status = nc_open( filename, NC_NOWRITE, &ncid2 ))) return status;
+    if(( status = nc_inq_nvars( ncid2, &nlocal ))) return status;
+
+    varname = (char*)calloc( STRING_SIZE, sizeof(char));
+    for( ivar = 0; ivar < nlocal; ivar++ ){
+      if(( status = nc_inq_varname( ncid2, ivar, varname ))) return status;
+
+      varInList = nccf_var_in_list( varname, tmp->variables );
+
+      struct nccf_var_obj *file_var_obj;
+
+      if( varInList == 0 ){
+
+        /* Add the variable to the var_info list */
+        struct var_information *var_info =
+            (struct var_information*)malloc(sizeof(struct var_information));
+        var_info->varname = (char*)calloc( STRING_SIZE, sizeof(char));
+        strcpy( var_info->varname, varname );
+        var_info->grid_stat_time_cat = (char*)calloc( STRING_SIZE, sizeof(char));
+        strcpy( var_info->grid_stat_time_cat, gst_cat );
+
+        nccf_li_new( &var_info->file_var_obj );
+
+        /* Read the variable without getting the data */
+        int readData = 0;
+        nccf_varCreateFromFile( &file_var_obj, varname, ncid2, readData, 0 );
+        nccf_varSetVarName( &file_var_obj, filename );
+
+        nccf_li_add( &var_info->file_var_obj, file_var_obj );
+        nccf_li_add( &tmp->variables, var_info );
+        tmp->nVars++;
+      } else {
+
+        /* Read the variable without getting the data */
+        int readData = 0;
+        nccf_varCreateFromFile( &file_var_obj, varname, ncid2, readData, 0 );
+        nccf_varSetVarName( &file_var_obj, filename );
+
+        nccf_li_begin( &tmp->variables );
+        while( nccf_li_next( &tmp->variables )){
+          id = nccf_li_get_id( &tmp->variables );
+          var_info =
+            (struct var_information *)nccf_li_find( &tmp->variables, id );
+          if( strcmp( var_info->varname, varname ) == 0 ){
+            nccf_li_add( &var_info->file_var_obj, file_var_obj );
+          }
+        }
+      }
+
+      char *gridName;
+      gridName = (char*)calloc( STRING_SIZE, sizeof(char));
+      nc_get_att_text( ncid2, NC_GLOBAL, CF_GRIDNAME, gridName);
+      nccf_varSetAttribText(&file_var_obj, CF_GRIDNAME, gridName);
+      free(gridName);
+
+    }
+    free( varname );
+
+    if((status = nc_close( ncid2 ))) return status;
+
+    return status;
+}
diff --git a/gridspec_api/host/nccf_free_host.c b/gridspec_api/host/nccf_free_host.c
new file mode 100644
index 0000000..b6d7325
--- /dev/null
+++ b/gridspec_api/host/nccf_free_host.c
@@ -0,0 +1,114 @@
+/**
+ * API free the host from a memory.
+ *
+ * "$Id: nccf_free_host.c 918 2012-02-07 22:10:36Z pletzer $"
+ */
+
+#include <nccf_host.h>
+#include <netcdf.h>
+
+/**
+ * \ingroup gs_host_grp
+ * Free all memory associated with a host (acts as a destructor).
+ *
+ * \param hostid The ID for the host object
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_free_host( int hostid ){
+
+  struct nccf_host_type *self;
+
+  /* Remove from list */
+  self = nccf_li_remove(&CFLIST_HOST, hostid);
+  if( nccf_li_get_nelem( &CFLIST_HOST ) == 0 )
+        nccf_li_del( &CFLIST_HOST );
+
+  if (self->mosaicFileBuffer) {
+    free(self->mosaicFileBuffer);
+    self->mosaicFileBuffer = NULL;
+  }
+  if (self->coordinates_id) {
+    free(self->coordinates_id);
+    self->coordinates_id = NULL;
+  }
+  if (self->data_id) {
+    free(self->data_id);
+    self->data_id = NULL;
+  }
+
+  /* Walk through the linked lists, remove each element and delete it */
+  int index, index2;
+  nccf_li_begin(&self->gridFiles);
+  while (nccf_li_next(&self->gridFiles)) {
+    index = nccf_li_get_id(&self->gridFiles);
+    char *val = (char *) nccf_li_remove(&self->gridFiles, index);
+    if (val) {
+      free(val);
+      val = NULL;
+    }
+  }
+  nccf_li_begin(&self->gridNames);
+  while (nccf_li_next(&self->gridNames)) {
+    index = nccf_li_get_id(&self->gridNames);
+    char *val = (char *) nccf_li_remove(&self->gridNames, index);
+    if (val) {
+      free(val);
+      val = NULL;
+    }
+  }
+  nccf_li_begin(&self->timeDataFiles);
+  while (nccf_li_next(&self->timeDataFiles)) {
+    index = nccf_li_get_id(&self->timeDataFiles);
+    char *val = (char *) nccf_li_remove(&self->timeDataFiles, index);
+    if (val) {
+      free(val);
+      val = NULL;
+    }
+  }
+  nccf_li_begin(&self->statDataFiles);
+  while (nccf_li_next(&self->statDataFiles)) {
+    index = nccf_li_get_id(&self->statDataFiles);
+    char *val = (char *) nccf_li_remove(&self->statDataFiles, index);
+    if (val) {
+      free(val);
+      val = NULL;
+    }
+  }
+
+  nccf_li_begin( &self->variables );
+  while(nccf_li_next( &self->variables )){
+    index = nccf_li_get_id( &self->variables );
+    struct var_information *v = 
+        (struct var_information *) nccf_li_remove(&self->variables, index);
+    if(v){
+      free(v->varname);
+      v->varname = NULL;
+      free(v->grid_stat_time_cat);
+      v->grid_stat_time_cat = NULL;
+      nccf_li_begin(&v->file_var_obj);
+      while( nccf_li_next( &v->file_var_obj )){
+        index2 = nccf_li_get_id( &v->file_var_obj );
+        struct nccf_var_obj *f = (struct nccf_var_obj *)
+                                  nccf_li_remove( &v->file_var_obj, index2 );
+        if( f ) nccf_varDestroy( &f );
+      }
+      free(v);
+      v = NULL;
+    }
+  }
+
+  /* Delete the lists */
+  nccf_li_del(&self->gridFiles);
+  nccf_li_del(&self->gridNames);
+  nccf_li_del(&self->timeDataFiles);
+  nccf_li_del(&self->statDataFiles);
+  nccf_li_del(&self->variables);
+
+  free(self);
+  self = NULL;
+
+  return NC_NOERR;
+
+}
diff --git a/gridspec_api/host/nccf_host.h b/gridspec_api/host/nccf_host.h
new file mode 100644
index 0000000..234f9d0
--- /dev/null
+++ b/gridspec_api/host/nccf_host.h
@@ -0,0 +1,153 @@
+/*
+ * API for host objects
+ *
+ * "$Id: nccf_host.h 835 2011-09-15 01:00:55Z pletzer $"
+ */
+
+#ifndef _NCCF_HOST_H
+#define _NCCF_HOST_H
+
+#include <netcdf.h>
+#include <libcf_src.h>
+#include <cflistitem.h>
+
+#include <nccf_varObj.h>
+#include <nccf_mosaic.h>
+#include <nccf_data.h>
+#include <nccf_grid.h>
+#include <nccf_coord.h>
+#include <nccf_constants.h>
+#include <nccf_handle_error.h>
+
+/* variable names we choose */
+
+#define CF_HOST_MOSAIC_FILENAME      "mosaic_filename"
+#define CF_HOST_TILE_NAMES           CF_MOSAIC_TILE_NAMES
+#define CF_HOST_TILE_FILENAMES       "tile_filenames"
+#define CF_HOST_STATDATA_FILENAME    "static_data_filenames"
+#define CF_HOST_TIMEDATA_FILENAME    "time_data_filenames"
+
+extern struct CFLISTITEM *CFLIST_HOST;
+
+struct var_information {
+  
+  /* Name of variable */
+  char *varname;
+
+  /* Grid, Static or Time category */
+  char *grid_stat_time_cat;
+
+  /* Variable resides in these files */
+  /* Each item is a nccf_varObj for each file. */
+  struct CFLISTITEM *file_var_obj;
+
+  /* Number of dimensions */
+  int ndims;
+
+  /* Dimension Ids for variable */
+  int *dimids;
+
+  /* Number of attributes */
+  int natts;
+
+};
+
+struct nccf_host_type {
+
+  /* NetCDF like variable objects */
+  struct nccf_var_obj *global;
+
+  struct CFLISTITEM *gridFiles;
+  struct CFLISTITEM *gridNames;
+  struct CFLISTITEM *timeDataFiles;
+  struct CFLISTITEM *statDataFiles;
+
+  /* List of var_information structures */
+  /* Each variables item will be of var_information */
+  struct CFLISTITEM *variables;
+  int nVars;
+
+  /* Permanent data containers for the above nccf_var_obj objects */
+  char *mosaicFileBuffer;
+
+  /* if mosaic file was added */
+  int hasMosaic;
+
+  /* number of grids (or tiles) */
+  int nGrids;
+
+  /* number of static data files (e.g. topography),
+     the host files will contain nStatDataFiles*nGrids files */
+  int nStatDataFiles;
+
+  /* number of time dependent data files 
+     the host file will contain nTimeDataFiles*nGrids*nTimeSlices files */
+  int nTimeDataFiles;
+
+  /* Number time slices in an indvidual time dependant variable file */
+  int nTimeSlices;
+
+  /* unique identifier binding the mosaci file layout */
+  char *uuid;
+
+  /* coordinates_id - Needed to match coordinates_id to other files */
+  char *coordinates_id;
+
+  /* data_id - Needed to match data_id to other files */
+  char *data_id;
+
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int nccf_def_host(const char *coordinates_id, const char *data_id, 
+                  int nTimeSlices, int *hostid);
+
+int nccf_add_host_file(int hostid, const char *filename, int force);
+
+int nccf_def_host_from_file(const char *filename, int *hostid);
+
+int nccf_free_host(int hostid);
+
+int nccf_put_host(int ncid, int hostid);
+
+int nccf_inq_host_ngrids(int hostid, int *ngrids);
+
+int nccf_inq_host_nstatdatafiles(int hostid, int *nstatdatafiles);
+
+int nccf_inq_host_ntimedatafiles(int hostid, int *ntimedatafiles);
+
+int nccf_inq_host_ntimeslices( int hostid, int *ntimeslices );
+
+int nccf_inq_host_statfilename(int hostid, int vfindx, int gfindx, 
+				 char *fname);
+
+int nccf_inq_host_timefilename(int hostid, int tfindx, 
+				 int vfindx, int gfindx, 
+				 char *fname);
+
+int nccf_inq_host_gridfilename( int hostid, int gfindx, char *filename );
+
+int nccf_inq_host_gridname( int hostid, int gfindx, char *gridname );
+
+int nccf_inq_host_mosaicfilename( int hostid, char *mosaicfilename );
+
+int nccf_def_host_data(int hostid, const char *varname, int gfindx, 
+		       int read_data, int *dataid);
+
+int nccf_inq_host_statfileindex(int hostid, const char *varname, 
+				   int *vfindx);	     
+
+int nccf_inq_host_timefileindex(int hostid, const char *varname, 
+				int *vfindx);	     
+
+/*!@}*/
+
+#ifdef __cplusplus
+}
+#endif 
+
+#endif /* _NCCF_HOST_H */
+
diff --git a/gridspec_api/host/nccf_inq_host_gridfilename.c b/gridspec_api/host/nccf_inq_host_gridfilename.c
new file mode 100644
index 0000000..0f96a70
--- /dev/null
+++ b/gridspec_api/host/nccf_inq_host_gridfilename.c
@@ -0,0 +1,35 @@
+/*
+ *
+ * $Id: nccf_inq_host_gridfilename.c 801 2011-09-11 18:58:14Z pletzer $
+ */
+
+#include <nccf_host.h>
+#include <string.h>
+#include <stdio.h>
+#include <netcdf.h>
+#include <nccf_coord.h>
+#include <nccf_data.h>
+#include <nccf_grid.h>
+#include <nccf_constants.h>
+
+/**
+ * \ingroup gs_host_grp
+ * Fill in grid file name
+ * 
+ * \param hostid the ID for the host object
+ * \param gfindx Grid file index varying from 0...ngrids-1
+ * \param filename Filename for given Id from dataset (space must be pre-allocated)
+ * \return NC_NOERR on success 
+ * \author Alexander Pletzer and Dave Kindig,  Tech-X Corp
+ */
+int nccf_inq_host_gridfilename(int hostid, int gfindx, char *filename) {
+
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+  
+  char *fn;
+  fn = nccf_li_find(&self->gridFiles, gfindx);
+  strcpy(filename, fn);
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/host/nccf_inq_host_gridname.c b/gridspec_api/host/nccf_inq_host_gridname.c
new file mode 100644
index 0000000..e9f73f1
--- /dev/null
+++ b/gridspec_api/host/nccf_inq_host_gridname.c
@@ -0,0 +1,32 @@
+/**
+ * Get a grid name from a grid index.
+ *
+ * $Id: nccf_inq_host_gridname.c 851 2011-11-08 14:37:20Z pletzer $
+ */
+
+#include <nccf_host.h>
+#include <stdio.h>
+#include <string.h>
+
+/**
+* \ingroup gs_host_grp
+* Return the grid name
+*
+* \param hostid the ID for the host object
+* \param gfindx Id of grid, index varying from 0...ngrids-1
+* \param gridname  grid name for Id in dataset
+* \return NC_NOERR on success
+* \author Alexander Pletzer and Dave Kindig,  Tech-X Corp
+*/
+
+int nccf_inq_host_gridname( int hostid, int gfindx, char *gridname ){
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+
+  char *gn;
+  gn = nccf_li_find(&self->gridNames, gfindx);
+  strcpy( gridname, gn );
+
+  return NC_NOERR;
+
+}
diff --git a/gridspec_api/host/nccf_inq_host_mosaicfilename.c b/gridspec_api/host/nccf_inq_host_mosaicfilename.c
new file mode 100644
index 0000000..ca2c1a1
--- /dev/null
+++ b/gridspec_api/host/nccf_inq_host_mosaicfilename.c
@@ -0,0 +1,26 @@
+/**
+ *
+ * $Id: nccf_inq_host_mosaicfilename.c 801 2011-09-11 18:58:14Z pletzer $
+ */
+#include <nccf_host.h>
+#include <string.h>
+
+/**
+ * \ingroup gs_host_grp
+ * Fill in a mosaic filename from a host file
+ *
+ * \param hostid the ID for the host object
+ * \param mosaicfilename Mosaic filename
+ * \return NC_NOERR on success
+ * \author Alexander Pletzer and Dave Kindig,  Tech-X Corp
+ */
+int nccf_inq_host_mosaicfilename( int hostid, char *mosaicfilename ){
+
+  int toterr = NC_NOERR;
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+
+  strcpy(mosaicfilename, self->mosaicFileBuffer );
+
+  return toterr;
+}
diff --git a/gridspec_api/host/nccf_inq_host_ngrids.c b/gridspec_api/host/nccf_inq_host_ngrids.c
new file mode 100644
index 0000000..c46a44d
--- /dev/null
+++ b/gridspec_api/host/nccf_inq_host_ngrids.c
@@ -0,0 +1,33 @@
+/*
+ *
+ * $Id: nccf_inq_host_ngrids.c 813 2011-09-12 20:54:25Z pletzer $
+ */
+
+#include <nccf_host.h>
+#include <string.h>
+#include <stdio.h>
+#include <netcdf.h>
+#include <nccf_coord.h>
+#include <nccf_data.h>
+#include <nccf_grid.h>
+#include <nccf_constants.h>
+
+/**
+ * \ingroup gs_host_grp
+ * Get the number of grid files from a host file
+ *
+ * \param hostid the ID for the host object
+ * \param ngrids  number of grids
+ * \return NC_NOERR on success
+ * \author Dave Kindig and Alexander Pletzer, Tech-X Corp
+ */
+
+int nccf_inq_host_ngrids(int hostid, int *ngrids){
+
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+
+  *ngrids = self->nGrids;
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/host/nccf_inq_host_nstatdatafiles.c b/gridspec_api/host/nccf_inq_host_nstatdatafiles.c
new file mode 100644
index 0000000..02b0e58
--- /dev/null
+++ b/gridspec_api/host/nccf_inq_host_nstatdatafiles.c
@@ -0,0 +1,32 @@
+/*
+ *
+ * $Id: nccf_inq_host_nstatdatafiles.c 823 2011-09-13 18:13:08Z dkindig $
+ */
+
+#include <nccf_host.h>
+#include <string.h>
+#include <stdio.h>
+#include <netcdf.h>
+#include <nccf_coord.h>
+#include <nccf_data.h>
+#include <nccf_grid.h>
+#include <nccf_constants.h>
+
+/**
+ * \ingroup gs_host_grp
+ * Get the number of static data files from host file
+ *
+ * \param hostid the ID for the host object
+ * \param nstatdatafiles number of static data files
+ * \return NC_NOERR on success
+ * \author Alexander Pletzer and Dave Kindig,  Tech-X Corp
+ */
+
+int nccf_inq_host_nstatdatafiles( int hostid, int *nstatdatafiles ){
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+
+  *nstatdatafiles = self->nStatDataFiles;
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/host/nccf_inq_host_ntimedatafiles.c b/gridspec_api/host/nccf_inq_host_ntimedatafiles.c
new file mode 100644
index 0000000..e810797
--- /dev/null
+++ b/gridspec_api/host/nccf_inq_host_ntimedatafiles.c
@@ -0,0 +1,32 @@
+/*
+ *
+ * $Id: nccf_inq_host_ntimedatafiles.c 810 2011-09-12 20:11:37Z dkindig $
+ */
+
+#include <nccf_host.h>
+#include <string.h>
+#include <stdio.h>
+#include <netcdf.h>
+#include <nccf_coord.h>
+#include <nccf_data.h>
+#include <nccf_grid.h>
+#include <nccf_constants.h>
+
+/**
+ * \ingroup gs_host_grp
+ * Get the number of time data files from host file
+ *
+ * \param hostid the ID for the host object
+ * \param ntimedatafiles number of time data files
+ * \return NC_NOERR on success
+ * \author Alexander Pletzer and Dave Kindig,  Tech-X Corp
+ */
+
+int nccf_inq_host_ntimedatafiles(int hostid, int *ntimedatafiles) {
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+
+  *ntimedatafiles = self->nTimeDataFiles;
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/host/nccf_inq_host_ntimeslices.c b/gridspec_api/host/nccf_inq_host_ntimeslices.c
new file mode 100644
index 0000000..0edac83
--- /dev/null
+++ b/gridspec_api/host/nccf_inq_host_ntimeslices.c
@@ -0,0 +1,32 @@
+/*
+ *
+ * $Id: nccf_inq_host_ntimeslices.c 809 2011-09-12 19:45:48Z dkindig $
+ */
+
+#include <nccf_host.h>
+#include <string.h>
+#include <stdio.h>
+#include <netcdf.h>
+#include <nccf_coord.h>
+#include <nccf_data.h>
+#include <nccf_grid.h>
+#include <nccf_constants.h>
+
+/**
+ * \ingroup gs_host_grp
+ * Get the number of time slices per time data file
+ *
+ * \param hostid the ID for the host object
+ * \param ntimeslices number of time slices per file
+ * \return NC_NOERR on success
+ * \author Alexander Pletzer and Dave Kindig,  Tech-X Corp
+ */
+
+int nccf_inq_host_ntimeslices(int hostid, int *ntimeslices) {
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+
+  *ntimeslices = self->nTimeSlices;
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/host/nccf_inq_host_statdataids.c b/gridspec_api/host/nccf_inq_host_statdataids.c
new file mode 100644
index 0000000..1c4bc36
--- /dev/null
+++ b/gridspec_api/host/nccf_inq_host_statdataids.c
@@ -0,0 +1,40 @@
+/**
+ * Get the static data object Ids from a host file
+ *
+ * $Id: nccf_inq_host_statdataids.c 823 2011-09-13 18:13:08Z dkindig $
+ */
+
+#include <nccf_host.h>
+#include <string.h>
+#include <stdio.h>
+#include <netcdf.h>
+#include <nccf_coord.h>
+#include <nccf_data.h>
+#include <nccf_grid.h>
+#include <nccf_constants.h>
+
+int nccf_inq_host_statdataids( int hostid, const char *varname, 
+                                 int readData, int *statdataids ){
+
+  int id, status = NC_NOERR, iStat, iGrid, sdid;
+  char *file;
+
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+  file = (char*)malloc( STRING_SIZE * sizeof(char));
+  nccf_li_begin( &self->statDataFiles );
+  for( iStat = 0; iStat < self->nStatDataFiles; iStat++ ){
+    for( iGrid = 0; iGrid < self->nGrids; iGrid++ ){
+      id = iGrid + ( self->nGrids * iStat );
+      strcpy( file, nccf_li_find( &self->statDataFiles, id ));
+      status = nccf_def_data_from_file( file, iGrid, varname, 
+                                        readData, &sdid );
+      if( status ) return status;
+      statdataids[id] = sdid;
+    }
+  }
+  free( file );
+
+  return status;
+
+}
diff --git a/gridspec_api/host/nccf_inq_host_statfileindex.c b/gridspec_api/host/nccf_inq_host_statfileindex.c
new file mode 100644
index 0000000..860ef68
--- /dev/null
+++ b/gridspec_api/host/nccf_inq_host_statfileindex.c
@@ -0,0 +1,71 @@
+/* $Id: nccf_inq_host_statfileindex.c 823 2011-09-13 18:13:08Z dkindig $ */
+
+#include <netcdf.h>
+#include <nccf_host.h>
+#include <string.h>
+#include <stdio.h>
+#include <netcdf.h>
+#include <nccf_errors.h>
+#include <nccf_axis.h>
+#include <nccf_coord.h>
+#include <nccf_data.h>
+#include <nccf_grid.h>
+#include <nccf_constants.h>
+
+/**
+ * \ingroup gs_host_grp
+ * Inquire the file index of a static variable
+ * 
+ * \param hostid the ID for the host object
+ * \param varname the variable name
+ * \param vfindx file index (output)
+ * \return NC_NOERR on success
+ * \author Alexander Pletzer and Dave Kindig, Tech-X Corp
+ */
+int nccf_inq_host_statfileindex(int hostid, const char *varname, 
+				int *vfindx) {
+
+  int toterr = 0;
+  int status;
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+  
+  int nstatdatafiles;
+  int gfindx = 0;
+  int ncid, ifile, ivar, nvars;
+
+  char *fname = calloc(STRING_SIZE, sizeof(char));
+  char *vname = calloc(STRING_SIZE, sizeof(char));
+
+  *vfindx = -1;
+  status = nccf_inq_host_nstatdatafiles(hostid, &nstatdatafiles);
+  toterr += abs(status);
+  for (ifile = 0; ifile < nstatdatafiles; ++ifile) {
+    status = nccf_inq_host_statfilename(hostid, ifile, gfindx, fname);
+    toterr += abs(status);
+    status = nc_open(fname, NC_NOWRITE, &ncid);
+    toterr += abs(status);
+    status = nc_inq_nvars(ncid, &nvars);
+    toterr += abs(status);
+    for (ivar = 0; ivar < nvars; ++ivar) {
+      status = nc_inq_varname(ncid, ivar, vname);
+      toterr += abs(status);
+      if ( strcmp(vname, varname) == 0 ) {
+	/* found! */
+	*vfindx = ivar;
+	status = nc_close(ncid);
+	toterr += abs(status);
+        free(fname);
+        free(vname);
+	return toterr;
+      }
+    }
+    status = nc_close(ncid);
+    toterr += abs(status);
+  }
+
+  free(fname);
+  free(vname);
+
+  return NCCF_EBADVAR;
+}
diff --git a/gridspec_api/host/nccf_inq_host_statfilename.c b/gridspec_api/host/nccf_inq_host_statfilename.c
new file mode 100644
index 0000000..11c9e78
--- /dev/null
+++ b/gridspec_api/host/nccf_inq_host_statfilename.c
@@ -0,0 +1,43 @@
+/*
+ *
+ * $Id: nccf_inq_host_statfilename.c 823 2011-09-13 18:13:08Z dkindig $ 
+ * */
+
+#include <nccf_host.h>
+#include <string.h>
+#include <nccf_errors.h>
+#include <nccf_utility_functions.h>
+
+ /** 
+  * \ingroup gs_host_grp
+  * Get the file name of a static data file 
+  *
+  * \param hostid the ID for the host object
+  * \param vfindx variable file index, ranges from 0...nstatdatafiles-1
+  * \param gfindx grid file index, ranges from 0...ngrids
+  * \param fname file name (output)
+  * \return NC_NOERR on success
+  */
+int nccf_inq_host_statfilename(int hostid, int vfindx, int gfindx, 
+			       char *fname) {
+  int index;
+  int dims[2];
+  const int inx[] = {vfindx, gfindx};
+  char *fn;
+
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+  dims[0] = self->nStatDataFiles;
+  dims[1] = self->nGrids;
+
+  // flatten the indices
+  index = nccf_get_flat_index(2, dims, inx);
+  fn = nccf_li_find(&self->statDataFiles, index);
+  if (fn) {
+    strcpy(fname, fn);
+    return NC_NOERR;
+  } 
+  else {
+    return NCCF_EINDEXOUTOFRANGE;
+  }
+}
diff --git a/gridspec_api/host/nccf_inq_host_struct_grid_ids.c b/gridspec_api/host/nccf_inq_host_struct_grid_ids.c
new file mode 100644
index 0000000..0012da1
--- /dev/null
+++ b/gridspec_api/host/nccf_inq_host_struct_grid_ids.c
@@ -0,0 +1,39 @@
+/**
+ * Get the grid object Ids from a host file
+ *
+ * $Id: nccf_inq_host_struct_grid_ids.c 719 2011-04-26 17:39:51Z srinath22 $
+ */
+
+#include <nccf_host.h>
+#include <string.h>
+#include <stdio.h>
+#include <netcdf.h>
+#include <nccf_coord.h>
+#include <nccf_data.h>
+#include <nccf_grid.h>
+#include <nccf_constants.h>
+
+int nccf_inq_host_struct_grid_ids( int hostid, int ndims, 
+                                   char **coordNames, int gridids[] ){
+
+  int id, status = NC_NOERR, i, gid;
+  char *file;
+
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+  file = (char*)malloc( STRING_SIZE * sizeof(char));
+  i = 0;
+  nccf_li_begin( &self->gridFiles );
+  while( nccf_li_next( &self->gridFiles )){
+    id = nccf_li_get_id( &self->gridFiles );
+    strcpy( file, nccf_li_find( &self->gridFiles, id ));
+    status = nccf_def_grid_from_file( file, ndims, 
+                         (const char**)coordNames, NULL, &gid );
+    if( status ) return status;
+    gridids[i] = gid;
+    i++;
+  }
+  free( file );
+
+  return status;
+}
diff --git a/gridspec_api/host/nccf_inq_host_timedataids.c b/gridspec_api/host/nccf_inq_host_timedataids.c
new file mode 100644
index 0000000..40c97c4
--- /dev/null
+++ b/gridspec_api/host/nccf_inq_host_timedataids.c
@@ -0,0 +1,41 @@
+/**
+ * Get the time data object Ids from a host file
+ *
+ * $Id: nccf_inq_host_timedataids.c 719 2011-04-26 17:39:51Z srinath22 $
+ */
+
+#include <nccf_host.h>
+#include <string.h>
+#include <stdio.h>
+#include <netcdf.h>
+#include <nccf_coord.h>
+#include <nccf_data.h>
+#include <nccf_grid.h>
+#include <nccf_constants.h>
+
+int nccf_inq_host_timedataids( int hostid, const char *varname, int readData, 
+                               int *timedataids ){
+
+  int id, status = NC_NOERR, iTime, iData, iGrid, tdid;
+  char *file;
+
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+  file = (char*)calloc( STRING_SIZE, sizeof(char));
+  nccf_li_begin( &self->timeDataFiles );
+  for( iTime = 0; iTime < self->nTimeSlices; iTime++ ){
+    for( iData = 0; iData < self->nTimeDataFiles; iData++ ){
+      for( iGrid = 0; iGrid < self->nGrids; iGrid++ ){
+        id = iGrid + ( self->nGrids * ( iData + ( self->nTimeDataFiles * iTime )));
+        strcpy( file, nccf_li_find( &self->timeDataFiles, id ));
+        status = nccf_def_data_from_file( file, iGrid, varname, 
+                                          readData, &tdid );
+        if( status ) return status;
+        timedataids[id] = tdid;
+      }
+    }
+  }
+  free( file );
+
+  return status;
+}
diff --git a/gridspec_api/host/nccf_inq_host_timefileindex.c b/gridspec_api/host/nccf_inq_host_timefileindex.c
new file mode 100644
index 0000000..0167a7a
--- /dev/null
+++ b/gridspec_api/host/nccf_inq_host_timefileindex.c
@@ -0,0 +1,73 @@
+/* $Id: nccf_inq_host_timefileindex.c 822 2011-09-13 14:39:33Z pletzer $ */
+
+#include <netcdf.h>
+#include <nccf_host.h>
+#include <string.h>
+#include <stdio.h>
+#include <netcdf.h>
+#include <nccf_errors.h>
+#include <nccf_axis.h>
+#include <nccf_coord.h>
+#include <nccf_data.h>
+#include <nccf_grid.h>
+#include <nccf_constants.h>
+
+/**
+ * \ingroup gs_host_grp
+ * Inquire the file index of a time dependent variable
+ * 
+ * \param hostid the ID for the host object
+ * \param varname the variable name
+ * \param vfindx file index (output)
+ * \return NC_NOERR on success
+ * \author Alexander Pletzer and Dave Kindig, Tech-X Corp
+ */
+int nccf_inq_host_timefileindex(int hostid, const char *varname, 
+				int *vfindx) {
+
+  int toterr = 0;
+  int status;
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+  
+  int ntimedata;
+  int gfindx = 0;
+  int tfindx = 0;
+  int ncid, ifile, ivar, nvars;
+  
+  char *fname = calloc(STRING_SIZE, sizeof(char));
+  char *vname = calloc(STRING_SIZE, sizeof(char));
+
+  *vfindx = -1;
+  status = nccf_inq_host_ntimedatafiles(hostid, &ntimedata);
+  toterr += abs(status);
+  for (ifile = 0; ifile < ntimedata; ++ifile) {
+    status = nccf_inq_host_timefilename(hostid, tfindx, 
+					ifile, gfindx, fname);
+    toterr += abs(status);
+    status = nc_open(fname, NC_NOWRITE, &ncid);
+    toterr += abs(status);
+    status = nc_inq_nvars(ncid, &nvars);
+    toterr += abs(status);
+    for (ivar = 0; ivar < nvars; ++ivar) {
+      status = nc_inq_varname(ncid, ivar, vname);
+      toterr += abs(status);
+      if ( strcmp(vname, varname) == 0 ) {
+	/* found! */
+	*vfindx = ivar;
+	status = nc_close(ncid);
+	toterr += abs(status);
+        free(fname);
+        free(vname);
+	return toterr;
+      }
+    }
+    status = nc_close(ncid);
+    toterr += abs(status);
+  }
+
+  free(fname);
+  free(vname);
+
+  return NCCF_EBADVAR;
+}
diff --git a/gridspec_api/host/nccf_inq_host_timefilename.c b/gridspec_api/host/nccf_inq_host_timefilename.c
new file mode 100644
index 0000000..f68aa15
--- /dev/null
+++ b/gridspec_api/host/nccf_inq_host_timefilename.c
@@ -0,0 +1,43 @@
+/* $Id: nccf_inq_host_timefilename.c 823 2011-09-13 18:13:08Z dkindig $ */
+
+#include <nccf_host.h>
+#include <string.h>
+#include <nccf_errors.h>
+#include <nccf_utility_functions.h>
+
+ /** 
+  * \ingroup gs_host_grp
+  * Get the file name of a time dependent data file 
+  *
+  * \param hostid the ID for the host object
+  * \param tfindx time file index, ranges from 0...ntimes-1
+  * \param vfindx variable file index, ranges from 0...ntimedatafiles-1
+  * \param gfindx grid file index, ranges from 0...ngrids-1
+  * \param fname file name (output)
+  * \return NC_NOERR on success
+  */
+int nccf_inq_host_timefilename(int hostid, int tfindx, 
+			       int vfindx, int gfindx, 
+			       char *fname) {
+  int index;
+  int dims[3];
+  const int inx[] = {tfindx, vfindx, gfindx};
+  char *fn;
+
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+  dims[0] = self->nTimeSlices;
+  dims[1] = self->nTimeDataFiles;
+  dims[2] = self->nGrids;
+
+  // flatten the indices
+  index = nccf_get_flat_index(3, dims, inx);
+  fn = nccf_li_find(&self->timeDataFiles, index);
+  if (fn) {
+    strcpy(fname, fn);
+    return NC_NOERR;
+  } 
+  else {
+    return NCCF_EINDEXOUTOFRANGE;
+  }
+}
diff --git a/gridspec_api/host/nccf_put_host.c b/gridspec_api/host/nccf_put_host.c
new file mode 100644
index 0000000..300603d
--- /dev/null
+++ b/gridspec_api/host/nccf_put_host.c
@@ -0,0 +1,183 @@
+/**
+ * API write the host file from memory.
+ *
+ * "$Id: nccf_put_host.c 767 2011-06-06 23:20:19Z pletzer $"
+ */
+
+#include <nccf_host.h>
+#include <string.h>
+#include <nccf_errors.h>
+
+/**
+ * \ingroup gs_host_grp
+ * Write the host to file.
+ *
+ * \param hostid the ID for the host object
+ * \param ncid the ID for a created netcdf file.
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_put_host(int hostid, int ncid){
+
+  int i;
+  struct nccf_var_obj *mosaicFile;
+  struct nccf_var_obj *vGridFiles;
+  struct nccf_var_obj *vGridNames;
+  struct nccf_var_obj *vStatDataFiles;
+  struct nccf_var_obj *vTimeDataFiles;
+  char *gridFilesBuff = NULL;
+  char *gridNamesBuff = NULL;
+  char *statDataFilesBuff = NULL;
+  char *timeDataFilesBuff = NULL;
+  int status;
+  int totErr = NC_NOERR;
+
+  struct nccf_host_type *self;
+  self = nccf_li_find(&CFLIST_HOST, hostid);
+
+  /* Build mosaic var */
+  if( self->hasMosaic == 1 ){
+    nccf_varCreate(&mosaicFile, CF_HOST_MOSAIC_FILENAME);
+    nccf_varSetAttribText(&mosaicFile, CF_ATTNAME_CF_TYPE_NAME, 
+			  CF_GS_HOST_MOSAIC_FILENAME);
+    int cfDims[] = {STRING_SIZE};
+    const char *cfDimNames[] = {"string"};
+    nccf_varSetDims( &mosaicFile, 1, cfDims, cfDimNames );
+    nccf_varSetDataPtr( &mosaicFile, NC_CHAR, self->mosaicFileBuffer );
+  }
+
+  /* build the grid names var */
+  if( self->nGrids > 0 ){
+    int gfDims[2] = {self->nGrids, STRING_SIZE};
+    const char *gfDimNames[2] = {CF_DIMNAME_NGRIDS, CF_DIMNAME_STRING};
+    gridNamesBuff = (char*)calloc( self->nGrids, STRING_SIZE*sizeof(char));
+    nccf_li_begin(&self->gridNames);
+    i = -1;
+    while (nccf_li_next(&self->gridNames)) {
+      i++;
+      int index = nccf_li_get_id(&self->gridNames);
+      char *fn = (char *) nccf_li_find(&self->gridNames, index);
+      strcpy(&gridNamesBuff[i*STRING_SIZE], fn);
+    }
+    nccf_varCreate(&vGridNames, CF_HOST_TILE_NAMES);
+    nccf_varSetAttribText(&vGridNames, CF_ATTNAME_CF_TYPE_NAME, 
+			  CF_GS_MOSAIC_TILE_NAMES);
+    nccf_varSetDims(&vGridNames, 2, gfDims, gfDimNames);
+    nccf_varSetDataPtr(&vGridNames, NC_CHAR, gridNamesBuff);
+  }
+
+  /* build the grid files var */
+  if( self->nGrids > 0 ){
+    int gfDims[2] = {self->nGrids, STRING_SIZE};
+    const char *gfDimNames[2] = {CF_DIMNAME_NGRIDS, CF_DIMNAME_STRING};
+    gridFilesBuff = (char*)calloc( self->nGrids, STRING_SIZE*sizeof(char));
+    nccf_li_begin(&self->gridFiles);
+    i = -1;
+    while (nccf_li_next(&self->gridFiles)) {
+      i++;
+      int index = nccf_li_get_id(&self->gridFiles);
+      char *fn = (char *) nccf_li_find(&self->gridFiles, index);
+      strcpy(&gridFilesBuff[i*STRING_SIZE], fn);
+    }
+    nccf_varCreate(&vGridFiles, CF_HOST_TILE_FILENAMES);
+    nccf_varSetAttribText(&vGridFiles, CF_ATTNAME_CF_TYPE_NAME, 
+			  CF_GS_HOST_TILE_FILENAMES);
+    nccf_varSetDims(&vGridFiles, 2, gfDims, gfDimNames);
+    nccf_varSetDataPtr(&vGridFiles, NC_CHAR, gridFilesBuff);
+  }
+
+  /* build static data files var */
+  if( self->nStatDataFiles > 0 ){
+    statDataFilesBuff = (char*)calloc( self->nStatDataFiles * self->nGrids, 
+                                       STRING_SIZE*sizeof(char));
+    nccf_li_begin(&self->statDataFiles);
+    i = -1;
+    while (nccf_li_next(&self->statDataFiles)) {
+      i++;
+      int index = nccf_li_get_id(&self->statDataFiles);
+      char *fn = (char *) nccf_li_find(&self->statDataFiles, index);
+      strcpy(&statDataFilesBuff[i*STRING_SIZE], fn);
+    }
+    nccf_varCreate(&vStatDataFiles, CF_HOST_STATDATA_FILENAME);
+    nccf_varSetAttribText(&vStatDataFiles, CF_ATTNAME_CF_TYPE_NAME, 
+			  CF_GS_HOST_STATDATA_FILENAME);
+    int nsd = self->nStatDataFiles / self->nGrids;
+    int sdDims[3] = {nsd, self->nGrids, STRING_SIZE};
+    const char *sdDimNames[3] = {CF_DIMNAME_NSTATDATA, 
+                                 CF_DIMNAME_NGRIDS, 
+                                 CF_DIMNAME_STRING};
+    nccf_varSetDims(&vStatDataFiles, 3, sdDims, sdDimNames);
+    nccf_varSetDataPtr(&vStatDataFiles, NC_CHAR, statDataFilesBuff);
+  }
+
+  /* write time dependent data files */
+  if( self->nTimeDataFiles > 0 ){
+    timeDataFilesBuff = (char*)calloc(self->nTimeDataFiles * self->nTimeSlices * self->nGrids, 
+                          STRING_SIZE*sizeof(char));
+    nccf_li_begin(&self->timeDataFiles);
+    i = -1;
+    while (nccf_li_next(&self->timeDataFiles)) {
+      i++;
+      int index = nccf_li_get_id(&self->timeDataFiles);
+      char *fn = (char *) nccf_li_find(&self->timeDataFiles, index);
+      strcpy(&timeDataFilesBuff[i*STRING_SIZE], fn);
+    }
+    nccf_varCreate(&vTimeDataFiles, CF_HOST_TIMEDATA_FILENAME);
+    nccf_varSetAttribText(&vTimeDataFiles, CF_ATTNAME_CF_TYPE_NAME, 
+			  CF_GS_HOST_TIMEDATA_FILENAME);
+    int ntd = self->nTimeDataFiles / ( self->nTimeSlices * self->nGrids );
+    int tdDims[4] = {self->nTimeSlices, ntd, self->nGrids, STRING_SIZE};
+    const char *tdDimNames[4] = {CF_DIMNAME_NTIMES, 
+                                 CF_DIMNAME_NTIMEDATA, 
+                                 CF_DIMNAME_NGRIDS, 
+                                 CF_DIMNAME_STRING};
+    nccf_varSetDims(&vTimeDataFiles, 4, tdDims, tdDimNames);
+    nccf_varSetDataPtr(&vTimeDataFiles, NC_CHAR, timeDataFilesBuff);
+  }
+
+  /* write everything to disk */
+  if (self->hasMosaic) {
+    status = nccf_writeListOfVars(ncid, 1, mosaicFile);
+    totErr += abs(status);
+  }
+  if (self->nGrids > 0) {
+    status = nccf_writeListOfVars(ncid, 2, vGridNames, vGridFiles);
+    totErr += abs(status);
+  }
+  if (self->nStatDataFiles > 0) {
+    status = nccf_writeListOfVars(ncid, 1, vStatDataFiles);
+    totErr += abs(status);
+  }
+  if (self->nTimeDataFiles > 0) {
+    status = nccf_writeListOfVars(ncid, 1, vTimeDataFiles);
+    totErr += abs(status);
+  }
+
+  /* clean up */
+  if( self->hasMosaic ) nccf_varDestroy( &mosaicFile );
+  if( gridFilesBuff ) free(gridFilesBuff);
+  if( gridNamesBuff ) free(gridNamesBuff);
+  
+  if( self->nGrids > 0 ) nccf_varDestroy(&vGridFiles);
+  if( self->nGrids > 0 ) nccf_varDestroy(&vGridNames);
+
+  if( self->nStatDataFiles > 0 ){
+    free(statDataFilesBuff);
+    nccf_varDestroy(&vStatDataFiles);
+  }
+
+  if( self->nTimeDataFiles > 0 ){
+    free(timeDataFilesBuff);
+    nccf_varDestroy(&vTimeDataFiles);
+  }
+
+  if (totErr != NC_NOERR) {
+    return NCCF_EPUTHOST;
+  }
+  else {
+    return NC_NOERR;
+  }
+}
+
+
diff --git a/gridspec_api/host/tst_cube_sphere_multi_dims_in_file.c b/gridspec_api/host/tst_cube_sphere_multi_dims_in_file.c
new file mode 100644
index 0000000..f0d8ed6
--- /dev/null
+++ b/gridspec_api/host/tst_cube_sphere_multi_dims_in_file.c
@@ -0,0 +1,498 @@
+/**
+ * Create a host file aggregation comprising static and time dependent 
+ * data stored in different files on three tiles of a cubed-sphere. The time 
+ * files contain multiple time steps. Time dependent and static data exist on 
+ * multiple tiles.
+ * 
+ * "$Id: tst_cube_sphere_multi_dims_in_file.c 767 2011-06-06 23:20:19Z pletzer $"
+ */
+
+#include "nccf_host.h"
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <netcdf.h>
+
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_data.h"
+#include "nccf_mosaic.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+
+#define NAME_MOSAIC "tst_cube_sphere_multi_var_dims_in_file_mosaic"
+#define NAME_GRID_0 "tst_cube_sphere_multi_var_dims_in_file_grid0"
+#define NAME_GRID_1 "tst_cube_sphere_multi_var_dims_in_file_grid1"
+#define NAME_GRID_2 "tst_cube_sphere_multi_var_dims_in_file_grid2"
+#define NAME_GRID_0_FILE "tst_cube_sphere_multi_var_dims_in_file_grid0.nc"
+#define NAME_GRID_1_FILE "tst_cube_sphere_multi_var_dims_in_file_grid1.nc"
+#define NAME_GRID_2_FILE "tst_cube_sphere_multi_var_dims_in_file_grid2.nc"
+#define NAME_MOSAIC_FILE "tst_cube_sphere_multi_var_dims_in_file_mosaic.nc"
+#define NAME_HOST_FILE   "tst_cube_sphere_multi_var_dims_in_file_host.nc"
+#define NAME_STATIC_DATA "tst_cube_sphere_multi_var_dims_in_file_stat_data"
+#define NAME_TIME_DATA   "tst_cube_sphere_multi_var_dims_in_file_time_data"
+#define NAME_STATIC_DATA_VARN "distance"
+#define NAME_TIME_DATA_VARN_v   "V"
+#define NAME_TIME_DATA_VARN_t   "T"
+#define NAME_TIME_VARN        "time"
+
+/* A structure for the time variable */
+struct time_struct{
+  int nVars;
+  int nCells;
+  int nTimes;
+  int nTimesPerFile;
+  int nGrids;
+
+  float value;
+  char *varname;
+  char *st_name;
+  char *units;
+  char *time_units;
+  char *time_stanname;
+  char *time_longname;
+} TIME;
+
+
+void create_grids(const char *coordinates_id,
+      int nCells, int nGrids,
+      const int *faceVectors[], char **gridFiles,
+      int gridids[], char **gridNames, int coordids[]) {
+
+  int status = NC_NOERR;
+  int i, iGrid;
+  int dims[] = {nCells, nCells};
+  double lon[dims[0] * dims[1]];
+  double lat[dims[0] * dims[1]];
+  const int save = 1;
+  const char *dimNames[] = {"nlon", "nlat"};
+
+  int globalids[nGrids];
+
+  /* tile 0 */
+  iGrid = 0;
+  status = nccf_get_cubedsphere_grid(dims, faceVectors[0], lon, lat);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lon_coord(2, dims, dimNames, lon, save, &coordids[0 + 0*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lat_coord(2, dims, dimNames, lat, save, &coordids[1 + 0*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_grid(&coordids[0], NAME_GRID_0, &gridids[0]);
+  if (status != NC_NOERR) ERR;
+  if(( status = nccf_def_global( &globalids[iGrid] ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_GRIDNAME, NAME_GRID_0, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* tile 1 */
+  iGrid = 1;
+  status = nccf_get_cubedsphere_grid(dims, faceVectors[0], lon, lat);
+  status = nccf_get_cubedsphere_grid(dims, faceVectors[1], lon, lat);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lon_coord(2, dims, dimNames, lon, save, &coordids[0 + 1*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lat_coord(2, dims, dimNames, lat, save, &coordids[1 + 1*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_grid(&coordids[1*2], NAME_GRID_1, &gridids[1]);
+  if (status != NC_NOERR) ERR;
+  if(( status = nccf_def_global( &globalids[iGrid] ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_GRIDNAME, NAME_GRID_1, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* tile 2 */
+  iGrid = 2;
+  status = nccf_get_cubedsphere_grid(dims, faceVectors[2], lon, lat);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lon_coord(2, dims, dimNames, lon, save, &coordids[0 + 2*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lat_coord(2, dims, dimNames, lat, save, &coordids[1 + 2*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_grid(&coordids[2*2], NAME_GRID_2, &gridids[2]);
+  if (status != NC_NOERR) ERR;
+  if(( status = nccf_def_global( &globalids[iGrid] ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_GRIDNAME, NAME_GRID_2, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* Create some file names */
+  strncpy(gridFiles[0], NAME_GRID_0_FILE, STRING_SIZE);
+  strncpy(gridFiles[1], NAME_GRID_1_FILE, STRING_SIZE);
+  strncpy(gridFiles[2], NAME_GRID_2_FILE, STRING_SIZE);
+  strncpy(gridNames[0], NAME_GRID_0, STRING_SIZE);
+  strncpy(gridNames[1], NAME_GRID_1, STRING_SIZE);
+  strncpy(gridNames[2], NAME_GRID_2_FILE, STRING_SIZE);
+
+  /* write files */
+  for (i = 0; i < nGrids; ++i) {
+    int ncid;
+    status = nc_create(gridFiles[i], NC_CLOBBER, &ncid);
+    if (status != NC_NOERR) ERR;
+    status = nccf_put_grid(gridids[i], ncid);
+    status = nccf_put_global(globalids[i], ncid);
+    
+    /* Add global attributes */
+    nc_redef( ncid );
+    nc_put_att_text( ncid, NC_GLOBAL, CF_TITLE, 
+            strlen("Dummy data for GRIDSPEC")+1, 
+            "Dummy data for GRIDSPEC" );
+    nccf_def_notes( ncid, NC_GLOBAL, "Tech-X Corporation", 
+                 "Multiple grids, variables, time files and times per file", 
+                 "Comment", "https://ice.txcorp.com/trac/modave/wiki/CFProposalGridspec" );
+    nc_enddef( ncid );
+
+    status = nc_close(ncid);
+    if (status != NC_NOERR) ERR;
+    status = nccf_free_global(globalids[i]);
+  }
+}
+
+int create_stat_data( const char *data_id, const char *coordinates_id,  
+                      int nCells, int nStatTiles, int nGrids, int gridids[],
+                      char **staticFiles, int staticids[] ){
+
+  int iStat, i, j, index, status, ncid, globalid;
+  int save = 0;
+  int toterr = 0;
+  float  data_f[nCells * nCells];
+  const char *df_sn = "static_data";
+  const char *df_ut = "meters";
+  char *name;
+  name = ( char* )calloc( STRING_SIZE, sizeof(char));
+
+  for( iStat = 0; iStat < nStatTiles; iStat++){
+
+    /* Create the data */
+    for( j = 0; j < nCells; j++ ){
+      for( i = 0; i < nCells; i++ ){
+        index = i + j * nCells;
+        data_f[index] = iStat + i * (float)( j+1 );
+      }
+    }
+
+    /* Define the data */
+    int gid = iStat % nGrids;
+    status += nccf_def_data( gridids[gid], NAME_STATIC_DATA_VARN,
+                                       df_sn, df_ut,
+                                       NULL, &staticids[iStat] );
+    status = nccf_inq_grid_name(gridids[gid], name);
+    toterr += status;
+    status += nccf_set_data_float( staticids[iStat], data_f, 
+					  save, NC_FILL_FLOAT );
+    toterr += status;
+
+    if(( status = nccf_def_global( &globalid ))) ERR;
+    if(( status = nccf_add_global_att( globalid, CF_FILETYPE, 
+                                       CF_GLATT_FILETYPE_STATIC_DATA, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalid, CF_GRIDNAME, 
+                                       name, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalid, CF_DATA_ID, 
+                                       data_id, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalid, CF_COORDINATES_ID, 
+                                       coordinates_id, 0 ))) ERR;
+
+    /* Open the file */
+    sprintf( staticFiles[iStat], "%s%d.nc", NAME_STATIC_DATA, iStat );
+    status += nc_create( staticFiles[iStat], NC_CLOBBER, &ncid );
+
+    /* Add global attributes */
+    nc_redef( ncid );
+    nc_put_att_text( ncid, NC_GLOBAL, CF_TITLE, 
+            strlen("Dummy data for GRIDSPEC")+1, 
+            "Dummy data for GRIDSPEC" );
+    nccf_def_notes( ncid, NC_GLOBAL, "Tech-X Corporation", 
+                 "Multiple grids, variables, time files and times per file", 
+                 "Comment", "https://ice.txcorp.com/trac/modave/wiki/CFProposalGridspec" );
+    nc_enddef( ncid );
+
+    /* Write the data to disk */
+    status += nccf_put_data(staticids[iStat], ncid);
+    status += nccf_put_global(globalid, ncid);
+    toterr += status;
+
+
+    status += nc_close( ncid );
+    status += nccf_free_global( globalid );
+  }
+
+  free( name );
+  return toterr;
+
+}
+
+int create_time_data( const char *data_id, const char *coordinates_id, 
+        int iVar, struct time_struct *time, int gridids[], char **timeFiles,
+        int timeids[] ){
+
+  int iTile, iTPF, i, j, ind, index, ii, status, ncid, iTime, globalid;
+  int time_dimidp, time_varidp;
+  int save = 0;
+  int toterr = 0;
+  long *times;
+  float  data_f[time->nCells * time->nCells];
+  char *name;
+  name = ( char* )calloc( STRING_SIZE, sizeof(char));
+
+  /* Initialize the time data */
+  for( j = 0; j < time->nCells; j++ ){
+    for( i = 0; i < time->nCells; i++ ){
+      ind = i + j * time->nCells;
+      data_f[ind] = 0.0;
+    }
+  }
+
+  float div = time->nGrids + time->nTimes + time->nTimesPerFile + 
+              time->nCells + time->nCells;
+  div = div - 5;
+  float div2  =  div / 2.0;
+
+  for( iTime = 0; iTime < time->nTimes; iTime++ ){
+    for( iTile = 0; iTile < time->nGrids; iTile++){
+
+      /* Create the data */
+      index = iTile + ( time->nGrids * ( iTime + ( time->nTimes * iVar )));
+
+      /* Open the file*/
+      sprintf( timeFiles[index], "%s_%d-%d-%d.nc", NAME_TIME_DATA, 
+               iVar, iTime, iTile );
+      status = nc_create( timeFiles[index], NC_CLOBBER, &ncid );
+      if( status ) return status;
+
+      /* Add the time coordinate */
+      nc_redef( ncid );
+      status = nccf_def_time(ncid, 
+                    "time", 
+                    time->nTimesPerFile, 
+                    NC_LONG, 
+                    time->time_units,
+                    time->time_stanname, 
+                    &time_dimidp, 
+                    &time_varidp);
+      nc_enddef( ncid );
+
+      times = malloc( time->nTimesPerFile * sizeof(long));
+      for( ii = 0; ii < time->nTimesPerFile; ii++ )
+        times[ii] = ii + time->nTimesPerFile * iTime;
+      if( status ) ERR;
+      status = nc_put_var_long( ncid, time_varidp, times );
+      if( status ) ERR;
+
+      /* Define the time data for each tile */
+      status = nccf_def_data( gridids[iTile], time->varname, 
+                                         time->st_name, time->units,
+                                         NAME_TIME_VARN, &timeids[index] );
+      toterr += status;
+
+      status = nccf_set_data_float( timeids[index], data_f, 
+					   save, NC_FILL_FLOAT );
+      toterr += status;
+
+      /* Add global attributes */
+      nc_redef( ncid );
+      nc_put_att_text( ncid, NC_GLOBAL, CF_TITLE, 
+              strlen("Dummy data for GRIDSPEC")+1, 
+              "Dummy data for GRIDSPEC" );
+      nccf_def_notes( ncid, NC_GLOBAL, "Tech-X Corporation", 
+                   "Multiple grids, variables, time files and times per file", 
+                   "Comment", "https://ice.txcorp.com/trac/modave/wiki/CFProposalGridspec" );
+      nc_enddef( ncid );
+
+
+      /* populate the data */
+      for( iTPF = 0; iTPF < time->nTimesPerFile; iTPF++ ){
+        for( j = 0; j < time->nCells; j++ ){
+          for( i = 0; i < time->nCells; i++ ){
+            ind = i + j * time->nCells;
+            data_f[ind] = time->value + (( iTile + iTime + iTPF + j + i ) - div2);
+          }
+        }
+
+        /* Write to disk*/
+        status = nccf_put_data(timeids[index], ncid);
+        toterr += status;
+      }
+
+      /* Global Attributes */
+      status = nccf_inq_grid_name(gridids[iTile], name);
+      status = nccf_def_global( &globalid );
+      status = nccf_add_global_att(globalid, CF_GRIDNAME, name, 0);
+      status = nccf_add_global_att(globalid, CF_FILETYPE, 
+                                   CF_GLATT_FILETYPE_TIME_DATA, 0);
+      status = nccf_add_global_att(globalid, CF_DATA_ID, data_id, 0);
+      status = nccf_put_global(globalid, ncid);
+
+      toterr += status;
+      status = nc_close( ncid );
+      status = nccf_free_global( globalid );
+      if( status ) return status;
+      free( times );
+    }
+  }
+
+  free( name );
+  return toterr;
+
+}
+
+int main(  ){
+
+  int status = NC_NOERR;
+  int i, j, ndims;
+
+  /* create the coordinate id */
+  char coordinates_id[36+1];
+  char data_id[36+1];
+  const int seed = 12345;
+  if ((status += nccf_generate_id(seed, coordinates_id))) ERR;
+  if ((status += nccf_generate_id(seed, data_id))) ERR;
+
+  /* Dimensions */
+  const int nGrids = 3;
+  int nvars = 2;
+  int nTimes = 2;
+  int nTimesPerFile = 3;
+  int nTimeFiles = nGrids * nTimes * nvars;
+  int nStatFiles = nGrids;
+
+  const int nCells = 10;
+
+  struct time_struct local;
+
+  local.nVars   = nvars;
+  local.nCells  = nCells;
+  local.nTimes  = nTimes;
+  local.nTimesPerFile = nTimesPerFile;
+  local.nGrids  = nGrids;
+  local.value   = 273.15;
+  local.varname = NAME_TIME_DATA_VARN_t;
+  local.st_name = "temperature";
+  local.units   = "K";
+  local.time_stanname = "Time";
+  local.time_longname = "Time";
+  local.time_units    = "Days";
+
+  /* create the grids */
+  const int faceVect0[] = {1, 0, 0};
+  const int faceVect1[] = {0, 1, 0};
+  const int faceVect2[] = {0, 0, 1};
+  const int *faceVectors[] = {faceVect0, faceVect1, faceVect2};
+  char **gridFiles   = calloc(nGrids, sizeof(char *));
+  char **gridNames   = calloc(nGrids, sizeof(char *));
+  char **staticFiles = calloc(nStatFiles, sizeof(char *));
+  char **timeFiles   = calloc(nTimeFiles, sizeof(char *));
+  for (i = 0; i < nGrids; ++i) {
+    gridFiles[i]   = calloc(STRING_SIZE, sizeof(char));
+    gridNames[i]   = calloc(STRING_SIZE, sizeof(char));
+  }
+  for( i = 0; i < nStatFiles; i++ ) staticFiles[i] = calloc(STRING_SIZE, sizeof(char));
+  for( i = 0; i < nTimeFiles; i++ ) timeFiles[i]   = calloc(STRING_SIZE, sizeof(char));
+  int gridids[nGrids];
+  int staticids[nStatFiles];
+  int timeids[nTimeFiles];
+  int coordids[nGrids * 2];
+  create_grids(coordinates_id, nCells, nGrids, faceVectors,
+         gridFiles, gridids, gridNames, coordids);
+
+  /* create the mosaic */
+  int mosaicid, globalid;
+  const double periods[] = {0., 0., 0.};
+  status += nccf_def_mosaic(nGrids, gridids, NAME_MOSAIC, &mosaicid);
+  if (status != NC_NOERR) ERR;
+  status += nccf_compute_mosaic_contacts( mosaicid, periods );
+  status += nccf_def_global( &globalid );
+  status += nccf_add_global_att(globalid, CF_COORDINATES_ID, coordinates_id, 0);
+  status += nccf_add_global_att(globalid, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0);
+  if (status != NC_NOERR) ERR;
+  int ncid;
+  status += nc_create(NAME_MOSAIC_FILE, NC_CLOBBER, &ncid);
+  if (status != NC_NOERR) ERR;
+  status += nccf_put_mosaic(mosaicid, ncid);
+  status += nccf_put_global(globalid, ncid);
+  status += nc_close(ncid);
+  if (status != NC_NOERR) ERR;
+  status += nccf_free_global(globalid);
+
+  /* create static data */
+  status += create_stat_data( data_id, coordinates_id, nCells, nStatFiles, nGrids,
+                                            gridids, staticFiles, staticids );
+
+ /* create time dependent data */
+
+  status = create_time_data( data_id, coordinates_id, 0, &local, gridids, timeFiles, timeids);
+  if( status ) ERR;
+  local.value   = 10.0;
+  local.varname = NAME_TIME_DATA_VARN_v; 
+  local.st_name = "velocity";
+  local.units = "m/s";
+  status = create_time_data( data_id, coordinates_id, 1, &local, gridids, timeFiles, timeids);
+  if( status ) ERR;
+
+  /* create the host file */
+  int hostid;
+  if (( status = nccf_def_host(coordinates_id, data_id, nTimes, &hostid))) ERR;
+  if (( status += nc_create( NAME_HOST_FILE, NC_CLOBBER, &ncid ))) ERR;
+  for( i = 0; i < nGrids; i++ ){
+    if (( status += nccf_add_host_file( hostid, gridFiles[i], 0 ))) ERR;
+  }
+  for( i = 0; i < nStatFiles; i++ ){
+    if (( status += nccf_add_host_file( hostid, staticFiles[i], 0 ))) ERR;
+  }
+
+  /* Reverse the order to test nccf_li_insert */
+  for( i = nTimeFiles-1; i >=  0; i-- ){
+    if (( status += nccf_add_host_file( hostid, timeFiles[i], 0 ))) ERR;
+  }
+  if (( status += nccf_add_host_file( hostid, NAME_MOSAIC_FILE, 0 ))) ERR;
+
+  /* Define the global attributes */
+  if(( status = nccf_def_global( &globalid ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_FILETYPE, 
+                                     CF_GLATT_FILETYPE_HOST, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_DATA_ID, 
+                                     data_id , 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_COORDINATES_ID, 
+                                     coordinates_id, 0 ))) ERR;
+
+  if (( status += nccf_put_host(hostid, ncid))) ERR;
+  if (( status += nccf_put_global(globalid, ncid))) ERR;
+  if (( status += nc_close( ncid ))) ERR;
+  if (( status += nccf_free_global( globalid ))) ERR;
+
+  /* clean up */
+  if ((status += nccf_free_host(hostid))) ERR;
+  if ((status += nccf_free_mosaic(mosaicid))) ERR;
+
+  nccf_inq_grid_ndims( gridids[0], &ndims );
+  int cid[ndims];
+  for (i = 0; i < nGrids; ++i) {
+    status += nccf_inq_grid_coordids( gridids[i], cid );
+
+    for( j = 0; j < ndims; j++ )
+      if ((status += nccf_free_coord(cid[j]))) ERR;
+    if ((status += nccf_free_grid(gridids[i]))) ERR;
+  }
+
+  for( i = 0; i < nStatFiles; i++ ){
+    if ((status += nccf_free_data(staticids[i]))) ERR;
+    free( staticFiles[i] );
+  }
+  for( i = 0; i < nTimeFiles; i++ ){
+    if ((status += nccf_free_data(timeids[i]))) ERR;
+    free( timeFiles[i] );
+  }
+  for (i = 0; i < 2*nGrids; ++i) {
+  }
+
+  for (i = 0; i < nGrids; ++i) {
+    free(gridFiles[i]);
+    free(gridNames[i]);
+  }
+
+  free(gridFiles);
+  free(gridNames);
+  free(staticFiles);
+  free(timeFiles);
+
+  return status;
+
+}
diff --git a/gridspec_api/host/tst_cube_sphere_multi_var.c b/gridspec_api/host/tst_cube_sphere_multi_var.c
new file mode 100644
index 0000000..e01fd31
--- /dev/null
+++ b/gridspec_api/host/tst_cube_sphere_multi_var.c
@@ -0,0 +1,366 @@
+/**
+ * Test writing a hostfile comprising multiple variables.
+ *
+ * "$Id: tst_cube_sphere_multi_var.c 224 2010-11-13 17:25:43Z dkindig $"
+ */
+
+#include "nccf_host.h"
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <netcdf.h>
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_data.h"
+#include "nccf_mosaic.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+
+#define NAME_MOSAIC "tst_cube_sphere_multi_var_mosaic"
+#define NAME_GRID_0 "tst_cube_sphere_multi_var_grid0"
+#define NAME_GRID_1 "tst_cube_sphere_multi_var_grid1"
+#define NAME_GRID_2 "tst_cube_sphere_multi_var_grid2"
+#define NAME_GRID_0_FILE "tst_cube_sphere_multi_var_grid0.nc"
+#define NAME_GRID_1_FILE "tst_cube_sphere_multi_var_grid1.nc"
+#define NAME_GRID_2_FILE "tst_cube_sphere_multi_var_grid2.nc"
+#define NAME_MOSAIC_FILE "tst_cube_sphere_multi_var_mosaic.nc"
+#define NAME_HOST_FILE   "tst_cube_sphere_multi_var_host.nc"
+#define NAME_STATIC_DATA "tst_cube_sphere_multi_var_stat_data"
+#define NAME_TIME_DATA   "tst_cube_sphere_multi_var_time_data"
+#define NAME_STATIC_DATA_VARN "distance"
+#define NAME_TIME_DATA_VARN_v   "v"
+#define NAME_TIME_DATA_VARN_t   "t"
+#define NAME_TIME_VARN        "time"
+
+void create_grids(const char *coordinates_id,
+      int nCells, int nGrids,
+      const int *faceVectors[], char **gridFiles,
+      int gridids[], char **gridNames, int coordids[]) {
+
+  int status = NC_NOERR;
+  int i, iGrid, globalids[nGrids];
+  int dims[] = {nCells, nCells};
+  double lon[dims[0] * dims[1]];
+  double lat[dims[0] * dims[1]];
+  const int save = 1;
+  const char *dimNames[] = {"n", "n"};
+
+
+  /* tile 0 */
+  iGrid = 0;
+  status = nccf_get_cubedsphere_grid(dims, faceVectors[0], lon, lat);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lon_coord(2, dims, dimNames, lon, save, &coordids[0 + 0*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lat_coord(2, dims, dimNames, lat, save, &coordids[1 + 0*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_grid(&coordids[0], NAME_GRID_0, &gridids[0]);
+  if (status != NC_NOERR) ERR;
+  if(( status = nccf_def_global( &globalids[iGrid] ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_GRIDNAME, NAME_GRID_0, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* tile 1 */
+  iGrid = 1;
+  status = nccf_get_cubedsphere_grid(dims, faceVectors[1], lon, lat);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lon_coord(2, dims, dimNames, lon, save, &coordids[0 + 1*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lat_coord(2, dims, dimNames, lat, save, &coordids[1 + 1*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_grid(&coordids[1*2], NAME_GRID_1, &gridids[1]);
+  if (status != NC_NOERR) ERR;
+  if(( status = nccf_def_global( &globalids[iGrid] ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_GRIDNAME, NAME_GRID_1, 0))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* tile 2 */
+  iGrid = 2;
+  status = nccf_get_cubedsphere_grid(dims, faceVectors[2], lon, lat);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lon_coord(2, dims, dimNames, lon, save, &coordids[0 + 2*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lat_coord(2, dims, dimNames, lat, save, &coordids[1 + 2*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_grid(&coordids[2*2], NAME_GRID_2, &gridids[2]);
+  if (status != NC_NOERR) ERR;
+  if(( status = nccf_def_global( &globalids[iGrid] ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_GRIDNAME, NAME_GRID_2, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* write files */
+  strncpy(gridFiles[0], NAME_GRID_0_FILE, STRING_SIZE);
+  strncpy(gridFiles[1], NAME_GRID_1_FILE, STRING_SIZE);
+  strncpy(gridFiles[2], NAME_GRID_2_FILE, STRING_SIZE);
+  strncpy(gridNames[0], NAME_GRID_0, STRING_SIZE);
+  strncpy(gridNames[1], NAME_GRID_1, STRING_SIZE);
+  strncpy(gridNames[2], NAME_GRID_2_FILE, STRING_SIZE);
+  for (i = 0; i < nGrids; ++i) {
+    int ncid;
+    status += nc_create(gridFiles[i], NC_CLOBBER, &ncid);
+    if (status != NC_NOERR) ERR;
+    status += nccf_put_grid(gridids[i], ncid);
+    status += nccf_put_global(globalids[i], ncid);
+    status += nc_close(ncid);
+    status += nccf_free_global( globalids[i] );
+    if (status != NC_NOERR) ERR;
+  }
+}
+
+int create_stat_data( const char *data_id, int nCells,
+                        int nStatTiles, int nGrids, int gridids[],
+                        char **staticFiles, int staticids[] ){
+
+  int iStat, i, j, index, status, ncid, globalid;
+  int save = 0;
+  int toterr = 0;
+  float  data_f[nCells * nCells];
+  const char *df_sn = "static_data";
+  const char *df_ut = "meters";
+  char *name;
+  name = ( char* )calloc( STRING_SIZE, sizeof(char));
+
+  for( iStat = 0; iStat < nStatTiles; iStat++){
+    for( j = 0; j < nCells; j++ ){
+      for( i = 0; i < nCells; i++ ){
+        index = i + j * nCells;
+        data_f[index] = iStat + i * (float)( j+1 );
+      }
+    }
+    int gid = iStat % nGrids;
+    status += nccf_def_data( gridids[gid], NAME_STATIC_DATA_VARN,
+                                       df_sn, df_ut,
+                                       NULL, &staticids[iStat] );
+    toterr += status;
+    status += nccf_set_data_float( staticids[iStat], data_f, 
+					  save, NC_FILL_FLOAT );
+    toterr += status;
+
+    /* Global Attributes */
+    status = nccf_inq_grid_name(gridids[gid], name);
+    status = nccf_def_global( &globalid );
+    status = nccf_add_global_att(globalid, CF_GRIDNAME, name, 0);
+    status = nccf_add_global_att(globalid, CF_FILETYPE, CF_GLATT_FILETYPE_STATIC_DATA, 0);
+    status = nccf_add_global_att(globalid, CF_DATA_ID, data_id, 0);
+
+    sprintf( staticFiles[iStat], "%s%d.nc", NAME_STATIC_DATA, iStat );
+    status += nc_create( staticFiles[iStat], NC_CLOBBER, &ncid );
+    status += nccf_put_data(staticids[iStat], ncid);
+    status += nccf_put_global(globalid, ncid);
+    status += nc_close( ncid );
+    status += nccf_free_global( globalid );
+    toterr += status;
+  }
+
+  free( name );
+  return toterr;
+
+}
+
+int create_time_data( const char *data_id, const char *varname,
+        const char *st_name, const char* units, float value, int nCells,
+        int iVar, int nTimes, int nGrids, int gridids[],
+        char **timeFiles, int timeids[] ){
+
+  int iTile, i, j, index, status, ncid, iTime, globalid;
+  int save = 0;
+  int toterr = 0;
+  float  data_f[nCells * nCells];
+  char *name;
+  name = ( char* )calloc( STRING_SIZE, sizeof(char));
+
+  for( iTile = 0; iTile < nGrids; iTile++){
+
+    /* Create the data */
+    for( iTime = 0; iTime < nTimes; iTime++ ){
+      for( j = 0; j < nCells; j++ ){
+        for( i = 0; i < nCells; i++ ){
+          index = i + j * nCells;
+          data_f[index] = value + (( 1+iTime ) * iTile + i / (float)( j+1 ));
+        }
+      }
+
+      /* Define the time data for each tile */
+      index = iTile + ( nGrids * ( iTime + ( nTimes * iVar )));
+      status += nccf_def_data( gridids[iTile], NAME_TIME_DATA_VARN_t,
+                                         st_name, units,
+                                         NAME_TIME_VARN, &timeids[index] );
+      toterr += status;
+      status += nccf_set_data_float( timeids[index], data_f, 
+					    save, NC_FILL_FLOAT );
+      toterr += status;
+
+      /* Global Attributes */
+      status = nccf_inq_grid_name(gridids[iTile], name);
+      status = nccf_def_global( &globalid );
+      status = nccf_add_global_att(globalid, CF_GRIDNAME, name, 0);
+      status = nccf_add_global_att(globalid, CF_FILETYPE, 
+                                   CF_GLATT_FILETYPE_TIME_DATA, 0);
+      status = nccf_add_global_att(globalid, CF_DATA_ID, data_id, 0);
+
+      /* OPen the file*/
+      sprintf( timeFiles[index], "%s_%d-%d-%d.nc", NAME_TIME_DATA, iTime, iVar, iTile );
+      status += nc_create( timeFiles[index], NC_CLOBBER, &ncid );
+
+      /* Write to disk*/
+      status += nccf_put_data(timeids[index], ncid);
+      status += nccf_put_global(globalid, ncid);
+      status += nc_close( ncid );
+      status += nccf_free_global( globalid );
+      toterr += status;
+    }
+  }
+
+  free( name );
+  return toterr;
+
+}
+
+int main(  ){
+
+
+  int status = NC_NOERR;
+  int i, j, ndims;
+
+  /* create the coordinate id */
+  char coordinates_id[36+1];
+  char data_id[36+1];
+  const int seed = 12345;
+  if ((status += nccf_generate_id(seed, coordinates_id))) ERR;
+  if ((status += nccf_generate_id(seed, data_id))) ERR;
+
+  /* Dimensions */
+  const int nGrids = 3;
+  int nvars = 2;
+  int nTimes = 2;
+  int nTimeFiles = nGrids * nTimes * nvars;
+  int nStatFiles = nGrids * 1;
+
+  /* create the grids */
+  const int nCells = 10;
+  const int faceVect0[] = {1, 0, 0};
+  const int faceVect1[] = {0, 1, 0};
+  const int faceVect2[] = {0, 0, 1};
+  const int *faceVectors[] = {faceVect0, faceVect1, faceVect2};
+  char **gridFiles   = calloc(nGrids, sizeof(char *));
+  char **gridNames   = calloc(nGrids, sizeof(char *));
+  char **staticFiles = calloc(nStatFiles, sizeof(char *));
+  char **timeFiles   = calloc(nTimeFiles, sizeof(char *));
+  for (i = 0; i < nGrids; ++i) {
+    gridFiles[i]   = calloc(STRING_SIZE, sizeof(char));
+    gridNames[i]   = calloc(STRING_SIZE, sizeof(char));
+  }
+  for( i = 0; i < nStatFiles; i++ ) staticFiles[i] = calloc(STRING_SIZE, sizeof(char));
+  for( i = 0; i < nTimeFiles; i++ ) timeFiles[i]   = calloc(STRING_SIZE, sizeof(char));
+  int gridids[nGrids];
+  int staticids[nStatFiles];
+  int timeids[nTimeFiles];
+  int coordids[nGrids * 2];
+  create_grids(coordinates_id, nCells, nGrids, faceVectors,
+         gridFiles, gridids, gridNames, coordids);
+
+  /* create the mosaic */
+  int mosaicid;
+  const double periods[] = {0., 0., 0.};
+  status += nccf_def_mosaic(nGrids, gridids, NAME_MOSAIC, &mosaicid);
+  status += nccf_compute_mosaic_contacts( mosaicid, periods );
+  if (status != NC_NOERR) ERR;
+
+  /* Global Atts */
+  int globalid;
+  status += nccf_def_global( &globalid );
+  status += nccf_add_global_att(globalid, CF_COORDINATES_ID, coordinates_id, 0);
+  if (status != NC_NOERR) ERR;
+
+  /* Write the mosaic file */
+  int ncid;
+  status += nc_create(NAME_MOSAIC_FILE, NC_CLOBBER, &ncid);
+  if (status != NC_NOERR) ERR;
+  status += nccf_put_mosaic(mosaicid, ncid);
+  status += nccf_put_global(globalid, ncid);
+  status += nc_close(ncid);
+  if (status != NC_NOERR) ERR;
+  if(( status = nccf_free_global(globalid))) ERR;
+
+  /* create static data */
+  status += create_stat_data( data_id, nCells, nStatFiles, nGrids,
+                                            gridids, staticFiles, staticids );
+
+ /* create time dependent data */
+
+  create_time_data( data_id, NAME_TIME_DATA_VARN_t, "temperature", "K", 273.15,
+                                   nCells, 0, nTimes, nGrids, gridids, timeFiles, timeids );
+  create_time_data( data_id, NAME_TIME_DATA_VARN_v, "velocity", "m/s", 0.0,
+                                   nCells, 1, nTimes, nGrids, gridids, timeFiles, timeids );
+
+  /* create the host file */
+  int hostid;
+  if (( status = nccf_def_host(coordinates_id, data_id, nTimes, &hostid))) ERR;
+  if (( status += nc_create( NAME_HOST_FILE, NC_CLOBBER, &ncid ))) ERR;
+  for( i = 0; i < nGrids; i++ ){
+    if (( status += nccf_add_host_file( hostid, gridFiles[i], 0 ))) ERR;
+  }
+  for( i = 0; i < nStatFiles; i++ ){
+    if (( status += nccf_add_host_file( hostid, staticFiles[i], 0 ))) ERR;
+  }
+  for( i = 0; i < nTimeFiles; i++ ){
+    if (( status += nccf_add_host_file( hostid, timeFiles[i], 0 ))) ERR;
+  }
+  if (( status += nccf_add_host_file( hostid, NAME_MOSAIC_FILE, 0 ))) ERR;
+
+  /* Define the global attributes */
+  if(( status = nccf_def_global( &globalid ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_FILETYPE, 
+                                     CF_GLATT_FILETYPE_HOST, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_DATA_ID, 
+                                     data_id , 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_COORDINATES_ID, 
+                                     coordinates_id, 0 ))) ERR;
+
+  if (( status += nccf_put_host(hostid, ncid))) ERR;
+  if (( status += nccf_put_global(globalid, ncid))) ERR;
+  if (( status += nc_close( ncid ))) ERR;
+  if (( status += nccf_free_global( globalid ))) ERR;
+
+
+  /* clean up */
+  if ((status += nccf_free_host(hostid))) ERR;
+  if ((status += nccf_free_mosaic(mosaicid))) ERR;
+
+  nccf_inq_grid_ndims( gridids[0], &ndims );
+  int cid[ndims];
+  for (i = 0; i < nGrids; ++i) {
+    status += nccf_inq_grid_coordids( gridids[i], cid );
+
+    for( j = 0; j < ndims; j++ )
+      if ((status += nccf_free_coord(cid[j]))) ERR;
+    if ((status += nccf_free_grid(gridids[i]))) ERR;
+  }
+
+  for( i = 0; i < nStatFiles; i++ ){
+    if ((status += nccf_free_data(staticids[i]))) ERR;
+    free( staticFiles[i] );
+  }
+  for( i = 0; i < nTimeFiles; i++ ){
+    if ((status += nccf_free_data(timeids[i]))) ERR;
+    free( timeFiles[i] );
+  }
+  for (i = 0; i < 2*nGrids; ++i) {
+  }
+
+  for (i = 0; i < nGrids; ++i) {
+    free(gridFiles[i]);
+    free(gridNames[i]);
+  }
+
+  free(gridFiles);
+  free(gridNames);
+  free(staticFiles);
+  free(timeFiles);
+
+  return status;
+
+}
diff --git a/gridspec_api/host/tst_get_host_three_tile.c b/gridspec_api/host/tst_get_host_three_tile.c
new file mode 100644
index 0000000..82ed5a9
--- /dev/null
+++ b/gridspec_api/host/tst_get_host_three_tile.c
@@ -0,0 +1,113 @@
+/*
+ * Test the opening of a host file and retriveing the data from the files
+ * contained therein.
+ *
+ * "$Id: tst_get_host_three_tile.c 824 2011-09-13 18:38:07Z dkindig $"
+ */
+
+#include "nccf_host.h"
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <netcdf.h>
+
+#define GRIDPREF "tst_three_tile_cubed_sphere_grid"
+
+int main(  ){
+
+  int status = NC_NOERR;
+  const char* host_filename = "tst_three_tile_cubed_sphere_host.nc";
+  int hostid, ngrids, nstatdatafiles, ntimedata, nTimes;
+  int nStatFiles = 0, nTimeFiles = 0;
+  int mosaicid;
+  int ndims, i;
+  int gridix, statvix, timevix, index, itime;
+  char staticfilename[STRING_SIZE];
+  char timefilename[STRING_SIZE];
+  char *name = NULL;
+  char gridfilename[STRING_SIZE];
+
+  status = nccf_def_host_from_file( host_filename, &hostid );
+  if (status != NC_NOERR) {
+    printf("Non-existant or corrupt file %s! Bailing out\n", host_filename);
+    return 0;
+  }
+  if ((status = nccf_inq_host_ngrids( hostid, &ngrids ))) ERR;
+  if ((status = nccf_inq_host_nstatdatafiles( hostid, &nstatdatafiles ))) ERR;
+  if ((status = nccf_inq_host_ntimedatafiles( hostid, &ntimedata ))) ERR;
+  if ((status = nccf_inq_host_ntimeslices( hostid, &nTimes ))) ERR;
+
+  nStatFiles = nstatdatafiles * ngrids;
+  nTimeFiles = ntimedata * ngrids * nTimes;
+
+  int staticdataids[nStatFiles];
+  int timedataids[nTimeFiles];
+
+  char mosaicfilename[STRING_SIZE];
+  if ((status = nccf_inq_host_mosaicfilename( hostid, mosaicfilename ))) ERR;
+  nccf_def_mosaic_from_file( mosaicfilename, "", &mosaicid );
+  int gridids[ngrids];
+  nccf_inq_mosaic_ndims( mosaicid, &ndims );
+  char **coordnames = calloc( ndims, STRING_SIZE * sizeof(char*));
+  for( i = 0; i < ndims; i++ ) 
+      coordnames[i] = calloc( STRING_SIZE, sizeof(char));
+  nccf_inq_mosaic_coordnames( mosaicid, coordnames );
+
+  for( gridix = 0; gridix < ngrids; ++gridix ){
+    name = (char*)malloc( STRING_SIZE * sizeof(char));
+    sprintf( name, "%s%d", GRIDPREF, gridix );
+
+    if((status = nccf_inq_host_gridfilename( hostid, gridix, gridfilename ))) ERR;
+    if((status = nccf_def_grid_from_file( gridfilename, ndims, 
+        (const char**)coordnames, name, &gridids[gridix] ))) ERR;
+    free( name );
+
+    for( statvix = 0; statvix < nstatdatafiles; ++statvix ){
+      
+      if((status = nccf_inq_host_statfilename( hostid, statvix, gridix, 
+                                                staticfilename ))) ERR;
+      index = gridix + ngrids * statvix;
+     
+      if((status = nccf_def_data_from_file( staticfilename, gridix, 
+        "distance", 1, &staticdataids[index]))) ERR;
+      
+    }
+ 
+    for( itime = 0; itime < nTimes; ++itime ){
+      for( timevix = 0; timevix < ntimedata; ++timevix ){
+        
+        if((status = nccf_inq_host_timefilename( hostid, itime, timevix, gridix,
+                                                 timefilename ))) ERR;
+        index = gridix + ngrids * timevix;
+        if((status = nccf_def_data_from_file( timefilename, gridix, 
+          "v", 1, &timedataids[index]))) ERR;
+      }
+    }
+  }
+
+  /* Assertions */
+//  assert( ngrids == 3 );
+//  assert( nstatdatafiles == 1 );
+//  assert( ntimedata == 1 );
+
+  /* Clean up */
+  for( i = 0; i < nTimeFiles; i++ ) 
+    nccf_free_data( timedataids[i] );
+  for( i = 0; i < nStatFiles; i++ ) 
+    nccf_free_data( staticdataids[i] );
+  int cid[ndims], j;
+  for( i = 0; i < ngrids; i++ ){
+    nccf_inq_grid_coordids( gridids[i], cid );
+    for( j = 0; j < ndims; j++) nccf_free_coord( cid[j] );
+    nccf_free_grid( gridids[i] );
+  }
+
+  nccf_free_mosaic( mosaicid );
+  nccf_free_host( hostid );
+
+  for( i = 0; i < ndims; i++ ) free( coordnames[i] );
+  free( coordnames );
+
+  return 0;
+}
diff --git a/gridspec_api/host/tst_nccf_add_host.c b/gridspec_api/host/tst_nccf_add_host.c
new file mode 100644
index 0000000..25b3a7a
--- /dev/null
+++ b/gridspec_api/host/tst_nccf_add_host.c
@@ -0,0 +1,46 @@
+/**
+ * 
+ * A test for the add_host method.
+ *
+ * "$Id: tst_nccf_add_host.c 767 2011-06-06 23:20:19Z pletzer $"
+ */
+
+#include "nccf_host.h"
+#include <assert.h>
+#include <netcdf.h>
+#include "nccf_global.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+
+int main(  ){
+
+  const char coordinates_id[] = "696c568a-31aa-4cdc-9c1a-c32821cc25ad";
+  const char data_id[] = "29fb9258-2458-11e0-8ea4-5c260a1834c1";
+  int hostid, globalid;
+  int status;
+  char *mosaic_filename = "tst_three_tile_cubed_sphere_mosaic.nc";
+  char *host_filename = "tst_nccf_add_host.nc";
+
+  if ((status = nccf_def_host(coordinates_id, data_id, 1, &hostid))) ERR;
+  status = nccf_add_host_file( hostid, mosaic_filename, 1 );
+  int ncid;
+
+  /* Define the global attributes */
+  if(( status = nccf_def_global( &globalid ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_FILETYPE, 
+                                     CF_GLATT_FILETYPE_HOST, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_DATA_ID, 
+                                     data_id , 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_COORDINATES_ID, 
+                                     coordinates_id, 0 ))) ERR;
+
+  if ((status = nc_create(host_filename, NC_CLOBBER, &ncid))) ERR;
+  if (( status += nccf_put_host(hostid, ncid))) ERR;
+  if (( status += nccf_put_global(globalid, ncid))) ERR;
+  if (( status += nc_close( ncid ))) ERR;
+  if (( status += nccf_free_global( globalid ))) ERR;
+  if (( status += nccf_free_host( hostid ))) ERR;
+
+  return status;
+
+}
diff --git a/gridspec_api/host/tst_nccf_def_host.c b/gridspec_api/host/tst_nccf_def_host.c
new file mode 100644
index 0000000..7c77c44
--- /dev/null
+++ b/gridspec_api/host/tst_nccf_def_host.c
@@ -0,0 +1,43 @@
+/**
+ * Test the API for defining a host file.
+ *
+ * "$Id: tst_nccf_def_host.c 767 2011-06-06 23:20:19Z pletzer $"
+ */
+
+#include "nccf_host.h"
+#include <assert.h>
+#include <netcdf.h>
+#include "nccf_global.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+
+int main(  ){
+
+  char coordinates_id[36+1];
+  char data_id[36+1];
+  const int seed = 12345;
+  int hostid, globalid;
+  int status;
+  if ((status = nccf_generate_id(seed, coordinates_id))) ERR;
+  if ((status = nccf_generate_id(seed, data_id))) ERR;
+  if ((status = nccf_def_host(coordinates_id, data_id, 0, &hostid))) ERR;
+  int ncid;
+  /* Define the global attributes */
+  if(( status = nccf_def_global( &globalid ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_FILETYPE, 
+                                     CF_GLATT_FILETYPE_HOST, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_DATA_ID, 
+                                     data_id , 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_COORDINATES_ID, 
+                                     coordinates_id, 0 ))) ERR;
+
+  if (( status = nc_create( "tst_nccf_def_host.nc", NC_CLOBBER, &ncid )));
+  if (( status = nccf_put_host(hostid, ncid))) ERR;
+  if (( status = nccf_put_global(globalid, ncid))) ERR;
+  if (( status = nc_close( ncid ))) ERR;
+  if (( status = nccf_free_global( globalid ))) ERR;
+
+  if (( status = nccf_free_host(hostid ))) ERR;
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/host/tst_nccf_def_host_from_file.c b/gridspec_api/host/tst_nccf_def_host_from_file.c
new file mode 100644
index 0000000..be43b3f
--- /dev/null
+++ b/gridspec_api/host/tst_nccf_def_host_from_file.c
@@ -0,0 +1,28 @@
+/*
+ * Test the method nccf_def_host_from_file.c  
+ * NOTE: This test should be run after tst_three_tile_cubed_sphere_host
+ *
+ * "$Id: tst_nccf_def_host_from_file.c 719 2011-04-26 17:39:51Z srinath22 $"
+ *
+ */
+
+#include "nccf_host.h"
+#include <string.h>
+#include <stdio.h>
+
+#include "nccf_handle_error.h"
+
+int main(  ){
+
+  int status = NC_NOERR;
+  int hostid;
+  char *filename = "tst_three_tile_cubed_sphere_host.nc";
+
+  // If the file is missing just exit as a pass.
+  status = nccf_def_host_from_file( filename, &hostid );
+  if ((status == NC_ENOTNC )) status = NC_NOERR;
+  else ERR;
+  if ((status = nccf_free_host( hostid ))) ERR;
+
+  return status;
+}
diff --git a/gridspec_api/host/tst_real_data_case.c b/gridspec_api/host/tst_real_data_case.c
new file mode 100644
index 0000000..84ffa78
--- /dev/null
+++ b/gridspec_api/host/tst_real_data_case.c
@@ -0,0 +1,226 @@
+/**
+ * Use the data from modave/data/c48_data to create a mosaic and host file.
+ * Then reread the host file.
+ *
+ * $Id: tst_real_data_case.c 824 2011-09-13 18:38:07Z dkindig $
+ */
+
+#include "nccf_host.h"
+#include <netcdf.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include "nccf_constants.h"
+#include "nccf_utility_functions.h"
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_data.h"
+
+#define GRIDNAME "horizontal_grid"
+#define DATANAME "19810101.atmos_month"
+#define TILE     ".tile"
+#define FILETYPE "gs_tile_file"
+#define DATATYPE "gs_time_data_file"
+#define MOSAICFILE "tst_real_data_case_mosaic.nc"
+#define HOSTFILE "tst_real_data_case_host.nc"
+
+int update_attrfiles(const char *name,   
+		     const char *file, 
+		     const char *coordinates_id, 
+		     const char *data_id,
+		     const char *filetype,
+		     int data){
+
+  int ncid, status;
+  /* Update the grid files global attributes */
+  if ((status = nc_open(file, NC_WRITE, &ncid))) ERR;
+  if ((status = nc_redef(ncid))) ERR;
+  if ((status = nc_put_att_text(ncid, NC_GLOBAL, CF_FILETYPE,
+                   strlen(filetype), filetype))) ERR;
+  if ((status = nc_put_att_text(ncid, NC_GLOBAL, CF_GRIDNAME,
+                   strlen(name), name))) ERR;
+  if ((status = nc_put_att_text(ncid, NC_GLOBAL, CF_COORDINATES_ID,
+                   strlen(coordinates_id), coordinates_id))) ERR;
+  if( data ){
+    if (data_id) {
+      if ((status = nc_put_att_text(ncid, NC_GLOBAL, CF_DATA_ID,
+				   strlen(data_id), data_id))) ERR;
+    }
+    if (( status = nc_put_att_text( ncid, NC_GLOBAL, "run", 
+                                  strlen("run_01"), "run_01" ))) ERR;
+    if (( status = nc_put_att_text( ncid, NC_GLOBAL, "model", 
+                                  strlen("model_01"), "model_01" ))) ERR;
+    if (( status = nc_put_att_text( ncid, NC_GLOBAL, "Institution", 
+                                  strlen("GFDL"), "GFDL" ))) ERR;
+  }
+  if(( status = nc_close( ncid ))) ERR;
+  return NC_NOERR;
+}
+
+int main(int argc, char **argv){
+
+  char *dirname;
+
+  if (argc < 2) {
+    printf("Error\nUsage:\n");
+    printf("%s <directory where 19810101.atmos_month data reside>\n", argv[0]);
+    exit(1);
+  } else {
+    dirname = calloc(strlen(argv[1]) + 1, sizeof(char));
+    strcpy(dirname, argv[1]);
+  }
+
+  int status = NC_NOERR, i, ncid, hostid, globalid;
+  char datafile[STRING_SIZE];
+  char gridfile[STRING_SIZE];
+  char gridname[STRING_SIZE];
+  char coordinates_id[STRING_SIZE];
+  char data_id[STRING_SIZE];
+  char *coordNames[] = {"x", "y"};
+  int nGrids = 6, nDims = 2;
+  int gridids[nGrids], mosaicid;
+  double period[] = {0.0, 0.0};
+  int force = 0;  // Don't force a file into the host file
+  int seed  = 54321;
+
+  if ((status = nccf_generate_id(seed, coordinates_id))) ERR;
+  if ((status = nccf_generate_id(seed, data_id))) ERR;
+
+  for( i = 1; i <=  nGrids; i++ ){
+    sprintf( gridfile, "%s%s%s%d%s", dirname, GRIDNAME, TILE, i, ".nc");
+    sprintf( gridname, "%s%s%d", GRIDNAME, TILE, i );
+    if(( status = update_attrfiles(gridname, gridfile, 
+				   coordinates_id, NULL, 
+				   CF_GLATT_FILETYPE_GRID, 1))) ERR;
+    if((status = nccf_def_grid_from_file( gridfile, nDims, 
+                (const char**)coordNames, gridname, &gridids[i-1] ))) ERR;
+  }
+  for( i = 1; i <=  nGrids; i++ ){
+    sprintf( datafile, "%s%s%s%d%s", dirname, DATANAME, TILE, i, ".nc");
+    sprintf( gridname, "%s%s%d", GRIDNAME, TILE, i );
+    if((status = update_attrfiles(gridname, datafile, 
+				  coordinates_id, data_id, 
+				  CF_GLATT_FILETYPE_TIME_DATA, 1))) ERR;
+  }
+
+  /* Create the mosaic file and add it to the host file */
+  nccf_def_mosaic(nGrids, gridids, gridname, &mosaicid);
+  status += nccf_compute_mosaic_contacts( mosaicid, period );
+  nccf_def_global( &globalid );
+  nccf_add_global_att(globalid, CF_COORDINATES_ID, coordinates_id, 0);
+
+  if (( status = nc_create( MOSAICFILE, NC_CLOBBER, &ncid ))) ERR;
+  if (( status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if (( status = nccf_put_global(globalid, ncid))) ERR;
+  if (( status = nc_close( ncid ))) ERR;
+
+  nccf_def_host( coordinates_id, data_id, 1, &hostid );
+  nccf_add_host_file( hostid, MOSAICFILE, force );
+
+  /* Add the grid names and files */
+  for( i = 1; i <= nGrids; i++  ){
+    sprintf( gridfile, "%s%s%s%d%s", dirname, GRIDNAME, TILE, i, ".nc");
+    nccf_add_host_file( hostid, gridfile, force );
+  }
+
+  /* Add the data files */
+  for( i = 1; i <= nGrids; i++  ){
+    sprintf( datafile, "%s%s%s%d%s", dirname, DATANAME, TILE, i, ".nc");
+    nccf_add_host_file( hostid, datafile, force );
+  }
+  
+  if (( status = nc_create( HOSTFILE, NC_CLOBBER, &ncid ))) ERR;
+  /* Define the global attributes */
+  if(( status = nccf_def_global( &globalid ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_FILETYPE, 
+                                     CF_GLATT_FILETYPE_HOST, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_DATA_ID, 
+                                     data_id , 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalid, CF_COORDINATES_ID, 
+                                     coordinates_id, 0 ))) ERR;
+
+  if (( status += nccf_put_host(hostid, ncid))) ERR;
+  if (( status += nccf_put_global(globalid, ncid))) ERR;
+  if (( status += nc_close( ncid ))) ERR;
+  if (( status += nccf_free_global( globalid ))) ERR;
+
+  nccf_free_host( hostid );
+  nccf_free_mosaic( mosaicid );
+  nccf_free_global( globalid );
+  int cid[nDims], j;
+  for( i = 0; i < nGrids; i++ ){
+    nccf_inq_grid_coordids( gridids[i], cid );
+    for( j = 0; j < nDims; j++ ) nccf_free_coord( cid[j] );
+    nccf_free_grid( gridids[i] );
+  }
+
+  /* Read the host file */
+  int ngrids, nstatdatafiles, ntimedata, ntimes, hostid2;
+  if (( status = nccf_def_host_from_file( HOSTFILE, &hostid2 ))) ERR;
+
+  if (( status = nccf_inq_host_ngrids( hostid2, &ngrids ))) ERR;
+  if (( status = nccf_inq_host_nstatdatafiles( hostid2, &nstatdatafiles ))) ERR;
+  if (( status = nccf_inq_host_ntimedatafiles( hostid2, &ntimedata ))) ERR;
+  if (( status = nccf_inq_host_ntimeslices( hostid2, &ntimes ))) ERR;
+
+  /* Get the mosaic file name */
+  char mosaicfilename[STRING_SIZE];
+  int mosaicid2;
+  nccf_inq_host_mosaicfilename( hostid2, mosaicfilename );
+  nccf_def_mosaic_from_file( mosaicfilename, "", &mosaicid2 );
+  nccf_inq_mosaic_ndims( mosaicid2, &nDims );
+  char **cdNm;
+  cdNm = (char**)calloc( STRING_SIZE, 2 * sizeof(char*));
+  cdNm[0] = (char*)calloc( STRING_SIZE, sizeof(char));
+  cdNm[1] = (char*)calloc( STRING_SIZE, sizeof(char));
+  nccf_inq_mosaic_coordnames( mosaicid2, cdNm );
+
+  /* Get the grid file names */
+  int gridid2[ngrids], ii;
+  if( ngrids != 0 ){
+    for( ii = 0; ii < ngrids; ++ii ){
+      nccf_inq_host_gridfilename( hostid2, ii, gridfile );
+      gridid2[ii] = ii;
+    }
+  }
+
+  /* Assert the host_from_file is behaving */
+  assert( ngrids == 6 );
+  assert( nstatdatafiles == 0 );
+  assert( ntimedata == 1 );
+  assert( ntimes == 1 );
+
+  int tfindx, vfindx, gfindx;
+  char fname[STRING_SIZE];
+  /* time var file names */
+  for (tfindx = 0; tfindx < ntimes; ++tfindx) {
+    for (vfindx = 0; vfindx < ntimedata; ++vfindx) {
+      for (gfindx = 0; gfindx < ngrids; ++gfindx) {
+	      status = nccf_inq_host_timefilename(hostid2, tfindx, vfindx, gfindx,
+	      				    fname);
+	      if (status) ERR;
+	      printf("time data file name [%d][%d][%d]: %s\n", tfindx, vfindx, 
+	       gfindx, fname);
+      }
+    }
+  }
+  /* static var file names */
+  for (vfindx = 0; vfindx < nstatdatafiles; ++vfindx) {
+    for (gfindx = 0; gfindx < ngrids; ++gfindx) {
+      status = nccf_inq_host_statfilename(hostid2, vfindx, gfindx,
+					  fname);
+      if (status) ERR;
+      printf("stat data file name [%d][%d]: %s\n", vfindx, gfindx, fname);
+    }
+  }
+
+  /* Clean up */
+  nccf_free_mosaic( mosaicid2 );
+  nccf_free_host( hostid2 );
+  free(dirname);
+
+  return status;
+
+}
diff --git a/gridspec_api/host/tst_three_tile_cubed_sphere.c b/gridspec_api/host/tst_three_tile_cubed_sphere.c
new file mode 100644
index 0000000..8b514a9
--- /dev/null
+++ b/gridspec_api/host/tst_three_tile_cubed_sphere.c
@@ -0,0 +1,373 @@
+/**
+ * Create a three tiled grid and write all data along with 
+ * mosaic and host files.
+ *
+ * "$Id: tst_three_tile_cubed_sphere.c 767 2011-06-06 23:20:19Z pletzer $"
+ */
+
+#include "nccf_host.h"
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <netcdf.h>
+
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_data.h"
+#include "nccf_mosaic.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+
+#define DIR_NAME ""
+#define NAME_MOSAIC "tst_three_tile_cubed_sphere_mosaic"
+#define NAME_GRID_0 "tst_three_tile_cubed_sphere_grid0"
+#define NAME_GRID_1 "tst_three_tile_cubed_sphere_grid1"
+#define NAME_GRID_2 "tst_three_tile_cubed_sphere_grid2"
+#define NAME_GRID_0_FILE "tst_three_tile_cubed_sphere_grid0.nc"
+#define NAME_GRID_1_FILE "tst_three_tile_cubed_sphere_grid1.nc"
+#define NAME_GRID_2_FILE "tst_three_tile_cubed_sphere_grid2.nc"
+#define NAME_MOSAIC_FILE "tst_three_tile_cubed_sphere_mosaic.nc"
+#define NAME_HOST_FILE   "tst_three_tile_cubed_sphere_host.nc"
+#define NAME_STATIC_DATA "tst_three_tile_cubed_sphere_stat_data"
+#define NAME_TIME_DATA   "tst_three_tile_cubed_sphere_time_data"
+#define NAME_STATIC_DATA_VARN "distance"
+#define NAME_TIME_DATA_VARN   "v"
+#define NAME_TIME_VARN        "time"
+
+void create_grids(const char *coordinates_id,
+      int nCells, int nGrids,
+      const int *faceVectors[], char **gridFiles,
+      int gridids[], char **gridNames, int coordids[]) {
+
+  int status;
+  int i, iGrid, globalids[nGrids];
+  int dims[] = {nCells, nCells};
+  double lon[dims[0] * dims[1]];
+  double lat[dims[0] * dims[1]];
+  const int save = 1;
+  const char *dimNames[] = {"n", "n"};
+
+  char *tmp_fn;
+
+  /* tile 0 */
+  iGrid = 0;
+  status = nccf_get_cubedsphere_grid(dims, faceVectors[0], lon, lat);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lon_coord(2, dims, dimNames, lon, save, &coordids[0 + 0*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lat_coord(2, dims, dimNames, lat, save, &coordids[1 + 0*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_grid(&coordids[0], NAME_GRID_0, &gridids[0]);
+  if (status != NC_NOERR) ERR;
+  if(( status = nccf_def_global( &globalids[iGrid] ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_GRIDNAME, NAME_GRID_0, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* tile 1 */
+  iGrid = 1;
+  status = nccf_get_cubedsphere_grid(dims, faceVectors[1], lon, lat);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lon_coord(2, dims, dimNames, lon, save, &coordids[0 + 1*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lat_coord(2, dims, dimNames, lat, save, &coordids[1 + 1*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_grid(&coordids[1*2], NAME_GRID_1, &gridids[1]);
+  if (status != NC_NOERR) ERR;
+  if(( status = nccf_def_global( &globalids[iGrid] ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_GRIDNAME, NAME_GRID_1, 0))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* tile 2 */
+  iGrid = 2;
+  status = nccf_get_cubedsphere_grid(dims, faceVectors[2], lon, lat);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lon_coord(2, dims, dimNames, lon, save, &coordids[0 + 2*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_lat_coord(2, dims, dimNames, lat, save, &coordids[1 + 2*2]);
+  if (status != NC_NOERR) ERR;
+  status = nccf_def_grid(&coordids[2*2], NAME_GRID_2, &gridids[2]);
+  if (status != NC_NOERR) ERR;
+  if(( status = nccf_def_global( &globalids[iGrid] ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_GRIDNAME, NAME_GRID_2, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalids[iGrid], CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* write files */
+  tmp_fn = calloc( 256, sizeof( char ));
+  strcat( tmp_fn, DIR_NAME );
+  strcat( tmp_fn, NAME_GRID_0_FILE );
+  strncpy(gridFiles[0], tmp_fn, STRING_SIZE);
+  free( tmp_fn );
+  tmp_fn = calloc( 256, sizeof( char ));
+  strcat( tmp_fn, DIR_NAME );
+  strcat( tmp_fn, NAME_GRID_1_FILE );
+  strncpy(gridFiles[1], tmp_fn, STRING_SIZE);
+  free( tmp_fn );
+  tmp_fn = calloc( 256, sizeof( char ));
+  strcat( tmp_fn, DIR_NAME );
+  strcat( tmp_fn, NAME_GRID_2_FILE );
+  strncpy(gridFiles[2], tmp_fn, STRING_SIZE);
+  free( tmp_fn );
+  strncpy(gridNames[0], NAME_GRID_0, STRING_SIZE);
+  strncpy(gridNames[1], NAME_GRID_1, STRING_SIZE);
+  strncpy(gridNames[2], NAME_GRID_2, STRING_SIZE);
+
+  for (i = 0; i < nGrids; ++i) {
+    int ncid;
+    status = nc_create(gridFiles[i], NC_CLOBBER, &ncid);
+    if (status != NC_NOERR) ERR;
+    status = nccf_put_grid(gridids[i], ncid);
+    status = nccf_put_global(globalids[i], ncid);
+    status = nc_close(ncid);
+    status = nccf_free_global( globalids[i] );
+    if (status != NC_NOERR) ERR;
+  }
+}
+
+int create_stat_data( const char *data_id, const char* coordinates_id, 
+                      int nCells, int nGrids, int gridids[],
+                      char **staticFiles, int staticids[] ){
+
+  int iTile, i, j, index, status, ncid, globalid;
+  int save = 0;
+  int toterr = 0;
+  float  data_f[nCells * nCells];
+  const char *df_sn = "static_data";
+  const char *df_ut = "meters";
+  char *name;
+  name = ( char* )calloc( STRING_SIZE, sizeof(char));
+
+  for( iTile = 0; iTile < nGrids; iTile++){
+    for( j = 0; j < nCells; j++ ){
+      for( i = 0; i < nCells; i++ ){
+        index = i + j * nCells;
+        data_f[index] = iTile + i * (float)( j+1 );
+      }
+    }
+    status = nccf_def_data( gridids[iTile], NAME_STATIC_DATA_VARN,
+                                       df_sn, df_ut,
+                                       NULL, &staticids[iTile] );
+    toterr += status;
+    status = nccf_set_data_float( staticids[iTile], data_f, 
+					 save, NC_FILL_FLOAT );
+    toterr += status;
+
+    /* Global Attributes */
+    status = nccf_inq_grid_name(gridids[iTile], name);
+    status = nccf_def_global( &globalid );
+    status = nccf_add_global_att(globalid, CF_GRIDNAME, name, 0);
+    status = nccf_add_global_att(globalid, CF_FILETYPE, CF_GLATT_FILETYPE_STATIC_DATA, 0);
+    status = nccf_add_global_att(globalid, CF_DATA_ID, data_id, 0);
+    status = nccf_add_global_att(globalid, CF_COORDINATES_ID, coordinates_id, 0);
+
+    sprintf( staticFiles[iTile], "%s%s%d.nc", DIR_NAME, NAME_STATIC_DATA, iTile );
+    status = nc_create( staticFiles[iTile], NC_CLOBBER, &ncid );
+    status = nccf_put_data(staticids[iTile], ncid);
+    status = nccf_put_global(globalid, ncid);
+    toterr += status;
+    status = nc_close( ncid );
+    status = nccf_free_global( globalid );
+  }
+
+  free( name );
+  return toterr;
+
+}
+
+int create_time_data( const char *data_id, const char* coordinates_id, 
+                      int nTimes, int nCells, int nGrids,
+                      int gridids[], char **timeFiles, int timeids[] ){
+
+  int iTile, i, j, index, status, ncid, iTime, globalid;
+  int save = 0;
+  int toterr = 0;
+  float  data_f[nCells * nCells];
+  char *df_sn = "velocity";
+  char *df_ut = "m/s";
+  char *name;
+  name = ( char* )calloc( STRING_SIZE, sizeof(char));
+
+  for( iTile = 0; iTile < nGrids; iTile++){
+
+    /* Create the data */
+    for( iTime = 0; iTime < nTimes; iTime++ ){
+      for( j = 0; j < nCells; j++ ){
+        for( i = 0; i < nCells; i++ ){
+          index = i + j * nCells;
+          data_f[index] = ( 1+iTime ) * iTile + i / (float)( j+1 );
+        }
+      }
+      if( iTime == 0 ){
+      /* Define the time data for each tile */
+        status = nccf_def_data( gridids[iTile], NAME_TIME_DATA_VARN,
+                                           df_sn, df_ut,
+                                           NAME_TIME_VARN, &timeids[iTile] );
+        toterr += status;
+        status = nccf_set_data_float( timeids[iTile], data_f, 
+					     save, NC_FILL_FLOAT );
+        toterr += status;
+
+
+        /* OPen the file*/
+        sprintf( timeFiles[iTile], "%s%s%d.nc", DIR_NAME, NAME_TIME_DATA, iTile );
+        status = nc_create( timeFiles[iTile], NC_CLOBBER, &ncid );
+      }
+
+      status = nccf_put_data(timeids[iTile], ncid);
+      toterr += status;
+    }
+
+    /* Global Attributes */
+    status = nccf_inq_grid_name( gridids[iTile], name );
+    status = nccf_def_global( &globalid );
+    status = nccf_add_global_att( globalid, CF_GRIDNAME, name, 0 );
+    status = nccf_add_global_att( globalid, 
+                                 CF_FILETYPE, CF_GLATT_FILETYPE_TIME_DATA, 0);
+    status = nccf_add_global_att( globalid, CF_DATA_ID, data_id, 0 );
+    status = nccf_add_global_att( globalid, CF_COORDINATES_ID, coordinates_id, 0 );
+    /* Write to disk*/
+    status = nccf_put_global(globalid, ncid);
+    status = nc_close( ncid );
+    status = nccf_free_global( globalid );
+  }
+
+  free( name );
+  return toterr;
+
+}
+
+int main(  ){
+
+  const int nGrids = 3;
+
+  int status;
+  int i;
+
+  /* create the coordinate id */
+  char coordinates_id[36+1];
+  char data_id[36+1];
+  const int seed = 12345;
+  if ((status = nccf_generate_id(seed, coordinates_id))) ERR;
+  if ((status = nccf_generate_id(seed, data_id))) ERR;
+
+  /* Time dims */
+  int nTimes = 5;
+  int nTimeFiles = nGrids * 1;
+  int nStatFiles = nGrids * 1;
+  int nTimeSlices = 1; // Number of files containing time slices.
+
+  /* create the grids */
+  const int nCells = 10;
+  const int faceVect0[] = {1, 0, 0};
+  const int faceVect1[] = {0, 1, 0};
+  const int faceVect2[] = {0, 0, 1};
+  const int *faceVectors[] = {faceVect0, faceVect1, faceVect2};
+  char **gridFiles   = calloc(nGrids, sizeof(char *));
+  char **gridNames   = calloc(nGrids, sizeof(char *));
+  char **staticFiles = calloc(nStatFiles, sizeof(char *));
+  char **timeFiles   = calloc(nTimeFiles, sizeof(char *));
+  for (i = 0; i < nGrids; ++i) {
+    gridFiles[i]   = calloc(STRING_SIZE, sizeof(char));
+    gridNames[i]   = calloc(STRING_SIZE, sizeof(char));
+    staticFiles[i] = calloc(STRING_SIZE, sizeof(char));
+    timeFiles[i]   = calloc(STRING_SIZE, sizeof(char));
+  }
+  int gridids[nGrids];
+  int staticids[nStatFiles];
+  int timeids[nTimeFiles];
+  int coordids[nGrids * 2];
+  create_grids(coordinates_id, nCells, nGrids, faceVectors,
+         gridFiles, gridids, gridNames, coordids);
+
+  /* create the mosaic */
+  int mosaicid, globalid;
+  const double periods[] = {0., 0., 0.};
+  status = nccf_def_mosaic(nGrids, gridids, NAME_MOSAIC, &mosaicid);
+  status += nccf_compute_mosaic_contacts( mosaicid, periods );
+  if (status != NC_NOERR) ERR;
+
+  /* Global Atts */
+  status += nccf_def_global( &globalid );
+  status += nccf_add_global_att(globalid, CF_COORDINATES_ID, coordinates_id, 0);
+  status += nccf_add_global_att(globalid, CF_DATA_ID, data_id, 0);
+  status += nccf_add_global_att(globalid, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0);
+  if (status != NC_NOERR) ERR;
+
+  /* Write the mosaic file */
+  int ncid;
+  char mosFile[256];
+  sprintf( mosFile, "%s%s", DIR_NAME, NAME_MOSAIC_FILE );
+  status = nc_create(mosFile, NC_CLOBBER, &ncid);
+  if (status != NC_NOERR) ERR;
+  status = nccf_put_mosaic(mosaicid, ncid);
+  status = nccf_put_global(globalid, ncid);
+  status = nc_close(ncid);
+  if (status != NC_NOERR) ERR;
+  status = nccf_free_global(globalid);
+
+  /* create static data */
+  status = create_stat_data( data_id, coordinates_id, 
+                             nCells, nGrids,
+                             gridids, staticFiles, staticids );
+
+  /* create time dependent data */
+  status = create_time_data( data_id, coordinates_id, 
+                             nTimes, nCells, nTimeFiles,
+                             gridids, timeFiles, timeids );
+
+  /* create the host file by adding the filenames */
+  int hostid;
+  if (( status = nccf_def_host(coordinates_id,
+			       data_id, nTimeSlices, &hostid))) ERR;
+  if (( status = nc_create( NAME_HOST_FILE, NC_CLOBBER, &ncid ))) ERR;
+  for( i = 0; i < nGrids; i++ ){
+    if (( status = nccf_add_host_file( hostid, gridFiles[i], 0 ))) ERR;
+  }
+  for( i = 0; i < nStatFiles; i++ ){
+    if (( status = nccf_add_host_file( hostid, staticFiles[i], 0 ))) ERR;
+  }
+  for( i = 0; i < nTimeFiles; i++ ){
+    if (( status = nccf_add_host_file( hostid, timeFiles[i], 0 ))) ERR;
+  }
+  if (( status = nccf_add_host_file( hostid, mosFile, 0 ))) ERR;
+  
+  /* Global Atts */
+  if (( status = nccf_def_global( &globalid ))) ERR;
+  if (( status = nccf_add_global_att( globalid, CF_FILETYPE, CF_GLATT_FILETYPE_HOST, 0 ))) ERR;
+  if (( status = nccf_add_global_att( globalid, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+  if (( status = nccf_add_global_att( globalid, CF_DATA_ID, data_id, 0 ))) ERR;
+
+  if (( status = nccf_put_host(hostid, ncid))) ERR;
+  if (( status = nccf_put_global(globalid, ncid))) ERR;
+  if (( status = nc_close( ncid ))) ERR;
+  if (( status = nccf_free_global( globalid ))) ERR;
+
+  /* clean up */
+  if ((status = nccf_free_host(hostid))) ERR;
+  if ((status = nccf_free_mosaic(mosaicid))) ERR;
+  for (i = 0; i < nGrids; ++i) {
+    if ((status = nccf_free_grid(gridids[i]))) ERR;
+    if ((status = nccf_free_data(staticids[i]))) ERR;
+    if ((status = nccf_free_data(timeids[i]))) ERR;
+  }
+  for (i = 0; i < 2*nGrids; ++i) {
+    if ((status = nccf_free_coord(coordids[i]))) ERR;
+  }
+
+  for (i = 0; i < nGrids; ++i) {
+    free(gridFiles[i]);
+    free(gridNames[i]);
+  }
+  for( i = 0; i < nStatFiles; ++i ) free( staticFiles[i] );
+  for( i = 0; i < nTimeFiles; ++i ) free( timeFiles[i] );
+
+  free(gridFiles);
+  free(gridNames);
+  free(staticFiles);
+  free(timeFiles);
+
+  return 0;
+
+}
diff --git a/gridspec_api/libcf_gridspec.h b/gridspec_api/libcf_gridspec.h
new file mode 100644
index 0000000..0eb097c
--- /dev/null
+++ b/gridspec_api/libcf_gridspec.h
@@ -0,0 +1,18 @@
+/*
+Combine all the gridspec include files into a single one
+ $Id: libcf_gridspec.h 834 2011-09-14 21:21:07Z pletzer $ 
+*/
+
+#include "nccf_constants.h"
+#include "nccf_utility_functions.h"
+#include "nccf_varObj.h"
+#include "nccf_global.h"
+#include "nccf_axis.h"
+#include "nccf_coord.h"
+#include "nccf_grid.h"
+#include "nccf_data.h"
+#include "nccf_regrid.h"
+#include "nccf_mosaic.h"
+#include "nccf_host.h"
+#include "nccf_errors.h"
+
diff --git a/gridspec_api/mosaic/Makefile.am b/gridspec_api/mosaic/Makefile.am
new file mode 100644
index 0000000..98c7464
--- /dev/null
+++ b/gridspec_api/mosaic/Makefile.am
@@ -0,0 +1,92 @@
+#
+# $Id: Makefile.am 808 2011-09-12 19:19:59Z dkindig $
+#
+
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include	\
+-I$(srcdir)/../global -I$(srcdir)/../coord -I$(srcdir)/../grid	\
+-I$(srcdir)/../data
+
+include_HEADERS = nccf_mosaic.h
+
+noinst_LTLIBRARIES = libnccf_mosaic.la
+libnccf_mosaic_la_SOURCES = nccf_def_mosaic.c nccf_put_mosaic.c	\
+nccf_free_mosaic.c nccf_inq_mosaic_contactmap.c			\
+nccf_inq_mosaic_tilecontact.c nccf_inq_mosaic_tileseparator.c	\
+nccf_inq_mosaic_gridranges.c nccf_inq_mosaic_ngrids.c		\
+nccf_inq_mosaic_ndims.c nccf_inq_mosaic_gridname.c		\
+nccf_inq_mosaic_gridids.c nccf_inq_mosaic_coordnames.c		\
+nccf_inq_mosaic_ncontacts.c nccf_add_mosaic_att.c		\
+nccf_def_mosaic_from_file.c nccf_print_mosaic_as_polytopes.c \
+nccf_set_mosaic_contact.c nccf_compute_mosaic_contacts.c
+
+INTLIBS = libnccf_mosaic.la ../data/libnccf_data.la	\
+../grid/libnccf_grid.la ../coord/libnccf_coord.la	\
+../global/libnccf_global.la ../../src/libcf_src.la
+
+EXTLIBS = -lnetcdf 
+
+EXTRA_DIST = copy_grid_for_bogus_data_files.sh
+
+noinst_PROGRAMS = tst_cubesphere_mosaic
+
+check_PROGRAMS = tst_sg_mosaic_latlon tst_sg_periodic_mosaic_latlon	\
+tst_periodic_grid tst_get_mosaic_grid_ranges				\
+tst_cubesphere_mosaic_grid_ranges tst_two_unequal_in_i_tiles		\
+tst_two_unequal_in_i_j_tiles tst_1d_mosaic tst_tripolar_zhi		\
+tst_bipolar_tripolar_grid tst_bipolar_tripolar_grid_periodic		\
+tst_rotation tst_big_dimsizes tst_two_tiles \
+tst_nccf_set_mosaic_contact
+
+
+# files generated by tests
+CLEANFILES = *.nc *.pt
+
+tst_big_dimsizes_SOURCES = tst_big_dimsizes.c 
+tst_big_dimsizes_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_1d_mosaic_SOURCES = tst_1d_mosaic.c 
+tst_1d_mosaic_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_sg_mosaic_latlon_SOURCES = tst_sg_mosaic_latlon.c 
+tst_sg_mosaic_latlon_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_sg_periodic_mosaic_latlon_SOURCES = tst_sg_periodic_mosaic_latlon.c 
+tst_sg_periodic_mosaic_latlon_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_periodic_grid_SOURCES = tst_periodic_grid.c 
+tst_periodic_grid_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_cubesphere_mosaic_SOURCES = tst_cubesphere_mosaic.c 
+tst_cubesphere_mosaic_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_get_mosaic_grid_ranges_SOURCES = tst_get_mosaic_grid_ranges.c 
+tst_get_mosaic_grid_ranges_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_cubesphere_mosaic_grid_ranges_SOURCES = tst_cubesphere_mosaic_grid_ranges.c 
+tst_cubesphere_mosaic_grid_ranges_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_two_unequal_in_i_tiles_SOURCES = tst_two_unequal_in_i_tiles.c 
+tst_two_unequal_in_i_tiles_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_two_unequal_in_i_j_tiles_SOURCES = tst_two_unequal_in_i_j_tiles.c 
+tst_two_unequal_in_i_j_tiles_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_tripolar_zhi_SOURCES = tst_tripolar_zhi.c 
+tst_tripolar_zhi_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_bipolar_tripolar_grid_SOURCES = tst_bipolar_tripolar_grid.c 
+tst_bipolar_tripolar_grid_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_bipolar_tripolar_grid_periodic_SOURCES = tst_bipolar_tripolar_grid_periodic.c 
+tst_bipolar_tripolar_grid_periodic_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_rotation_SOURCES = tst_rotation.c
+tst_rotation_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_two_tiles_SOURCES = tst_two_tiles.c
+tst_two_tiles_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_nccf_set_mosaic_contact_SOURCES = tst_nccf_set_mosaic_contact.c
+tst_nccf_set_mosaic_contact_LDADD = $(INTLIBS) $(EXTLIBS)
+
+TESTS = $(check_PROGRAMS) 
diff --git a/src/Makefile.in b/gridspec_api/mosaic/Makefile.in
similarity index 50%
copy from src/Makefile.in
copy to gridspec_api/mosaic/Makefile.in
index afcdc0d..b5f1581 100644
--- a/src/Makefile.in
+++ b/gridspec_api/mosaic/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,11 +15,10 @@
 
 @SET_MAKE@
 
-# Copyright 2006, see the COPYRIGHT file for more information.
+#
+# $Id: Makefile.am 808 2011-09-12 19:19:59Z dkindig $
+#
 
-# THis automake file is in charge of building the src directory.
-
-# $Id: Makefile.am,v 1.5 2009/11/11 12:59:24 ed Exp $
 
 
 VPATH = @srcdir@
@@ -41,43 +40,18 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-check_PROGRAMS = tst_coords$(EXEEXT) tst_files$(EXEEXT) \
-	tst_vars$(EXEEXT) tst_cvars$(EXEEXT) tst_vert$(EXEEXT) \
-	tst_subsets$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2)
- at BUILD_F90_TRUE@am__append_1 = libcff.la
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at am__append_2 = tst_f03_file
- at BUILD_F90_TRUE@am__append_3 = libcf.la
-
-# Link to the netCDF-4, (optionally) HDF4, and the HDF5 libraries.
- at USE_NETCDF_DIR_TRUE@am__append_4 = -lnetcdf
- at USE_NETCDF_DIR_TRUE@am__append_5 = -I at NETCDFDIR@/include
- at USE_NETCDF_DIR_TRUE@am__append_6 = -L at NETCDFDIR@/lib
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_7 = ../../libsrc4/libnetcdf.la 
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_8 = -I$(top_srcdir)/../libsrc4
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_9 = -L../../libsrc4
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_10 = ../../libsrc/libnetcdf.la
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_11 = -I$(top_srcdir)/../libsrc
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_12 = -L../../libsrc
- at USE_HDF4_TRUE@am__append_13 = -lmfhdf -ldf -ljpeg
- at USE_NETCDF4_TRUE@am__append_14 = -lhdf5_hl -lhdf5 -lz 
-
-# If the user specified a root for HDF5, use it.
- at USE_HDF5_DIR_TRUE@am__append_15 = -I at HDF5DIR@/include
- at USE_HDF5_DIR_TRUE@am__append_16 = -L at HDF5DIR@/lib
-
-# If the user specified a prefix for the HDF4 library location, use it.
- at USE_HDF4_DIR_TRUE@am__append_17 = -I at HDF4DIR@/include
- at USE_HDF4_DIR_TRUE@am__append_18 = -L at HDF4DIR@/lib
-
-# If the user specified a root location for ZLIB, use it.
- at USE_ZLIB_DIR_TRUE@am__append_19 = -I at ZLIBDIR@/include
- at USE_ZLIB_DIR_TRUE@am__append_20 = -L at ZLIBDIR@/lib
-
-# If the user specified a root location for SZLIB, use it.
- at USE_SZLIB_DIR_TRUE@am__append_21 = -I at SZLIBDIR@/include
- at USE_SZLIB_DIR_TRUE@am__append_22 = -L at SZLIBDIR@/lib
- at EXTRA_DATA_TESTS_TRUE@am__append_23 = tst_example_data
-subdir = src
+noinst_PROGRAMS = tst_cubesphere_mosaic$(EXEEXT)
+check_PROGRAMS = tst_sg_mosaic_latlon$(EXEEXT) \
+	tst_sg_periodic_mosaic_latlon$(EXEEXT) \
+	tst_periodic_grid$(EXEEXT) tst_get_mosaic_grid_ranges$(EXEEXT) \
+	tst_cubesphere_mosaic_grid_ranges$(EXEEXT) \
+	tst_two_unequal_in_i_tiles$(EXEEXT) \
+	tst_two_unequal_in_i_j_tiles$(EXEEXT) tst_1d_mosaic$(EXEEXT) \
+	tst_tripolar_zhi$(EXEEXT) tst_bipolar_tripolar_grid$(EXEEXT) \
+	tst_bipolar_tripolar_grid_periodic$(EXEEXT) \
+	tst_rotation$(EXEEXT) tst_big_dimsizes$(EXEEXT) \
+	tst_two_tiles$(EXEEXT) tst_nccf_set_mosaic_contact$(EXEEXT)
+subdir = gridspec_api/mosaic
 DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -88,9 +62,138 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
+CONFIG_HEADER = $(top_builddir)/cf_config.h \
+	$(top_builddir)/nfconfig.inc
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libnccf_mosaic_la_LIBADD =
+am_libnccf_mosaic_la_OBJECTS = nccf_def_mosaic.lo nccf_put_mosaic.lo \
+	nccf_free_mosaic.lo nccf_inq_mosaic_contactmap.lo \
+	nccf_inq_mosaic_tilecontact.lo \
+	nccf_inq_mosaic_tileseparator.lo nccf_inq_mosaic_gridranges.lo \
+	nccf_inq_mosaic_ngrids.lo nccf_inq_mosaic_ndims.lo \
+	nccf_inq_mosaic_gridname.lo nccf_inq_mosaic_gridids.lo \
+	nccf_inq_mosaic_coordnames.lo nccf_inq_mosaic_ncontacts.lo \
+	nccf_add_mosaic_att.lo nccf_def_mosaic_from_file.lo \
+	nccf_print_mosaic_as_polytopes.lo nccf_set_mosaic_contact.lo \
+	nccf_compute_mosaic_contacts.lo
+libnccf_mosaic_la_OBJECTS = $(am_libnccf_mosaic_la_OBJECTS)
+PROGRAMS = $(noinst_PROGRAMS)
+am_tst_1d_mosaic_OBJECTS = tst_1d_mosaic.$(OBJEXT)
+tst_1d_mosaic_OBJECTS = $(am_tst_1d_mosaic_OBJECTS)
+am__DEPENDENCIES_1 =
+tst_1d_mosaic_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_big_dimsizes_OBJECTS = tst_big_dimsizes.$(OBJEXT)
+tst_big_dimsizes_OBJECTS = $(am_tst_big_dimsizes_OBJECTS)
+tst_big_dimsizes_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_bipolar_tripolar_grid_OBJECTS =  \
+	tst_bipolar_tripolar_grid.$(OBJEXT)
+tst_bipolar_tripolar_grid_OBJECTS =  \
+	$(am_tst_bipolar_tripolar_grid_OBJECTS)
+tst_bipolar_tripolar_grid_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_bipolar_tripolar_grid_periodic_OBJECTS =  \
+	tst_bipolar_tripolar_grid_periodic.$(OBJEXT)
+tst_bipolar_tripolar_grid_periodic_OBJECTS =  \
+	$(am_tst_bipolar_tripolar_grid_periodic_OBJECTS)
+tst_bipolar_tripolar_grid_periodic_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_cubesphere_mosaic_OBJECTS = tst_cubesphere_mosaic.$(OBJEXT)
+tst_cubesphere_mosaic_OBJECTS = $(am_tst_cubesphere_mosaic_OBJECTS)
+tst_cubesphere_mosaic_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_cubesphere_mosaic_grid_ranges_OBJECTS =  \
+	tst_cubesphere_mosaic_grid_ranges.$(OBJEXT)
+tst_cubesphere_mosaic_grid_ranges_OBJECTS =  \
+	$(am_tst_cubesphere_mosaic_grid_ranges_OBJECTS)
+tst_cubesphere_mosaic_grid_ranges_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_get_mosaic_grid_ranges_OBJECTS =  \
+	tst_get_mosaic_grid_ranges.$(OBJEXT)
+tst_get_mosaic_grid_ranges_OBJECTS =  \
+	$(am_tst_get_mosaic_grid_ranges_OBJECTS)
+tst_get_mosaic_grid_ranges_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_nccf_set_mosaic_contact_OBJECTS =  \
+	tst_nccf_set_mosaic_contact.$(OBJEXT)
+tst_nccf_set_mosaic_contact_OBJECTS =  \
+	$(am_tst_nccf_set_mosaic_contact_OBJECTS)
+tst_nccf_set_mosaic_contact_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_periodic_grid_OBJECTS = tst_periodic_grid.$(OBJEXT)
+tst_periodic_grid_OBJECTS = $(am_tst_periodic_grid_OBJECTS)
+tst_periodic_grid_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_rotation_OBJECTS = tst_rotation.$(OBJEXT)
+tst_rotation_OBJECTS = $(am_tst_rotation_OBJECTS)
+tst_rotation_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_sg_mosaic_latlon_OBJECTS = tst_sg_mosaic_latlon.$(OBJEXT)
+tst_sg_mosaic_latlon_OBJECTS = $(am_tst_sg_mosaic_latlon_OBJECTS)
+tst_sg_mosaic_latlon_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_sg_periodic_mosaic_latlon_OBJECTS =  \
+	tst_sg_periodic_mosaic_latlon.$(OBJEXT)
+tst_sg_periodic_mosaic_latlon_OBJECTS =  \
+	$(am_tst_sg_periodic_mosaic_latlon_OBJECTS)
+tst_sg_periodic_mosaic_latlon_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_tripolar_zhi_OBJECTS = tst_tripolar_zhi.$(OBJEXT)
+tst_tripolar_zhi_OBJECTS = $(am_tst_tripolar_zhi_OBJECTS)
+tst_tripolar_zhi_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_two_tiles_OBJECTS = tst_two_tiles.$(OBJEXT)
+tst_two_tiles_OBJECTS = $(am_tst_two_tiles_OBJECTS)
+tst_two_tiles_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_two_unequal_in_i_j_tiles_OBJECTS =  \
+	tst_two_unequal_in_i_j_tiles.$(OBJEXT)
+tst_two_unequal_in_i_j_tiles_OBJECTS =  \
+	$(am_tst_two_unequal_in_i_j_tiles_OBJECTS)
+tst_two_unequal_in_i_j_tiles_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_two_unequal_in_i_tiles_OBJECTS =  \
+	tst_two_unequal_in_i_tiles.$(OBJEXT)
+tst_two_unequal_in_i_tiles_OBJECTS =  \
+	$(am_tst_two_unequal_in_i_tiles_OBJECTS)
+tst_two_unequal_in_i_tiles_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(libnccf_mosaic_la_SOURCES) $(tst_1d_mosaic_SOURCES) \
+	$(tst_big_dimsizes_SOURCES) \
+	$(tst_bipolar_tripolar_grid_SOURCES) \
+	$(tst_bipolar_tripolar_grid_periodic_SOURCES) \
+	$(tst_cubesphere_mosaic_SOURCES) \
+	$(tst_cubesphere_mosaic_grid_ranges_SOURCES) \
+	$(tst_get_mosaic_grid_ranges_SOURCES) \
+	$(tst_nccf_set_mosaic_contact_SOURCES) \
+	$(tst_periodic_grid_SOURCES) $(tst_rotation_SOURCES) \
+	$(tst_sg_mosaic_latlon_SOURCES) \
+	$(tst_sg_periodic_mosaic_latlon_SOURCES) \
+	$(tst_tripolar_zhi_SOURCES) $(tst_two_tiles_SOURCES) \
+	$(tst_two_unequal_in_i_j_tiles_SOURCES) \
+	$(tst_two_unequal_in_i_tiles_SOURCES)
+DIST_SOURCES = $(libnccf_mosaic_la_SOURCES) $(tst_1d_mosaic_SOURCES) \
+	$(tst_big_dimsizes_SOURCES) \
+	$(tst_bipolar_tripolar_grid_SOURCES) \
+	$(tst_bipolar_tripolar_grid_periodic_SOURCES) \
+	$(tst_cubesphere_mosaic_SOURCES) \
+	$(tst_cubesphere_mosaic_grid_ranges_SOURCES) \
+	$(tst_get_mosaic_grid_ranges_SOURCES) \
+	$(tst_nccf_set_mosaic_contact_SOURCES) \
+	$(tst_periodic_grid_SOURCES) $(tst_rotation_SOURCES) \
+	$(tst_sg_mosaic_latlon_SOURCES) \
+	$(tst_sg_periodic_mosaic_latlon_SOURCES) \
+	$(tst_tripolar_zhi_SOURCES) $(tst_two_tiles_SOURCES) \
+	$(tst_two_unequal_in_i_j_tiles_SOURCES) \
+	$(tst_two_unequal_in_i_tiles_SOURCES)
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -112,106 +215,7 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
-LTLIBRARIES = $(lib_LTLIBRARIES)
-libcf_la_LIBADD =
-am_libcf_la_OBJECTS = nccoord.lo cffiles.lo cfvars.lo cfcvars.lo \
-	cfsubsets.lo cferror.lo cdTimeConv.lo
-libcf_la_OBJECTS = $(am_libcf_la_OBJECTS)
-libcf_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(libcf_la_LDFLAGS) \
-	$(LDFLAGS) -o $@
-libcff_la_LIBADD =
-am__libcff_la_SOURCES_DIST = cffcvars.f90
- at BUILD_F90_TRUE@am_libcff_la_OBJECTS = cffcvars.lo
-libcff_la_OBJECTS = $(am_libcff_la_OBJECTS)
- at BUILD_F90_TRUE@am_libcff_la_rpath = -rpath $(libdir)
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at am__EXEEXT_1 =  \
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE@	tst_f03_file$(EXEEXT)
- at EXTRA_DATA_TESTS_TRUE@am__EXEEXT_2 = tst_example_data$(EXEEXT)
-am_tst_coords_OBJECTS = tst_coords.$(OBJEXT)
-tst_coords_OBJECTS = $(am_tst_coords_OBJECTS)
-tst_coords_LDADD = $(LDADD)
-am__DEPENDENCIES_1 =
-tst_coords_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_cvars_OBJECTS = tst_cvars.$(OBJEXT)
-tst_cvars_OBJECTS = $(am_tst_cvars_OBJECTS)
-tst_cvars_LDADD = $(LDADD)
-tst_cvars_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am__tst_example_data_SOURCES_DIST = tst_example_data.c nc_tests.h
- at EXTRA_DATA_TESTS_TRUE@am_tst_example_data_OBJECTS =  \
- at EXTRA_DATA_TESTS_TRUE@	tst_example_data.$(OBJEXT)
-tst_example_data_OBJECTS = $(am_tst_example_data_OBJECTS)
-tst_example_data_LDADD = $(LDADD)
-tst_example_data_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am__tst_f03_file_SOURCES_DIST = tst_f03_file.f90
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at am_tst_f03_file_OBJECTS =  \
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE@	tst_f03_file.$(OBJEXT)
-tst_f03_file_OBJECTS = $(am_tst_f03_file_OBJECTS)
-tst_f03_file_LDADD = $(LDADD)
-tst_f03_file_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_files_OBJECTS = tst_files.$(OBJEXT)
-tst_files_OBJECTS = $(am_tst_files_OBJECTS)
-tst_files_LDADD = $(LDADD)
-tst_files_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_subsets_OBJECTS = tst_subsets.$(OBJEXT)
-tst_subsets_OBJECTS = $(am_tst_subsets_OBJECTS)
-tst_subsets_LDADD = $(LDADD)
-tst_subsets_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_vars_OBJECTS = tst_vars.$(OBJEXT)
-tst_vars_OBJECTS = $(am_tst_vars_OBJECTS)
-tst_vars_LDADD = $(LDADD)
-tst_vars_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_vert_OBJECTS = tst_vert.$(OBJEXT)
-tst_vert_OBJECTS = $(am_tst_vert_OBJECTS)
-tst_vert_LDADD = $(LDADD)
-tst_vert_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
-FCCOMPILE = $(FC) $(AM_FCFLAGS) $(FCFLAGS)
-LTFCCOMPILE = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS)
-FCLD = $(FC)
-FCLINK = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
-SOURCES = $(libcf_la_SOURCES) $(libcff_la_SOURCES) \
-	$(tst_coords_SOURCES) $(tst_cvars_SOURCES) \
-	$(tst_example_data_SOURCES) $(tst_f03_file_SOURCES) \
-	$(tst_files_SOURCES) $(tst_subsets_SOURCES) \
-	$(tst_vars_SOURCES) $(tst_vert_SOURCES)
-DIST_SOURCES = $(libcf_la_SOURCES) $(am__libcff_la_SOURCES_DIST) \
-	$(tst_coords_SOURCES) $(tst_cvars_SOURCES) \
-	$(am__tst_example_data_SOURCES_DIST) \
-	$(am__tst_f03_file_SOURCES_DIST) $(tst_files_SOURCES) \
-	$(tst_subsets_SOURCES) $(tst_vars_SOURCES) $(tst_vert_SOURCES)
+am__installdirs = "$(DESTDIR)$(includedir)"
 HEADERS = $(include_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -222,7 +226,6 @@ ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
 AR = @AR@
-AS = @AS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -243,15 +246,19 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-F77 = @F77@
 FC = @FC@
 FCFLAGS = @FCFLAGS@
 FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
+FCLIBS = @FCLIBS@
 FGREP = @FGREP@
 GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
+HAVE_DARWIN = @HAVE_DARWIN@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_LAPACK_LIB = @HAVE_LAPACK_LIB@
+HAVE_LAPACK_NO_UNDERSCORE = @HAVE_LAPACK_NO_UNDERSCORE@
+HAVE_LAPACK_UNDERSCORE = @HAVE_LAPACK_UNDERSCORE@
+HAVE_SHARED = @HAVE_SHARED@
+HAVE_UUID = @HAVE_UUID@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -266,8 +273,10 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 MOD_FLAG = @MOD_FLAG@
+NCDUMP = @NCDUMP@
 NCDUMPDIR = @NCDUMPDIR@
 NETCDFDIR = @NETCDFDIR@
 NM = @NM@
@@ -281,23 +290,23 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
 VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
 ac_ct_FC = @ac_ct_FC@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -329,7 +338,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -345,65 +353,68 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-
-# Tell automake that libcf.h is a header file we want to install.
-include_HEADERS = libcf.h
-
-# Test programs will need to link to this library (libcf) and also
-# netcdf.
-LDADD = ${lib_LTLIBRARIES} $(am__append_3) $(am__append_4) \
-	$(am__append_7) $(am__append_10) $(am__append_13) \
-	$(am__append_14)
-
-# Initalize these.
-AM_CPPFLAGS = $(am__append_5) $(am__append_8) $(am__append_11) \
-	$(am__append_15) $(am__append_17) $(am__append_19) \
-	$(am__append_21)
-AM_LDFLAGS = $(am__append_6) $(am__append_9) $(am__append_12) \
-	$(am__append_16) $(am__append_18) $(am__append_20) \
-	$(am__append_22)
-
-# This is our output, the NetCDF CF Library.
-lib_LTLIBRARIES = libcf.la $(am__append_1)
- at BUILD_F90_TRUE@libcff_la_DEPENDENCIES = libcf_api.f90
- at BUILD_F90_TRUE@EXTRA_DIST = libcf_api.f90
- at BUILD_F90_TRUE@libcff_la_SOURCES = cffcvars.f90
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at tst_f03_file_SOURCES = tst_f03_file.f90
- at BUILD_F90_TRUE@@USE_NETCDF_DIR_FALSE at AM_FCFLAGS = @MOD_FLAG at ../../f90
- at BUILD_F90_TRUE@@USE_NETCDF_DIR_TRUE at AM_FCFLAGS = @MOD_FLAG@@NETCDFDIR@/include
-
-# Add the gridspec functions.
-#libcf_la_LIBADD = ../gridspec/shared/mosaic/libshared.la 
-#libcf_la_LIBADD += ../gridspec/tools/shared/libtoolsshared.la 
-
-# These linker flags specify libtool version info.
-libcf_la_LDFLAGS = -version-info 0:0:0
-
-# This is the coordinate systems stuff.
-libcf_la_SOURCES = nccoord.c libcf.h libcf_int.h cffiles.c cfvars.c	\
-cfcvars.c cfsubsets.c cferror.c cferror.h cdTimeConv.c cdmsint.h	\
-cdms.h cddrs.h drscdf.h cdunif.h
-
-
-# These files are created by the tests.
-CLEANFILES = tst_coords_classic.nc tst_coords_64bit.nc			\
-tst_coords_netcdf4_classic.nc tst_coords_netcdf4.nc tst_vars.nc		\
-tst_files.nc tst_cvars.nc tst_vert_sigma.nc tst_vert_hybrid_sigma.nc	\
-tst_subsets_simple_sigma.nc tst_subsets_nw.nc tst_subsets_sw.nc		\
-tst_subsets_se.nc tst_subsets_ne.nc tst_f03_file.nc libcf.mod
-
-tst_coords_SOURCES = tst_coords.c nc_tests.h
-tst_files_SOURCES = tst_files.c nc_tests.h
-tst_vars_SOURCES = tst_vars.c nc_tests.h
-tst_cvars_SOURCES = tst_cvars.c nc_tests.h
-tst_vert_SOURCES = tst_vert.c nc_tests.h
-tst_subsets_SOURCES = tst_subsets.c nc_tests.h
- at EXTRA_DATA_TESTS_TRUE@tst_example_data_SOURCES = tst_example_data.c nc_tests.h
-TESTS = $(check_PROGRAMS)
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include	\
+-I$(srcdir)/../global -I$(srcdir)/../coord -I$(srcdir)/../grid	\
+-I$(srcdir)/../data
+
+include_HEADERS = nccf_mosaic.h
+noinst_LTLIBRARIES = libnccf_mosaic.la
+libnccf_mosaic_la_SOURCES = nccf_def_mosaic.c nccf_put_mosaic.c	\
+nccf_free_mosaic.c nccf_inq_mosaic_contactmap.c			\
+nccf_inq_mosaic_tilecontact.c nccf_inq_mosaic_tileseparator.c	\
+nccf_inq_mosaic_gridranges.c nccf_inq_mosaic_ngrids.c		\
+nccf_inq_mosaic_ndims.c nccf_inq_mosaic_gridname.c		\
+nccf_inq_mosaic_gridids.c nccf_inq_mosaic_coordnames.c		\
+nccf_inq_mosaic_ncontacts.c nccf_add_mosaic_att.c		\
+nccf_def_mosaic_from_file.c nccf_print_mosaic_as_polytopes.c \
+nccf_set_mosaic_contact.c nccf_compute_mosaic_contacts.c
+
+INTLIBS = libnccf_mosaic.la ../data/libnccf_data.la	\
+../grid/libnccf_grid.la ../coord/libnccf_coord.la	\
+../global/libnccf_global.la ../../src/libcf_src.la
+
+EXTLIBS = -lnetcdf 
+EXTRA_DIST = copy_grid_for_bogus_data_files.sh
+
+# files generated by tests
+CLEANFILES = *.nc *.pt
+tst_big_dimsizes_SOURCES = tst_big_dimsizes.c 
+tst_big_dimsizes_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_1d_mosaic_SOURCES = tst_1d_mosaic.c 
+tst_1d_mosaic_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_sg_mosaic_latlon_SOURCES = tst_sg_mosaic_latlon.c 
+tst_sg_mosaic_latlon_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_sg_periodic_mosaic_latlon_SOURCES = tst_sg_periodic_mosaic_latlon.c 
+tst_sg_periodic_mosaic_latlon_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_periodic_grid_SOURCES = tst_periodic_grid.c 
+tst_periodic_grid_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_cubesphere_mosaic_SOURCES = tst_cubesphere_mosaic.c 
+tst_cubesphere_mosaic_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_get_mosaic_grid_ranges_SOURCES = tst_get_mosaic_grid_ranges.c 
+tst_get_mosaic_grid_ranges_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_cubesphere_mosaic_grid_ranges_SOURCES = tst_cubesphere_mosaic_grid_ranges.c 
+tst_cubesphere_mosaic_grid_ranges_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_two_unequal_in_i_tiles_SOURCES = tst_two_unequal_in_i_tiles.c 
+tst_two_unequal_in_i_tiles_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_two_unequal_in_i_j_tiles_SOURCES = tst_two_unequal_in_i_j_tiles.c 
+tst_two_unequal_in_i_j_tiles_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_tripolar_zhi_SOURCES = tst_tripolar_zhi.c 
+tst_tripolar_zhi_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_bipolar_tripolar_grid_SOURCES = tst_bipolar_tripolar_grid.c 
+tst_bipolar_tripolar_grid_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_bipolar_tripolar_grid_periodic_SOURCES = tst_bipolar_tripolar_grid_periodic.c 
+tst_bipolar_tripolar_grid_periodic_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_rotation_SOURCES = tst_rotation.c
+tst_rotation_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_two_tiles_SOURCES = tst_two_tiles.c
+tst_two_tiles_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_nccf_set_mosaic_contact_SOURCES = tst_nccf_set_mosaic_contact.c
+tst_nccf_set_mosaic_contact_LDADD = $(INTLIBS) $(EXTLIBS)
+TESTS = $(check_PROGRAMS) 
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .f90 .lo .o .obj
+.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -413,9 +424,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec_api/mosaic/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign src/Makefile
+	  $(AUTOMAKE) --foreign gridspec_api/mosaic/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -434,41 +445,17 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
-	@$(NORMAL_INSTALL)
-	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
-	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
-	list2=; for p in $$list; do \
-	  if test -f $$p; then \
-	    list2="$$list2 $$p"; \
-	  else :; fi; \
-	done; \
-	test -z "$$list2" || { \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
-	}
-
-uninstall-libLTLIBRARIES:
-	@$(NORMAL_UNINSTALL)
-	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
-	for p in $$list; do \
-	  $(am__strip_dir) \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
-	done
 
-clean-libLTLIBRARIES:
-	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
-	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
 	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
 	  test "$$dir" != "$$p" || dir=.; \
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libcf.la: $(libcf_la_OBJECTS) $(libcf_la_DEPENDENCIES) 
-	$(libcf_la_LINK) -rpath $(libdir) $(libcf_la_OBJECTS) $(libcf_la_LIBADD) $(LIBS)
-libcff.la: $(libcff_la_OBJECTS) $(libcff_la_DEPENDENCIES) 
-	$(FCLINK) $(am_libcff_la_rpath) $(libcff_la_OBJECTS) $(libcff_la_LIBADD) $(LIBS)
+libnccf_mosaic.la: $(libnccf_mosaic_la_OBJECTS) $(libnccf_mosaic_la_DEPENDENCIES) 
+	$(LINK)  $(libnccf_mosaic_la_OBJECTS) $(libnccf_mosaic_la_LIBADD) $(LIBS)
 
 clean-checkPROGRAMS:
 	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
@@ -478,30 +465,63 @@ clean-checkPROGRAMS:
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	rm -f $$list
-tst_coords$(EXEEXT): $(tst_coords_OBJECTS) $(tst_coords_DEPENDENCIES) 
-	@rm -f tst_coords$(EXEEXT)
-	$(LINK) $(tst_coords_OBJECTS) $(tst_coords_LDADD) $(LIBS)
-tst_cvars$(EXEEXT): $(tst_cvars_OBJECTS) $(tst_cvars_DEPENDENCIES) 
-	@rm -f tst_cvars$(EXEEXT)
-	$(LINK) $(tst_cvars_OBJECTS) $(tst_cvars_LDADD) $(LIBS)
-tst_example_data$(EXEEXT): $(tst_example_data_OBJECTS) $(tst_example_data_DEPENDENCIES) 
-	@rm -f tst_example_data$(EXEEXT)
-	$(LINK) $(tst_example_data_OBJECTS) $(tst_example_data_LDADD) $(LIBS)
-tst_f03_file$(EXEEXT): $(tst_f03_file_OBJECTS) $(tst_f03_file_DEPENDENCIES) 
-	@rm -f tst_f03_file$(EXEEXT)
-	$(FCLINK) $(tst_f03_file_OBJECTS) $(tst_f03_file_LDADD) $(LIBS)
-tst_files$(EXEEXT): $(tst_files_OBJECTS) $(tst_files_DEPENDENCIES) 
-	@rm -f tst_files$(EXEEXT)
-	$(LINK) $(tst_files_OBJECTS) $(tst_files_LDADD) $(LIBS)
-tst_subsets$(EXEEXT): $(tst_subsets_OBJECTS) $(tst_subsets_DEPENDENCIES) 
-	@rm -f tst_subsets$(EXEEXT)
-	$(LINK) $(tst_subsets_OBJECTS) $(tst_subsets_LDADD) $(LIBS)
-tst_vars$(EXEEXT): $(tst_vars_OBJECTS) $(tst_vars_DEPENDENCIES) 
-	@rm -f tst_vars$(EXEEXT)
-	$(LINK) $(tst_vars_OBJECTS) $(tst_vars_LDADD) $(LIBS)
-tst_vert$(EXEEXT): $(tst_vert_OBJECTS) $(tst_vert_DEPENDENCIES) 
-	@rm -f tst_vert$(EXEEXT)
-	$(LINK) $(tst_vert_OBJECTS) $(tst_vert_LDADD) $(LIBS)
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_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
+tst_1d_mosaic$(EXEEXT): $(tst_1d_mosaic_OBJECTS) $(tst_1d_mosaic_DEPENDENCIES) 
+	@rm -f tst_1d_mosaic$(EXEEXT)
+	$(LINK) $(tst_1d_mosaic_OBJECTS) $(tst_1d_mosaic_LDADD) $(LIBS)
+tst_big_dimsizes$(EXEEXT): $(tst_big_dimsizes_OBJECTS) $(tst_big_dimsizes_DEPENDENCIES) 
+	@rm -f tst_big_dimsizes$(EXEEXT)
+	$(LINK) $(tst_big_dimsizes_OBJECTS) $(tst_big_dimsizes_LDADD) $(LIBS)
+tst_bipolar_tripolar_grid$(EXEEXT): $(tst_bipolar_tripolar_grid_OBJECTS) $(tst_bipolar_tripolar_grid_DEPENDENCIES) 
+	@rm -f tst_bipolar_tripolar_grid$(EXEEXT)
+	$(LINK) $(tst_bipolar_tripolar_grid_OBJECTS) $(tst_bipolar_tripolar_grid_LDADD) $(LIBS)
+tst_bipolar_tripolar_grid_periodic$(EXEEXT): $(tst_bipolar_tripolar_grid_periodic_OBJECTS) $(tst_bipolar_tripolar_grid_periodic_DEPENDENCIES) 
+	@rm -f tst_bipolar_tripolar_grid_periodic$(EXEEXT)
+	$(LINK) $(tst_bipolar_tripolar_grid_periodic_OBJECTS) $(tst_bipolar_tripolar_grid_periodic_LDADD) $(LIBS)
+tst_cubesphere_mosaic$(EXEEXT): $(tst_cubesphere_mosaic_OBJECTS) $(tst_cubesphere_mosaic_DEPENDENCIES) 
+	@rm -f tst_cubesphere_mosaic$(EXEEXT)
+	$(LINK) $(tst_cubesphere_mosaic_OBJECTS) $(tst_cubesphere_mosaic_LDADD) $(LIBS)
+tst_cubesphere_mosaic_grid_ranges$(EXEEXT): $(tst_cubesphere_mosaic_grid_ranges_OBJECTS) $(tst_cubesphere_mosaic_grid_ranges_DEPENDENCIES) 
+	@rm -f tst_cubesphere_mosaic_grid_ranges$(EXEEXT)
+	$(LINK) $(tst_cubesphere_mosaic_grid_ranges_OBJECTS) $(tst_cubesphere_mosaic_grid_ranges_LDADD) $(LIBS)
+tst_get_mosaic_grid_ranges$(EXEEXT): $(tst_get_mosaic_grid_ranges_OBJECTS) $(tst_get_mosaic_grid_ranges_DEPENDENCIES) 
+	@rm -f tst_get_mosaic_grid_ranges$(EXEEXT)
+	$(LINK) $(tst_get_mosaic_grid_ranges_OBJECTS) $(tst_get_mosaic_grid_ranges_LDADD) $(LIBS)
+tst_nccf_set_mosaic_contact$(EXEEXT): $(tst_nccf_set_mosaic_contact_OBJECTS) $(tst_nccf_set_mosaic_contact_DEPENDENCIES) 
+	@rm -f tst_nccf_set_mosaic_contact$(EXEEXT)
+	$(LINK) $(tst_nccf_set_mosaic_contact_OBJECTS) $(tst_nccf_set_mosaic_contact_LDADD) $(LIBS)
+tst_periodic_grid$(EXEEXT): $(tst_periodic_grid_OBJECTS) $(tst_periodic_grid_DEPENDENCIES) 
+	@rm -f tst_periodic_grid$(EXEEXT)
+	$(LINK) $(tst_periodic_grid_OBJECTS) $(tst_periodic_grid_LDADD) $(LIBS)
+tst_rotation$(EXEEXT): $(tst_rotation_OBJECTS) $(tst_rotation_DEPENDENCIES) 
+	@rm -f tst_rotation$(EXEEXT)
+	$(LINK) $(tst_rotation_OBJECTS) $(tst_rotation_LDADD) $(LIBS)
+tst_sg_mosaic_latlon$(EXEEXT): $(tst_sg_mosaic_latlon_OBJECTS) $(tst_sg_mosaic_latlon_DEPENDENCIES) 
+	@rm -f tst_sg_mosaic_latlon$(EXEEXT)
+	$(LINK) $(tst_sg_mosaic_latlon_OBJECTS) $(tst_sg_mosaic_latlon_LDADD) $(LIBS)
+tst_sg_periodic_mosaic_latlon$(EXEEXT): $(tst_sg_periodic_mosaic_latlon_OBJECTS) $(tst_sg_periodic_mosaic_latlon_DEPENDENCIES) 
+	@rm -f tst_sg_periodic_mosaic_latlon$(EXEEXT)
+	$(LINK) $(tst_sg_periodic_mosaic_latlon_OBJECTS) $(tst_sg_periodic_mosaic_latlon_LDADD) $(LIBS)
+tst_tripolar_zhi$(EXEEXT): $(tst_tripolar_zhi_OBJECTS) $(tst_tripolar_zhi_DEPENDENCIES) 
+	@rm -f tst_tripolar_zhi$(EXEEXT)
+	$(LINK) $(tst_tripolar_zhi_OBJECTS) $(tst_tripolar_zhi_LDADD) $(LIBS)
+tst_two_tiles$(EXEEXT): $(tst_two_tiles_OBJECTS) $(tst_two_tiles_DEPENDENCIES) 
+	@rm -f tst_two_tiles$(EXEEXT)
+	$(LINK) $(tst_two_tiles_OBJECTS) $(tst_two_tiles_LDADD) $(LIBS)
+tst_two_unequal_in_i_j_tiles$(EXEEXT): $(tst_two_unequal_in_i_j_tiles_OBJECTS) $(tst_two_unequal_in_i_j_tiles_DEPENDENCIES) 
+	@rm -f tst_two_unequal_in_i_j_tiles$(EXEEXT)
+	$(LINK) $(tst_two_unequal_in_i_j_tiles_OBJECTS) $(tst_two_unequal_in_i_j_tiles_LDADD) $(LIBS)
+tst_two_unequal_in_i_tiles$(EXEEXT): $(tst_two_unequal_in_i_tiles_OBJECTS) $(tst_two_unequal_in_i_tiles_DEPENDENCIES) 
+	@rm -f tst_two_unequal_in_i_tiles$(EXEEXT)
+	$(LINK) $(tst_two_unequal_in_i_tiles_OBJECTS) $(tst_two_unequal_in_i_tiles_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -509,20 +529,40 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdTimeConv.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cfcvars.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cferror.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cffiles.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cfsubsets.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cfvars.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccoord.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_coords.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_cvars.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_example_data.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_subsets.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vars.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vert.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_add_mosaic_att.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_compute_mosaic_contacts.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_mosaic.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_mosaic_from_file.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_free_mosaic.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_mosaic_contactmap.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_mosaic_coordnames.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_mosaic_gridids.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_mosaic_gridname.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_mosaic_gridranges.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_mosaic_ncontacts.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_mosaic_ndims.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_mosaic_ngrids.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_mosaic_tilecontact.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_mosaic_tileseparator.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_print_mosaic_as_polytopes.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_put_mosaic.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_set_mosaic_contact.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_1d_mosaic.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_big_dimsizes.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_bipolar_tripolar_grid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_bipolar_tripolar_grid_periodic.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_cubesphere_mosaic.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_cubesphere_mosaic_grid_ranges.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_get_mosaic_grid_ranges.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_set_mosaic_contact.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_periodic_grid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_rotation.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_sg_mosaic_latlon.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_sg_periodic_mosaic_latlon.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_tripolar_zhi.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_two_tiles.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_two_unequal_in_i_j_tiles.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_two_unequal_in_i_tiles.Po at am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -548,15 +588,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
-.f90.o:
-	$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
-
-.f90.obj:
-	$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'`
-
-.f90.lo:
-	$(LTFCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
-
 mostlyclean-libtool:
 	-rm -f *.lo
 
@@ -761,9 +792,9 @@ check-am: all-am
 	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
-all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
 installdirs:
-	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
+	for dir in "$(DESTDIR)$(includedir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-am
@@ -794,8 +825,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-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES clean-noinstPROGRAMS mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -821,7 +852,7 @@ install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am: install-libLTLIBRARIES
+install-exec-am:
 
 install-html: install-html-am
 
@@ -861,33 +892,25 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
+uninstall-am: uninstall-includeHEADERS
 
 .MAKE: check-am install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
-	clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
-	clean-libtool ctags 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 \
-	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+	clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES clean-noinstPROGRAMS ctags 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 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 pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-includeHEADERS \
-	uninstall-libLTLIBRARIES
-
-
-# Rule to build Fortran 2003 code.
-#cfcvars.o:cfcvsars.f90
-#	$(FC) -c $(AM_FCFLAGS) $(FCFLAGS) -c $? -o $@
+	tags uninstall uninstall-am uninstall-includeHEADERS
 
-tst_f03_file.o:tst_f03_file.f90
-	$(FC) -c $(AM_FCFLAGS) $(FCFLAGS) -c $? -o $@
 
 # 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/gridspec_api/mosaic/copy_grid_for_bogus_data_files.sh b/gridspec_api/mosaic/copy_grid_for_bogus_data_files.sh
new file mode 100755
index 0000000..8d4142b
--- /dev/null
+++ b/gridspec_api/mosaic/copy_grid_for_bogus_data_files.sh
@@ -0,0 +1,28 @@
+#
+# This script copies the grid to four files which will have bogus data added
+# to them.
+#
+# $Id: $
+#
+
+if [ -f "tst_two_tiles_add_id_bog00.nc" ] 
+then
+  rm tst_two_tiles_add_id_bog00.nc
+fi
+if [ -f "tst_two_tiles_add_id_bog01.nc" ] 
+then
+rm tst_two_tiles_add_id_bog01.nc
+fi
+if [ -f "tst_two_tiles_add_id_bog10.nc" ] 
+then
+  rm tst_two_tiles_add_id_bog10.nc
+fi
+if [ -f "tst_two_tiles_add_id_bog11.nc" ] 
+then
+  rm tst_two_tiles_add_id_bog11.nc
+fi
+
+cp tst_two_tiles_add_id_grid0.nc tst_two_tiles_add_id_bog00.nc
+cp tst_two_tiles_add_id_grid0.nc tst_two_tiles_add_id_bog01.nc
+cp tst_two_tiles_add_id_grid1.nc tst_two_tiles_add_id_bog10.nc
+cp tst_two_tiles_add_id_grid1.nc tst_two_tiles_add_id_bog11.nc
diff --git a/gridspec_api/mosaic/nccf_add_mosaic_att.c b/gridspec_api/mosaic/nccf_add_mosaic_att.c
new file mode 100644
index 0000000..fc98941
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_add_mosaic_att.c
@@ -0,0 +1,27 @@
+/**
+ * Add attribute
+ *
+ * $Id: nccf_add_mosaic_att.c 737 2011-05-06 17:48:14Z edhartnett $
+ */
+
+#include "nccf_mosaic.h"
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Add an attribute to a mosaic.
+ *
+ * \param mosaicid mosaic ID
+ * \param name name of the attribute to add
+ * \param value value of the attribute
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_add_mosaic_att(int mosaicid, const char *name, const char *value) {
+
+  struct nccf_mosaic_type *self;
+  self = nccf_li_find(&CFLIST_MOSAIC, mosaicid);
+  nccf_varSetAttribText(&self->gridToGrid, name, value);
+  
+  return NC_NOERR;
+}
diff --git a/gridspec_api/mosaic/nccf_compute_mosaic_contacts.c b/gridspec_api/mosaic/nccf_compute_mosaic_contacts.c
new file mode 100644
index 0000000..7122352
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_compute_mosaic_contacts.c
@@ -0,0 +1,315 @@
+/********************************************************
+  * Set the contact indices for a given contact.
+  *
+  * $Id: nccf_def_mosaic.c 719 2011-04-26 17:39:51Z srinath22 $
+  *
+  */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include <libcf_src.h>
+#include <netcdf.h>
+#include <nccf_grid.h>
+#include <nccf_coord.h>
+#include <nccf_utility_functions.h>
+#include <nccf_constants.h>
+#include <nccf_handle_error.h>
+#include <nccf_varObj.h>
+#include <cflistitem.h>
+
+#define EPSLN 1.e-10  /* Define zero as |val| < EPSLN... */
+#define min( a, b ) ( a<b ? a : b )
+
+int nccf_local_do_flipped( int ndims, double begPos1[], double endPos1[] ){
+
+  /* Need to compare the dimensions to see if there is rotation
+   * This will rewrite the Positions to match IFF there is rotation */
+
+  double *bp1, *ep1;
+  int i;
+
+  bp1 = ( double * )malloc( ndims * sizeof( double ));
+  ep1 = ( double * )malloc( ndims * sizeof( double ));
+
+  for( i = 0; i < ndims; i++ ){
+    bp1[i] = endPos1[i];
+    ep1[i] = begPos1[i];
+  }
+  for( i = 0; i < ndims; i++ ){
+    begPos1[i] = bp1[i];
+    endPos1[i] = ep1[i];
+  }
+
+  free( bp1 );
+  free( ep1 );
+
+  return NC_NOERR;
+}
+
+int nccf_local_check_contact( int ndims, double tol, const double period[],
+           const double begPos0[], const double endPos0[],
+           const double begPos1[], const double endPos1[]) {
+  /* 1 means there is a contact */
+  int res = 1;
+  int i;
+  double begDiff = 0, endDiff = 0, period_test = 0;
+
+  /* It is possible that the 0 dimension
+   * will match the 1 dimension and vice versa */
+  /* Check for rotation */
+  for ( i = 0; i < ndims; ++i ) {
+    if(( begPos1[i] - begPos0[i] ) == period[i] ){
+      period_test = begPos1[i] - begPos0[i];
+    }
+    if (( period[i] > 0.0 ) && ( begPos1[i] == endPos1[i] ) &&
+       ((( period_test ) == period[i] ) ||
+        (( endPos1[i] - endPos0[i] ) == period[i] ))){
+  /* coordinates are periodic */
+      if( period_test == period[i] ){
+        begDiff = fmod(( begPos1[i]-period[i] ), begPos0[i] );
+        endDiff = fmod(( endPos1[i]-period[i] ), endPos0[i] );
+      }
+      else{
+        begDiff = fabs( begPos1[i] - begPos0[i] );
+        endDiff = fabs( endPos1[i] - endPos0[i] );
+      }
+    }
+    else {
+  /* no periodicity */
+      begDiff = fabs( begPos1[i] - begPos0[i]);
+      endDiff = fabs( endPos1[i] - endPos0[i]);
+    }
+    if ( begDiff > tol || endDiff > tol ) {
+  /* no contact */
+      res *= 0;
+    }
+  }
+  //printf("contact=%i\n\n",res );
+  return res;
+}
+
+/*! \defgroup gs_mosaic_grp Mosaic connectivity
+  \ingroup gridspec_grp
+
+The mosaic contains all the connectivity information between tile grids. 
+Thus, a mosaic must know about its underlying grids and these must
+exist prior to the construction of a mosaic. Grid objects should not
+be freed before all operations on the mosaic have been completed.
+
+*/
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Infer the contacts based on comparing endpoints from adjacent tiles.
+ *
+ * \param mosaicid a mosaic ID (e.g. returned by nccf_def_mosaic)
+ * \param period periodicity array, one element for each dimension. A value of 0 means no periodicity. Must be of type double
+ */
+int nccf_compute_mosaic_contacts( int mosaicid, const double period[] ){
+
+  /* Open the mosaic structure */
+  struct nccf_mosaic_type *self;
+  self = nccf_li_find( &CFLIST_MOSAIC, mosaicid );
+
+  int ndims, *dims;
+  int *normVec0, *normVec1;
+  double *begPos0, *begPos1, *endPos0, *endPos1;
+  int *begInd0, *begInd1, *endInd0, *endInd1;
+  double *dataPtr;
+  double sumPeriods;
+
+  /* flat indices */
+  int begIndex0, endIndex0, begIndex1, endIndex1;
+
+  int iedge0, iedge1;
+  int iGrid0, iGrid1;
+  char *file0, *file1;
+  int i;
+  int status;
+  int isContact = 0, is1Flipped = 0;
+
+  char slice0[STRING_SIZE], slice1[STRING_SIZE];
+  char *contactStr, *gridStr;
+  char *coordnamesbuffer   = NULL;
+
+  /* Get dimensionality */
+  nccf_inq_grid_ndims( self->gridids[0], &ndims );
+  self->ndims = ndims;
+  int coordIds0[ndims], coordIds1[ndims];
+  dims = (int*)malloc( ndims * sizeof( int ));
+
+  /* Allocate some strings */
+  file1 = (char*)calloc( STRING_SIZE, sizeof( char ));
+  coordnamesbuffer = (char*)calloc( ndims, STRING_SIZE * sizeof(char ));
+
+  /* Populate the coordnames list */
+  status = nccf_inq_grid_coordnames( self->gridids[0], coordnamesbuffer );
+  for( i = 0; i < ndims; i++ ){
+    char *test = (char*)calloc( STRING_SIZE, sizeof(char));
+    strcpy( test, &coordnamesbuffer[i*STRING_SIZE] );
+    nccf_li_add( &self->coordnameslist, test );
+  }
+  free( coordnamesbuffer );
+
+  sumPeriods = 0.0;
+  for ( i = 0; i < ndims; ++i ) {
+    sumPeriods += period[i];
+  }
+
+  /* Normal vector of -1, 0, and 1 */
+  normVec0 = ( int * ) malloc( ndims * sizeof( int ));
+  normVec1 = ( int * ) malloc( ndims * sizeof( int ));
+
+  /* Index values at the start/end corner of the boundary */
+  begInd0 = (int *) malloc(ndims * sizeof(int));
+  begInd1 = (int *) malloc(ndims * sizeof(int));
+  endInd0 = (int *) malloc(ndims * sizeof(int));
+  endInd1 = (int *) malloc(ndims * sizeof(int));
+
+  /* Coordinate values at the start/end points of a boundary */
+  begPos0 = (double *) malloc(ndims * sizeof(double));
+  begPos1 = (double *) malloc(ndims * sizeof(double));
+  endPos0 = (double *) malloc(ndims * sizeof(double));
+  endPos1 = (double *) malloc(ndims * sizeof(double));
+
+  for( i = 0; i<ndims; i++ ){
+    begInd0[i] = 0;
+    begInd1[i] = 0;
+    endInd0[i] = 0;
+    endInd1[i] = 0;
+    begPos0[i] = 0;
+    begPos1[i] = 0;
+    endPos0[i] = 0;
+    endPos1[i] = 0;
+  }
+
+  /* Heavy lifting */
+  /* Loop over grids (0) */
+  for( iGrid0 = 0; iGrid0 < self->ngrids; ++iGrid0 ){
+    status = nccf_inq_grid_coordids( self->gridids[iGrid0], coordIds0 );
+
+    /* Track the filenames of the grids - if blank ignore */
+    file0 = ( char* )calloc( STRING_SIZE, sizeof( char ));
+    status = nccf_inq_grid_name( self->gridids[iGrid0], file0 );
+    nccf_li_add( &self->gridnameslist, file0 );
+
+    /* Loop over grids (1) starting with self and don't look back. Avoids reverse
+     * duplication */
+    for( iGrid1 = iGrid0; iGrid1 < self->ngrids; ++iGrid1 ){
+
+      /* Skip if same grid and no periodicity */
+      if ( self->gridids[iGrid0] == self->gridids[iGrid1] && sumPeriods == 0.0 ) {
+          continue;
+      }
+      status = nccf_inq_grid_name( self->gridids[iGrid1], file1 );
+      status = nccf_inq_grid_coordids( self->gridids[iGrid1],
+                  coordIds1 );
+
+      /* Loop over boundaries (1) */
+      for (iedge0 = 0; iedge0 < 2 * ndims; ++iedge0 ){
+        /* fill in normVec */
+        status = nccf_index2vector( iedge0, ndims, normVec0 );
+        /* compute begIndex and endIndex */
+        status = nccf_inq_coord_bound( coordIds0[0], normVec0,
+                          begInd0, endInd0 );
+          status = nccf_inq_coord_dims( coordIds0[0], dims );
+          begIndex0 = nccf_get_flat_index( ndims, dims, begInd0 );
+          endIndex0 = nccf_get_flat_index( ndims, dims, endInd0 );
+
+        /* fill in start and end coordinates (1) */
+        for ( i = 0; i < ndims; ++i ) {
+
+          /* get pointer to the data */
+          status = nccf_get_coord_data_pointer( coordIds0[i], &dataPtr );
+          begPos0[i] = dataPtr[begIndex0];
+          endPos0[i] = dataPtr[endIndex0];
+        }
+
+        /* Loop over boundaries (2) */
+        for ( iedge1 = 0; iedge1 < 2 * ndims; ++iedge1 ){
+          /* by default no contact */
+          isContact = 0;
+          /* fill in normVec */
+          status = nccf_index2vector( iedge1, ndims, normVec1 );
+          /* compute begIndex and endIndex */
+          status = nccf_inq_coord_bound( coordIds1[0], normVec1,
+                                        begInd1, endInd1 );
+          status = nccf_inq_coord_dims( coordIds1[0], dims );
+          begIndex1 = nccf_get_flat_index( ndims, dims, begInd1 );
+          endIndex1 = nccf_get_flat_index( ndims, dims, endInd1 );
+          /* fill in start and end coordinates (2) */
+          for ( i = 0; i < ndims; ++i ) {
+            /* get pointer to the data */
+            status = nccf_get_coord_data_pointer( coordIds1[i], &dataPtr );
+            begPos1[i] = dataPtr[begIndex1];
+            endPos1[i] = dataPtr[endIndex1];
+          }
+
+          /* test contact
+           * Don't test if the grid is the same and the edge is the same */
+          int same_grid_same_edge;
+          same_grid_same_edge = (( iGrid0 == iGrid1 ) && ( iedge0 == iedge1 ));
+          if(!(( iGrid0 == iGrid1 ) && ( iedge0 == iedge1 )))
+            isContact = nccf_local_check_contact( ndims, EPSLN, period,
+                 begPos0, endPos0, begPos1, endPos1 );
+          /* If contact fails swap begPos1 with endPos1 and retest contact */
+          if( !isContact ){
+            status = nccf_local_do_flipped( ndims, begPos1, endPos1 );
+            if(!(( iGrid0 == iGrid1 ) && ( iedge0 == iedge1 )))
+              isContact = nccf_local_check_contact( ndims, EPSLN, period,
+                   begPos0, endPos0, begPos1, endPos1 );
+            if( isContact ) is1Flipped = 1;
+          }
+          if ( isContact ) {
+          /*
+           * Flip only the second grid, the first is assumed to be
+           * j up and i right oriented. */
+            status = nccf_inq_coord_bound_slice( coordIds0[0],
+                    normVec0, 0,
+                    self->gs_slice_format, slice0 );
+            status = nccf_inq_coord_bound_slice( coordIds1[0],
+                    normVec1, is1Flipped,
+                    self->gs_slice_format, slice1 );
+
+            /* each entry must be freshly allocated,
+               the desctructor will clean things up */
+            contactStr = (char *)calloc(STRING_SIZE, sizeof(char));
+            gridStr    = (char *)calloc(STRING_SIZE, sizeof(char));
+
+            sprintf( contactStr, "%s%s%s", slice0,
+            CF_TILE_SEPARATOR, slice1 );
+            sprintf( gridStr, "%s%s%s", file0,
+            CF_TILE_SEPARATOR, file1 );
+
+            /* add contact to list */
+            nccf_li_add( &self->contactindexlist, contactStr );
+            nccf_li_add( &self->gridtogridlist, gridStr );
+
+            self->ncontacts += 1;
+          }
+          is1Flipped = 0;
+        }
+      }
+    }   // Grid1
+  }     // Grid0
+
+  free( dims );
+  free( begPos0 );
+  free( begPos1 );
+  free( endPos0 );
+  free( endPos1 );
+  free( begInd0 );
+  free( begInd1 );
+  free( endInd0 );
+  free( endInd1 );
+  free( normVec0 );
+  free( normVec1 );
+  free( file1 ); // Dont free file0. It is in the gridnameslist.
+
+  return NC_NOERR;
+}
+
diff --git a/gridspec_api/mosaic/nccf_def_mosaic.c b/gridspec_api/mosaic/nccf_def_mosaic.c
new file mode 100644
index 0000000..efc871d
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_def_mosaic.c
@@ -0,0 +1,87 @@
+  /********************************************************
+
+  * Purpose :  Create a mosaic file from grid files.  Prepare the contact file
+  *
+  * $Id: nccf_def_mosaic.c 750 2011-05-13 19:25:37Z pletzer $
+  *
+  */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include <libcf_src.h>
+#include <netcdf.h>
+#include <nccf_grid.h>
+#include <nccf_coord.h>
+#include <nccf_utility_functions.h>
+#include <nccf_constants.h>
+#include <nccf_handle_error.h>
+#include <nccf_varObj.h>
+#include <cflistitem.h>
+
+struct CFLISTITEM *CFLIST_MOSAIC;
+
+/*! \defgroup gs_mosaic_grp Mosaic connectivity
+  \ingroup gridspec_grp
+
+The mosaic file, or equivalently its representation in memory, contains
+all the connectivity information between tile grids. Thus, a mosaic 
+must know about its underlying grids and these must 
+exist prior to the construction of a mosaic. Grid objects should not
+be freed before all operations on the mosaic have been completed.
+
+*/
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Define a mosaic, acts as a constructor.
+ *
+ * \param ngrids the number of grid files
+ * \param gridids grid IDs for each grid forming the mosaic
+ * \param name name of the mosaic
+ * \param mosaicid (output) ID
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_def_mosaic( int ngrids, const int gridids[], const char *name,
+                     int *mosaicid){
+
+  struct nccf_mosaic_type *self;
+  self = (struct nccf_mosaic_type *) malloc(sizeof(struct nccf_mosaic_type));
+
+  int i;
+
+  /* Initialize the structure */
+  self->name = ( char* )calloc( STRING_SIZE, sizeof( char ));
+  strcpy(self->name, name);
+
+  self->coordnameslist   = NULL;
+  self->gridnameslist    = NULL;
+  self->gridtogridlist   = NULL;
+  self->contactindexlist = NULL;
+  nccf_li_new(&self->coordnameslist);
+  nccf_li_new(&self->gridnameslist);
+  nccf_li_new(&self->gridtogridlist);
+  nccf_li_new(&self->contactindexlist);
+  self->ncontacts = 0;
+  self->ngrids    = ngrids;
+  self->gridids   = ( int * )malloc( ngrids * sizeof( int ));
+  self->ndims     = 0;
+  self->gs_slice_format = (char*)calloc( STRING_SIZE, sizeof(char));
+  strcpy( self->gs_slice_format, "C" );
+
+  /* Populate the grid id array */
+  for( i = 0; i < ngrids; i++ ) self->gridids[i] = gridids[i];
+
+  /* add an element to the linked list */
+  if (CFLIST_MOSAIC == NULL) nccf_li_new(&CFLIST_MOSAIC);
+
+  *mosaicid = nccf_li_add( &CFLIST_MOSAIC, self );
+
+  return NC_NOERR;
+
+}
diff --git a/gridspec_api/mosaic/nccf_def_mosaic_from_file.c b/gridspec_api/mosaic/nccf_def_mosaic_from_file.c
new file mode 100644
index 0000000..c36e936
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_def_mosaic_from_file.c
@@ -0,0 +1,146 @@
+/**
+ * $Id: nccf_def_mosaic_from_file.c 920 2012-03-20 23:11:28Z dkindig $
+ */
+
+#include "nccf_mosaic.h"
+#include <netcdf.h>
+#include "nccf_varObj.h"
+
+// std includes
+#include <string.h>
+#include <stdio.h>
+
+
+/* Local functions - Ultimitely get stored in the mosaic structure where 
+ * external functions can read them */
+int nccf_inq_mosaic_ndims_from_file(int ncid, int *ndims) {
+  struct nccf_var_obj *v;
+  int *dims;
+  nccf_varCreateFromFile(&v, CF_MOSAIC_COORDINATE_NAME, ncid, 1, 0);
+  nccf_varGetDimsPtr(&v, &dims);
+  *ndims = dims[0];
+  nccf_varDestroy(&v);
+  return NC_NOERR;
+}
+
+int nccf_inq_mosaic_ncontacts_from_file(int ncid, int *ncontacts) {
+  struct nccf_var_obj *v;
+  int *dims;
+  nccf_varCreateFromFile(&v, CF_MOSAIC_TILE_CONTACTS, ncid, 1, 0);
+  nccf_varGetDimsPtr(&v, &dims);
+  *ncontacts = dims[0];
+  nccf_varDestroy(&v);
+  return NC_NOERR;
+}
+
+int nccf_inq_mosaic_ngrids_from_file(int ncid, int *ngrids) {
+  struct nccf_var_obj *v;
+  int *dims;
+  nccf_varCreateFromFile(&v, CF_MOSAIC_TILE_NAMES, ncid, 1, 0);
+  nccf_varGetDimsPtr(&v, &dims);
+  *ngrids = dims[0];
+  nccf_varDestroy(&v);
+  return NC_NOERR;
+}
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Define (construct) a mosaic from a netcdf file.
+ *
+ * \param filename file name
+ * \param name name of the mosaic
+ * \param mosaicid (output) ID
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_def_mosaic_from_file(const char *filename, const char *name,
+				int *mosaicid) {
+
+  int ncid, status = NC_NOERR, i;
+  int totError = NC_NOERR;
+  char *coordname;
+  
+  struct nccf_mosaic_type *self;
+  self = (struct nccf_mosaic_type *)
+    malloc(sizeof(struct nccf_mosaic_type));
+  
+  self->name = ( char* )calloc( STRING_SIZE, sizeof( char ));
+  strcpy(self->name, name);
+
+  // open file
+  status = nc_open(filename, NC_NOWRITE, &ncid);
+  if( status ) return status;
+  totError += abs(status);
+
+  // Initialize the mosaic structure
+  self->coordnameslist   = NULL;
+  self->gridnameslist    = NULL;
+  self->gridtogridlist   = NULL;
+  self->contactindexlist = NULL;
+  nccf_li_new(&self->coordnameslist);
+  nccf_li_new(&self->gridnameslist);
+  nccf_li_new(&self->gridtogridlist);
+  nccf_li_new(&self->contactindexlist);
+  self->ncontacts = 0;
+  self->ngrids    = 0;
+  self->gridids   = NULL;
+  self->ndims     = 0;
+  self->gs_slice_format = NULL;
+
+  // Read the information from the file
+  status = nccf_varCreateFromFile(&self->coordnames, CF_MOSAIC_COORDINATE_NAME, 
+				  ncid, 1, 0);
+  totError += abs(status);
+  status = nccf_varCreateFromFile(&self->gridNames, CF_MOSAIC_TILE_NAMES, 
+				  ncid, 1, 0);
+  totError += abs(status);
+  status = nccf_varCreateFromFile(&self->gridToGrid, CF_MOSAIC_TILE_CONTACTS, 
+				  ncid, 1, 0);
+  totError += abs(status);
+  status = nccf_varCreateFromFile(&self->contactIndex, CF_MOSAIC_CONTACT_MAP, 
+				  ncid, 1, 0);
+  totError += abs(status);
+
+  status = nccf_inq_mosaic_ndims_from_file(ncid, &self->ndims);
+  totError += abs(status);
+
+  status = nccf_inq_mosaic_ngrids_from_file(ncid, &self->ngrids);
+  totError += abs(status);
+
+  status = nccf_inq_mosaic_ncontacts_from_file(ncid, &self->ncontacts);
+  totError += abs(status);
+
+  // get pointer to the grid file name list
+  char *gridNamesStr;
+  nccf_varGetDataPtr(&self->gridNames, (void **) &gridNamesStr);
+  int *gridNamesDims;
+  nccf_varGetDimsPtr(&self->gridNames, &gridNamesDims);
+
+  // get pointer to the coordinate name list
+  char *coordnamesStr;
+  nccf_varGetDataPtr(&self->coordnames, (void **) &coordnamesStr);
+  int *coordnamesDims;
+  nccf_varGetDimsPtr(&self->coordnames, &coordnamesDims);
+  int strLengthCoordNames = coordnamesDims[1];
+
+  // build a list of strings for the coordinate names
+  for (i = 0; i < self->ndims; ++i) {
+    coordname = (char *) calloc( strLengthCoordNames, sizeof(char) );
+    strcpy( coordname, &coordnamesStr[ i * strLengthCoordNames ] );
+    nccf_li_add( &self->coordnameslist, coordname );
+  }
+
+  // load gridids with NULL for later.
+  self->gridids = NULL;
+  
+  // close the file
+  status = nc_close(ncid);
+  totError += abs(status);
+
+  // add object to global list of mosaics
+  if (CFLIST_MOSAIC == NULL) nccf_li_new(&CFLIST_MOSAIC);
+  *mosaicid = nccf_li_add( &CFLIST_MOSAIC, self );
+
+  return totError;
+}
diff --git a/gridspec_api/mosaic/nccf_free_mosaic.c b/gridspec_api/mosaic/nccf_free_mosaic.c
new file mode 100644
index 0000000..955641f
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_free_mosaic.c
@@ -0,0 +1,105 @@
+/*
+ * $Id: nccf_free_mosaic.c 918 2012-02-07 22:10:36Z pletzer $
+ *
+ */
+
+#include <nccf_mosaic.h>
+#include <stdlib.h>
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Free (destroy) a mosaic object (this will reclaim memory).
+ *
+ * \param mosaicid mosaic identifier
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_free_mosaic(int mosaicid) {
+  
+  struct nccf_mosaic_type *self;
+  int index;
+
+  /* Remove from list */
+  self = nccf_li_remove(&CFLIST_MOSAIC, mosaicid);
+  if( nccf_li_get_nelem( &CFLIST_MOSAIC ) == 0 )
+      nccf_li_del(&CFLIST_MOSAIC);
+
+  /* Free members */
+  if (self->name) {
+    free(self->name);
+    self->name = NULL;
+  }
+  if (self->gridids) {
+    free(self->gridids);
+    self->gridids = NULL;
+  }
+
+  if (self->gs_slice_format) {
+    free(self->gs_slice_format);
+    self->gs_slice_format = NULL;
+  }
+
+  /* Free the list members */
+  /* Coordinate names */ 
+  nccf_li_begin( &self->coordnameslist );
+  while( nccf_li_next( &self->coordnameslist )){
+    index = nccf_li_get_id( &self->coordnameslist );
+    char *val = nccf_li_remove( &self->coordnameslist, index );
+    if(val) {
+      free(val);
+      val = NULL;
+    }
+  }
+
+  /* Grid names */ 
+  nccf_li_begin( &self->gridnameslist );
+  while( nccf_li_next( &self->gridnameslist )){
+    index = nccf_li_get_id( &self->gridnameslist );
+    char *val = nccf_li_remove( &self->gridnameslist, index );
+    if(val) {
+      free(val);
+      val = NULL;
+    }
+  }
+
+  /* Contact index maps */ 
+  nccf_li_begin( &self->contactindexlist );
+  while( nccf_li_next( &self->contactindexlist )){
+    index = nccf_li_get_id( &self->contactindexlist );
+    char *val = nccf_li_remove( &self->contactindexlist, index );
+    if(val) {
+      free(val);
+      val = NULL;
+    }
+  }
+
+  /* Grid to grid contacts */ 
+  nccf_li_begin( &self->gridtogridlist );
+  while( nccf_li_next( &self->gridtogridlist )){
+    index = nccf_li_get_id( &self->gridtogridlist );
+    char *val = nccf_li_remove( &self->gridtogridlist, index );
+    if(val) {
+      free(val);
+      val = NULL;
+    }
+  }
+
+  /* Delete the head of each list */
+  nccf_li_del( &self->coordnameslist );
+  nccf_li_del( &self->gridnameslist );
+  nccf_li_del( &self->contactindexlist );
+  nccf_li_del( &self->gridtogridlist );
+
+  /* Free variable */
+  nccf_varDestroy(&self->contactIndex);
+  nccf_varDestroy(&self->gridToGrid);
+  nccf_varDestroy(&self->coordnames);
+  nccf_varDestroy(&self->gridNames);
+  
+  /* Free object */
+  free(self);
+  self = NULL;
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/mosaic/nccf_inq_mosaic_contactmap.c b/gridspec_api/mosaic/nccf_inq_mosaic_contactmap.c
new file mode 100644
index 0000000..c86b781
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_inq_mosaic_contactmap.c
@@ -0,0 +1,35 @@
+/**
+ * $Id: nccf_inq_mosaic_contactmap.c 753 2011-05-13 20:31:50Z pletzer $
+ */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <string.h>
+#include <libcf_src.h>
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Get contact map for a given index from a mosaic object.
+ *
+ * \param mosaicid Mosaic object ID
+ * \param index Contact map index
+ * \param contact_map Returned contact map string 
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_mosaic_contactmap( int mosaicid, int index, char *contact_map){
+
+  struct nccf_mosaic_type *self;
+  self = nccf_li_find(&CFLIST_MOSAIC, mosaicid);
+
+  char *cn_ptr;
+  int *dims;
+  
+  nccf_varGetDataPtr( &self->contactIndex, (void**)&cn_ptr );
+  nccf_varGetDimsPtr( &self->contactIndex, &dims );
+  strcpy( contact_map, &cn_ptr[index*dims[1]] );
+
+  return NC_NOERR;
+
+}
diff --git a/gridspec_api/mosaic/nccf_inq_mosaic_coordnames.c b/gridspec_api/mosaic/nccf_inq_mosaic_coordnames.c
new file mode 100644
index 0000000..1c2ed03
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_inq_mosaic_coordnames.c
@@ -0,0 +1,37 @@
+/*
+ * $Id: nccf_inq_mosaic_coordnames.c 754 2011-05-13 20:35:24Z dkindig $
+ * 
+ */
+
+#include <nccf_mosaic.h>
+#include <stdio.h>
+#include <string.h>
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Get the coordinate names.
+ *
+ * \param mosaicid a mosaic ID (e.g. returned by nccf_def_mosaic)
+ * \param coordnames coordinate names used by grid (output)
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_mosaic_coordnames( int mosaicid, char **coordnames ){
+
+  struct nccf_mosaic_type *self;
+  self = nccf_li_find(&CFLIST_MOSAIC, mosaicid);
+
+  char *cn_ptr;
+  int ndims = self->ndims, i;
+  int *dims;
+
+  nccf_varGetDataPtr( &self->coordnames, (void**)&cn_ptr );
+  nccf_varGetDimsPtr( &self->coordnames, &dims );
+  for( i = 0; i < ndims; i++ ){
+    strcpy( coordnames[i], &cn_ptr[i*dims[1]] );
+  }
+
+  return NC_NOERR;
+
+}
diff --git a/gridspec_api/mosaic/nccf_inq_mosaic_gridids.c b/gridspec_api/mosaic/nccf_inq_mosaic_gridids.c
new file mode 100644
index 0000000..6ec8a8c
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_inq_mosaic_gridids.c
@@ -0,0 +1,27 @@
+/*
+ * $Id: nccf_inq_mosaic_gridids.c 737 2011-05-06 17:48:14Z edhartnett $
+ * 
+ */
+
+#include <nccf_mosaic.h>
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Get the grid ids.
+ *
+ * \param mosaicid a mosaic object handle (returned by nccf_def_mosaic)
+ * \param gridids (output) array of grid unique identifiers
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_mosaic_gridids(int mosaicid, int gridids[]) {
+
+  int i;
+  struct nccf_mosaic_type *self;
+  self = nccf_li_find(&CFLIST_MOSAIC, mosaicid);
+
+  for( i = 0; i < self->ngrids; i++ ) gridids[i] = self->gridids[i];
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/mosaic/nccf_inq_mosaic_gridname.c b/gridspec_api/mosaic/nccf_inq_mosaic_gridname.c
new file mode 100644
index 0000000..86767d4
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_inq_mosaic_gridname.c
@@ -0,0 +1,28 @@
+/*
+ * $Id: nccf_inq_mosaic_gridname.c 755 2011-05-13 20:47:11Z dkindig $
+ * 
+ */
+
+#include <nccf_mosaic.h>
+#include <stdio.h>
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Get the i-th gridname.
+ *
+ * \param mosaicid mosaic ID
+ * \param index index of grid
+ * \param gridname (output) The grid name
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_mosaic_gridname(int mosaicid, int index, char *gridname){
+
+  struct nccf_mosaic_type *self;
+  self = nccf_li_find(&CFLIST_MOSAIC, mosaicid);
+
+  gridname = (char*)nccf_li_find( &self->gridnameslist, index );
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/mosaic/nccf_inq_mosaic_gridranges.c b/gridspec_api/mosaic/nccf_inq_mosaic_gridranges.c
new file mode 100644
index 0000000..a4effba
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_inq_mosaic_gridranges.c
@@ -0,0 +1,193 @@
+/**
+ *  $Id: nccf_inq_mosaic_gridranges.c 751 2011-05-13 19:31:11Z pletzer $
+ *
+ */
+
+#include <nccf_mosaic.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <nccf_errors.h>
+
+/* Utility function */
+int nccf_remove_whitespace( char *tmpstr, char *output ){
+
+  int i = 0;
+  char *p = tmpstr;
+  while(*p)
+  {
+     if(*p != ' ')
+        output[i++] = *p;
+     p++;
+  }
+  output[i] = 0;
+
+  return 0;
+}
+
+/* Find the grid id */
+//int nccf_find_gridid( const char *gridname, const char *gridnamesbuffer,
+//                        int gridids[], int ngrids ){
+int nccf_find_gridid( const char *gridname, struct CFLISTITEM *list,
+                      int gridids[], int ngrids ){
+
+  int iGrid, result, gridid;
+  char *gn, *tmpname;
+  tmpname = (char*)malloc( STRING_SIZE * sizeof(char));
+  gn      = (char*)malloc( STRING_SIZE * sizeof(char));
+  strcpy( gn, gridname );
+  nccf_remove_whitespace( gn, tmpname );
+  for( iGrid = 0; iGrid < ngrids; ++iGrid ){
+//    result = strcmp( tmpname, &gridnamesbuffer[iGrid * STRING_SIZE] );
+    result = strcmp( tmpname, nccf_li_find( &list, iGrid ));
+    if( result == 0 ){
+      gridid = gridids[iGrid];
+      break;
+    }
+  }
+
+  free( gn );
+  free( tmpname );
+
+  return gridid;
+
+}
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Get contact indices from a given contact.
+ *
+ * \param mosaicid mosaic object ID (returned by nccf_def_mosaic)
+ * \param index contact index
+ * \param gridid0 (output) first grid in contact
+ * \param gridid1 (output) second grid in contact
+ * \param grid0_beg_ind (output) begin indices for the coordinates on the first grid
+ * \param grid0_end_ind (output) end indices for the coordinates on the first grid
+ * \param grid1_beg_ind (output) begin indices for the coordinates on the second grid
+ * \param grid1_end_ind (output) end indices for the coordinates on the second grid
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_mosaic_gridranges( int mosaicid, int index,
+                                 int *gridid0, int *gridid1,
+                                 int grid0_beg_ind[], int grid0_end_ind[],
+                                 int grid1_beg_ind[], int grid1_end_ind[]){
+
+  int ndims, ngrids;
+
+  /* Search Strings and delimieters for sscanf*/
+  char *contactMapStr, *tileContactStr, *contactIndex, *gridToGrid;
+  int j, iIdx, iDim, cnt;
+  char *str1, *str2, *token, *subtoken, *saveptr1, *saveptr2;
+
+  struct nccf_mosaic_type *self;
+  self = nccf_li_find(&CFLIST_MOSAIC, mosaicid);
+
+  ndims = self->ndims;
+  ngrids = self->ngrids;
+
+  tileContactStr   = (char*)calloc( STRING_SIZE, sizeof( char ));
+  contactMapStr  = (char*)calloc( STRING_SIZE, sizeof( char ));
+
+  /* Read the grids */
+  nccf_varGetDataPtr( &self->gridToGrid, (void **) &gridToGrid );
+  nccf_varGetDataPtr( &self->contactIndex, (void **) &contactIndex );
+
+  /* Read the string */
+//  strcpy( contactMapStr,  &contactIndex[index * STRING_SIZE] );
+//  strcpy( tileContactStr, &gridToGrid[index * STRING_SIZE] );
+  sprintf( contactMapStr, "%s", &contactIndex[index * STRING_SIZE] );
+  sprintf( tileContactStr, "%s", &gridToGrid[index * STRING_SIZE] );
+
+  /* Split the two tiles apart into separate strings */
+  char *tile_separator;
+  tile_separator = (char*)calloc( STRING_SIZE, sizeof( char ));
+
+  char *tmpstr;
+  tmpstr = (char*)malloc( strlen(CF_TILE_SEPARATOR)+1);
+  strcpy( tmpstr, CF_TILE_SEPARATOR );
+  if(strchr( tmpstr, ' ' ) != NULL ){
+    /* CF_TILE_SEPARATOR has a space */
+    nccf_remove_whitespace( tmpstr, tile_separator );
+  } else {
+    /* Use the separator as is */
+    strcpy( tile_separator, CF_TILE_SEPARATOR );
+  }
+  /* Clean up */
+  free( tmpstr );
+
+  /* Find the grid Ids from the tile contact string */
+  for( j = 1, str1 = tileContactStr; ; j++, str1 = NULL ){
+    
+    /* Split the index string */
+    token = strtok_r( str1, tile_separator, &saveptr1 );
+    if( token == NULL )
+      break;
+
+    /* Get the grid Id from self */
+    if( j == 1 ) *gridid0 = nccf_find_gridid( token, self->gridnameslist, 
+                                              self->gridids, ngrids );
+    if( j == 2 ) *gridid1 = nccf_find_gridid( token, self->gridnameslist, 
+                                              self->gridids, ngrids );
+  }
+
+  /* Create the subtoken string by concatenating the
+   * INDEX and RANGE separators */
+  char *range_index_sep;
+  int len = strlen( CF_INDEX_SEPARATOR ) + strlen( CF_RANGE_SEPARATOR ) + 1;
+  range_index_sep = (char*)malloc( len * sizeof(char));
+  strcpy( range_index_sep, CF_RANGE_SEPARATOR );
+  strcat( range_index_sep, CF_INDEX_SEPARATOR );
+
+  /* Loop over the contactMapStr and split on the CF_TILE_SEPARATOR
+   * Then split each Dimension to get the beginning and end indices */
+  iDim = 0;
+  cnt = 0;
+  for( j = 1, str1 = contactMapStr; ; j++, str1 = NULL ){
+    
+    /* Split the index string */
+    token = strtok_r( str1, tile_separator, &saveptr1 );
+    if( token == NULL )
+      break;
+
+    /* Find the indices. Increment the dimension only when both indices have 
+     * been retrieved */
+    for( str2 = token; ; str2 = NULL ){
+
+      /* iIdx = 0, 1 --> beg, end */
+      iIdx = (cnt % 2);
+
+      /* iDim = 0, 1...ndims at contact between 2 tiles */
+      iDim = ( cnt / 2 ) % ndims;
+
+      subtoken = strtok_r( str2, range_index_sep, &saveptr2 );
+      if( subtoken == NULL )
+        break;
+
+      if( j == 1 ){
+        if(iIdx == 0) grid0_beg_ind[iDim] = atoi(subtoken);
+        if(iIdx == 1) grid0_end_ind[iDim] = atoi(subtoken);
+      }
+      if( j == 2 ){
+        if(iIdx == 0) grid1_beg_ind[iDim] = atoi(subtoken);
+        if(iIdx == 1) grid1_end_ind[iDim] = atoi(subtoken);
+      }
+      cnt++;
+    }
+  }
+
+  free( tile_separator );
+  free( tileContactStr );
+  free( contactMapStr );
+  free( range_index_sep );
+
+  /* Make sure the cnt has reached 
+   * cnt = (beg, end) * (tile contact0, tile contact 1)* ndims */
+  if (cnt !=  2 * 2 * ndims ) {
+    return NCCF_EPARSERANGES;
+  }
+  else {
+    return NC_NOERR;
+  }
+}
diff --git a/gridspec_api/mosaic/nccf_inq_mosaic_ncontacts.c b/gridspec_api/mosaic/nccf_inq_mosaic_ncontacts.c
new file mode 100644
index 0000000..5bd0495
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_inq_mosaic_ncontacts.c
@@ -0,0 +1,26 @@
+/*
+ * $Id: nccf_inq_mosaic_ncontacts.c 737 2011-05-06 17:48:14Z edhartnett $
+ * 
+ */
+
+#include <nccf_mosaic.h>
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Inquire the number of contacts from the mosaic. 
+ *
+ * \param mosaicid mosaic file ID
+ * \param ncontacts number of contacts
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_mosaic_ncontacts(int mosaicid, int *ncontacts) {
+
+  struct nccf_mosaic_type *self;
+  self = nccf_li_find(&CFLIST_MOSAIC, mosaicid);
+
+  *ncontacts = self->ncontacts;
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/mosaic/nccf_inq_mosaic_ndims.c b/gridspec_api/mosaic/nccf_inq_mosaic_ndims.c
new file mode 100644
index 0000000..0b8d806
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_inq_mosaic_ndims.c
@@ -0,0 +1,27 @@
+/*
+ * $Id: nccf_inq_mosaic_ndims.c 737 2011-05-06 17:48:14Z edhartnett $
+ * 
+ */
+
+#include <nccf_mosaic.h>
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Get the number of dims.
+ *
+ * \param mosaicid a mosaic ID (e.g. returned by nccf_def_mosaic)
+ * \param ndims number of dims for the coordinates (output)
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_mosaic_ndims(int mosaicid, int *ndims) {
+
+  struct nccf_mosaic_type *self;
+  self = nccf_li_find(&CFLIST_MOSAIC, mosaicid);
+
+  *ndims = self->ndims;
+
+  return NC_NOERR;
+  
+}
diff --git a/gridspec_api/mosaic/nccf_inq_mosaic_ngrids.c b/gridspec_api/mosaic/nccf_inq_mosaic_ngrids.c
new file mode 100644
index 0000000..46ccf82
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_inq_mosaic_ngrids.c
@@ -0,0 +1,27 @@
+/*
+ * $Id: nccf_inq_mosaic_ngrids.c 737 2011-05-06 17:48:14Z edhartnett $
+ * 
+ */
+
+#include <nccf_mosaic.h>
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Get the number of grids.
+ *
+ * \param mosaicid a mosaic ID (e.g. returned by nccf_def_mosaic)
+ * \param ngrids number of grids (output)
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_mosaic_ngrids(int mosaicid, int *ngrids) {
+
+  struct nccf_mosaic_type *self;
+  self = nccf_li_find(&CFLIST_MOSAIC, mosaicid);
+
+  *ngrids = self->ngrids;
+
+  return NC_NOERR;
+  
+}
diff --git a/gridspec_api/mosaic/nccf_inq_mosaic_tilecontact.c b/gridspec_api/mosaic/nccf_inq_mosaic_tilecontact.c
new file mode 100644
index 0000000..90bdbd4
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_inq_mosaic_tilecontact.c
@@ -0,0 +1,37 @@
+/*
+ * $Id: nccf_inq_mosaic_tilecontact.c 756 2011-05-13 20:49:57Z dkindig $
+ *
+ */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <string.h>
+#include <libcf_src.h>
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Get a tile to tile contact from an index, i.e. "grid0 | grid1".
+ *
+ * \param mosaicid Mosaic object ID
+ * \param index Contact map index
+ * \param tile_contact Returned tile contacts
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_mosaic_tilecontact( int mosaicid, int index, char *tile_contact){
+
+  struct nccf_mosaic_type *self;
+  self = nccf_li_find(&CFLIST_MOSAIC, mosaicid);
+
+  char *cn_ptr;
+  int *dims;
+  
+  nccf_varGetDataPtr( &self->gridToGrid, (void**)&cn_ptr );
+  nccf_varGetDimsPtr( &self->gridToGrid, &dims );
+  strcpy( tile_contact, &cn_ptr[index*dims[1]] );
+
+  return NC_NOERR;
+
+}
+
diff --git a/gridspec_api/mosaic/nccf_inq_mosaic_tileseparator.c b/gridspec_api/mosaic/nccf_inq_mosaic_tileseparator.c
new file mode 100644
index 0000000..84bc1aa
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_inq_mosaic_tileseparator.c
@@ -0,0 +1,29 @@
+/*
+ * $Id: nccf_inq_mosaic_tileseparator.c 756 2011-05-13 20:49:57Z dkindig $
+ *
+ */
+ 
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <string.h>
+#include <libcf_src.h>
+#include "nccf_constants.h"
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Get the separator for the contact_map and tile_contacts.
+ *
+ * \param tile_separator Returned string CF_TILE_SEPARATOR
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_inq_mosaic_tileseparator( char *tile_separator){
+
+  strcpy( tile_separator, CF_TILE_SEPARATOR );
+
+  return NC_NOERR;
+
+}
+
+
diff --git a/gridspec_api/mosaic/nccf_mosaic.h b/gridspec_api/mosaic/nccf_mosaic.h
new file mode 100644
index 0000000..f0cc6b6
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_mosaic.h
@@ -0,0 +1,122 @@
+/*
+ * API for mosaic objects
+ *
+ * $Id: nccf_mosaic.h 835 2011-09-15 01:00:55Z pletzer $
+ *
+ */
+
+#ifndef _NCCF_MOSAIC_H
+#define _NCCF_MOSAIC_H
+
+#include <netcdf.h>
+#include <libcf_src.h>
+#include <cflistitem.h>
+#include <nccf_varObj.h>
+#include <nccf_handle_error.h>
+#include <nccf_grid.h>
+#include <nccf_coord.h>
+#include <nccf_constants.h>
+
+#define CF_MOSAIC_COORDINATE_NAME    "gridspec_coordinate_names"
+#define CF_MOSAIC_TILE_NAMES         "tile_names"
+#define CF_MOSAIC_TILE_CONTACTS      "tile_contacts"
+#define CF_MOSAIC_CONTACT_MAP        "contact_map"
+
+extern struct CFLISTITEM *CFLIST_MOSAIC;
+
+struct nccf_mosaic_type {
+
+  /* Name of object */
+  char *name;
+
+  /* NetCDF like variable objects */
+  struct nccf_var_obj *coordnames;
+  struct nccf_var_obj *gridNames;
+  struct nccf_var_obj *gridToGrid;
+  struct nccf_var_obj *contactIndex;
+
+  /* Permanent data containers
+     for the above nccf_var_obj objects */
+  char *coordnamesbuffer;
+  char *gridnamesbuffer;
+  char *gridtogridbuffer;
+  char *contactindexbuffer;
+
+  struct CFLISTITEM *coordnameslist;
+  struct CFLISTITEM *gridnameslist;
+  struct CFLISTITEM *gridtogridlist;
+  struct CFLISTITEM *contactindexlist;
+
+  /* Number of dimensions */
+  int ndims;
+
+  /* number of grids (or tiles) */
+  int ngrids;
+
+  /* number of mosaic */
+  int ncontacts;
+
+  /* Slice Format */
+  char *gs_slice_format;
+
+  /* unique grid identifiers (for checking consistency) */
+  int *gridids;
+
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int nccf_def_mosaic( int ngrids, const int gridids[], const char *name,
+                     int *mosaicid);
+
+int nccf_def_mosaic_from_file(const char *filename, const char *name,
+      int *mosaicid);
+
+int nccf_free_mosaic(int mosaicid);
+
+int nccf_put_mosaic(int ncid, int mosaicid);
+
+int nccf_set_mosaic_contact( int mosaicid, int ndims, 
+				 int gridid0, int gridid1,
+				 int grid0_beg_ind[], int grid0_end_ind[], 
+				 int grid1_beg_ind[], int grid1_end_ind[]);
+
+int nccf_compute_mosaic_contacts( int mosaicid, const double period[] );
+
+int nccf_inq_mosaic_ngrids(int mosaicid, int *ngrids);
+
+int nccf_inq_mosaic_ndims(int mosaicid, int *ndims);
+
+int nccf_inq_mosaic_coordnames( int mosaicid, char **coordnames );
+
+int nccf_inq_mosaic_gridranges( int mosaicid, int index, 
+				 int *gridid0, int *gridid1,
+				 int grid0_beg_ind[], int grid0_end_ind[], 
+				 int grid1_beg_ind[], int grid1_end_ind[]);
+
+int nccf_inq_mosaic_gridids(int mosaicid, int gridids[]);
+
+int nccf_inq_mosaic_gridname(int mosaicid, int index, char *file);
+
+int nccf_add_mosaic_att( int mosaicid, const char *name,
+                          const char *value );
+
+int nccf_inq_mosaic_ncontacts( int ncid, int *ncontacts );
+
+int nccf_inq_mosaic_contactmap(int mosaicid, int index, char *contact_map);
+
+int nccf_inq_mosaic_tilecontact(int mosaicid, int index, char *contact_map);
+
+int nccf_inq_mosaic_tileseparator(char *tile_separator);
+
+int nccf_print_mosaic_as_polytopes(int mosaicid, const char *file_name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NCCF_MOSAIC_H */
+
+
diff --git a/gridspec_api/mosaic/nccf_print_mosaic_as_polytopes.c b/gridspec_api/mosaic/nccf_print_mosaic_as_polytopes.c
new file mode 100644
index 0000000..3f056a5
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_print_mosaic_as_polytopes.c
@@ -0,0 +1,360 @@
+
+#include "nccf_mosaic.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "cflistitem.h"
+#include <libcf_src.h>
+#include "nccf_varObj.h"
+#include "nccf_errors.h"
+/**
+ * $Id: nccf_print_mosaic_as_polytopes.c 737 2011-05-06 17:48:14Z edhartnett $
+ */
+
+struct polytope{
+   int id;
+   int n_supers;
+   int supers[2];
+};
+
+inline double sq(double x){return x*x;}
+
+#define nccf_print_mosaic_as_polytopes_debug
+#ifdef nccf_print_mosaic_as_polytopes_debug
+ #define TRD(x) fprintf(stderr,#x "=%le\n",x);
+   #define TRI(x) fprintf(stderr,#x "=%i\n",x);
+   #define TRA(x) fprintf(stderr,#x "=%03.1lf deg\n",x*180/M_PI);
+#else
+   #define TRD(x)
+   #define TRI(x)
+   #define TRA(x)
+#endif
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Create a polytope file for plotting tile connectivity.
+ *
+ * \param contacts_id mosaic ID
+ * \param file_name the .pt file name
+ * \return NC_NOERR on success
+ *
+ * \author Andrey Sobol and David Kindig, Tech-X Corp.
+ */
+int nccf_print_mosaic_as_polytopes(int contacts_id, const char *file_name){
+
+   /* Use C index ordering */
+   double spread=0.1;
+   int poly_id; // This has nothing to do with nccf.
+   int root_poly_id;
+   FILE *f=fopen(file_name,"w");
+   int g; // grid index
+   int d; // dimension index
+   int rgb_list_size=6;
+   double rgb_list[][3]=
+     {  {1.0,0.5,0.25},
+        {0.5,1.0,0.25},
+        {1.0,0.25,0.5},
+        {0.5,0.25,1.0},
+        {0.25,1.0,0.5},
+        {0.25,0.5,1.0},
+     }
+   ;
+
+   int n_grids, n_dims;
+
+   nccf_inq_mosaic_ngrids(contacts_id,&n_grids);
+   int *grid=malloc(n_grids*sizeof(int));
+   nccf_inq_mosaic_gridids(contacts_id,grid);
+
+   /*  determining the number of dimensions. */
+   nccf_inq_grid_ndims(grid[0],&n_dims);
+
+   int *coord=malloc(sizeof(int)*n_dims);
+
+   /* moments and shifts that are used to push the tiles apart */
+   double *m0=malloc(n_grids*  sizeof(double));
+   double *m1=malloc(n_grids*n_dims*sizeof(double));
+   double m0t,m1t[n_dims];
+   int dim[n_dims];
+   int i;
+
+
+   /* counting 0-polytopes i.e. How many vertices? */
+
+   int n_vertices=0;
+   for(g=0;g<n_grids;g++){
+       nccf_inq_grid_coordids(grid[g],coord);
+       nccf_inq_coord_dims(coord[0],dim);
+       int nv=1;
+       for(d=0;d<n_dims;d++){
+         nv*=dim[d];
+       }
+       n_vertices+=nv;
+   }
+
+   struct polytope * poly=malloc(sizeof(struct polytope)*n_vertices);
+
+   /* initialize the 0-polytopes */
+   /* and calculating the moments: */
+   m0t=0;
+   for(d=0;d<n_dims;d++){
+      m1t[d]=0;
+   }
+
+   poly_id=0;
+   for(g=0;g<n_grids;g++){
+      nccf_inq_grid_coordids(grid[g],coord);
+      nccf_inq_coord_dims(coord[0],dim);
+      int nv=1;
+      double * data[n_dims];
+      for(d=0;d<n_dims;d++){
+         m1[g*n_dims+d]=0;
+         nv*=dim[d];
+         nccf_get_coord_data_pointer(coord[d],&data[d]);
+      }
+      for(i=0;i<nv;i++){
+         //TRI(poly_id);
+         poly[poly_id].n_supers=0;
+         poly[poly_id].id=poly_id;
+         poly_id++;
+         for(d=0;d<n_dims;d++){
+            m1[g*n_dims+d]+=data[d][i];
+         }
+      }
+      m0[g]=nv;
+      m0t+=m0[g];
+      for(d=0;d<n_dims;d++){
+         m1t[d]+=m1[g*n_dims+d];
+         m1[g*n_dims+d]/=m0[g];
+      }
+   }
+   for(d=0;d<n_dims;d++){
+      m1t[d]/=m0t;
+   }
+
+   /*  process the contacts */
+   int n_contacts,n_edges;
+   nccf_inq_mosaic_ncontacts(contacts_id,&n_contacts);
+   //TRI(n_contacts);
+   //contact=malloc(n_contacts*sizeof(int));
+
+   /* calculate the number of edges for each cell along the contact edge */
+   /*  index ranges */
+   int ij0_min[n_dims],ij0_max[n_dims],ij1_min[n_dims],ij1_max[n_dims];
+   n_edges=0;
+   int cfo = 0;
+   for(i=0;i<n_contacts;i++){
+      int ne = 1;
+      int tile0,tile1;
+
+      nccf_inq_mosaic_gridranges(contacts_id, i,
+                                  &tile0, &tile1,
+                                  ij0_min, ij0_max, ij1_min, ij1_max);
+
+      /* DNK removed +1 from this calc to get it to "C" order*/
+      for(d=0;d<n_dims;d++){
+         ne*=(ij0_max[d]-ij0_min[d]+cfo);
+      }
+      n_edges+=ne;
+   }
+
+   root_poly_id=n_vertices+n_edges;
+
+   poly_id=n_vertices;
+   for(i=0;i<n_contacts;i++){
+      int tile0,tile1;
+
+      /*  index ranges */
+//      int ij0_min[n_dims],ij0_max[n_dims],ij1_min[n_dims],ij1_max[n_dims];
+      int i0_inc[n_dims],i1_inc[n_dims];
+      if( i == 6 ){
+        tile0 = tile0;
+      }
+
+      nccf_inq_mosaic_gridranges(contacts_id,i,
+                                  &tile0,&tile1,
+                                  ij0_min,ij0_max,ij1_min,ij1_max);
+
+      for(d=0;d<n_dims;d++){
+         i0_inc[d]=ij0_min[d]<=ij0_max[d]?1:-1;
+         i1_inc[d]=ij1_min[d]<=ij1_max[d]?1:-1;
+      }
+
+      /*  this is vertex ID offset */
+      int vio0=0,vio1=0;   
+      
+      /*  these are the dimensions of the grid */
+      int dim0[d],dim1[d];
+
+      int found;
+      found=0;
+      for(g=0;g<n_grids;g++){
+         nccf_inq_grid_coordids(grid[g],coord);
+         nccf_inq_coord_dims(coord[0],dim);
+         if (grid[g]==tile0){
+            nccf_inq_coord_dims(coord[0],dim0);
+            found=1;
+            break;
+         }
+         int nv=1;
+         for(d=0;d<n_dims;d++){
+           nv*=dim[d];
+         }
+         vio0+=nv;
+      }
+      if (!found) {
+         printf("Error: I was not able to match a tile with its id in"
+                " nccf_print_mosaic_as_polytopes (tile0_id=%i)\n",tile0);
+         return 1;
+      }
+      if (vio0 >= n_vertices) return NCCF_EVERTMISMATCH;
+
+      found=0;
+      for(g=0;g<n_grids;g++){
+         nccf_inq_grid_coordids(grid[g],coord);
+         nccf_inq_coord_dims(coord[0],dim);
+         if (grid[g]==tile1){
+            nccf_inq_coord_dims(coord[0],dim1);
+            found=1;
+            break;
+         }
+         int nv=1;
+         for(d=0;d<n_dims;d++){
+           nv*=dim[d];
+         }
+         vio1+=nv;
+      }
+      if (vio1 >= n_vertices) return NCCF_EVERTMISMATCH;
+      if (!found) {
+         printf("Error: I was not able to match a tile with its id in"
+                " nccf_print_mosaic_as_polytopes (tile1_id=%i)\n",tile1);
+         return NCCF_EVERTMISMATCH;
+      }
+      //TRI(tile0);
+      //TRI(tile1);
+      //TRI(vio0);
+      //TRI(vio1);
+      // assign the ranges here
+
+      int i0[d],i1[d];
+      for(d=0;d<n_dims;d++){
+         i0[d]=ij0_min[d];
+         i1[d]=ij1_min[d];
+      }
+      int done=0;
+      while(!done){
+         int vid[2];
+         vid[0]=vio0;
+         vid[1]=vio1;
+         int k0=1,k1=1;
+//         for(d=n_dims-1;d>=0;d--){  // Fortran order
+         for(d=0;d<n_dims;d++){       // C order
+            vid[0]+=k0*(i0[d]);
+            vid[1]+=k1*(i1[d]);
+            k0*=dim0[d];
+            k1*=dim1[d];
+         }
+         if (vid[0]>=n_vertices || vid[1]>=n_vertices){
+            TRI(vid[0]);
+            TRI(vid[1]);
+            for(d=0;d<n_dims;d++) TRI(i0[d]);
+            for(d=0;d<n_dims;d++) TRI(i1[d]);
+            TRI(tile0);
+            TRI(tile1);
+            TRI(n_vertices);
+            for(g=0;g<n_grids;g++) TRI(grid[g]);
+            exit(1);
+         }
+         int k;
+         for(k=0;k<2;k++){
+            int si=poly[vid[k]].n_supers;
+            poly[vid[k]].supers[si]=poly_id;
+            poly[vid[k]].n_supers++;
+         }
+         fprintf(f,"polytope %i\n",poly_id);
+         fprintf(f,"facets %i %i\n",vid[0],vid[1]);
+         //fprintf(f,"supers %i\n",root_poly_id);
+         poly_id++;
+
+         // update i0:
+
+         // Fortran
+//       for(d=n_dims-1;d>=0 && i0[d]*i0_inc[d]>=ij0_max[d]*i0_inc[d];d--){
+         // C
+         for(d=0;d < n_dims && i0[d]*i0_inc[d]>=(ij0_max[d]-1)*i0_inc[d];d++){
+            i0[d]=ij0_min[d];
+         }
+//         if (d>=0){  // Fortran
+         if (d<n_dims){  // C
+            i0[d]+=i0_inc[d];
+         } else {
+            break;
+         }
+         // update i1:
+
+         // Fortran
+//       for(d=n_dims-1;d>=0 && i1[d]*i1_inc[d]>=ij1_max[d]*i1_inc[d];d--){
+         // C
+         for(d=0;d < n_dims && i1[d]*i1_inc[d]>=(ij1_max[d]-1)*i1_inc[d];d++){
+            i1[d]=ij1_min[d];
+         }
+//         if (d>=0){    // F
+         if (d<n_dims){    // C
+            i1[d]+=i1_inc[d];
+         } else {
+            break;
+         }
+      }
+   }
+   //TRI(poly_id);
+
+
+   // printing out the vertices:
+   poly_id=0;
+   for(g=0;g<n_grids;g++){
+       // int i,j,k,dim[2];
+       int dim[2];
+       double * coord_data[n_dims];
+       nccf_inq_grid_coordids(grid[g],coord);
+       nccf_inq_coord_dims(coord[0],dim);
+       for(d=0;d<n_dims;d++){
+         nccf_get_coord_data_pointer(coord[d],&coord_data[d]);
+       }
+       double dx[n_dims];
+       int nv=1;
+       for(d=0;d<n_dims;d++) {
+         dx[d]=(m1[n_dims*g+d]-m1t[d])*spread;
+         nv*=dim[d];
+       }
+       int k;
+       for(k=0;k<nv;k++){
+            fprintf(f,"polytope %i\n",poly_id);
+            //if (poly[poly_id].n_supers>0){
+            //   fprintf(f,"supers");
+            //   for(k=0;k<poly[poly_id].n_supers;k++){
+            //      fprintf(f," %i",poly[poly_id].supers[k]);
+            //   }
+            //   fprintf(f,"\n");
+            //}
+            fprintf(f,"coords");
+            for(d=0;d<n_dims;d++) fprintf(f," %le",coord_data[d][k]+dx[d]);
+            for(   ;d<3     ;d++) fprintf(f," %le",0.0);
+            const double *rgb=rgb_list[g%rgb_list_size];
+            fprintf(f,"\nvalues %le %le %le\n\n",rgb[0],rgb[1],rgb[2]);
+            poly_id++;
+       }
+   }
+   fprintf(f,"polytope %i\nfacets",root_poly_id);
+   for(i=0;i<n_edges;i++){
+      fprintf(f," %i",i+n_vertices);
+   }
+   fprintf(f,"\n");
+   fclose(f);
+   free(grid);
+   free(coord);
+   free(m0);
+   free(m1);
+   free(poly);
+   return 0;
+}
+
diff --git a/gridspec_api/mosaic/nccf_put_mosaic.c b/gridspec_api/mosaic/nccf_put_mosaic.c
new file mode 100644
index 0000000..f842962
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_put_mosaic.c
@@ -0,0 +1,110 @@
+/*
+ * $Id: nccf_put_mosaic.c 767 2011-06-06 23:20:19Z pletzer $
+ *
+ */
+
+#include <nccf_mosaic.h>
+#include <string.h>
+#include <stdio.h>
+
+void nccf_set_data( int ndims, char *buffer, 
+                    struct CFLISTITEM *currlist, 
+                    struct nccf_var_obj *currobj ){
+  int count = 0, index;
+  nccf_li_begin( &currlist );
+  while( nccf_li_next( &currlist )){
+    index = nccf_li_get_id( &currlist);
+    char *val = nccf_li_find( &currlist, index );
+    strcpy( &buffer[count * STRING_SIZE], val );
+    count++;
+  }
+  nccf_varSetDataPtr( &currobj, NC_CHAR, buffer );
+}
+
+/**
+ * \ingroup gs_mosaic_grp
+ * Write mosaic to netcdf file.
+ *
+ * \param mosaicid mosaic ID
+ * \param ncid netcdf file ID
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+
+int nccf_put_mosaic(int mosaicid, int ncid) {
+
+  int status = NC_NOERR;
+  struct nccf_mosaic_type *self;
+  self = nccf_li_find( &CFLIST_MOSAIC, mosaicid );
+
+  /* Create the dimensions for the netcdf file */
+  int cndim[] = {0, 0}, gfdim[] = {0, 0}, contact_dims[2];
+  cndim[0] = self->ndims;
+  cndim[1] = STRING_SIZE;
+  gfdim[0] = self->ngrids;
+  gfdim[1] = STRING_SIZE;
+  contact_dims[0] = self->ncontacts;
+  contact_dims[1] = STRING_SIZE;
+
+  const char *dimListcoordnames[] = {CF_DIMNAME_NDIMS, CF_DIMNAME_STRING};
+  const char *dimListgridFiles[] = {CF_DIMNAME_NGRIDS, CF_DIMNAME_STRING};
+  const char *dimNames[] = {CF_DIMNAME_NCONTACTS, CF_DIMNAME_STRING};
+
+  /* Buffer strings */
+  char *coordbuffer = (char*)calloc( self->ndims, STRING_SIZE * sizeof(char));
+  char *gridbuffer = (char*)calloc( self->ngrids, STRING_SIZE * sizeof(char));
+  char *contactbuffer = (char*)calloc( self->ncontacts, STRING_SIZE * sizeof(char));
+  char *grid2gridbuffer = (char*)calloc( self->ncontacts, STRING_SIZE * sizeof(char));
+
+  /* Create the Coordinate names variable */
+  nccf_varCreate( &self->coordnames, CF_MOSAIC_COORDINATE_NAME );
+  nccf_varSetAttribText( &self->coordnames, CF_ATTNAME_CF_TYPE_NAME, 
+                        CF_GS_MOSAIC_COORDINATE_NAME );
+  nccf_varSetDims( &self->coordnames, 2, cndim, dimListcoordnames );
+  nccf_set_data( self->ndims, coordbuffer, self->coordnameslist, self->coordnames );
+
+  /* Create the grid to grid contacts */
+  nccf_varCreate( &self->gridToGrid, CF_MOSAIC_TILE_CONTACTS );
+  nccf_varSetAttribText( &self->gridToGrid, CF_ATTNAME_CF_TYPE_NAME, 
+      CF_GS_MOSAIC_TILE_CONTACTS );
+  nccf_varSetDims( &self->gridToGrid, 2, contact_dims, (const char **) dimNames );
+  nccf_set_data( self->ncontacts, grid2gridbuffer, self->gridtogridlist, 
+                 self->gridToGrid );
+
+  /* Create the Grid Names variable */
+  nccf_varCreate( &self->gridNames, CF_MOSAIC_TILE_NAMES );
+  nccf_varSetAttribText( &self->gridNames, CF_ATTNAME_CF_TYPE_NAME, 
+      CF_GS_MOSAIC_TILE_NAMES );
+  nccf_varSetDims( &self->gridNames, 2, gfdim, dimListgridFiles );
+  nccf_set_data( self->ngrids, gridbuffer, self->gridnameslist, self->gridNames );
+
+  /* Create the contact index map */
+  nccf_varCreate( &self->contactIndex, CF_MOSAIC_CONTACT_MAP );
+  nccf_varSetAttribText( &self->contactIndex, CF_ATTNAME_CF_TYPE_NAME, 
+      CF_GS_MOSAIC_CONTACT_MAP );
+  nccf_varSetAttribText( &self->contactIndex, CF_CONTACT_FORMAT,
+      self->gs_slice_format );
+  nccf_varSetDims( &self->contactIndex, 2, contact_dims, (const char **) dimNames );
+  nccf_set_data( self->ncontacts, contactbuffer, self->contactindexlist, 
+                 self->contactIndex );
+
+  /* Set the save flag for each of the data pointers so they are free'd on destroy */
+  self->gridNames->save = 1;
+  self->gridToGrid->save = 1;
+  self->coordnames->save = 1;
+  self->contactIndex->save = 1;
+
+  nccf_writeListOfVars( ncid, 1, self->coordnames );
+  nccf_writeListOfVars( ncid, 1, self->gridNames );
+  if( self->ncontacts > 0 ){
+    nccf_writeListOfVars( ncid, 2, self->contactIndex, self->gridToGrid );
+  }
+
+//  free( coordbuffer );
+//  free( gridbuffer );
+//  free( contactbuffer );
+//  free( grid2gridbuffer );
+
+  return status;
+}
diff --git a/gridspec_api/mosaic/nccf_set_mosaic_contact.c b/gridspec_api/mosaic/nccf_set_mosaic_contact.c
new file mode 100644
index 0000000..676512d
--- /dev/null
+++ b/gridspec_api/mosaic/nccf_set_mosaic_contact.c
@@ -0,0 +1,142 @@
+/********************************************************
+  * Set the contact indices for a given contact.
+  *
+  * $Id: nccf_set_mosaic_contact.c 845 2011-10-04 18:14:07Z pletzer $
+  *
+  */
+
+#include <stdio.h>
+#include <string.h>
+#include "nccf_mosaic.h"
+#include <libcf_src.h>
+
+/* Convert the start_indices/end_indices into a string slice */
+void nccf_make_slice( int ndims, int bind[], int eind[], char *slice ){
+  char *iBegStr, *iEndStr;
+  char range[STRING_SIZE];
+  int i;
+
+  strcpy( slice, "\0" );
+  iBegStr = (char*)calloc( STRING_SIZE, sizeof(char) );
+  iEndStr = (char*)calloc( STRING_SIZE, sizeof(char) );
+
+  for (i = 0; i < ndims; ++i) {
+    sprintf(iBegStr, "%d", bind[i]);
+    sprintf(iEndStr, "%d", eind[i]);
+    strcpy(range, iBegStr);
+    strcat(range, CF_RANGE_SEPARATOR);
+    strcat(range, iEndStr);
+    if (i < ndims - 1) {
+      strcat(range, CF_INDEX_SEPARATOR);
+    }
+    strcat(slice, range);
+  }
+
+  free( iBegStr );
+  free( iEndStr );
+}
+
+int nccf_item_comparison( const void *A, const void *B ){
+  int result;
+  char *string1, *string2;
+  string1 = (char*)calloc( strlen((char*)A )+1, sizeof(char) );
+  string2 = (char*)calloc( strlen((char*)B )+1, sizeof(char) );
+  strcpy( string1, (char*)A );
+  strcpy( string2, (char*)B );
+
+  if( strcmp( string1, string2 ) <  0 ) result = -1;
+  if( strcmp( string1, string2 ) >  0 ) result =  1;
+  if( strcmp( string1, string2 ) == 0 ) result =  0;
+
+  free( string1 );
+  free( string2 );
+
+  return result;
+
+}
+
+void nccf_local_pop_list( struct CFLISTITEM *list, char *string ){
+  if( nccf_li_get_nelem( &list ) == 0 ){
+    nccf_li_add( &list, string );
+  }
+  else{
+    nccf_li_insert( &list, string, &nccf_item_comparison, 1 );
+  }
+}
+
+/**
+ * \ingroup gs_mosaic_grp
+  * Set the contact indices for a given contact.
+ *
+ * \param mosaicid Mosaic object ID
+ * \param ndims Number of dimensions
+ * \param grididA The grid id for the first grid ( tile )
+ * \param grididB The grid id for the second grid ( tile )
+ * \param gridA_beg_ind Vector containing ndims of grid id A beginning indices
+ * \param gridB_beg_ind Vector containing ndims of grid id B beginning indices
+ * \param gridA_end_ind Vector containing ndims of grid id A ending indices
+ * \param gridB_end_ind Vector containing ndims of grid id B ending indices
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_set_mosaic_contact( int mosaicid, int ndims, 
+         int grididA, int grididB,
+         int gridA_beg_ind[], int gridA_end_ind[], 
+         int gridB_beg_ind[], int gridB_end_ind[]){
+
+
+  struct nccf_mosaic_type *self;
+  self = nccf_li_find(&CFLIST_MOSAIC, mosaicid);
+  self->ndims = ndims;
+
+  int status = NC_NOERR, i;
+  char *sliceA, *sliceB, *contactMap, *gridMap;
+  char *gridnameA, *gridnameB;
+  char *coordnames, *coordname;
+
+  /* Build the contact index map */
+  sliceA = (char*)calloc( STRING_SIZE, sizeof(char) );
+  sliceB = (char*)calloc( STRING_SIZE, sizeof(char) );
+
+  nccf_make_slice( ndims, gridA_beg_ind, gridA_end_ind, sliceA );
+  nccf_make_slice( ndims, gridB_beg_ind, gridB_end_ind, sliceB );
+
+  contactMap = (char*)calloc( STRING_SIZE, sizeof(char) );
+  sprintf( contactMap, "%s%s%s", sliceA, CF_TILE_SEPARATOR, sliceB );
+
+  /* Build tile contact map */
+  gridnameA = (char*)calloc( STRING_SIZE, sizeof(char) );
+  gridnameB = (char*)calloc( STRING_SIZE, sizeof(char) );
+  if (( status = nccf_inq_grid_name( grididA, gridnameA ))) ERR;
+  if (( status = nccf_inq_grid_name( grididB, gridnameB ))) ERR;
+
+  gridMap = (char*)calloc( STRING_SIZE, sizeof(char) );
+  sprintf( gridMap, "%s%s%s", gridnameA, CF_TILE_SEPARATOR, gridnameB );
+
+  /* Get the coordinate names */
+  status = nccf_inq_grid_ndims( grididA, &ndims );
+  coordnames = (char*)calloc( ndims, STRING_SIZE * sizeof(char) );
+  status = nccf_inq_grid_coordnames( grididA, coordnames );
+
+  /* Add the maps to the appropriate list in mosaic */
+  for( i = 0; i < ndims; i++ ){
+    coordname = (char*)calloc( STRING_SIZE, sizeof(char) );
+    strcpy( coordname, &coordnames[i * STRING_SIZE] );
+    nccf_local_pop_list( self->coordnameslist, coordname );
+  }
+  nccf_local_pop_list( self->gridnameslist, gridnameA );
+  nccf_local_pop_list( self->gridnameslist, gridnameB );
+  nccf_local_pop_list( self->contactindexlist, contactMap );
+  nccf_local_pop_list( self->gridtogridlist, gridMap );
+
+  /* Update the number of contacts */
+  self->ncontacts++;
+
+  free( coordnames );
+  free( sliceA );
+  free( sliceB );
+
+  return status;
+
+}
diff --git a/gridspec_api/mosaic/tst_1d_mosaic.c b/gridspec_api/mosaic/tst_1d_mosaic.c
new file mode 100644
index 0000000..2bfc763
--- /dev/null
+++ b/gridspec_api/mosaic/tst_1d_mosaic.c
@@ -0,0 +1,104 @@
+/**
+ * Test generation of a structured grid and write a mosaic file.
+ *
+ * "$Id: tst_1d_mosaic.c 767 2011-06-06 23:20:19Z pletzer $"
+ *
+ */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <netcdf.h>
+#include "libcf_src.h"
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_coord.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+
+int main(){
+
+  const int save = 1;
+  const int ndims = 1;
+  const int dims[] = {10};
+  const double lonMin[] = {0.0, 180.};
+  const double lonMax[] = {180.0, 360.};
+  double dLon;
+  int nvertex = dims[0];
+  double lonData[nvertex];
+  int ngrids = 2;
+  double period[] = {0.};
+  char coordinates_id[36+1];
+
+  nc_type nc_mode = NC_CLOBBER;
+  int i, j;
+  int coordIds[ngrids][ndims], gridid[ngrids], mosaicid, globalId;
+  int status, ncid;
+
+  char name[STRING_SIZE];
+  char filename[STRING_SIZE];
+  const char *dimnames[] = {"ni"};
+
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+
+  /* Populate coordinates and create lon/lat coordinate objects */
+  for( j = 0; j < ngrids; j++ ){
+    dLon = (lonMax[j] - lonMin[j]) / (dims[0] - 1);
+    for (i = 0; i < dims[0]; ++i) {
+      lonData[i] = lonMin[j] + i * dLon;
+    }
+    if ((status = nccf_def_lon_coord(ndims, dims, dimnames, lonData,
+                    save, &coordIds[j][0]))) ERR;
+
+    /* Create grid */
+    sprintf( name, "%s_grid%d", "grid_1d", j);
+    sprintf( filename, "%s.nc", name );
+    if ((status = nccf_def_grid(coordIds[j], name, &gridid[j]))) ERR;
+    if(( status = nccf_def_global( &globalId ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+    /* Write to file */
+    if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+    if(( status = nccf_put_grid(gridid[j], ncid))) ERR;
+    if(( status = nccf_put_global(globalId, ncid))) ERR;
+    if(( status = nc_close( ncid ))) ERR;
+
+    if(( status = nccf_free_global( globalId ))) ERR;
+
+  }
+
+  /* Write the mosaic file */
+  ncid = -1;
+  if(( status = nccf_def_mosaic( ngrids, gridid, name, &mosaicid ))) ERR;
+  if(( status = nccf_compute_mosaic_contacts( mosaicid, period ))) ERR;
+  sprintf( filename, "%s%s.nc", name, CF_FILENAME_MOSAIC );
+  sprintf( filename, "%s%s.nc", "test_", CF_FILENAME_MOSAIC );
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0 ))) ERR;
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+
+  /* write mosaic as polytopes */
+//  nccf_print_mosaic_as_polytopes(mosaicid,"1d_mosaic.pt");
+
+  /* Free */
+  for ( j = 0; j < ngrids; j++ ){
+    if (( status = nccf_free_grid(gridid[j]))) ERR;
+    if (( status = nccf_free_coord( coordIds[j][0] ))) ERR;
+  }
+
+  if(( status = nccf_free_global( globalId ))) ERR;
+  printf( "Befor free\n" );
+  if(( status = nccf_free_mosaic( mosaicid ))) ERR;
+  printf( "After free\n" );
+
+  return 0;
+
+}
diff --git a/gridspec_api/mosaic/tst_big_dimsizes.c b/gridspec_api/mosaic/tst_big_dimsizes.c
new file mode 100644
index 0000000..125b05d
--- /dev/null
+++ b/gridspec_api/mosaic/tst_big_dimsizes.c
@@ -0,0 +1,111 @@
+/**
+ * Test building a grid with large dimension sizes.
+ *
+ * "$Id: tst_big_dimsizes.c 767 2011-06-06 23:20:19Z pletzer $"
+ *
+ */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <netcdf.h>
+#include "libcf_src.h"
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_coord.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+
+int main(){
+
+  const int save = 0;
+  const int ndims = 2;
+
+  /* Define a large grid */
+  const int dims[] = {1000, 1000};
+
+  const long nvertex = dims[0] * dims[1];
+  const double lonMin = 0.0;
+  const double lonMax = 360.0;
+  const double latMin = -90.0;
+  const double latMax = +90.0;
+  double dLon, dLat;
+  double *lonData;
+  double *latData;
+  double period[] = {360.0, 0.0};
+  int gridid, globalId, mosaicid;
+  int coordIds[ndims];
+  char coordinates_id[36+1];
+
+  lonData = (double *) malloc(nvertex * sizeof(double));
+  latData = (double *) malloc(nvertex * sizeof(double));
+
+  nc_type nc_mode = NC_CLOBBER;
+  int i, j;
+  int status;
+  int ncid;
+  const int ngrids = 1;
+
+  char filename[STRING_SIZE];
+  char name[STRING_SIZE] = "tst_sg_periodic_latlon";
+  const char *dimnames[] = {"ni", "nj"};
+
+  /* Create some coordinates */
+  dLon = (lonMax - lonMin) / (dims[1] - 1);
+  dLat = (latMax - latMin) / (dims[0] - 1);
+  for (j = 0; j < dims[0]; ++j) {
+    for (i = 0; i < dims[1]; ++i) {
+      lonData[i + dims[1] * j] = lonMin + i * dLon;
+      latData[i + dims[1] * j] = latMin + j * dLat;
+    }
+  }
+  if ((status = nccf_def_lon_coord(ndims, dims, dimnames, lonData, save,
+                &coordIds[0]))) ERR;
+  if ((status = nccf_def_lat_coord(ndims, dims, dimnames, latData, save,
+                &coordIds[1]))) ERR;
+
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+
+  /* Create grid */
+  if ((status = 
+       nccf_def_grid(coordIds, name, &gridid ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* Write to file */
+  sprintf( filename, "%s%s.nc", name, CF_FILENAME_GRID );
+  if ((status = nc_create(filename, nc_mode, &ncid))) ERR;
+  if ((status = nccf_put_grid(gridid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid)));
+  if ((status = nc_close(ncid))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+  
+  /* Define the contact file */
+  if(( status = nccf_def_mosaic( ngrids, &gridid, name, &mosaicid ))) ERR;
+  if(( status = nccf_compute_mosaic_contacts( mosaicid, period ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0 ))) ERR;
+
+  /* Write to file */
+  sprintf( filename, "%s%s.nc", name, CF_FILENAME_MOSAIC );
+  if ((status = nc_create(filename, nc_mode, &ncid))) ERR;
+  if ((status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if (( status = nccf_put_global(globalId, ncid)));
+  if ((status = nc_close(ncid))) ERR;
+
+  /* Free */
+  if (( status = nccf_free_global( globalId ))) ERR;
+  if (( status = nccf_free_mosaic( mosaicid ))) ERR;
+  if (( status = nccf_free_grid( gridid ))) ERR;
+  if (( status = nccf_free_coord( coordIds[0] ))) ERR;
+  if (( status = nccf_free_coord( coordIds[1] ))) ERR;
+  free(lonData);
+  free(latData);
+
+  return 0;
+}
diff --git a/gridspec_api/mosaic/tst_bipolar_tripolar_grid.c b/gridspec_api/mosaic/tst_bipolar_tripolar_grid.c
new file mode 100644
index 0000000..0c83075
--- /dev/null
+++ b/gridspec_api/mosaic/tst_bipolar_tripolar_grid.c
@@ -0,0 +1,131 @@
+/*
+ * Test the creation of a tripolar grid and write a mosaic file for it.
+ * \author Dave Kinding and Alexander Pletzer, Tech-X Corp.
+ *
+ * "$Id: tst_bipolar_tripolar_grid.c 767 2011-06-06 23:20:19Z pletzer $"
+ * */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include <libcf_src.h>
+#include <netcdf.h>
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_coord.h"
+#include "nccf_handle_error.h"
+#include "nccf_utility_functions.h"
+
+int main(){
+
+/* Grid variables */
+  const int ndims = 2;
+  const int ngrids = 3;
+  const int bpdims[] = {6, 6}, gldims[] = {6, 6};
+  const int bpnvertex = bpdims[0] * bpdims[1];
+  const int glnvertex = gldims[0] * gldims[1];
+  const double latPerim = 60;
+  const double lonSing = 0.0;
+  double bplons[bpnvertex], bplats[bpnvertex];
+  double gllons[glnvertex], gllats[glnvertex];
+  double dLon, dLat, lonMin[] = {-180, 0}, lonMax[] = {0, 180};
+  double latMin = -90, latMax = latPerim;
+  int i, j, k, status, ncid;
+  const int save = 1;
+  char coordinates_id[36+1];  
+  
+  double period[] = {0., 0.};
+
+// 4 for the lower grid, and 2 for the bipolar grid
+  int gridid[ngrids], coordIds[ngrids][ndims], mosaicid, globalId;
+
+  nc_type nc_mode = NC_CLOBBER;
+
+  char *tname = "3tile_tripolar";
+  char *name, filename[STRING_SIZE];
+  name = ( char * )calloc( STRING_SIZE, sizeof( char ) );
+  sprintf( name, "%s", tname );
+  const char *dimnames[] = {"ni", "nj"};
+  const char *bpdimnames[] = {"bp_ni", "bp_nj"};
+  
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+
+  /* Get the bipolar cap 1 grid */
+  status = nccf_get_bipolar_cap(bpdims, latPerim, lonSing, bplons, bplats);
+
+  /* A two grids below the cap */
+  for( k = 0; k < 2; k++ ){
+    dLon = (lonMax[k] - lonMin[k]) / (gldims[0] - 1);
+    dLat = (latMax    - latMin) / (gldims[1] - 1);
+    for (j = 0; j < gldims[1]; ++j) {
+      for (i = 0; i < gldims[0]; ++i) {
+        gllons[i + gldims[0] * j] = lonMin[k] + i * dLon;
+        gllats[i + gldims[0] * j] = latMin    + j * dLat;
+      }
+    }
+    if ((status = 
+      nccf_def_lon_coord(ndims, gldims, dimnames, gllons, save, &coordIds[k][0]))) ERR;
+    if ((status = 
+      nccf_def_lat_coord(ndims, gldims, dimnames, gllats, save, &coordIds[k][1]))) ERR;
+
+/* Write the grid */
+    sprintf( filename, "%s_grid%d.nc", name, k );
+    if(( status = nccf_def_grid( coordIds[k], name, &gridid[k] )));
+    if(( status = nccf_def_global( &globalId ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+    if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+    if(( status = nccf_put_grid(gridid[k], ncid))) ERR;
+    if(( status = nccf_put_global(globalId, ncid)));
+    if(( status = nc_close( ncid ))) ERR;
+    if(( status = nccf_free_global( globalId ))) ERR;
+
+  }
+
+  if ((status = 
+    nccf_def_lon_coord(ndims, bpdims, bpdimnames, bplons, save, &coordIds[2][0]))) ERR;
+  if ((status = 
+    nccf_def_lat_coord(ndims, bpdims, bpdimnames, bplats, save, &coordIds[2][1]))) ERR;
+
+/* Write the mosaics */
+  sprintf( filename, "%s_grid%d.nc", name, 2 );
+  status = nccf_def_grid( coordIds[2], name, &gridid[k] ); //bipolar cap grid
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_grid(gridid[k], ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+  if(( status = nccf_def_mosaic( ngrids, gridid, name, &mosaicid ))) ERR;
+  if(( status = nccf_compute_mosaic_contacts( mosaicid, period ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0 ))) ERR;
+  sprintf( filename, "%s_mosaics.nc", name );
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid)));
+  if(( status = nc_close( ncid ))) ERR;
+
+/* write mosaic as polytopes */
+//  nccf_print_mosaic_as_polytopes(mosaicid,"tripolar.pt");
+
+  if(( status = nccf_free_global( globalId ))) ERR;
+  if(( status = nccf_free_mosaic( mosaicid ))) ERR;
+  free(name);
+ 
+  for (k=0; k<ngrids; ++k) {
+    nccf_free_grid(gridid[k]);
+    for (j=0; j<ndims; ++j)
+        if( (status = nccf_free_coord(coordIds[k][j])) ) ERR;
+  }
+    
+  return NC_NOERR;
+}
diff --git a/gridspec_api/mosaic/tst_bipolar_tripolar_grid_periodic.c b/gridspec_api/mosaic/tst_bipolar_tripolar_grid_periodic.c
new file mode 100644
index 0000000..d131ef2
--- /dev/null
+++ b/gridspec_api/mosaic/tst_bipolar_tripolar_grid_periodic.c
@@ -0,0 +1,129 @@
+/**
+ * Test the creation of a tripolar grid with periodic boundaries.
+ *
+ * "$Id: tst_bipolar_tripolar_grid_periodic.c 767 2011-06-06 23:20:19Z pletzer $"
+ */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include <libcf_src.h>
+#include <netcdf.h>
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_coord.h"
+#include "nccf_handle_error.h"
+#include "nccf_utility_functions.h"
+
+int main(){
+
+/* Grid variables */
+  const int ndims = 2;
+  const int ngrids = 3;
+  const int bpdims[] = {6, 6}, gldims[] = {6, 6};
+  const int bpnvertex = bpdims[0] * bpdims[1];
+  const int glnvertex = gldims[0] * gldims[1];
+  
+  const char *bpdimnames[] = {"bp_ni", "bp_nj"};
+  const char *gldimnames[] = {"gl_ni", "gl_nj"};
+
+
+  const double latPerim = 60;
+  const double lonSing = 0.0;
+
+  double bplons[bpnvertex], bplats[bpnvertex];
+  double gllons[glnvertex], gllats[glnvertex];
+  double dLon, dLat, lonMin[] = {-180, 0}, lonMax[] = {0, 180};
+  double latMin = -90, latMax = latPerim;
+  int i, j, k, status, ncid;
+  const int save = 1;
+  char coordinates_id[36+1];  
+  
+  double period[] = {360., 0.};
+
+// 4 for the lower grid, and 2 for the bipolar grid
+  int gridid[ngrids], coordIds[ngrids][ndims], mosaicid, globalId;
+
+  nc_type nc_mode = NC_CLOBBER;
+
+  char *tname = "3tile_tripolar";
+  char *name, filename[STRING_SIZE];
+  name = ( char * )calloc( STRING_SIZE, sizeof( char ) );
+  sprintf( name, "%s", tname );
+  
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+
+  /* Get the bipolar cap 1 grid */
+  status = nccf_get_bipolar_cap(bpdims, latPerim, lonSing, bplons, bplats);
+
+  /* A two grids below the cap */
+  for( k = 0; k < 2; k++ ){
+    dLon = (lonMax[k] - lonMin[k]) / (gldims[0] - 1);
+    dLat = (latMax    - latMin) / (gldims[1] - 1);
+    for (j = 0; j < gldims[1]; ++j) {
+      for (i = 0; i < gldims[0]; ++i) {
+        gllons[i + gldims[0] * j] = lonMin[k] + i * dLon;
+        gllats[i + gldims[0] * j] = latMin    + j * dLat;
+      }
+    }
+    if ((status = 
+      nccf_def_lon_coord(ndims, gldims, gldimnames, gllons, save, &coordIds[k][0]))) ERR;
+    if ((status = 
+      nccf_def_lat_coord(ndims, gldims, gldimnames, gllats, save, &coordIds[k][1]))) ERR;
+
+    /* Write the grid */
+    sprintf( filename, "%s_grid%d.nc", name, k );
+    status = nccf_def_grid( coordIds[k], name, &gridid[k] );
+    if(( status = nccf_def_global( &globalId ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+    if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+    if(( status = nccf_put_grid(gridid[k], ncid))) ERR;
+    if(( status = nccf_put_global(globalId, ncid))) ERR;
+    if(( status = nc_close( ncid ))) ERR;
+    if(( status = nccf_free_global( globalId ))) ERR;
+  }
+
+  if ((status = 
+    nccf_def_lon_coord(ndims, bpdims, bpdimnames, bplons, save, &coordIds[2][0]))) ERR;
+  if ((status = 
+    nccf_def_lat_coord(ndims, bpdims, bpdimnames, bplats, save, &coordIds[2][1]))) ERR;
+
+  /* Write the mosaic */
+  sprintf( filename, "%s_grid%d.nc", name, 2 );
+  if(( status = nccf_def_grid( coordIds[2], name, &gridid[k] ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+  if(( status = nccf_def_mosaic( ngrids, gridid, name, &mosaicid ))) ERR;
+  if(( status = nccf_compute_mosaic_contacts( mosaicid, period ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0 ))) ERR;
+  sprintf( filename, "%s_mosaic.nc", name );
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+  if(( status = nccf_free_mosaic( mosaicid ))) ERR;
+  free(name);
+ 
+  for (k=0; k<ngrids; ++k) {
+    nccf_free_grid(gridid[k]);
+    for (j=0; j<ndims; ++j)
+        if( (status = nccf_free_coord(coordIds[k][j])) ) ERR;
+  }
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/mosaic/tst_cubesphere_mosaic.c b/gridspec_api/mosaic/tst_cubesphere_mosaic.c
new file mode 100644
index 0000000..08dff89
--- /dev/null
+++ b/gridspec_api/mosaic/tst_cubesphere_mosaic.c
@@ -0,0 +1,142 @@
+/**
+ * Test the creation of a cubed-sphere structured grid.
+ *
+ * "$Id: tst_cubesphere_mosaic.c 767 2011-06-06 23:20:19Z pletzer $"
+ */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <netcdf.h>
+
+#include "libcf_src.h"
+#include "nccf_coord.h"
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_data.h"
+#include "nccf_handle_error.h"
+#include "nccf_utility_functions.h"
+
+void fill_func(double *in,double *out){
+   out[0]=in[0]+in[1];
+}
+int main(){
+
+/* to save the data in the coordinate object */
+  const int save = 1;
+
+/* Variables for the grid */
+  int ncid, mosaicid, mosaicid2;
+  int status;
+  int iGrid; // Some counters
+
+  const int ndims = 2;         // Number of x, y dims
+  const int ngrids = 6;
+  const int nlon = 10;         // number of x faces, gives nlon + 1 edges
+  const int elon = nlon + 1;   // # of edges
+  const int dims[] = {elon, elon};
+  const int nvertex = elon*elon;
+  int faceVec[3] = {0, 0, 0}, pos, sign;
+  int i;
+  char coordinates_id[36+1];
+
+  nc_type nc_mode = NC_CLOBBER;
+
+  double clon[nvertex], clat[nvertex], data_values[nvertex];
+  double period[] = {0., 0.};
+
+  char *name = "tst_cubesphere";
+  char gridname[STRING_SIZE], filename[STRING_SIZE];
+  const char *dimnames[] = {"ni", "nj"};
+
+  int coordIds[ngrids][ndims], globalId, gridids[ngrids];
+
+/* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;  
+
+
+/* Define a grid */
+  for( iGrid = 0; iGrid < ngrids; iGrid++ ){
+    pos = iGrid % 3;
+    sign = ( iGrid/3 )  == 0 ? 1 : -1;
+    faceVec[pos] = sign;
+    
+    nccf_get_cubedsphere_grid( dims, faceVec, clon, clat );
+    faceVec[pos] = 0; // reset to zero.
+
+    // set data
+    for (i = 0; i < nvertex; ++i) {
+      data_values[i] = sin(clat[i]*M_PI/180.0) * cos(clon[i]*2.0*M_PI/180.0);
+    }
+
+    if(( status = nccf_def_lon_coord( ndims, dims, dimnames, clon, save,
+                                            &coordIds[iGrid][0] ))) ERR;
+    if(( status = nccf_def_lat_coord( ndims, dims, dimnames, clat, save,
+                                            &coordIds[iGrid][1] ))) ERR;
+
+/* Define the grid for the current tile. */
+    sprintf( gridname, "%s%s%d", name, CF_FILENAME_GRID, iGrid );
+    if(( status = nccf_def_grid( coordIds[iGrid], 
+					    gridname, 
+					    &gridids[iGrid] ))) ERR;
+    if(( status = nccf_def_global( &globalId ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+    sprintf( filename, "%s.nc", gridname );
+    if(( status = nc_create(filename, nc_mode, &ncid) )) ERR;
+    if(( status = nccf_put_grid(gridids[iGrid], ncid) )) ERR;
+    int data_id;
+    const char *timeDim = NULL;
+    if(( status = nccf_def_data(gridids[iGrid], 
+					   "p", "pressure", "Pa", 
+					   timeDim, &data_id) )) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_FILETYPE,   
+                                       CF_GLATT_FILETYPE_STATIC_DATA, 1 ))) ERR;
+    if(( status = nccf_set_data_double(data_id, data_values, 
+					      save, NC_FILL_DOUBLE) )) ERR;
+    if(( status = nccf_put_data(data_id, ncid) )) ERR;
+    if(( status = nccf_put_global(globalId, ncid)));
+    if(( status = nc_close( ncid )));
+    if(( status = nccf_free_global( globalId ))) ERR;
+
+  }
+
+  sprintf( filename, "%s%s.nc", name, CF_FILENAME_MOSAIC );
+  if(( status = nccf_def_mosaic( ngrids, gridids, gridname, &mosaicid ))) ERR;
+  if(( status = nccf_compute_mosaic_contacts( mosaicid, period ))) ERR;
+
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+
+//  if(( status = nccf_print_mosaic_as_polytopes( mosaicid, "cubesphere.pt" ))) ERR;
+
+  if(( status = nccf_free_mosaic( mosaicid ))) ERR;
+  
+  /* free the contacts object */
+  /* free the grid and the coordinates */
+  int coordids[ngrids];
+  for( iGrid = 0; iGrid < ngrids; iGrid++ ){
+    if(( status = nccf_inq_grid_coordids( gridids[iGrid], coordids ))) ERR;
+    if(( status = nccf_free_grid( gridids[iGrid] ))) ERR;
+    for (i = 0; i < ndims; ++i) {
+      if(( status = nccf_free_coord( coordids[i] ))) ERR;
+    }
+    if(( status = nccf_free_data(gridids[iGrid]) )) ERR;
+  }
+
+  /* Load the contacts, grids, and coordinates from file */
+  if ((status = nccf_def_mosaic_from_file( filename,
+					    "tst_two_tiles_mosaic",
+					    &mosaicid2))) ERR;
+
+  /* free the grid and the coordinates */
+  status = nccf_free_mosaic( mosaicid2 );
+
+  /* Close the file*/
+  return 0;
+}
diff --git a/gridspec_api/mosaic/tst_cubesphere_mosaic_grid_ranges.c b/gridspec_api/mosaic/tst_cubesphere_mosaic_grid_ranges.c
new file mode 100644
index 0000000..f9331f2
--- /dev/null
+++ b/gridspec_api/mosaic/tst_cubesphere_mosaic_grid_ranges.c
@@ -0,0 +1,124 @@
+/**
+ * Test reading the grid contacts for a cube sphere from a mosaic file.
+ *
+ * "$Id: tst_cubesphere_mosaic_grid_ranges.c 767 2011-06-06 23:20:19Z pletzer $"
+ */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include <libcf_src.h>
+#include <netcdf.h>
+#include "nccf_coord.h"
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_handle_error.h"
+#include "nccf_utility_functions.h"
+
+int main(){
+
+  /* to save the data in the coordinate object */
+  const int save = 1;
+
+  /* Variables for the grid */
+  int ncid, mosaicid, globalId;
+  int status;
+  int iGrid; // Some counters
+
+  const int ndims = 2;         // Number of x, y dims
+  const int ngrids = 6;
+  const int nlon = 10;         // number of x faces, gives nlon + 1 edges
+  const int elon = nlon + 1;   // # of edges
+  const int dims[] = {elon, elon};
+  const int nvertex = elon*elon;
+  int faceVec[3] = {0, 0, 0}, pos, sign;
+  int i;
+  char coordinates_id[36+1];
+
+  nc_type nc_mode = NC_CLOBBER;
+
+  double clon[nvertex], clat[nvertex];
+  double period[] = {0., 0.};
+
+  char *name = "tst_cubesphere_periodic";
+  char gridname[STRING_SIZE], filename[STRING_SIZE];
+  const char *dimnames[] = {"ni", "nj"};
+
+  int coordIds[ngrids][ndims];
+  int gridids[ngrids];
+
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+
+  /* Define a grid */
+  for( iGrid = 0; iGrid < ngrids; iGrid++ ){
+    pos = iGrid % 3;
+    sign = ( iGrid/3 )  == 0 ? 1 : -1;
+    faceVec[pos] = sign;
+
+    nccf_get_cubedsphere_grid( dims, faceVec, clon, clat );
+    faceVec[pos] = 0; // reset to zero.
+
+    if(( status = nccf_def_lon_coord( ndims, dims, dimnames, clon, save,
+                                            &coordIds[iGrid][0] ))) ERR;
+    if(( status = nccf_def_lat_coord( ndims, dims, dimnames, clat, save,
+                                            &coordIds[iGrid][1] ))) ERR;
+
+    /* Define the grid for the current tile. */
+    sprintf( gridname, "%s%d", name, iGrid );
+    if(( status = nccf_def_grid( coordIds[iGrid],
+					    gridname, 
+					    &gridids[iGrid] ))) ERR;
+    if(( status = nccf_def_global( &globalId ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+    sprintf( filename, "%s%s%d.nc", name, CF_FILENAME_GRID, iGrid );
+    if(( status = nc_create( filename, nc_mode, &ncid )));
+    if(( status = nccf_put_grid(gridids[iGrid], ncid)));
+    if(( status = nccf_put_global(globalId, ncid)));
+    if(( status = nc_close( ncid )));
+    if(( status = nccf_free_global( globalId )));
+
+  }
+
+  /* Write the mosaic file */
+  sprintf( filename, "%s%s.nc", name, CF_FILENAME_MOSAIC );
+  if(( status = nccf_def_mosaic( ngrids, gridids, gridname, &mosaicid ))) ERR;
+  if(( status = nccf_compute_mosaic_contacts( mosaicid, period ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0 ))) ERR;
+
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid)));
+  if(( status = nc_close( ncid ))) ERR;
+
+  /* Find the contacts */
+  int g0, g1, ij0_min[ndims], ij0_max[ndims], ij1_min[ndims], ij1_max[ndims];
+  int ncont, iContact;
+  nccf_inq_mosaic_ncontacts( mosaicid, &ncont );
+
+  for( iContact = 0; iContact < ncont; iContact++ ){
+    status = nccf_inq_mosaic_gridranges( 
+          mosaicid, iContact, &g0, &g1, ij0_min, ij0_max, ij1_min, ij1_max );
+  }
+
+  /* free the contacts object */
+  if(( status = nccf_free_global( globalId ))) ERR;
+  if(( status = nccf_free_mosaic( mosaicid ))) ERR;
+
+  /* free the grid and the coordinates */
+  for( iGrid = 0; iGrid < ngrids; iGrid++ ){
+    if(( status = nccf_free_grid( gridids[iGrid] ))) ERR;
+    for (i = 0; i < ndims; ++i) {
+      if(( status = nccf_free_coord( coordIds[iGrid][i] ))) ERR;
+    }
+  }
+
+/* Close the file*/
+  return 0;
+}
diff --git a/gridspec_api/mosaic/tst_get_mosaic_grid_ranges.c b/gridspec_api/mosaic/tst_get_mosaic_grid_ranges.c
new file mode 100644
index 0000000..b499476
--- /dev/null
+++ b/gridspec_api/mosaic/tst_get_mosaic_grid_ranges.c
@@ -0,0 +1,165 @@
+/*
+ * Test grid contact maps.
+ *
+ * "$Id: tst_get_mosaic_grid_ranges.c 767 2011-06-06 23:20:19Z pletzer $"
+ */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <libcf_src.h>
+#include <netcdf.h>
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_coord.h"
+#include "nccf_varObj.h"
+#include "nccf_handle_error.h"
+#include "nccf_utility_functions.h"
+
+#include <assert.h>
+
+int main(  ){
+
+  /* Initialize the the cflists */
+
+  /* Variables for the grid */
+  // Each Id goes with a ncid
+  int status, ncid;
+  int iGrid; // Some counters
+  const int ndims = 2;         // Number of x, y dims
+  const int ngrids = 2;
+  const int nx   = 20;         // number of x faces, gives nlon + 1 edges
+  const int ny   = 10;         // number of x faces, gives nlon + 1 edges
+  const int dims[] = {ny, nx};
+  const int nvertex = ny * nx;
+  /* Return contact indices for i, j etc. and gridids */
+  int ibeg0[ndims], iend0[ndims], ibeg1[ndims], iend1[ndims], g0, g1;
+  const double period[] = {0., 0.};
+
+  int gridid[ngrids], mosaicid, i, j, globalId;
+  int coordId[ngrids][ndims];
+  int save = 1;
+  char coordinates_id[36+1];
+
+  nc_type nc_mode = NC_CLOBBER;
+
+  char *name = "tile";
+  char grid_filename[STRING_SIZE] = "tst_get_mosaic_grid_ranges.nc";
+  char gridname[STRING_SIZE];
+  char filename[STRING_SIZE];
+  const char *dimnames[] = {"ni", "nj"};
+
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+
+  double x1[nvertex], y1[nvertex], x2[nvertex], y2[nvertex], dx, dy;
+  const double xMin =   0.0;
+  const double xMax = 360.0;
+  const double yMin = -90.0;
+  const double yMax =  90.0;
+
+  dy = ( yMax - yMin )/( ny - 1 );
+  dx = ( xMax - xMin )/( nx - 1 )/2;
+
+  for( j = 0; j < nx; j++){
+    for( i = 0; i < ny; i++ ){
+      x1[j + nx * i] = xMin + j * dx;
+      x2[j + nx * i] = xMin + j * dx + 180;
+      y1[j + nx * i] = yMin + i * dy;
+      y2[j + nx * i] = yMin + i * dy;
+    }
+  }
+
+  /* Define tile 0 */
+  iGrid = 0;
+  if(( status = nccf_def_lon_coord( ndims, dims, dimnames, x1, save,
+                                         &coordId[iGrid][0] ))) ERR;
+  if(( status = nccf_def_lat_coord( ndims, dims, dimnames, y1, save,
+                                         &coordId[iGrid][1] ))) ERR;
+
+  sprintf( gridname, "%s%d", name, iGrid + 1 );
+  sprintf( filename, "%s.nc", gridname );
+
+  if(( status = nccf_def_grid( coordId[iGrid],
+            gridname, 
+            &gridid[iGrid] ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* Write tile 0 */
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_grid(gridid[iGrid], ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid)));
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+  /* Define tile 1 */
+  iGrid = 1;
+  if(( status = nccf_def_lon_coord( ndims, dims, dimnames, x2, save,
+                                         &coordId[iGrid][0] ))) ERR;
+  if(( status = nccf_def_lat_coord( ndims, dims, dimnames, y2, save,
+                                         &coordId[iGrid][1] ))) ERR;
+
+  sprintf( gridname, "%s%d", name, iGrid + 1 );
+  sprintf( filename, "%s.nc", gridname );
+  if(( status = nccf_def_grid( coordId[iGrid],
+            gridname, 
+            &gridid[iGrid] ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* Write tile 1 */
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_grid(gridid[iGrid], ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid)));
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+  /* Define the contacts */
+  if(( status = nccf_def_mosaic( ngrids, gridid, gridname, &mosaicid ))) ERR;
+  if(( status = nccf_compute_mosaic_contacts( mosaicid, period ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0 ))) ERR;
+
+  /* Write the file */
+  if(( status = nc_create( grid_filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid)));
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+  /* Get the contact map and tile contacts */
+  nccf_inq_mosaic_gridranges( mosaicid, 0, &g0, &g1, 
+			       ibeg0, iend0, 
+			       ibeg1, iend1 );
+
+  /* free the grid */
+  for( iGrid = 0; iGrid < ngrids; iGrid++ ){
+    if(( status = nccf_inq_grid_coordids( gridid[iGrid],
+        coordId[iGrid] ))) ERR;
+    for( i = 0; i < ndims; i++ ){
+      if(( status = nccf_free_coord( coordId[iGrid][i] ))) ERR;
+    }
+    if(( status = nccf_free_grid( gridid[iGrid] ))) ERR;
+  }
+  if(( status = nccf_free_mosaic( mosaicid ))) ERR;
+
+  assert( g0 == 0 );
+  assert( g1 == 1 );
+  assert( ibeg0[0] ==  0 );
+  assert( ibeg0[1] == 19 );
+  assert( iend0[0] ==  9 );
+  assert( iend0[1] == 19 );
+  assert( ibeg1[0] == 0  );
+  assert( ibeg1[1] == 0  );
+  assert( iend1[0] ==  9 );
+  assert( iend1[1] ==  0 );
+
+/* Close the file*/
+  return 0;
+}
diff --git a/gridspec_api/mosaic/tst_nccf_set_mosaic_contact.c b/gridspec_api/mosaic/tst_nccf_set_mosaic_contact.c
new file mode 100644
index 0000000..1b3598b
--- /dev/null
+++ b/gridspec_api/mosaic/tst_nccf_set_mosaic_contact.c
@@ -0,0 +1,69 @@
+/*
+ * Test for setting contacts
+ *
+ * $Id: tst_nccf_set_mosaic_contact.c 783 2011-07-11 15:31:22Z dkindig $
+ */
+
+#include <netcdf.h>
+#include <stdio.h>
+#include "nccf_mosaic.h"
+
+
+int main(  ){
+
+  int status = NC_NOERR, ngrids = 2, ndims = 2, ncid;
+  int gridids[ngrids], mosaicid;
+  char *coordnames[] = {"lon", "lat"};
+  char mosaicname[] = "set_test";
+  char *gridfile0 = "tst_two_tiles_grid0.nc";
+  char *gridfile1 = "tst_two_tiles_grid1.nc";
+  char *mosaicfile = "test_set_contact_mosaic.nc";
+  int coordids[ngrids], i, j;
+
+  /* Create/Define a pair of grids */
+  status = nccf_def_grid_from_file( gridfile0, ndims, 
+         (const char **)coordnames, "", &gridids[0] );
+  if( status ) {
+    printf( "file doesn't exist %s\n", gridfile0 );
+    return status;
+  }
+  status = nccf_def_grid_from_file( gridfile1, ndims,
+         (const char **)coordnames, "", &gridids[1] );
+  if( status ) {
+    printf( "file doesn't exist %s\n", gridfile1 );
+    return status;
+  }
+  /* Define a mosaic */
+  nccf_def_mosaic( ngrids, gridids, mosaicname, &mosaicid );
+
+  /* Define the contacts manually */
+  int grid0_beg_ind[] = {0, 9}, grid0_end_ind[] = {9, 9};
+  int grid1_beg_ind[] = {0, 0}, grid1_end_ind[] = {9, 0};
+
+  /* Populate the mosaic */
+  nccf_set_mosaic_contact( mosaicid, ndims, 
+       gridids[0], gridids[1],
+       grid0_beg_ind, grid0_end_ind, 
+       grid1_beg_ind, grid1_end_ind);
+
+  /* Write to a file */
+  nc_create( mosaicfile, NC_CLOBBER, &ncid );
+  nccf_put_mosaic(mosaicid, ncid);
+  nc_close( ncid );
+
+  /* Clean up */
+  nccf_free_mosaic( mosaicid );
+  for( i = 0; i < ngrids; i++ ){
+    if(( status = nccf_inq_grid_coordids( gridids[i], coordids ))) ERR;
+    if(( status = nccf_free_grid( gridids[i] ))) ERR;
+    for( j = 0; j < ndims; j++ )
+      if(( status = nccf_free_coord( coordids[j] ))) ERR;
+  }
+
+  if( status ) return status;
+
+  /* Verify the contents of the mosaic file */
+
+  return status;
+
+}
diff --git a/gridspec_api/mosaic/tst_periodic_grid.c b/gridspec_api/mosaic/tst_periodic_grid.c
new file mode 100644
index 0000000..977ce96
--- /dev/null
+++ b/gridspec_api/mosaic/tst_periodic_grid.c
@@ -0,0 +1,165 @@
+/**
+ * Test the definition of a structured grid.
+ *
+ * "$Id: tst_periodic_grid.c 767 2011-06-06 23:20:19Z pletzer $"
+ */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+
+#include <netcdf.h>
+#include <libcf_src.h>
+
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_coord.h"
+#include "nccf_varObj.h"
+#include "nccf_handle_error.h"
+#include "nccf_utility_functions.h"
+
+int main(  ){
+
+  /* whether or not coordinate data are copy-saved in coordinate object */
+  const int save = 1;
+  /* periodicities used in determining contacts */
+  const double period[] = {360., 0.};
+  /* number of space dimensions */
+  const int ndims = 2;
+  /* number of grids */
+  const int ngrids = 2;
+  /* unique grid id */
+  char coordinates_id[36+1];
+
+  int i, j, iGrid;
+  int status, ncid;
+  int nx = 10, ny = 10; // number of x faces, gives nlon + 1 edges
+  int dims[] = {ny, nx};
+  int nvertex = dims[0] * dims[1];
+
+  /* Coordinate ids */
+  int coordId[ngrids][ndims];
+  int gridid[ngrids], globalId, mosaicid;
+
+
+  nc_type nc_mode = NC_CLOBBER;
+
+  char *name = "tst_periodic_latlon";
+  char gridname[STRING_SIZE];
+  char filename[STRING_SIZE];
+  const char *dimnames[] = {"ni", "nj"};
+
+  double x1[nvertex], y1[nvertex], x2[nvertex], y2[nvertex], dx, dy;
+  const double xMin =   0.0;
+  const double xMax = 360.0;
+  const double yMin = -90.0;
+  const double yMax =  90.0;
+  
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;  
+
+  dy = ( yMax - yMin )/( ny - 1 );
+  dx = ( xMax - xMin )/( nx - 1 )/2;
+
+  for( j = 0; j < nx; j++){
+    for( i = 0; i < ny; i++ ){
+      x1[j + nx * i] = xMin + j * dx;
+      x2[j + nx * i] = xMin + j * dx + 180;
+      y1[j + ny * i] = yMin + i * dy;
+      y2[j + ny * i] = yMin + i * dy;
+    }
+  }
+
+/* Calculate the coordinates for the current tile */
+
+/* Define tile 0 */
+  if(( status = nccf_def_lon_coord( ndims, dims, dimnames, x1, save,
+                                         &coordId[0][0] ))) ERR;
+  if(( status = nccf_def_lat_coord( ndims, dims, dimnames, y1, save,
+                                         &coordId[0][1] ))) ERR;
+
+  iGrid = 0;
+  sprintf( gridname, "%s%s%d", name, CF_FILENAME_GRID, iGrid );
+  if(( status = nccf_def_grid( coordId[0],
+					  gridname, 
+					  &gridid[iGrid] ))) ERR;
+
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  sprintf( filename, "%s.nc", gridname );
+  if(( status = nc_create( filename, nc_mode, &ncid )));
+  if(( status = nccf_put_grid(gridid[iGrid], ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+/* Define tile 1 */
+  if(( status = nccf_def_lon_coord( ndims, dims, dimnames, x2, save,
+                                         &coordId[1][0] ))) ERR;
+  if(( status = nccf_def_lat_coord( ndims, dims, dimnames, y2, save,
+                                         &coordId[1][1] ))) ERR;
+
+  iGrid = 1;
+  sprintf( gridname, "%s%s%d.nc", name, CF_FILENAME_GRID, iGrid );
+  if(( status = nccf_def_grid( coordId[1],
+					  gridname, 
+					  &gridid[iGrid] ))) ERR;
+
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  sprintf( filename, "%s.nc", gridname );
+  if(( status = nc_create( filename, nc_mode, &ncid )));
+  if(( status = nccf_put_grid(gridid[iGrid], ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+/* Define the contacts */
+  if(( status = nccf_def_mosaic( ngrids, gridid, gridname, &mosaicid ))) ERR;
+  if(( status = nccf_compute_mosaic_contacts( mosaicid, period ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0 ))) ERR;
+
+/* Write Polytopes */
+//  if(( status = nccf_print_mosaic_as_polytopes( mosaicid, "periodic.pt" ))) ERR;
+
+/* Write the contacts file */
+  sprintf( filename, "%s%s.nc", name, CF_FILENAME_MOSAIC );
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+/* Checks */
+  int ncontacts;
+  if(( status = nccf_inq_mosaic_ncontacts(mosaicid, &ncontacts))) ERR;
+  assert(ncontacts == 2);
+
+  //if( status=nccf_print_mosaic_as_polytopes(mosaicid,"periodic_grid.pt")) ERR;
+
+/* Free */
+  for (j = 0; j < ngrids; ++j) {
+    for (i = 0; i < ndims; ++i) {
+      if(( status = nccf_free_coord(coordId[j][i]))) ERR;
+    }
+  }
+  for( iGrid = 0; iGrid < ngrids; iGrid++ ){
+    if(( status = nccf_inq_grid_coordids( gridid[iGrid],
+        coordId[iGrid] ))) ERR;
+    if(( status = nccf_free_grid( gridid[iGrid] ))) ERR;
+  }
+
+  if(( status = nccf_free_mosaic( mosaicid ))) ERR;
+
+  return 0;
+}
diff --git a/gridspec_api/mosaic/tst_rotation.c b/gridspec_api/mosaic/tst_rotation.c
new file mode 100644
index 0000000..fd37b81
--- /dev/null
+++ b/gridspec_api/mosaic/tst_rotation.c
@@ -0,0 +1,156 @@
+/**
+ * Two tile mosaic with contact as a rotation in index space
+ *
+ *
+ * "$Id: tst_rotation.c 767 2011-06-06 23:20:19Z pletzer $"
+ */
+
+// libcf/gridspec includes
+#include "nccf_mosaic.h"
+#include "nccf_global.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+
+// standard includes
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+int main() {
+
+  const int ngrids = 2;
+  const int ndims = 2;
+  char coordinates_id[36+1];
+
+  // first tile
+  const int dims1[] = {3 + 1, 2 + 1};
+  const double xyMins1[] = {0., 0.};
+  const double xyMaxs1[] = {1., 1.};
+
+  // second tile
+  const int dims2[] = {4 + 1, 3 + 1};
+  const double xyMins2[] = {2., 0.};
+  const double xyMaxs2[] = {1., 1.};
+
+  assert(dims1[0] == dims2[1]); // because of rotation
+
+  // compute coordinates
+  int i, j;
+  double *x1s, *y1s;
+  double *x2s, *y2s;
+
+  int n1 = 1, n2 = 1;
+  for (i = 0; i < ndims; ++i) {
+    n1 *= dims1[i];
+    n2 *= dims2[i];
+  }
+  x1s = (double *) malloc(n1 * sizeof(double));
+  y1s = (double *) malloc(n1 * sizeof(double));
+  x2s = (double *) malloc(n2 * sizeof(double));
+  y2s = (double *) malloc(n2 * sizeof(double));
+
+  double dx1 = (xyMaxs1[0] - xyMins1[0]) / (dims1[1] - 1);
+  double dy1 = (xyMaxs1[1] - xyMins1[1]) / (dims1[0] - 1);
+  for(j = 0; j < dims1[0]; j++){
+    for(i = 0; i < dims1[1]; i++){
+      x1s[i + dims1[1]*j] = xyMins1[0] + i * dx1;
+      y1s[i + dims1[1]*j] = xyMins1[1] + j * dy1;
+    }
+  }
+
+  double dx2 = (xyMaxs2[0] - xyMins2[0]) / (dims2[1] - 1);
+  double dy2 = (xyMaxs2[1] - xyMins2[1]) / (dims2[0] - 1);
+  for(j = 0; j < dims2[0]; j++){
+    for(i = 0; i < dims2[1]; i++){
+      x2s[i + dims2[1]*j] = xyMins2[0] + i * dx2;
+      y2s[i + dims2[1]*j] = xyMins2[1] + j * dy2;
+    }
+  }
+
+  // create grid objects
+  int coordIds[ngrids][ndims];
+  const char *coordnames[] = {"x", "y"};
+  const char *coordDimsNames[] = {"ny", "nx"};
+  const int save = 0;
+  int status;
+
+  /* generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+
+  if(( status = nccf_def_coord(ndims, dims1, coordDimsNames,
+				    x1s, save,
+				    coordnames[0], NULL, NULL,
+				    &coordIds[0][0] ))) ERR;
+  if(( status = nccf_def_coord(ndims, dims1, coordDimsNames,
+				    y1s, save,
+				    coordnames[1], NULL, NULL,
+				    &coordIds[0][1] ))) ERR;
+  if(( status = nccf_def_coord(ndims, dims2, coordDimsNames,
+				    x2s, save,
+				    coordnames[0], NULL, NULL,
+				    &coordIds[1][0] ))) ERR;
+  if(( status = nccf_def_coord(ndims, dims2, coordDimsNames,
+				    y2s, save,
+				    coordnames[1], NULL, NULL,
+				    &coordIds[1][1] ))) ERR;
+
+  // create grids
+  int gridids[ngrids], globalIds[ngrids];
+  char *gridNames[] = {"left", "right"};
+  for (i = 0; i < ngrids; ++i) {
+    if (( status = nccf_def_grid(coordIds[i],
+					    gridNames[i],
+					    &gridids[i] ))) ERR;
+    if(( status = nccf_def_global( &globalIds[i] ))) ERR;
+    if(( status = nccf_add_global_att( globalIds[i], CF_FILETYPE,
+                                       CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalIds[i], CF_GRIDNAME,
+                                       gridNames[i], 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalIds[i], CF_COORDINATES_ID,
+                                       coordinates_id, 0 ))) ERR;
+  }
+
+  // write grid files
+  const nc_type nc_mode = NC_CLOBBER;
+  char filename[STRING_SIZE];
+  int ncid;
+  for (i = 0; i < ngrids; ++i) {
+    sprintf(filename, "%s_grid%d.nc", "tst_rotation", i);
+    nc_create(filename, nc_mode, &ncid);
+    nccf_put_grid(gridids[i], ncid);
+    nccf_put_global(globalIds[i], ncid);
+    nc_close(ncid);
+  }
+
+  // define the mosaic, do this after writing the grid files to disk
+  int mosaicid, globalId;
+  const double periods[] = {0.0, 0.0};
+  if ((status = nccf_def_mosaic(ngrids, gridids, "tst_rotation", &mosaicid))) ERR;
+  if(( status = nccf_compute_mosaic_contacts( mosaicid, periods ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0 ))) ERR;
+
+  // write mosaic
+  sprintf(filename, "%s_mosaic.nc", "tst_rotation");
+  if(( status = nc_create(filename, nc_mode, &ncid))) ERR;
+  if((status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close(ncid))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+  // clean up
+  if (( status = nccf_free_mosaic(mosaicid))) ERR;
+  for (i = 0; i < ngrids; ++i) {
+    if ((status ==  nccf_free_global( globalIds[i]))) ERR;
+    if ((status ==  nccf_free_grid(gridids[i]))) ERR;
+    for (j = 0; j < ndims; ++j) {
+      if ((status ==  nccf_free_coord(coordIds[i][j]) )) ERR;
+    }
+  }
+  free(x1s);
+  free(y1s);
+  free(x2s);
+  free(y2s);
+
+  return 0;
+}
diff --git a/gridspec_api/mosaic/tst_sg_mosaic_latlon.c b/gridspec_api/mosaic/tst_sg_mosaic_latlon.c
new file mode 100644
index 0000000..e8828f0
--- /dev/null
+++ b/gridspec_api/mosaic/tst_sg_mosaic_latlon.c
@@ -0,0 +1,106 @@
+/**
+ * Single grid contact.
+ *
+ * "$Id: tst_sg_mosaic_latlon.c 767 2011-06-06 23:20:19Z pletzer $"
+ *
+ */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <netcdf.h>
+
+#include "libcf_src.h"
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_coord.h"
+#include "nccf_handle_error.h"
+#include "nccf_utility_functions.h"
+
+int main(){
+
+  const int save = 0;
+  const int ndims = 2;
+  const int dims[] = {10, 11};
+  const double lonMin = 0.0;
+  const double lonMax = 360.0;
+  const double latMin = -90.0;
+  const double latMax = +90.0;
+  double dLon, dLat;
+  int nvertex = dims[0] * dims[1];
+  double lonData[nvertex], latData[nvertex];
+  double period[] = {0.0, 0.0};
+  int gridid, globalId;
+  int coordIds[ndims];
+  int mosaicid;
+  char coordinates_id[36+1];
+
+  nc_type nc_mode = NC_CLOBBER;
+  int i, j;
+  int status;
+  int ncid;
+  const int ngrids = 1;
+
+  char filename[STRING_SIZE];
+  char name[STRING_SIZE] = "tst_sg_latlon";
+  const char *dimnames[] = {"ni", "nj"};
+
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;  
+
+  dLon = (lonMax - lonMin) / (dims[1] - 1);
+  dLat = (latMax - latMin) / (dims[0] - 1);
+  for (j = 0; j < dims[0]; ++j) {
+    for (i = 0; i < dims[1]; ++i) {
+      lonData[i + dims[1] * j] = lonMin + i * dLon;
+      latData[i + dims[1] * j] = latMin + j * dLat;
+    }
+  }
+  if ((status = nccf_def_lon_coord(ndims, dims, dimnames, lonData, save,
+                &coordIds[0]))) ERR;
+  if ((status = nccf_def_lat_coord(ndims, dims, dimnames, latData, save,
+                &coordIds[1]))) ERR;
+
+  /* Create grid */
+  if ((status = nccf_def_grid(coordIds, name, &gridid ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* Write to file */
+  sprintf( filename, "%s%s.nc", name, CF_FILENAME_GRID );
+  if ((status = nc_create(filename, nc_mode, &ncid))) ERR;
+  if ((status = nccf_put_grid(gridid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+
+  /* Define the contact file */
+  if(( status = nccf_def_mosaic( ngrids, &gridid, name, &mosaicid ))) ERR;
+  if(( status = nccf_compute_mosaic_contacts( mosaicid, period ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0 ))) ERR;
+
+  /* Write to file */
+  sprintf( filename, "%s%s.nc", name, CF_FILENAME_MOSAIC );
+  if ((status = nc_create(filename, nc_mode, &ncid))) ERR;
+  if ((status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+/* write mosaic as polytopes */
+  //nccf_print_mosaic_as_polytopes(mosaicid,"sg_latlon.pt");
+
+  /* Free */
+  if (( status = nccf_free_mosaic( mosaicid ))) ERR;
+  if (( status = nccf_free_grid( gridid ))) ERR;
+  if (( status = nccf_free_coord( coordIds[0] ))) ERR;
+  if (( status = nccf_free_coord( coordIds[1] ))) ERR;
+
+  return 0;
+}
diff --git a/gridspec_api/mosaic/tst_sg_periodic_mosaic_latlon.c b/gridspec_api/mosaic/tst_sg_periodic_mosaic_latlon.c
new file mode 100644
index 0000000..8b4c79a
--- /dev/null
+++ b/gridspec_api/mosaic/tst_sg_periodic_mosaic_latlon.c
@@ -0,0 +1,103 @@
+/**
+ * Single grid contact.
+ *
+ * "$Id: tst_sg_periodic_mosaic_latlon.c 767 2011-06-06 23:20:19Z pletzer $"
+ *
+ */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <netcdf.h>
+
+#include "libcf_src.h"
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_coord.h"
+#include "nccf_handle_error.h"
+#include "nccf_utility_functions.h"
+
+int main(){
+
+  const int save = 0;
+  const int ndims = 2;
+  const int dims[] = {10, 11};
+  int nvertex = dims[0] * dims[1];
+  const double lonMin = 0.0;
+  const double lonMax = 360.0;
+  const double latMin = -90.0;
+  const double latMax = +90.0;
+  double dLon, dLat;
+  double lonData[nvertex], latData[nvertex];
+  double period[] = {360.0, 0.0};
+  int gridid, globalId;
+  int coordIds[ndims];
+  int mosaicid;
+  char coordinates_id[36+1];
+
+  nc_type nc_mode = NC_CLOBBER;
+  int i, j;
+  int status;
+  int ncid;
+  const int ngrids = 1;
+
+  char filename[STRING_SIZE];
+  char name[STRING_SIZE] = "tst_sg_periodic_latlon";
+  const char *dimnames[] = {"ni", "nj"};
+
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;  
+
+  dLon = (lonMax - lonMin) / (dims[1] - 1);
+  dLat = (latMax - latMin) / (dims[0] - 1);
+  for (j = 0; j < dims[0]; ++j) {
+    for (i = 0; i < dims[1]; ++i) {
+      lonData[i + dims[1] * j] = lonMin + i * dLon;
+      latData[i + dims[1] * j] = latMin + j * dLat;
+    }
+  }
+  if ((status = nccf_def_lon_coord(ndims, dims, dimnames, lonData, save,
+                &coordIds[0]))) ERR;
+  if ((status = nccf_def_lat_coord(ndims, dims, dimnames, latData, save,
+                &coordIds[1]))) ERR;
+
+  /* Create grid */
+  if ((status = 
+       nccf_def_grid(coordIds, name, &gridid ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* Write to file */
+  sprintf( filename, "%s%s.nc", name, CF_FILENAME_GRID );
+  if ((status = nc_create(filename, nc_mode, &ncid))) ERR;
+  if ((status = nccf_put_grid(gridid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+  
+  /* Define the contact file */
+  if(( status = nccf_def_mosaic( ngrids, &gridid, name, &mosaicid ))) ERR;
+  if(( status = nccf_compute_mosaic_contacts( mosaicid, period ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0 ))) ERR;
+
+  /* Write to file */
+  sprintf( filename, "%s%s.nc", name, CF_FILENAME_MOSAIC );
+  if ((status = nc_create(filename, nc_mode, &ncid))) ERR;
+  if ((status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+
+  /* Free */
+  if (( status = nccf_free_mosaic( mosaicid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+  if (( status = nccf_free_grid( gridid ))) ERR;
+  if (( status = nccf_free_coord( coordIds[0] ))) ERR;
+  if (( status = nccf_free_coord( coordIds[1] ))) ERR;
+
+  return 0;
+}
diff --git a/gridspec_api/mosaic/tst_tripolar_zhi.c b/gridspec_api/mosaic/tst_tripolar_zhi.c
new file mode 100644
index 0000000..81716c0
--- /dev/null
+++ b/gridspec_api/mosaic/tst_tripolar_zhi.c
@@ -0,0 +1,99 @@
+/*
+ * Test the creation of a tripolar grid
+ *
+ * "$Id: tst_tripolar_zhi.c 767 2011-06-06 23:20:19Z pletzer $"
+ * */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include <libcf_src.h>
+#include <netcdf.h>
+
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_coord.h"
+#include "nccf_handle_error.h"
+#include "nccf_utility_functions.h"
+
+int main(int arg, char *argv[]){
+
+/* Grid variables */
+  int ndims = 2;
+  int ngrids = 2;
+  int gldims[] = {10, 10};
+  int glnvertex = gldims[0] * gldims[1];
+  const char *dimnames[] = {"ni", "nj"};
+  int capIndx = 7;
+  double gllons[glnvertex], gllats[glnvertex];
+  int j, k, status, ncid, mosaicid;
+  const int save = 1;
+  char coordinates_id[36+1];
+
+  printf("Running %s\n", argv[0]);
+
+  double period[] = {0, 0};
+// 4 for the lower grid, and 2 for the bipolar grid
+  int gridid[ngrids], coordIds[2][2], globalId;
+
+  nc_type nc_mode = NC_CLOBBER;
+
+  char *tname = "2tile_tripolar_zhi";
+  char *name, filename[STRING_SIZE];
+  name = ( char * )calloc( STRING_SIZE, sizeof( char ) );
+  sprintf( name, "%s", tname );
+
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+
+  for (k=0; k<2; ++k) {
+  /* Get the first half */
+    status = nccf_get_tripolar_halfgrid( gldims, k, capIndx, gllons, gllats );
+
+    if ((status =
+      nccf_def_lon_coord(ndims, gldims, dimnames, gllons, save, &coordIds[k][0]))) ERR;
+    if ((status =
+      nccf_def_lat_coord(ndims, gldims, dimnames, gllats, save, &coordIds[k][1]))) ERR;
+
+  /* Write the grid */
+    sprintf( filename, "%s_grid%d.nc", name, k );
+    status = nccf_def_grid( coordIds[k], name, &gridid[k] );
+    if(( status = nccf_def_global( &globalId ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+    if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+    if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+    if(( status = nccf_put_grid(gridid[k], ncid))) ERR;
+    if(( status = nccf_put_global(globalId, ncid))) ERR;
+    if(( status = nc_close( ncid ))) ERR;
+    if(( status = nccf_free_global( globalId ))) ERR;
+  }
+/* contacts */
+  if(( status = nccf_def_mosaic( ngrids, gridid, name, &mosaicid ))) ERR;
+  if(( status = nccf_compute_mosaic_contacts( mosaicid, period ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0 ))) ERR;
+  sprintf( filename, "%s_contacts.nc", name );
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+/* write mosaic as polytopes */
+//  nccf_print_mosaic_as_polytopes(mosaicid,"tripolar_zhi.pt");
+
+  if(( status = nccf_free_mosaic( mosaicid ))) ERR;
+  free(name);
+
+  for (k=0; k<ngrids; ++k) {
+    nccf_free_grid(gridid[k]);
+    for (j=0; j<ndims; ++j)
+        if(( status = nccf_free_coord(coordIds[k][j]))) ERR;
+  }
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/mosaic/tst_two_tiles.c b/gridspec_api/mosaic/tst_two_tiles.c
new file mode 100644
index 0000000..a386d01
--- /dev/null
+++ b/gridspec_api/mosaic/tst_two_tiles.c
@@ -0,0 +1,157 @@
+/*
+ * Test the definition of a structured grid.
+ *
+ * "$Id: tst_two_tiles.c 767 2011-06-06 23:20:19Z pletzer $"
+ * */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <libcf_src.h>
+#include <netcdf.h>
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_coord.h"
+#include "nccf_varObj.h"
+#include "nccf_handle_error.h"
+#include "nccf_utility_functions.h"
+#include "nccf_constants.h"
+
+#include <assert.h>
+
+int main(int argc, char *argv[]){
+
+  printf("Running %s\n", argv[0]);
+
+  /* Variables for the grid */
+  // Each Id goes with a ncid
+  int status, ncid;
+  int iGrid; // Some counters
+  int ndims = 2;         // Number of x, y dims
+  int ngrids = 2;
+  int nlon = 10;         // number of x faces, gives nlon + 1 edges
+  int dims[] = {nlon, nlon};
+  int nvertex = nlon * nlon;
+  double period[] = {0., 0.};
+
+  int gridid[ngrids], mosaicid, mosaicid2, i, j, globalId;
+  int coordId[ngrids][ndims];
+  const int save = 1;
+  char coordinates_id[36+1];
+
+  nc_type nc_mode = NC_CLOBBER;
+
+  char *name = "tst_two_tiles";
+//  char grid_filename[STRING_SIZE] = "tst_two_tiles_mosaic.nc";
+  char gridname[STRING_SIZE];
+  char filename[STRING_SIZE];
+  const char *dimnames[] = {"ni", "nj"};
+
+  double lon1[nvertex], lat1[nvertex], lon2[nvertex], lat2[nvertex], dlon, dlat;
+  const double lonMin =   0.0;
+  const double lonMax = 360.0;
+  const double latMin = -90.0;
+  const double latMax =  90.0;
+
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;  
+
+  dlat = ( latMax - latMin )/( nlon - 1 );
+  dlon = ( lonMax - lonMin )/( nlon - 1 )/2;
+
+  for( j = 0; j < nlon; j++){
+    for( i = 0; i < nlon; i++ ){
+      lon1[j + nlon * i] = lonMin + j * dlon;
+      lon2[j + nlon * i] = lonMin + j * dlon + 180;
+      lat1[j + nlon * i] = latMin + i * dlat;
+      lat2[j + nlon * i] = latMin + i * dlat;
+    }
+  }
+
+/* Calculate the coordinates for the current tile */
+
+/* Define tile 0 */
+  iGrid = 0;
+  if(( status = nccf_def_lon_coord( ndims, dims, dimnames, lon1, save,
+                                         &coordId[iGrid][0] ))) ERR;
+  if(( status = nccf_def_lat_coord( ndims, dims, dimnames, lat1, save,
+                                         &coordId[iGrid][1] ))) ERR;
+
+  sprintf( gridname, "%s%s%d", name, CF_FILENAME_GRID, iGrid );
+  sprintf( filename, "%s.nc", gridname );
+  if(( status = nccf_def_grid( coordId[iGrid],
+					  gridname, 
+					  &gridid[iGrid] ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, gridname, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* Write tile 0 */
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_grid(gridid[iGrid], ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+/* Define tile 1 */
+  iGrid = 1;
+  if(( status = nccf_def_lon_coord( ndims, dims, dimnames, lon2, save,
+                                         &coordId[iGrid][0] ))) ERR;
+  if(( status = nccf_def_lat_coord( ndims, dims, dimnames, lat2, save,
+                                         &coordId[iGrid][1] ))) ERR;
+
+  sprintf( gridname, "%s%s%d", name, CF_FILENAME_GRID, iGrid );
+  sprintf( filename, "%s.nc", gridname );
+  if(( status = nccf_def_grid( coordId[iGrid],
+					  gridname, 
+					  &gridid[iGrid] ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, gridname, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+  /* Write tile 1 */
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_grid(gridid[iGrid], ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+/* Define the contacts */
+  if(( status = nccf_def_mosaic( ngrids, gridid, gridname, &mosaicid ))) ERR;
+  if(( status = nccf_compute_mosaic_contacts( mosaicid, period ))) ERR;
+
+/* Write the file */
+  sprintf( filename, "%s%s.nc", name, CF_FILENAME_MOSAIC );
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+
+/* write mosaic as polytopes */
+//  nccf_print_mosaic_as_polytopes(mosaicid,"two_tiles.pt");
+
+  status = nccf_free_mosaic( mosaicid );
+  for( iGrid = 0; iGrid < ngrids; iGrid++ ){
+    status = nccf_free_grid( gridid[iGrid] );
+    status = nccf_free_coord( coordId[iGrid][0] );
+    status = nccf_free_coord( coordId[iGrid][1] );
+  }  
+
+/* Load the contacts, grids, and coordinates from file */
+  char *tst_name  = "tst_two_tiles_mosaic";
+  if ((status = nccf_def_mosaic_from_file(filename, 
+					  tst_name,
+   					  &mosaicid2))) ERR;
+
+/* Check */
+  int ncontacts;
+  if ((status = nccf_inq_mosaic_ncontacts(mosaicid2, &ncontacts))) ERR;
+  assert(ncontacts == 1);
+
+/* free the grid */
+  if(( status = nccf_free_mosaic( mosaicid ))) ERR;
+
+  return 0;
+}
diff --git a/gridspec_api/mosaic/tst_two_unequal_in_i_j_tiles.c b/gridspec_api/mosaic/tst_two_unequal_in_i_j_tiles.c
new file mode 100644
index 0000000..7d737f3
--- /dev/null
+++ b/gridspec_api/mosaic/tst_two_unequal_in_i_j_tiles.c
@@ -0,0 +1,197 @@
+/**
+ * Test mosaic construction of two tiles with unequal i and j dimensions.
+ *
+ * "$Id: tst_two_unequal_in_i_j_tiles.c 767 2011-06-06 23:20:19Z pletzer $"
+ */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <libcf_src.h>
+#include <netcdf.h>
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_coord.h"
+#include "nccf_handle_error.h"
+#include "nccf_utility_functions.h"
+
+#include <assert.h>
+
+int main(  ){
+
+  /* Variables for the grid */
+  // Each Id goes with a ncid
+  int status, ncid;
+  int iGrid; // Some counters
+  const int ndims = 2;         // Number of x, y dims
+  const int ngrids = 2;
+  const int dims0[] = { 5,10};
+  const int dims1[] = { 11, 7};
+  const double period[] = {360., 0.};
+  char coordinates_id[36+1];
+
+  int gridid[ngrids], mosaicid, mosaicid2, i, j, globalId;
+  int coordId[ngrids][ndims], save = 1;
+
+  nc_type nc_mode = NC_CLOBBER;
+
+  char *name = "tst_two_unequal_in_i_j";
+  char gridname[STRING_SIZE];
+  char filename[STRING_SIZE];
+  const char *dimnames[] = {"ni", "nj"};
+  char **files;
+  files = ( char** )calloc( 3, sizeof( char* ));
+  for( iGrid = 0; iGrid < 3; iGrid++ )
+      files[iGrid] = ( char* )calloc( STRING_SIZE, sizeof( char ));
+
+  int nv0 = dims0[0] * dims0[1];
+  int nv1 = dims1[0] * dims1[1];
+  double lon1[nv0], lat1[nv0], lon2[nv1], lat2[nv1], dlon, dlat;
+  const double lonMin[2] = {  0., 270.};
+  const double lonMax[2] = {270., 360.};
+  const double latMin    = -90.0;
+  const double latMax    =  90.0;
+
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+
+  /* Grid 0 */
+  dlat = ( latMax    - latMin )    / ( dims0[0] - 1 );
+  dlon = ( lonMax[0] - lonMin[0] ) / ( dims0[1] - 1 );
+
+  for( j = 0; j < dims0[0]; j++ ){
+    for( i = 0; i < dims0[1]; i++){
+      lon1[i + dims0[1] * j] = lonMin[0] + i * dlon;
+      lat1[i + dims0[1] * j] = latMin    + j * dlat;
+    }
+  }
+
+  /* Grid 1 */
+  dlat = ( latMax    - latMin )    / ( dims1[0] - 1 );
+  dlon = ( lonMax[1] - lonMin[1] ) / ( dims1[1] - 1 );
+
+  for( j = 0; j < dims1[0]; j++ ){
+    for( i = 0; i < dims1[1]; i++){
+      lon2[i + dims1[1] * j] = lonMin[1] + i * dlon;
+      lat2[i + dims1[1] * j] = latMin    + j * dlat;
+    }
+  }
+
+/* Calculate the coordinates for the current tile */
+
+/* Define tile 0 */
+  iGrid = 0;
+  if(( status = nccf_def_lon_coord( ndims, dims0, dimnames, lon1, save,
+                                         &coordId[iGrid][0] ))) ERR;
+  if(( status = nccf_def_lat_coord( ndims, dims0, dimnames, lat1, save,
+                                         &coordId[iGrid][1] ))) ERR;
+
+  sprintf( gridname, "%s%s%d", name, CF_FILENAME_GRID, iGrid );
+  sprintf( filename, "%s.nc", gridname );
+  if(( status = nccf_def_grid( coordId[iGrid],
+					  gridname, 
+					  &gridid[iGrid] ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+  sprintf( files[0], "%s", filename );
+
+/* Write tile 0 */
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;  
+  if(( status = nccf_put_grid(gridid[iGrid], ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+/* Define tile 1 */
+  iGrid = 1;
+  if(( status = nccf_def_lon_coord( ndims, dims1, dimnames, lon2, save,
+                                         &coordId[iGrid][0] ))) ERR;
+  if(( status = nccf_def_lat_coord( ndims, dims1, dimnames, lat2, save,
+                                         &coordId[iGrid][1] ))) ERR;
+
+  sprintf( gridname, "%s%s%d", name, CF_FILENAME_GRID, iGrid );
+  sprintf( filename, "%s.nc", gridname );
+  sprintf( files[1], "%s", filename );
+  if(( status = nccf_def_grid( coordId[iGrid],
+					  gridname, 
+					  &gridid[iGrid] ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+  
+/* Write tile 1 */
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;  
+  if(( status = nccf_put_grid(gridid[iGrid], ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+/* Define the contacts */
+  if(( status = nccf_def_mosaic( ngrids, gridid, gridname, &mosaicid ))) ERR;
+  if(( status = nccf_compute_mosaic_contacts( mosaicid, period ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0 ))) ERR;
+
+/* Write the file */
+  sprintf( filename, "%s%s.nc", name, CF_FILENAME_MOSAIC );
+  sprintf( files[2], "%s", filename );
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+/* write mosaic as polytopes */
+//  nccf_print_mosaic_as_polytopes(mosaicid,"two_unequal_in_i_j.pt");
+
+  status = nccf_free_mosaic( mosaicid );
+  for( iGrid = 0; iGrid < ngrids; iGrid++ ){
+    status = nccf_free_grid( gridid[iGrid] );
+    status = nccf_free_coord( coordId[iGrid][0] );
+    status = nccf_free_coord( coordId[iGrid][1] );
+  }  
+
+/* Load the contacts, grids, and coordinates from file */
+  if ((status = nccf_def_mosaic_from_file( filename,
+					    "tst_two_tiles_mosaic",
+					    &mosaicid2))) ERR;
+
+/* Check */
+  int ncontacts;
+  if ((status = nccf_inq_mosaic_ncontacts(mosaicid2, &ncontacts))) ERR;
+  assert(ncontacts == 2);
+
+  char contact_map[STRING_SIZE], tile_contact[STRING_SIZE], sep[10];
+  nccf_inq_mosaic_contactmap(  mosaicid2, 0, contact_map );
+  nccf_inq_mosaic_tilecontact( mosaicid2, 0, tile_contact );
+  nccf_inq_mosaic_tileseparator( sep );
+  printf( "%s, %s, %s\n", contact_map, tile_contact, sep );
+
+
+/* free the grid */
+  if(( status = nccf_free_mosaic( mosaicid2 ))) ERR;
+
+/* Add the signature to these files */
+  char *id;
+  char *names[] = {"grid0", "grid1", "mosaic"};
+  char *types[] = {"grid", "grid", "mosaic"};
+  id = ( char* )calloc( STRING_SIZE, sizeof( char ));
+
+  nccf_generate_id( 77, id );
+  if(( status = nccf_add_id_to_files( id, 3, (const char**)names, 
+                                             (const char**)types, 
+                                             (const char**)files ))) ERR;
+
+  free( id );
+  for (i = 0; i < 3; ++i) {
+    free( files[i] );
+  }
+  free(files);
+
+/* Close the file*/
+  return 0;
+}
diff --git a/gridspec_api/mosaic/tst_two_unequal_in_i_tiles.c b/gridspec_api/mosaic/tst_two_unequal_in_i_tiles.c
new file mode 100644
index 0000000..04f1cd8
--- /dev/null
+++ b/gridspec_api/mosaic/tst_two_unequal_in_i_tiles.c
@@ -0,0 +1,164 @@
+/*
+ * Test the creation of a two tiled structured grid with unequal i dimension.
+ *
+ * "$Id: tst_two_unequal_in_i_tiles.c 767 2011-06-06 23:20:19Z pletzer $"
+ * */
+
+#include "nccf_mosaic.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <libcf_src.h>
+#include <netcdf.h>
+#include "nccf_grid.h"
+#include "nccf_global.h"
+#include "nccf_coord.h"
+#include "nccf_varObj.h"
+#include "nccf_handle_error.h"
+#include "nccf_utility_functions.h"
+
+#include <assert.h>
+
+int main(  ){
+
+  /* Variables for the grid */
+  // Each Id goes with a ncid
+  int status, ncid;
+  int iGrid; // Some counters
+  int ndims = 2;         // Number of x, y dims
+  int ngrids = 2;
+  int dims0[] = { 5,10};
+  int dims1[] = { 5, 7};
+  double period[] = {360., 0.};
+  char coordinates_id[36+1];
+
+  int gridid[ngrids], mosaicid, mosaicid2, i, j, globalId;
+  int coordId[ngrids][ndims], save = 1;
+
+  nc_type nc_mode = NC_CLOBBER;
+
+  char *name = "tst_two_unequal_in_i";
+  char gridname[STRING_SIZE];
+  char filename[STRING_SIZE];
+  const char *dimnames[] = {"ni", "nj"};
+
+  int nv0 = dims0[0] * dims0[1];
+  int nv1 = dims1[0] * dims1[1];
+  double lon1[nv0], lat1[nv0], lon2[nv1], lat2[nv1], dlon, dlat;
+  const double lonMin[2] = {  0., 270.};
+  const double lonMax[2] = {270., 360.};
+  const double latMin    = -90.0;
+  const double latMax    =  90.0;
+
+  /* Generate unique coordinate id */
+  if ((status = nccf_generate_id(123, coordinates_id))) ERR;
+
+  /* Grid 0 */
+  dlat = ( latMax    - latMin )    / ( dims0[0] - 1 );
+  dlon = ( lonMax[0] - lonMin[0] ) / ( dims0[1] - 1 );
+
+  for( j = 0; j < dims0[0]; j++ ){
+    for( i = 0; i < dims0[1]; i++){
+      lon1[i + dims0[1] * j] = lonMin[0] + i * dlon;
+      lat1[i + dims0[1] * j] = latMin    + j * dlat;
+    }
+  }
+
+  /* Grid 1 */
+  dlat = ( latMax    - latMin )    / ( dims1[0] - 1 );
+  dlon = ( lonMax[1] - lonMin[1] ) / ( dims1[1] - 1 );
+
+  for( j = 0; j < dims1[0]; j++ ){
+    for( i = 0; i < dims1[1]; i++){
+      lon2[i + dims1[1] * j] = lonMin[1] + i * dlon;
+      lat2[i + dims1[1] * j] = latMin    + j * dlat;
+    }
+  }
+
+/* Calculate the coordinates for the current tile */
+
+/* Define tile 0 */
+  iGrid = 0;
+  if(( status = nccf_def_lon_coord( ndims, dims0, dimnames, lon1, save,
+                                         &coordId[iGrid][0] ))) ERR;
+  if(( status = nccf_def_lat_coord( ndims, dims0, dimnames, lat1, save,
+                                         &coordId[iGrid][1] ))) ERR;
+
+  sprintf( gridname, "%s%s%d", name, CF_FILENAME_GRID, iGrid );
+  sprintf( filename, "%s.nc", gridname );
+  if(( status = nccf_def_grid( coordId[iGrid],
+					  gridname,
+					  &gridid[iGrid] ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+/* Write tile 0 */
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_grid(gridid[iGrid], ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+/* Define tile 1 */
+  iGrid = 1;
+  if(( status = nccf_def_lon_coord( ndims, dims1, dimnames, lon2, save,
+                                         &coordId[iGrid][0] ))) ERR;
+  if(( status = nccf_def_lat_coord( ndims, dims1, dimnames, lat2, save,
+                                         &coordId[iGrid][1] ))) ERR;
+
+  sprintf( gridname, "%s%s%d", name, CF_FILENAME_GRID, iGrid );
+  sprintf( filename, "%s.nc", gridname );
+  if(( status = nccf_def_grid( coordId[iGrid],
+					  gridname,
+					  &gridid[iGrid] ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_GRIDNAME, name, 0 ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_COORDINATES_ID, coordinates_id, 0 ))) ERR;
+
+/* Write tile 1 */
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_grid(gridid[iGrid], ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+/* Define the contacts */
+  if(( status = nccf_def_mosaic( ngrids, gridid, gridname, &mosaicid ))) ERR;
+  if(( status = nccf_compute_mosaic_contacts( mosaicid, period ))) ERR;
+  if(( status = nccf_def_global( &globalId ))) ERR;
+  if(( status = nccf_add_global_att( globalId, CF_FILETYPE, CF_GLATT_FILETYPE_MOSAIC, 0 ))) ERR;
+
+/* Write the file */
+  sprintf( filename, "%s%s.nc", name, CF_FILENAME_MOSAIC );
+  if(( status = nc_create( filename, nc_mode, &ncid ))) ERR;
+  if(( status = nccf_put_mosaic(mosaicid, ncid))) ERR;
+  if(( status = nccf_put_global(globalId, ncid))) ERR;
+  if(( status = nc_close( ncid ))) ERR;
+  if(( status = nccf_free_global( globalId ))) ERR;
+
+  status = nccf_free_mosaic( mosaicid );
+  for( iGrid = 0; iGrid < ngrids; iGrid++ ){
+    status = nccf_free_grid( gridid[iGrid] );
+    status = nccf_free_coord( coordId[iGrid][0] );
+    status = nccf_free_coord( coordId[iGrid][1] );
+  }
+
+/* Load the contacts, grids, and coordinates from file */
+  if ((status = nccf_def_mosaic_from_file( filename,
+					    "tst_two_tiles_mosaic",
+					    &mosaicid2))) ERR;
+
+/* Check */
+  int ncontacts;
+  if ((status = nccf_inq_mosaic_ncontacts(mosaicid2, &ncontacts))) ERR;
+  assert(ncontacts == 2);
+
+/* free the grid */
+  if(( status = nccf_free_mosaic( mosaicid2 ))) ERR;
+
+/* Close the file*/
+  return 0;
+}
diff --git a/gridspec_api/regrid/Makefile.am b/gridspec_api/regrid/Makefile.am
new file mode 100644
index 0000000..f8d0f35
--- /dev/null
+++ b/gridspec_api/regrid/Makefile.am
@@ -0,0 +1,77 @@
+#
+# $Id: Makefile.am 915 2012-01-09 16:58:08Z pletzer $
+#
+
+AM_CPPFLAGS = -I at NETCDFDIR@/include -I$(top_srcdir)/src			\
+-I$(top_srcdir)/include -I$(srcdir)/../global -I$(srcdir)/../coord	\
+-I$(srcdir)/../grid -I$(srcdir)/../data
+
+include_HEADERS = nccf_regrid.h
+
+noinst_LTLIBRARIES = libnccf_regrid.la
+libnccf_regrid_la_SOURCES = nccf_def_regrid.c				\
+nccf_def_regrid_from_file.c nccf_put_regrid.c nccf_free_regrid.c	\
+nccf_apply_regrid.c nccf_apply_regrid_type.h				\
+nccf_inq_regrid_ntargets.c nccf_inq_regrid_nvalid.c			\
+nccf_inq_regrid_nnodes.c nccf_add_regrid_forbidden.c			\
+nccf_compute_regrid_weights.c nccf_inq_regrid_weights.c                 \
+nccf_get_regrid_weights_pointer.c
+
+INTLIBS = libnccf_regrid.la ../data/libnccf_data.la	\
+../grid/libnccf_grid.la ../global/libnccf_global.la	\
+../coord/libnccf_coord.la ../../src/libcf_src.la
+
+EXTLIBS = -lnetcdf 
+
+noinst_PROGRAMS = tst_cubesphere_to_lonlat_regrid \
+tst_tripolar_to_lonlat_regrid_from_weights
+
+check_PROGRAMS = \
+  tst_lonlat_regrid \
+  tst_slanted_lonlat_regrid \
+  tst_lonlat_to_lonlat_regrid \
+  tst_tripolar_to_lonlat_regrid	\
+  tst_put_and_def_from_file \
+  tst_mask tst_mask2 \
+  tst_periodic tst_periodic2 tst_periodic3
+
+tst_lonlat_regrid_SOURCES = tst_lonlat_regrid.c
+tst_lonlat_regrid_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_slanted_lonlat_regrid_SOURCES = tst_slanted_lonlat_regrid.c
+tst_slanted_lonlat_regrid_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_lonlat_to_lonlat_regrid_SOURCES = tst_lonlat_to_lonlat_regrid.c
+tst_lonlat_to_lonlat_regrid_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_tripolar_to_lonlat_regrid_SOURCES = tst_tripolar_to_lonlat_regrid.c
+tst_tripolar_to_lonlat_regrid_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_put_and_def_from_file_SOURCES = tst_put_and_def_from_file.c
+tst_put_and_def_from_file_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_cubesphere_to_lonlat_regrid_SOURCES = tst_cubesphere_to_lonlat_regrid.c
+tst_cubesphere_to_lonlat_regrid_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_tripolar_to_lonlat_regrid_from_weights_SOURCES = tst_tripolar_to_lonlat_regrid_from_weights.c
+tst_tripolar_to_lonlat_regrid_from_weights_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_mask_SOURCES = tst_mask.c
+tst_mask_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_mask2_SOURCES = tst_mask2.c
+tst_mask2_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_periodic_SOURCES = tst_periodic.c
+tst_periodic_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_periodic2_SOURCES = tst_periodic2.c
+tst_periodic2_LDADD = $(INTLIBS) $(EXTLIBS)
+
+tst_periodic3_SOURCES = tst_periodic3.c
+tst_periodic3_LDADD = $(INTLIBS) $(EXTLIBS)
+
+TESTS = $(check_PROGRAMS)
+
+# files generated by tests
+CLEANFILES = *.nc
diff --git a/src/Makefile.in b/gridspec_api/regrid/Makefile.in
similarity index 56%
copy from src/Makefile.in
copy to gridspec_api/regrid/Makefile.in
index afcdc0d..05d2f34 100644
--- a/src/Makefile.in
+++ b/gridspec_api/regrid/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,11 +15,10 @@
 
 @SET_MAKE@
 
-# Copyright 2006, see the COPYRIGHT file for more information.
+#
+# $Id: Makefile.am 915 2012-01-09 16:58:08Z pletzer $
+#
 
-# THis automake file is in charge of building the src directory.
-
-# $Id: Makefile.am,v 1.5 2009/11/11 12:59:24 ed Exp $
 
 
 VPATH = @srcdir@
@@ -41,43 +40,16 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-check_PROGRAMS = tst_coords$(EXEEXT) tst_files$(EXEEXT) \
-	tst_vars$(EXEEXT) tst_cvars$(EXEEXT) tst_vert$(EXEEXT) \
-	tst_subsets$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2)
- at BUILD_F90_TRUE@am__append_1 = libcff.la
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at am__append_2 = tst_f03_file
- at BUILD_F90_TRUE@am__append_3 = libcf.la
-
-# Link to the netCDF-4, (optionally) HDF4, and the HDF5 libraries.
- at USE_NETCDF_DIR_TRUE@am__append_4 = -lnetcdf
- at USE_NETCDF_DIR_TRUE@am__append_5 = -I at NETCDFDIR@/include
- at USE_NETCDF_DIR_TRUE@am__append_6 = -L at NETCDFDIR@/lib
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_7 = ../../libsrc4/libnetcdf.la 
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_8 = -I$(top_srcdir)/../libsrc4
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_9 = -L../../libsrc4
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_10 = ../../libsrc/libnetcdf.la
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_11 = -I$(top_srcdir)/../libsrc
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_12 = -L../../libsrc
- at USE_HDF4_TRUE@am__append_13 = -lmfhdf -ldf -ljpeg
- at USE_NETCDF4_TRUE@am__append_14 = -lhdf5_hl -lhdf5 -lz 
-
-# If the user specified a root for HDF5, use it.
- at USE_HDF5_DIR_TRUE@am__append_15 = -I at HDF5DIR@/include
- at USE_HDF5_DIR_TRUE@am__append_16 = -L at HDF5DIR@/lib
-
-# If the user specified a prefix for the HDF4 library location, use it.
- at USE_HDF4_DIR_TRUE@am__append_17 = -I at HDF4DIR@/include
- at USE_HDF4_DIR_TRUE@am__append_18 = -L at HDF4DIR@/lib
-
-# If the user specified a root location for ZLIB, use it.
- at USE_ZLIB_DIR_TRUE@am__append_19 = -I at ZLIBDIR@/include
- at USE_ZLIB_DIR_TRUE@am__append_20 = -L at ZLIBDIR@/lib
-
-# If the user specified a root location for SZLIB, use it.
- at USE_SZLIB_DIR_TRUE@am__append_21 = -I at SZLIBDIR@/include
- at USE_SZLIB_DIR_TRUE@am__append_22 = -L at SZLIBDIR@/lib
- at EXTRA_DATA_TESTS_TRUE@am__append_23 = tst_example_data
-subdir = src
+noinst_PROGRAMS = tst_cubesphere_to_lonlat_regrid$(EXEEXT) \
+	tst_tripolar_to_lonlat_regrid_from_weights$(EXEEXT)
+check_PROGRAMS = tst_lonlat_regrid$(EXEEXT) \
+	tst_slanted_lonlat_regrid$(EXEEXT) \
+	tst_lonlat_to_lonlat_regrid$(EXEEXT) \
+	tst_tripolar_to_lonlat_regrid$(EXEEXT) \
+	tst_put_and_def_from_file$(EXEEXT) tst_mask$(EXEEXT) \
+	tst_mask2$(EXEEXT) tst_periodic$(EXEEXT) \
+	tst_periodic2$(EXEEXT) tst_periodic3$(EXEEXT)
+subdir = gridspec_api/regrid
 DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -88,9 +60,109 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
+CONFIG_HEADER = $(top_builddir)/cf_config.h \
+	$(top_builddir)/nfconfig.inc
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libnccf_regrid_la_LIBADD =
+am_libnccf_regrid_la_OBJECTS = nccf_def_regrid.lo \
+	nccf_def_regrid_from_file.lo nccf_put_regrid.lo \
+	nccf_free_regrid.lo nccf_apply_regrid.lo \
+	nccf_inq_regrid_ntargets.lo nccf_inq_regrid_nvalid.lo \
+	nccf_inq_regrid_nnodes.lo nccf_add_regrid_forbidden.lo \
+	nccf_compute_regrid_weights.lo nccf_inq_regrid_weights.lo \
+	nccf_get_regrid_weights_pointer.lo
+libnccf_regrid_la_OBJECTS = $(am_libnccf_regrid_la_OBJECTS)
+PROGRAMS = $(noinst_PROGRAMS)
+am_tst_cubesphere_to_lonlat_regrid_OBJECTS =  \
+	tst_cubesphere_to_lonlat_regrid.$(OBJEXT)
+tst_cubesphere_to_lonlat_regrid_OBJECTS =  \
+	$(am_tst_cubesphere_to_lonlat_regrid_OBJECTS)
+am__DEPENDENCIES_1 =
+tst_cubesphere_to_lonlat_regrid_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_lonlat_regrid_OBJECTS = tst_lonlat_regrid.$(OBJEXT)
+tst_lonlat_regrid_OBJECTS = $(am_tst_lonlat_regrid_OBJECTS)
+tst_lonlat_regrid_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_lonlat_to_lonlat_regrid_OBJECTS =  \
+	tst_lonlat_to_lonlat_regrid.$(OBJEXT)
+tst_lonlat_to_lonlat_regrid_OBJECTS =  \
+	$(am_tst_lonlat_to_lonlat_regrid_OBJECTS)
+tst_lonlat_to_lonlat_regrid_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_mask_OBJECTS = tst_mask.$(OBJEXT)
+tst_mask_OBJECTS = $(am_tst_mask_OBJECTS)
+tst_mask_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_mask2_OBJECTS = tst_mask2.$(OBJEXT)
+tst_mask2_OBJECTS = $(am_tst_mask2_OBJECTS)
+tst_mask2_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_periodic_OBJECTS = tst_periodic.$(OBJEXT)
+tst_periodic_OBJECTS = $(am_tst_periodic_OBJECTS)
+tst_periodic_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_periodic2_OBJECTS = tst_periodic2.$(OBJEXT)
+tst_periodic2_OBJECTS = $(am_tst_periodic2_OBJECTS)
+tst_periodic2_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_periodic3_OBJECTS = tst_periodic3.$(OBJEXT)
+tst_periodic3_OBJECTS = $(am_tst_periodic3_OBJECTS)
+tst_periodic3_DEPENDENCIES = $(INTLIBS) $(am__DEPENDENCIES_1)
+am_tst_put_and_def_from_file_OBJECTS =  \
+	tst_put_and_def_from_file.$(OBJEXT)
+tst_put_and_def_from_file_OBJECTS =  \
+	$(am_tst_put_and_def_from_file_OBJECTS)
+tst_put_and_def_from_file_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_slanted_lonlat_regrid_OBJECTS =  \
+	tst_slanted_lonlat_regrid.$(OBJEXT)
+tst_slanted_lonlat_regrid_OBJECTS =  \
+	$(am_tst_slanted_lonlat_regrid_OBJECTS)
+tst_slanted_lonlat_regrid_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_tripolar_to_lonlat_regrid_OBJECTS =  \
+	tst_tripolar_to_lonlat_regrid.$(OBJEXT)
+tst_tripolar_to_lonlat_regrid_OBJECTS =  \
+	$(am_tst_tripolar_to_lonlat_regrid_OBJECTS)
+tst_tripolar_to_lonlat_regrid_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+am_tst_tripolar_to_lonlat_regrid_from_weights_OBJECTS =  \
+	tst_tripolar_to_lonlat_regrid_from_weights.$(OBJEXT)
+tst_tripolar_to_lonlat_regrid_from_weights_OBJECTS =  \
+	$(am_tst_tripolar_to_lonlat_regrid_from_weights_OBJECTS)
+tst_tripolar_to_lonlat_regrid_from_weights_DEPENDENCIES = $(INTLIBS) \
+	$(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(libnccf_regrid_la_SOURCES) \
+	$(tst_cubesphere_to_lonlat_regrid_SOURCES) \
+	$(tst_lonlat_regrid_SOURCES) \
+	$(tst_lonlat_to_lonlat_regrid_SOURCES) $(tst_mask_SOURCES) \
+	$(tst_mask2_SOURCES) $(tst_periodic_SOURCES) \
+	$(tst_periodic2_SOURCES) $(tst_periodic3_SOURCES) \
+	$(tst_put_and_def_from_file_SOURCES) \
+	$(tst_slanted_lonlat_regrid_SOURCES) \
+	$(tst_tripolar_to_lonlat_regrid_SOURCES) \
+	$(tst_tripolar_to_lonlat_regrid_from_weights_SOURCES)
+DIST_SOURCES = $(libnccf_regrid_la_SOURCES) \
+	$(tst_cubesphere_to_lonlat_regrid_SOURCES) \
+	$(tst_lonlat_regrid_SOURCES) \
+	$(tst_lonlat_to_lonlat_regrid_SOURCES) $(tst_mask_SOURCES) \
+	$(tst_mask2_SOURCES) $(tst_periodic_SOURCES) \
+	$(tst_periodic2_SOURCES) $(tst_periodic3_SOURCES) \
+	$(tst_put_and_def_from_file_SOURCES) \
+	$(tst_slanted_lonlat_regrid_SOURCES) \
+	$(tst_tripolar_to_lonlat_regrid_SOURCES) \
+	$(tst_tripolar_to_lonlat_regrid_from_weights_SOURCES)
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -112,106 +184,7 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
-LTLIBRARIES = $(lib_LTLIBRARIES)
-libcf_la_LIBADD =
-am_libcf_la_OBJECTS = nccoord.lo cffiles.lo cfvars.lo cfcvars.lo \
-	cfsubsets.lo cferror.lo cdTimeConv.lo
-libcf_la_OBJECTS = $(am_libcf_la_OBJECTS)
-libcf_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(libcf_la_LDFLAGS) \
-	$(LDFLAGS) -o $@
-libcff_la_LIBADD =
-am__libcff_la_SOURCES_DIST = cffcvars.f90
- at BUILD_F90_TRUE@am_libcff_la_OBJECTS = cffcvars.lo
-libcff_la_OBJECTS = $(am_libcff_la_OBJECTS)
- at BUILD_F90_TRUE@am_libcff_la_rpath = -rpath $(libdir)
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at am__EXEEXT_1 =  \
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE@	tst_f03_file$(EXEEXT)
- at EXTRA_DATA_TESTS_TRUE@am__EXEEXT_2 = tst_example_data$(EXEEXT)
-am_tst_coords_OBJECTS = tst_coords.$(OBJEXT)
-tst_coords_OBJECTS = $(am_tst_coords_OBJECTS)
-tst_coords_LDADD = $(LDADD)
-am__DEPENDENCIES_1 =
-tst_coords_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_cvars_OBJECTS = tst_cvars.$(OBJEXT)
-tst_cvars_OBJECTS = $(am_tst_cvars_OBJECTS)
-tst_cvars_LDADD = $(LDADD)
-tst_cvars_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am__tst_example_data_SOURCES_DIST = tst_example_data.c nc_tests.h
- at EXTRA_DATA_TESTS_TRUE@am_tst_example_data_OBJECTS =  \
- at EXTRA_DATA_TESTS_TRUE@	tst_example_data.$(OBJEXT)
-tst_example_data_OBJECTS = $(am_tst_example_data_OBJECTS)
-tst_example_data_LDADD = $(LDADD)
-tst_example_data_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am__tst_f03_file_SOURCES_DIST = tst_f03_file.f90
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at am_tst_f03_file_OBJECTS =  \
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE@	tst_f03_file.$(OBJEXT)
-tst_f03_file_OBJECTS = $(am_tst_f03_file_OBJECTS)
-tst_f03_file_LDADD = $(LDADD)
-tst_f03_file_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_files_OBJECTS = tst_files.$(OBJEXT)
-tst_files_OBJECTS = $(am_tst_files_OBJECTS)
-tst_files_LDADD = $(LDADD)
-tst_files_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_subsets_OBJECTS = tst_subsets.$(OBJEXT)
-tst_subsets_OBJECTS = $(am_tst_subsets_OBJECTS)
-tst_subsets_LDADD = $(LDADD)
-tst_subsets_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_vars_OBJECTS = tst_vars.$(OBJEXT)
-tst_vars_OBJECTS = $(am_tst_vars_OBJECTS)
-tst_vars_LDADD = $(LDADD)
-tst_vars_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_vert_OBJECTS = tst_vert.$(OBJEXT)
-tst_vert_OBJECTS = $(am_tst_vert_OBJECTS)
-tst_vert_LDADD = $(LDADD)
-tst_vert_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
-FCCOMPILE = $(FC) $(AM_FCFLAGS) $(FCFLAGS)
-LTFCCOMPILE = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS)
-FCLD = $(FC)
-FCLINK = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
-SOURCES = $(libcf_la_SOURCES) $(libcff_la_SOURCES) \
-	$(tst_coords_SOURCES) $(tst_cvars_SOURCES) \
-	$(tst_example_data_SOURCES) $(tst_f03_file_SOURCES) \
-	$(tst_files_SOURCES) $(tst_subsets_SOURCES) \
-	$(tst_vars_SOURCES) $(tst_vert_SOURCES)
-DIST_SOURCES = $(libcf_la_SOURCES) $(am__libcff_la_SOURCES_DIST) \
-	$(tst_coords_SOURCES) $(tst_cvars_SOURCES) \
-	$(am__tst_example_data_SOURCES_DIST) \
-	$(am__tst_f03_file_SOURCES_DIST) $(tst_files_SOURCES) \
-	$(tst_subsets_SOURCES) $(tst_vars_SOURCES) $(tst_vert_SOURCES)
+am__installdirs = "$(DESTDIR)$(includedir)"
 HEADERS = $(include_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -222,7 +195,6 @@ ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
 AR = @AR@
-AS = @AS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -243,15 +215,19 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-F77 = @F77@
 FC = @FC@
 FCFLAGS = @FCFLAGS@
 FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
+FCLIBS = @FCLIBS@
 FGREP = @FGREP@
 GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
+HAVE_DARWIN = @HAVE_DARWIN@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_LAPACK_LIB = @HAVE_LAPACK_LIB@
+HAVE_LAPACK_NO_UNDERSCORE = @HAVE_LAPACK_NO_UNDERSCORE@
+HAVE_LAPACK_UNDERSCORE = @HAVE_LAPACK_UNDERSCORE@
+HAVE_SHARED = @HAVE_SHARED@
+HAVE_UUID = @HAVE_UUID@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -266,8 +242,10 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 MOD_FLAG = @MOD_FLAG@
+NCDUMP = @NCDUMP@
 NCDUMPDIR = @NCDUMPDIR@
 NETCDFDIR = @NETCDFDIR@
 NM = @NM@
@@ -281,23 +259,23 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
 VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
 ac_ct_FC = @ac_ct_FC@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -329,7 +307,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -345,65 +322,57 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-
-# Tell automake that libcf.h is a header file we want to install.
-include_HEADERS = libcf.h
-
-# Test programs will need to link to this library (libcf) and also
-# netcdf.
-LDADD = ${lib_LTLIBRARIES} $(am__append_3) $(am__append_4) \
-	$(am__append_7) $(am__append_10) $(am__append_13) \
-	$(am__append_14)
-
-# Initalize these.
-AM_CPPFLAGS = $(am__append_5) $(am__append_8) $(am__append_11) \
-	$(am__append_15) $(am__append_17) $(am__append_19) \
-	$(am__append_21)
-AM_LDFLAGS = $(am__append_6) $(am__append_9) $(am__append_12) \
-	$(am__append_16) $(am__append_18) $(am__append_20) \
-	$(am__append_22)
-
-# This is our output, the NetCDF CF Library.
-lib_LTLIBRARIES = libcf.la $(am__append_1)
- at BUILD_F90_TRUE@libcff_la_DEPENDENCIES = libcf_api.f90
- at BUILD_F90_TRUE@EXTRA_DIST = libcf_api.f90
- at BUILD_F90_TRUE@libcff_la_SOURCES = cffcvars.f90
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at tst_f03_file_SOURCES = tst_f03_file.f90
- at BUILD_F90_TRUE@@USE_NETCDF_DIR_FALSE at AM_FCFLAGS = @MOD_FLAG at ../../f90
- at BUILD_F90_TRUE@@USE_NETCDF_DIR_TRUE at AM_FCFLAGS = @MOD_FLAG@@NETCDFDIR@/include
-
-# Add the gridspec functions.
-#libcf_la_LIBADD = ../gridspec/shared/mosaic/libshared.la 
-#libcf_la_LIBADD += ../gridspec/tools/shared/libtoolsshared.la 
-
-# These linker flags specify libtool version info.
-libcf_la_LDFLAGS = -version-info 0:0:0
-
-# This is the coordinate systems stuff.
-libcf_la_SOURCES = nccoord.c libcf.h libcf_int.h cffiles.c cfvars.c	\
-cfcvars.c cfsubsets.c cferror.c cferror.h cdTimeConv.c cdmsint.h	\
-cdms.h cddrs.h drscdf.h cdunif.h
-
-
-# These files are created by the tests.
-CLEANFILES = tst_coords_classic.nc tst_coords_64bit.nc			\
-tst_coords_netcdf4_classic.nc tst_coords_netcdf4.nc tst_vars.nc		\
-tst_files.nc tst_cvars.nc tst_vert_sigma.nc tst_vert_hybrid_sigma.nc	\
-tst_subsets_simple_sigma.nc tst_subsets_nw.nc tst_subsets_sw.nc		\
-tst_subsets_se.nc tst_subsets_ne.nc tst_f03_file.nc libcf.mod
-
-tst_coords_SOURCES = tst_coords.c nc_tests.h
-tst_files_SOURCES = tst_files.c nc_tests.h
-tst_vars_SOURCES = tst_vars.c nc_tests.h
-tst_cvars_SOURCES = tst_cvars.c nc_tests.h
-tst_vert_SOURCES = tst_vert.c nc_tests.h
-tst_subsets_SOURCES = tst_subsets.c nc_tests.h
- at EXTRA_DATA_TESTS_TRUE@tst_example_data_SOURCES = tst_example_data.c nc_tests.h
+AM_CPPFLAGS = -I at NETCDFDIR@/include -I$(top_srcdir)/src			\
+-I$(top_srcdir)/include -I$(srcdir)/../global -I$(srcdir)/../coord	\
+-I$(srcdir)/../grid -I$(srcdir)/../data
+
+include_HEADERS = nccf_regrid.h
+noinst_LTLIBRARIES = libnccf_regrid.la
+libnccf_regrid_la_SOURCES = nccf_def_regrid.c				\
+nccf_def_regrid_from_file.c nccf_put_regrid.c nccf_free_regrid.c	\
+nccf_apply_regrid.c nccf_apply_regrid_type.h				\
+nccf_inq_regrid_ntargets.c nccf_inq_regrid_nvalid.c			\
+nccf_inq_regrid_nnodes.c nccf_add_regrid_forbidden.c			\
+nccf_compute_regrid_weights.c nccf_inq_regrid_weights.c                 \
+nccf_get_regrid_weights_pointer.c
+
+INTLIBS = libnccf_regrid.la ../data/libnccf_data.la	\
+../grid/libnccf_grid.la ../global/libnccf_global.la	\
+../coord/libnccf_coord.la ../../src/libcf_src.la
+
+EXTLIBS = -lnetcdf 
+tst_lonlat_regrid_SOURCES = tst_lonlat_regrid.c
+tst_lonlat_regrid_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_slanted_lonlat_regrid_SOURCES = tst_slanted_lonlat_regrid.c
+tst_slanted_lonlat_regrid_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_lonlat_to_lonlat_regrid_SOURCES = tst_lonlat_to_lonlat_regrid.c
+tst_lonlat_to_lonlat_regrid_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_tripolar_to_lonlat_regrid_SOURCES = tst_tripolar_to_lonlat_regrid.c
+tst_tripolar_to_lonlat_regrid_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_put_and_def_from_file_SOURCES = tst_put_and_def_from_file.c
+tst_put_and_def_from_file_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_cubesphere_to_lonlat_regrid_SOURCES = tst_cubesphere_to_lonlat_regrid.c
+tst_cubesphere_to_lonlat_regrid_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_tripolar_to_lonlat_regrid_from_weights_SOURCES = tst_tripolar_to_lonlat_regrid_from_weights.c
+tst_tripolar_to_lonlat_regrid_from_weights_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_mask_SOURCES = tst_mask.c
+tst_mask_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_mask2_SOURCES = tst_mask2.c
+tst_mask2_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_periodic_SOURCES = tst_periodic.c
+tst_periodic_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_periodic2_SOURCES = tst_periodic2.c
+tst_periodic2_LDADD = $(INTLIBS) $(EXTLIBS)
+tst_periodic3_SOURCES = tst_periodic3.c
+tst_periodic3_LDADD = $(INTLIBS) $(EXTLIBS)
 TESTS = $(check_PROGRAMS)
+
+# files generated by tests
+CLEANFILES = *.nc
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .f90 .lo .o .obj
+.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -413,9 +382,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec_api/regrid/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign src/Makefile
+	  $(AUTOMAKE) --foreign gridspec_api/regrid/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -434,41 +403,17 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
-	@$(NORMAL_INSTALL)
-	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
-	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
-	list2=; for p in $$list; do \
-	  if test -f $$p; then \
-	    list2="$$list2 $$p"; \
-	  else :; fi; \
-	done; \
-	test -z "$$list2" || { \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
-	}
-
-uninstall-libLTLIBRARIES:
-	@$(NORMAL_UNINSTALL)
-	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
-	for p in $$list; do \
-	  $(am__strip_dir) \
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
-	done
 
-clean-libLTLIBRARIES:
-	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
-	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
 	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
 	  test "$$dir" != "$$p" || dir=.; \
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libcf.la: $(libcf_la_OBJECTS) $(libcf_la_DEPENDENCIES) 
-	$(libcf_la_LINK) -rpath $(libdir) $(libcf_la_OBJECTS) $(libcf_la_LIBADD) $(LIBS)
-libcff.la: $(libcff_la_OBJECTS) $(libcff_la_DEPENDENCIES) 
-	$(FCLINK) $(am_libcff_la_rpath) $(libcff_la_OBJECTS) $(libcff_la_LIBADD) $(LIBS)
+libnccf_regrid.la: $(libnccf_regrid_la_OBJECTS) $(libnccf_regrid_la_DEPENDENCIES) 
+	$(LINK)  $(libnccf_regrid_la_OBJECTS) $(libnccf_regrid_la_LIBADD) $(LIBS)
 
 clean-checkPROGRAMS:
 	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
@@ -478,30 +423,51 @@ clean-checkPROGRAMS:
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	rm -f $$list
-tst_coords$(EXEEXT): $(tst_coords_OBJECTS) $(tst_coords_DEPENDENCIES) 
-	@rm -f tst_coords$(EXEEXT)
-	$(LINK) $(tst_coords_OBJECTS) $(tst_coords_LDADD) $(LIBS)
-tst_cvars$(EXEEXT): $(tst_cvars_OBJECTS) $(tst_cvars_DEPENDENCIES) 
-	@rm -f tst_cvars$(EXEEXT)
-	$(LINK) $(tst_cvars_OBJECTS) $(tst_cvars_LDADD) $(LIBS)
-tst_example_data$(EXEEXT): $(tst_example_data_OBJECTS) $(tst_example_data_DEPENDENCIES) 
-	@rm -f tst_example_data$(EXEEXT)
-	$(LINK) $(tst_example_data_OBJECTS) $(tst_example_data_LDADD) $(LIBS)
-tst_f03_file$(EXEEXT): $(tst_f03_file_OBJECTS) $(tst_f03_file_DEPENDENCIES) 
-	@rm -f tst_f03_file$(EXEEXT)
-	$(FCLINK) $(tst_f03_file_OBJECTS) $(tst_f03_file_LDADD) $(LIBS)
-tst_files$(EXEEXT): $(tst_files_OBJECTS) $(tst_files_DEPENDENCIES) 
-	@rm -f tst_files$(EXEEXT)
-	$(LINK) $(tst_files_OBJECTS) $(tst_files_LDADD) $(LIBS)
-tst_subsets$(EXEEXT): $(tst_subsets_OBJECTS) $(tst_subsets_DEPENDENCIES) 
-	@rm -f tst_subsets$(EXEEXT)
-	$(LINK) $(tst_subsets_OBJECTS) $(tst_subsets_LDADD) $(LIBS)
-tst_vars$(EXEEXT): $(tst_vars_OBJECTS) $(tst_vars_DEPENDENCIES) 
-	@rm -f tst_vars$(EXEEXT)
-	$(LINK) $(tst_vars_OBJECTS) $(tst_vars_LDADD) $(LIBS)
-tst_vert$(EXEEXT): $(tst_vert_OBJECTS) $(tst_vert_DEPENDENCIES) 
-	@rm -f tst_vert$(EXEEXT)
-	$(LINK) $(tst_vert_OBJECTS) $(tst_vert_LDADD) $(LIBS)
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_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
+tst_cubesphere_to_lonlat_regrid$(EXEEXT): $(tst_cubesphere_to_lonlat_regrid_OBJECTS) $(tst_cubesphere_to_lonlat_regrid_DEPENDENCIES) 
+	@rm -f tst_cubesphere_to_lonlat_regrid$(EXEEXT)
+	$(LINK) $(tst_cubesphere_to_lonlat_regrid_OBJECTS) $(tst_cubesphere_to_lonlat_regrid_LDADD) $(LIBS)
+tst_lonlat_regrid$(EXEEXT): $(tst_lonlat_regrid_OBJECTS) $(tst_lonlat_regrid_DEPENDENCIES) 
+	@rm -f tst_lonlat_regrid$(EXEEXT)
+	$(LINK) $(tst_lonlat_regrid_OBJECTS) $(tst_lonlat_regrid_LDADD) $(LIBS)
+tst_lonlat_to_lonlat_regrid$(EXEEXT): $(tst_lonlat_to_lonlat_regrid_OBJECTS) $(tst_lonlat_to_lonlat_regrid_DEPENDENCIES) 
+	@rm -f tst_lonlat_to_lonlat_regrid$(EXEEXT)
+	$(LINK) $(tst_lonlat_to_lonlat_regrid_OBJECTS) $(tst_lonlat_to_lonlat_regrid_LDADD) $(LIBS)
+tst_mask$(EXEEXT): $(tst_mask_OBJECTS) $(tst_mask_DEPENDENCIES) 
+	@rm -f tst_mask$(EXEEXT)
+	$(LINK) $(tst_mask_OBJECTS) $(tst_mask_LDADD) $(LIBS)
+tst_mask2$(EXEEXT): $(tst_mask2_OBJECTS) $(tst_mask2_DEPENDENCIES) 
+	@rm -f tst_mask2$(EXEEXT)
+	$(LINK) $(tst_mask2_OBJECTS) $(tst_mask2_LDADD) $(LIBS)
+tst_periodic$(EXEEXT): $(tst_periodic_OBJECTS) $(tst_periodic_DEPENDENCIES) 
+	@rm -f tst_periodic$(EXEEXT)
+	$(LINK) $(tst_periodic_OBJECTS) $(tst_periodic_LDADD) $(LIBS)
+tst_periodic2$(EXEEXT): $(tst_periodic2_OBJECTS) $(tst_periodic2_DEPENDENCIES) 
+	@rm -f tst_periodic2$(EXEEXT)
+	$(LINK) $(tst_periodic2_OBJECTS) $(tst_periodic2_LDADD) $(LIBS)
+tst_periodic3$(EXEEXT): $(tst_periodic3_OBJECTS) $(tst_periodic3_DEPENDENCIES) 
+	@rm -f tst_periodic3$(EXEEXT)
+	$(LINK) $(tst_periodic3_OBJECTS) $(tst_periodic3_LDADD) $(LIBS)
+tst_put_and_def_from_file$(EXEEXT): $(tst_put_and_def_from_file_OBJECTS) $(tst_put_and_def_from_file_DEPENDENCIES) 
+	@rm -f tst_put_and_def_from_file$(EXEEXT)
+	$(LINK) $(tst_put_and_def_from_file_OBJECTS) $(tst_put_and_def_from_file_LDADD) $(LIBS)
+tst_slanted_lonlat_regrid$(EXEEXT): $(tst_slanted_lonlat_regrid_OBJECTS) $(tst_slanted_lonlat_regrid_DEPENDENCIES) 
+	@rm -f tst_slanted_lonlat_regrid$(EXEEXT)
+	$(LINK) $(tst_slanted_lonlat_regrid_OBJECTS) $(tst_slanted_lonlat_regrid_LDADD) $(LIBS)
+tst_tripolar_to_lonlat_regrid$(EXEEXT): $(tst_tripolar_to_lonlat_regrid_OBJECTS) $(tst_tripolar_to_lonlat_regrid_DEPENDENCIES) 
+	@rm -f tst_tripolar_to_lonlat_regrid$(EXEEXT)
+	$(LINK) $(tst_tripolar_to_lonlat_regrid_OBJECTS) $(tst_tripolar_to_lonlat_regrid_LDADD) $(LIBS)
+tst_tripolar_to_lonlat_regrid_from_weights$(EXEEXT): $(tst_tripolar_to_lonlat_regrid_from_weights_OBJECTS) $(tst_tripolar_to_lonlat_regrid_from_weights_DEPENDENCIES) 
+	@rm -f tst_tripolar_to_lonlat_regrid_from_weights$(EXEEXT)
+	$(LINK) $(tst_tripolar_to_lonlat_regrid_from_weights_OBJECTS) $(tst_tripolar_to_lonlat_regrid_from_weights_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -509,20 +475,30 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdTimeConv.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cfcvars.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cferror.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cffiles.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cfsubsets.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cfvars.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccoord.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_coords.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_cvars.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_example_data.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_subsets.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vars.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vert.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_add_regrid_forbidden.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_apply_regrid.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_compute_regrid_weights.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_regrid.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_def_regrid_from_file.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_free_regrid.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_get_regrid_weights_pointer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_regrid_nnodes.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_regrid_ntargets.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_regrid_nvalid.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_inq_regrid_weights.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_put_regrid.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_cubesphere_to_lonlat_regrid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_lonlat_regrid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_lonlat_to_lonlat_regrid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_mask.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_mask2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_periodic.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_periodic2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_periodic3.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_put_and_def_from_file.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_slanted_lonlat_regrid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_tripolar_to_lonlat_regrid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_tripolar_to_lonlat_regrid_from_weights.Po at am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -548,15 +524,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
-.f90.o:
-	$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
-
-.f90.obj:
-	$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'`
-
-.f90.lo:
-	$(LTFCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
-
 mostlyclean-libtool:
 	-rm -f *.lo
 
@@ -761,9 +728,9 @@ check-am: all-am
 	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
-all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
 installdirs:
-	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
+	for dir in "$(DESTDIR)$(includedir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-am
@@ -794,8 +761,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-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES clean-noinstPROGRAMS mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -821,7 +788,7 @@ install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am: install-libLTLIBRARIES
+install-exec-am:
 
 install-html: install-html-am
 
@@ -861,33 +828,25 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
+uninstall-am: uninstall-includeHEADERS
 
 .MAKE: check-am install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
-	clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
-	clean-libtool ctags 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 \
-	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+	clean-checkPROGRAMS clean-generic clean-libtool \
+	clean-noinstLTLIBRARIES clean-noinstPROGRAMS ctags 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 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 pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-includeHEADERS \
-	uninstall-libLTLIBRARIES
-
-
-# Rule to build Fortran 2003 code.
-#cfcvars.o:cfcvsars.f90
-#	$(FC) -c $(AM_FCFLAGS) $(FCFLAGS) -c $? -o $@
+	tags uninstall uninstall-am uninstall-includeHEADERS
 
-tst_f03_file.o:tst_f03_file.f90
-	$(FC) -c $(AM_FCFLAGS) $(FCFLAGS) -c $? -o $@
 
 # 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/gridspec_api/regrid/nccf_add_regrid_forbidden.c b/gridspec_api/regrid/nccf_add_regrid_forbidden.c
new file mode 100644
index 0000000..09b5030
--- /dev/null
+++ b/gridspec_api/regrid/nccf_add_regrid_forbidden.c
@@ -0,0 +1,40 @@
+/**
+ * $Id: nccf_add_regrid_forbidden.c 742 2011-05-09 19:17:59Z edhartnett $
+ */
+
+#include "nccf_regrid.h"
+#include <netcdf.h>
+
+#include <nccf_utility_functions.h>
+
+/**
+ * \ingroup gs_regrid_grp
+ * Add a forbidden box, any target point inside the box will not 
+ * be interpolated
+ * 
+ * \param regrid_id object id
+ * \param lo inclusive lower set of indices delimiting the box
+ * \param hi inclusive upper set of indices delimiting the box
+ * \return NC_NOERR on success
+ *
+ * \note The order of indices in lo and hi follows C convention. 
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int 
+nccf_add_regrid_forbidden(int regrid_id, const int lo[], const int hi[]) {
+
+  int *lohi;
+  int i;
+  struct nccf_regrid_type *self;
+  self = nccf_li_find(&CFLIST_REGRID, regrid_id);
+  
+  lohi = (int *) malloc(2 * self->ndims * sizeof(int));
+  for (i = 0; i < self->ndims; ++i) {
+    lohi[i] = lo[i];
+    lohi[i + self->ndims] = hi[i];
+  }
+  nccf_li_add(&self->box_lohi, lohi);
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/regrid/nccf_apply_regrid.c b/gridspec_api/regrid/nccf_apply_regrid.c
new file mode 100644
index 0000000..bf8eb06
--- /dev/null
+++ b/gridspec_api/regrid/nccf_apply_regrid.c
@@ -0,0 +1,61 @@
+/**
+ * $Id: nccf_apply_regrid.c 787 2011-07-28 19:04:22Z dkindig $
+ */
+
+#include "nccf_regrid.h"
+#include <math.h>
+#include <netcdf.h>
+#include <stdio.h>
+
+#include <nccf_data.h>
+#include <nccf_utility_functions.h>
+
+/**
+ * \ingroup gs_regrid_grp
+ * Regrid data, should be called after nccf_compute_regrid_weights.
+ *
+ * \param regrid_id object Id
+ * \param ori_data_id data object on original grid
+ * \param tgt_data_id data object on target grid
+ * \return NC_NOERR on success
+ *
+ * \see nccf_compute_regrid_weights
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int 
+nccf_apply_regrid(int regrid_id, int ori_data_id, int tgt_data_id) {
+  
+  struct nccf_regrid_type *self;
+  self = nccf_li_find(&CFLIST_REGRID, regrid_id);
+
+  int totErr = NC_NOERR;
+  int status;
+
+  nc_type dType;
+  status =  nccf_inq_data_type(tgt_data_id, &dType);
+  totErr += abs(status);
+
+  int i, j;
+  int nNodes = 1;
+  for (i = 0; i < self->ndims; ++i) {
+    nNodes *= 2;
+  }
+
+  if (dType == NC_DOUBLE) {
+#define _TYPE double
+#include "nccf_apply_regrid_type.h"
+#undef _TYPE
+  }
+  else if (dType == NC_FLOAT) {
+#define _TYPE float
+#include "nccf_apply_regrid_type.h"
+#undef _TYPE
+  }
+  else {
+    /* not supported */
+    totErr += 1;
+  }
+
+  return totErr;
+}
diff --git a/gridspec_api/regrid/nccf_apply_regrid_type.h b/gridspec_api/regrid/nccf_apply_regrid_type.h
new file mode 100644
index 0000000..d807472
--- /dev/null
+++ b/gridspec_api/regrid/nccf_apply_regrid_type.h
@@ -0,0 +1,92 @@
+/* $Id: nccf_apply_regrid_type.h 924 2012-03-23 16:47:05Z pletzer $ */
+
+_TYPE *ori_data = NULL;
+_TYPE *tgt_data = NULL;
+_TYPE datum;
+_TYPE old_tgt_value;
+double sum_weights;
+nc_type xtype;
+int k, k2;
+const void *fill_value = NULL;
+const void *ori_data_fill_value = NULL;
+
+double *weights;
+status = nccf_varGetDataPtr(&self->weights_stt, 
+                            (void **)&weights);
+totErr += abs(status);
+
+int *lower_corner_indices;
+status = nccf_varGetDataPtr(&self->lower_corner_indices_stt, 
+                            (void **)&lower_corner_indices);
+totErr += abs(status);
+
+const int *displ;
+status = nccf_varGetAttribPtr(&self->lower_corner_indices_stt,
+                              CF_INDEX_OFFSETS, 
+                              (const void **)&displ);
+
+const int *ori_dims;
+status = nccf_varGetAttribPtr(&self->lower_corner_indices_stt,
+                              CF_ORI_DIMS, 
+                              (const void **)&ori_dims);
+int ori_ntot = 1;
+for (i = 0; i < self->ndims; ++i) {
+  ori_ntot *= ori_dims[i];
+ }
+                              
+char *inside_domain;
+status = nccf_varGetDataPtr(&self->inside_domain_stt, 
+                            (void **)&inside_domain);
+totErr += abs(status);
+
+status = nccf_get_data_pointer(ori_data_id, &xtype, 
+              (void **)&ori_data, &ori_data_fill_value);
+totErr += abs(status);
+status = nccf_get_data_pointer(tgt_data_id, &xtype, 
+              (void **)&tgt_data, &fill_value);
+totErr += abs(status);
+
+/* Set the tgt fill_value to the original fill value */
+status = nccf_add_data_att(tgt_data_id, "_FillValue", 
+                           (const void*)(_TYPE*)ori_data_fill_value);
+totErr += abs(status);
+    
+/* Make sure at least one target point is in the domain */
+if (self->nvalid > 0) {
+  for (i = 0; i < self->ntargets; ++i) {
+    /* Compute sum of weights * field values when inside_domain == 1
+       Don't change the value if inside_domain == 0 
+       This will set tgt_data[i] to zero if valid and keep 
+       tgt_data[i] otherwise
+    */
+    tgt_data[i] = (_TYPE)(1 - inside_domain[i])*tgt_data[i];
+
+    /* Linear interpolation */
+    
+    sum_weights = 0;
+    old_tgt_value = tgt_data[i];
+    for (j = 0; j < nNodes; ++j) {
+      k = i*nNodes + j;
+      k2 = lower_corner_indices[i] + displ[j];
+      // make sure index is valid, weights should be 
+      // zero if k2 is outside.
+      k2 = (k2 > ori_ntot - 1? lower_corner_indices[i]: k2);
+      datum = ori_data[k2];
+      tgt_data[i] += (_TYPE)(weights[k]*datum*inside_domain[i]);
+      sum_weights += weights[k];
+    }
+
+    if (sum_weights == 0) {
+      /* cell with invalid data */
+      if (ori_data_fill_value) {
+        tgt_data[i] = *(_TYPE *)ori_data_fill_value;
+      }
+      else {
+  /* re-instate the old value, the user does not want to use any
+     fill_value (== NULL). This amounts to a no-op. */
+        tgt_data[i] = old_tgt_value;
+      }
+    }
+  }
+  if( totErr ) ERR;
+}
diff --git a/gridspec_api/regrid/nccf_compute_regrid_weights.c b/gridspec_api/regrid/nccf_compute_regrid_weights.c
new file mode 100644
index 0000000..57d6ca5
--- /dev/null
+++ b/gridspec_api/regrid/nccf_compute_regrid_weights.c
@@ -0,0 +1,444 @@
+/**
+ * $Id: nccf_compute_regrid_weights.c 906 2012-01-03 21:57:44Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ *
+ */
+
+#include "nccf_regrid.h"
+#include <math.h>
+#include <netcdf.h>
+
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_utility_functions.h>
+
+#define MULTIPLE_TRIALS 1
+#define SNAKE 0
+#define EXHAUSTIVE_SEARCH 0
+
+int nccf_is_forbidden(int ndims, const double dIndices[], 
+          struct CFLISTITEM *box_lohi) {
+  int res = 0;
+  int in_this_box;
+  int i, id;
+  int *lohi;
+  nccf_li_begin(&box_lohi);
+  while (nccf_li_next(&box_lohi)) {
+    id = nccf_li_get_id(&box_lohi);
+    lohi = nccf_li_find(&box_lohi, id);
+    in_this_box = 1;
+    for (i = 0; i < ndims; ++i) {
+      in_this_box *= (dIndices[i] >= lohi[i] && dIndices[i] <= lohi[i + ndims]);
+    }
+    res += in_this_box;
+  }
+  return res;
+}
+
+/**
+ * Iterate over all grid nodes until finding a successful index search. 
+ * THIS IS VERY EXPENSIVE!
+ */
+int nccf_find_indices_exhaustive(int ndims, const int oriDims[], 
+                                 const double ** coordOriData, 
+                                 const double coord_periodicity[],
+                                 const double xyz[], 
+                                 int *niter, double *tolpos, 
+                                 double dIndices[], int hit_bounds[]) {
+  int status = 1;
+  int k, i;
+  int ntot = 1;
+  int ijk[ndims];
+  for (i = 0; i < ndims; ++i) {
+    ntot *= oriDims[i];
+  }
+  for (k = 0; k < ntot; ++k) {
+    nccf_get_multi_index(ndims, oriDims, k, ijk);
+    for (i = 0; i < ndims; ++i) {
+      dIndices[i] = (double) ijk[i];
+    }
+    status = nccf_find_indices_double(ndims, oriDims,
+                                      coordOriData,                      
+                                      coord_periodicity,
+                                      xyz, niter, tolpos,
+                                      NULL, dIndices, hit_bounds); 
+    if (!status) {
+      break;
+    }
+  }
+  return status;
+}
+
+/**
+ * Starting from corners and sides, do a Newton search for dIndices. This routine can 
+ * be used to overcome grid singularities at the poles.
+ */
+int nccf_find_indices_from_corners(int ndims, const int oriDims[], 
+                                   const double ** coordOriData, 
+                                   const double coord_periodicity[],
+                                   const double xyz[], 
+                                   int *nitermax, double *tolpos, 
+                                   double dIndices[], int hit_bounds[]) {
+  int status = 0;
+  int numSides = 1;
+  int j, i;
+  int cornerVector[ndims];
+  for (i = 0; i < ndims; ++i) {
+    numSides *= 3;
+  }
+  for (j = 0; j < numSides; ++j) {
+    nccf_index_to_corner_vector(j, ndims, cornerVector);
+    for (i = 0; i < ndims; ++i) {
+      dIndices[i] = 
+        ((double) cornerVector[i] + 1.0)*
+        ((double) oriDims[i] - 1.0)/2.0;
+    }
+    int niter = *nitermax;
+    double tol = *tolpos;
+    status = nccf_find_indices_double(ndims, oriDims,
+                                      (const double **) coordOriData,
+                                      coord_periodicity,
+                                      xyz, &niter, &tol,
+                                      NULL, dIndices, hit_bounds);
+    if (!status) {
+      /* success */
+      break;
+    }
+  }
+  return status;
+}
+
+/**
+ * \ingroup gs_regrid_grp
+ * Compute the weights of a regridding object.
+ *
+ * \param regrid_id regridding object id
+ * \param nitermax maximum number of passes before failing to locate a position
+ * \param tolpos tolerance in coordinate space
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_compute_regrid_weights(int regrid_id,
+                                int nitermax, 
+                                double tolpos) {
+
+  int totErr = NC_NOERR;
+  int status;
+  int dims[] = {0, 0}, indom_dim[] = {0};
+  const char *dim_names[] = {CF_DIMNAME_NTARGETS, CF_DIMNAME_NNODES};
+  const char *indom_name[] = {CF_DIMNAME_NTARGETS};
+
+  struct nccf_regrid_type *self;
+  self = nccf_li_find(&CFLIST_REGRID, regrid_id);
+
+  int hit_bounds[self->ndims];
+
+  /* get pointer to the original grid mask */
+  int *imask;
+  status = nccf_get_grid_mask_pointer(self->ori_grid_id, &imask);
+  totErr += abs(status);
+
+  /* get the periodicity lengths */
+  double coord_periodicity[self->ndims];
+  status = nccf_inq_grid_periodicity(self->ori_grid_id, 
+                                     coord_periodicity);
+  totErr += abs(status);
+
+  /* Fix */
+  nitermax = (nitermax <= 0? 1: nitermax);
+  tolpos = (tolpos < 1.e-8? 1.e-8: tolpos);
+  int niter = nitermax;
+  double tol = tolpos;
+  
+  int coordTargetIds[self->ndims];
+  status = nccf_inq_grid_coordids(self->tgt_grid_id, coordTargetIds);
+  totErr += abs(status);
+
+  /* assume ndims >= 1 */
+  int targetDims[self->ndims];
+  status = nccf_inq_coord_dims(coordTargetIds[0], targetDims);
+  totErr += abs(status);
+
+  /* get the original grid coordinates */
+  int coordOriIds[self->ndims];
+  status = nccf_inq_grid_coordids(self->ori_grid_id, coordOriIds);
+  totErr += abs(status);
+
+
+  /* get the original grid dimensions */
+  int oriDims[self->ndims];
+  status = nccf_inq_coord_dims(coordOriIds[0], oriDims);
+  totErr += abs(status);  
+
+  int i, j, k;
+  int numNodes = 1;
+  int ntot = 1;
+  self->ntargets = 1;
+  for (i = 0; i < self->ndims; ++i) {
+    self->ntargets *= targetDims[i];
+    numNodes *= 2;
+    ntot *= oriDims[i];
+  }
+  self->nnodes = numNodes;
+
+  /* get the original and target grid coordinates */
+  double **coordOriData;
+  double **coordTargetData;
+  coordOriData = (double **) malloc(self->ndims * sizeof(double *));
+  coordTargetData = (double **) malloc(self->ndims * sizeof(double *));
+  for (i = 0; i < self->ndims; ++i) {
+    double *dataPtr;
+    status = nccf_get_coord_data_pointer(coordOriIds[i], &dataPtr);
+    totErr += abs(status);
+    coordOriData[i] = dataPtr;
+    status = nccf_get_coord_data_pointer(coordTargetIds[i], &dataPtr);
+    totErr += abs(status);
+    coordTargetData[i] = dataPtr;
+  }
+
+  /* Compute min/max values of coordinates */
+  double coordOriMins[self->ndims];
+  double coordOriMaxs[self->ndims];
+  for (i = 0; i < self->ndims; ++i) {
+    coordOriMins[i] = +CF_HUGE_DOUBLE;
+    coordOriMaxs[i] = -CF_HUGE_DOUBLE;
+    for (k = 0; k < ntot; ++k) {
+      coordOriMins[i] = (coordOriData[i][k] < coordOriMins[i]? 
+                         coordOriData[i][k]: coordOriMins[i]);
+      coordOriMaxs[i] = (coordOriData[i][k] > coordOriMaxs[i]? 
+                         coordOriData[i][k]: coordOriMaxs[i]);
+    }
+  }
+  
+  /* Locate the cells and compute the weights */
+  double dIndices[self->ndims];
+  for (i = 0; i < self->ndims; ++i) {
+    /* initial guess */
+    dIndices[i] = 0.5; 
+  }
+
+  double *weights;
+  weights = (double *) malloc(self->ntargets * self->nnodes * sizeof(double));
+  int *lower_corner_indices;
+  lower_corner_indices = (int *) malloc(self->ntargets * sizeof(int));
+  char *inside_domain;
+  inside_domain = (char *) malloc(self->ntargets * sizeof(char));
+
+  int displ[self->ndims];
+  int indx[self->ndims];
+
+  int prodDims[self->ndims];
+  prodDims[self->ndims - 1] = 1; 
+  for (i = self->ndims - 2; i >= 0; --i) {
+    prodDims[i] = prodDims[i + 1] * 2;
+  }
+
+  double xyz[self->ndims];
+  int countFirstHit = 0;
+  int countMultipleTrials = 0;
+#if SNAKE == 1
+  int ijk[self->ndims];
+  for (i = 0; i < self->ndims; ++i) {
+    ijk[i] = 0;
+  }
+  
+  k = 0;
+  int is_inside_domain = 1;
+  while (is_inside_domain) {
+    k = nccf_get_flat_index(self->ndims, targetDims, ijk);
+#else
+  for (k = 0; k < self->ntargets; ++k) {
+#endif // SNAKE
+
+    status = 0;
+
+    /* Adjust the target position, taking into account that the dateline may
+       may be different between the original and target grids when the 
+       coordinate is periodic */
+
+    int mod_count = 0;
+    const int max_mod_count = 10; // max mod factor
+    for (i = 0; i < self->ndims; ++i) {
+      // set the target
+      xyz[i] = coordTargetData[i][k];
+
+      // consider adjusting if periodic
+      if (coord_periodicity[i] < CF_HUGE_DOUBLE) {
+        // periodic, angle-like coordinate, may need to adjust target position
+        if (xyz[i] < coordOriMins[i] - tolpos &&
+            xyz[i] + coord_periodicity[i] <= coordOriMaxs[i] + tolpos) {
+          mod_count = 0;
+          while (xyz[i] < coordOriMins[i] - tolpos && mod_count < max_mod_count) {
+            xyz[i] += coord_periodicity[i];
+            mod_count++;
+          }
+          if (mod_count >= max_mod_count) status = CF_HUGE_INT;
+        }
+        else if (xyz[i] > coordOriMaxs[i] + tolpos &&
+                 xyz[i] - coord_periodicity[i] >= coordOriMins[i] - tolpos) {
+          mod_count = 0;
+          while (xyz[i] > coordOriMaxs[i] + tolpos && mod_count < max_mod_count) {
+            xyz[i] -= coord_periodicity[i];
+            mod_count++;
+          }
+          if (mod_count >= max_mod_count) status = CF_HUGE_INT;
+        }
+      }
+    }
+
+    /* Make sure the target position roughly lies in the original 
+       grid domain, otherwise skip... */
+
+    if (status == 0) {
+
+      niter = nitermax;
+      tol = tolpos;
+      status = nccf_find_indices_double(self->ndims, oriDims, 
+                                        (const double **) coordOriData, 
+                                        coord_periodicity,
+                                        xyz, &niter, &tol, 
+                                        NULL, dIndices, hit_bounds);
+      // detect if boundaries were hit, if so adjust xyz for those
+      // axes that are periodic and try again
+      if (status) {
+        int xyzAdjusted = 0;
+        for (i = 0; i < self->ndims; ++i) {
+          if (hit_bounds[i] > 0 &&
+              coord_periodicity[i] < CF_HUGE_DOUBLE &&
+              xyz[i] - coord_periodicity[i] >= coordOriMins[i] - tolpos) {
+            // subtract periodicity length
+            xyz[i] -= coord_periodicity[i];
+            xyzAdjusted = 1;
+          }
+          else if (hit_bounds[i] < 0 &&
+                   coord_periodicity[i] < CF_HUGE_DOUBLE &&
+                   xyz[i] + coord_periodicity[i] <= coordOriMaxs[i] + tolpos) {
+            // add periodicity length
+            xyz[i] += coord_periodicity[i];
+            xyzAdjusted = 1;
+          }
+        }
+        if (xyzAdjusted) {
+          // now try again
+          niter = nitermax;
+          tol = tolpos;
+          status = nccf_find_indices_double(self->ndims, oriDims, 
+                                            (const double **) coordOriData, 
+                                            coord_periodicity,
+                                            xyz, &niter, &tol, 
+                                            NULL, dIndices, hit_bounds);
+        }
+      }
+
+      if (!status && nccf_is_forbidden(self->ndims, dIndices, self->box_lohi)) {
+        status = -1;
+      }
+      if (!status) {
+        countFirstHit++;
+      }
+#if MULTIPLE_TRIALS == 1
+      /*
+        A non-zero value indicates failure to find the set of (float) indices.
+        This may be due to the target position being outside of the domain or
+        the position was found to be in the forbidden region.
+      */
+      if (status) {
+        niter = nitermax;
+        tol = tolpos;
+        status = nccf_find_indices_from_corners(self->ndims, oriDims,
+                                                (const double **) coordOriData,
+                                                coord_periodicity,
+                                                xyz, &niter, &tol,
+                                                dIndices, hit_bounds);
+
+#if EXHAUSTIVE_SEARCH == 1
+        if (status) {
+          niter = nitermax;
+          tol = tolpos;
+          status = nccf_find_indices_exhaustive(self->ndims, oriDims,
+                                                (const double **) coordOriData,
+                                                coord_periodicity,
+                                                xyz, &niter, &tol,
+                                                dIndices, hit_bounds);
+        }
+#endif
+        if (!status && nccf_is_forbidden(self->ndims, dIndices, self->box_lohi)) {
+          status = -1;
+        }
+        if (!status) {
+          /* success */
+          countMultipleTrials++;
+        }
+      }
+#endif // MULTIPLE_TRIALS
+
+    } // target (roughly) lies in original domain 
+
+    inside_domain[k] = 0;
+    if (status == 0) {
+      inside_domain[k] = 1;
+      self->nvalid++;
+    }
+
+    // compute weights
+    status = nccf_get_linear_weights_double(self->ndims, oriDims,
+                                            dIndices, imask, 
+                                            &weights[k*self->nnodes]);
+    
+    // status > 0 means some masked values but interpolation was 
+    // successful
+    // status < 0 means too many masked values or interpolation 
+    // was not successful.
+
+    // compute the index set of the node
+    for (i = 0; i < self->ndims; ++i) {
+      indx[i] = (int) floor(dIndices[i]);
+    }
+    lower_corner_indices[k] = nccf_get_flat_index(self->ndims, 
+                                                  oriDims, indx);
+    
+#if SNAKE == 1
+    is_inside_domain = nccf_find_next_adjacent(self->ndims, 
+                                               targetDims, ijk);
+#endif
+  }
+
+/* Populate the data structures initialized in nccf_def_regrid */
+  dims[0] = self->ntargets;
+  dims[1] = numNodes;
+  self->nnodes =  numNodes;
+  indom_dim[0] = self->ntargets;
+
+  nccf_varSetDims( &self->weights_stt, 2, dims, dim_names );
+  nccf_varSetDataDouble( &self->weights_stt, weights );
+
+  nccf_varSetDims( &self->lower_corner_indices_stt, 1, dims, dim_names );
+  int flat_index_offsets[numNodes];
+  for (j = 0; j < numNodes; ++j) {
+    for (i = 0; i < self->ndims; ++i) {
+      displ[i] = j / prodDims[i] % 2;
+    }
+    flat_index_offsets[j] = nccf_get_flat_index(self->ndims, oriDims, displ);
+  }
+  nccf_varSetAttribIntArray( &self->lower_corner_indices_stt,
+                             CF_INDEX_OFFSETS,
+                             numNodes, flat_index_offsets );
+  nccf_varSetAttribIntArray( &self->lower_corner_indices_stt,
+                             CF_ORI_DIMS, 
+                             self->ndims, oriDims );
+  nccf_varSetDataInt( &self->lower_corner_indices_stt, lower_corner_indices );
+
+  nccf_varSetDims( &self->inside_domain_stt, 1, indom_dim, indom_name );
+  nccf_varSetDataChar( &self->inside_domain_stt, inside_domain );
+
+  /* Clean up */
+  free(inside_domain);
+  free(lower_corner_indices);
+  free(weights);
+  free(coordOriData);
+  free(coordTargetData);
+  
+  return totErr;
+}
diff --git a/gridspec_api/regrid/nccf_def_regrid.c b/gridspec_api/regrid/nccf_def_regrid.c
new file mode 100644
index 0000000..378fdff
--- /dev/null
+++ b/gridspec_api/regrid/nccf_def_regrid.c
@@ -0,0 +1,100 @@
+/**
+ * $Id: nccf_def_regrid.c 856 2011-11-08 17:44:01Z pletzer $
+ */
+
+#include "nccf_regrid.h"
+#include <math.h>
+#include <netcdf.h>
+
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_utility_functions.h>
+
+struct CFLISTITEM *CFLIST_REGRID;
+
+/*! \defgroup gs_regrid_grp Structured data regridding
+  \ingroup gridspec_grp
+
+Regridding is an interpolation operation, which takes the data attached
+to an original grid and computes corresponding values on a target grid. The 
+regridding operation assumes that both grids are structured 
+and involves linear interpolation, i.e. only the closest neighbor 
+values are used to determine the interpolated values. The interpolated
+values are guaranteed to be within the range of neighboring values. 
+
+Interpolation requires the location of a target position in index space. 
+A pseudo-Newton scheme is used to find the index position. A single iteration
+is sufficient in the case of a uniform grid, more iterations are required 
+when the grid is locally refined and/or highly warped. 
+
+Regridding only applies to target positions that have been found to lie
+within the original grid. Regridding is a no-operation for those target 
+positions that lie outside the original grid, or for target positions which 
+could not be determined to lie within the original grid.  It is not
+an error to have non-overlapping original and target grids. 
+
+When regridding it is possible to exclude some regions (e.g. land in 
+an ocean model) and this is achieved by adding forbidden boxes to the
+regridding object. Care should also be taken when the original grid has a 
+cut in coordinate space, that is a discontinuity in coordinates. This case
+ arises when the longitudes jump by 360 degrees in particular. To remove the 
+possibility for the interpolation algorithm to erroneously find the target 
+position to lie within the cut (multi-valued coordinates are not allowed), 
+it is advisable to add a forbidden box at the cut location.
+
+*/
+
+/**
+ * \ingroup gs_regrid_grp
+ * Define a regridding object (acts as a constructor).
+ *
+ * \param ori_grid_id original grid id.
+ * \param tgt_grid_id target grid id.
+ * \param regrid_id (output) grid ID
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_def_regrid(int ori_grid_id, int tgt_grid_id, int *regrid_id) {
+
+  int totErr = NC_NOERR;
+  int status;
+
+  /* Instantiate object */
+  struct nccf_regrid_type *self;
+  self = (struct nccf_regrid_type *)
+    malloc(sizeof(struct nccf_regrid_type));
+
+  /* Initialize */
+  self->ndims = 0;
+  self->ntargets = 0;
+  self->nvalid = 0;
+  nccf_li_new(&self->box_lohi);
+  self->ori_grid_id = ori_grid_id;
+  self->tgt_grid_id = tgt_grid_id;
+
+  /* Initialize the weights, index and inside_domain structures */
+  nccf_varCreate(&self->weights_stt, "weights");
+  nccf_varSetAttribText(&self->weights_stt, CF_ATTNAME_CF_TYPE_NAME, 
+                        CF_REGRID_WEIGHTS);
+
+  nccf_varCreate(&self->lower_corner_indices_stt, "indices");
+  nccf_varSetAttribText(&self->lower_corner_indices_stt, 
+                        CF_ATTNAME_CF_TYPE_NAME, 
+                        CF_REGRID_INDICES);
+
+  nccf_varCreate(&self->inside_domain_stt, "inside_domain");
+  nccf_varSetAttribText(&self->inside_domain_stt, CF_ATTNAME_CF_TYPE_NAME, 
+                        CF_REGRID_INSIDE_DOMAIN);
+
+  /* Get number of space dimensions */
+  status = nccf_inq_grid_ndims(ori_grid_id, &self->ndims);
+  totErr += abs(status);
+
+  
+  /* Add the objet to the list */
+  if (CFLIST_REGRID == NULL) nccf_li_new(&CFLIST_REGRID);
+  *regrid_id = nccf_li_add(&CFLIST_REGRID, self);
+
+  return totErr;
+}
diff --git a/gridspec_api/regrid/nccf_def_regrid_from_file.c b/gridspec_api/regrid/nccf_def_regrid_from_file.c
new file mode 100644
index 0000000..8a7dfe5
--- /dev/null
+++ b/gridspec_api/regrid/nccf_def_regrid_from_file.c
@@ -0,0 +1,87 @@
+/**
+ * $Id: nccf_def_regrid_from_file.c 869 2011-11-29 20:12:54Z pletzer $
+ */
+
+#include <nccf_regrid.h>
+#include <netcdf.h>
+#include <string.h>
+#include <stdio.h>
+#include <math.h>
+#include <nccf_varObj.h>
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+
+int nccf_get_weights( int regrid_id, double **weights ){
+  
+  double **data;
+  struct nccf_var_obj *self;
+  self = nccf_li_find(&CFLIST_REGRID, regrid_id);
+
+  nccf_varGetDataPtr( &self, ( void** ) &data );
+
+  return NC_NOERR;
+
+}
+
+/**
+ * \ingroup gs_regrid_grp
+ * Create a regrid object from a file
+ * 
+ * /param filename File to read from
+ * /param ndims Dimensions of grid
+ * /param regrid_id regrid object to write
+ * /return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Dave Kindig, Tech-X Corp.
+ */
+int nccf_def_regrid_from_file(const char *filename,
+                   int *regridId) {
+
+  int ncid;
+  int status = NC_NOERR;
+  int *dims;
+
+  struct nccf_regrid_type *self;
+  self = ( struct nccf_regrid_type* )malloc( sizeof( struct nccf_regrid_type ));
+
+  /* initialize self */
+  nccf_li_new( &self->box_lohi );
+
+  self->nvalid = 0;
+  const int *nvalid = NULL;
+
+  status = nc_open( filename, NC_NOWRITE, &ncid );
+  if( status ) return status;
+
+  const int read_data = 1;
+  const int as_double = 1;
+  const int keep_type = 0;
+  nccf_varCreateFromFile( &self->weights_stt, "weights", 
+                          ncid, read_data, as_double );
+  nccf_varCreateFromFile( &self->lower_corner_indices_stt, "indices", 
+                          ncid, read_data, keep_type );
+  nccf_varCreateFromFile( &self->inside_domain_stt, "inside_domain", 
+                          ncid, read_data, keep_type );
+
+  nccf_varGetDimsPtr( &self->weights_stt, &dims );
+  self->ntargets = dims[0];
+  self->nnodes = dims[1];
+
+  self->ndims = 0;
+  while ( powf(2.0f, (float) self->ndims) < (float)(self->nnodes) ) {
+    self->ndims++;
+  }
+
+  nccf_varGetAttribPtr( &self->inside_domain_stt, "nvalid", 
+                        (const void **)&nvalid );
+  self->nvalid = *nvalid;
+
+  if (( status = nc_close( ncid ))) ERR;
+
+  /* Add the objet to the list */
+  if (CFLIST_REGRID == NULL) nccf_li_new(&CFLIST_REGRID);
+  *regridId = nccf_li_add(&CFLIST_REGRID, self);
+
+  return NC_NOERR;
+
+}
diff --git a/gridspec_api/regrid/nccf_free_regrid.c b/gridspec_api/regrid/nccf_free_regrid.c
new file mode 100644
index 0000000..64e8569
--- /dev/null
+++ b/gridspec_api/regrid/nccf_free_regrid.c
@@ -0,0 +1,48 @@
+/**
+ * $Id: nccf_free_regrid.c 918 2012-02-07 22:10:36Z pletzer $
+ */
+
+#include "nccf_regrid.h"
+#include <netcdf.h>
+
+#include <nccf_utility_functions.h>
+#include <nccf_varObj.h>
+
+/**
+ * \ingroup gs_regrid_grp
+ * Free regridding object (destructor).
+ *
+ * \param regrid_id object Id.
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int 
+nccf_free_regrid(int regrid_id) {
+
+  int *lohi;
+  int id;
+  struct nccf_regrid_type *self;
+  self = nccf_li_remove(&CFLIST_REGRID, regrid_id);
+  if( nccf_li_get_nelem( &CFLIST_REGRID ) == 0 )
+      nccf_li_del( &CFLIST_REGRID );
+
+  /* Clean up */
+  nccf_li_begin(&self->box_lohi);
+  while (nccf_li_next(&self->box_lohi)) {
+    id = nccf_li_get_id(&self->box_lohi);
+    lohi = nccf_li_remove(&self->box_lohi, id);
+    free(lohi);
+    lohi = NULL;
+  }
+  nccf_li_del(&self->box_lohi);
+  
+  nccf_varDestroy(&self->weights_stt);
+  nccf_varDestroy(&self->lower_corner_indices_stt);
+  nccf_varDestroy(&self->inside_domain_stt);
+
+  free(self);
+  self = NULL;
+
+  return NC_NOERR;
+}
diff --git a/gridspec_api/regrid/nccf_get_regrid_weights_pointer.c b/gridspec_api/regrid/nccf_get_regrid_weights_pointer.c
new file mode 100644
index 0000000..2eebb9b
--- /dev/null
+++ b/gridspec_api/regrid/nccf_get_regrid_weights_pointer.c
@@ -0,0 +1,41 @@
+/**
+ * $Id: nccf_get_regrid_weights_pointer.c 915 2012-01-09 16:58:08Z pletzer $
+ */
+
+#include "nccf_regrid.h"
+#include <math.h>
+#include <netcdf.h>
+#include <stdio.h>
+
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_utility_functions.h>
+
+/**
+ * \ingroup gs_regrid_grp
+ * Get the pointer to weights array, should be called after 
+ * nccf_compute_regrid_weights.
+ *
+ * \param regrid_id object Id
+ * \param datap pointer to the data
+ * \return NC_NOERR on success
+ *
+ * \see nccf_compute_regrid_weights
+ *
+* \author Alexander Pletzer, Tech-X Corp.
+ */
+int 
+nccf_get_regrid_weights_pointer(int regrid_id, double **datap) {
+  
+  struct nccf_regrid_type *self;
+  self = nccf_li_find(&CFLIST_REGRID, regrid_id);
+
+  int totErr = NC_NOERR;
+  int status;
+
+  status = nccf_varGetDataPtr(&self->weights_stt, 
+                              (void **)datap);
+  totErr += abs(status);
+
+  return totErr;
+}
diff --git a/gridspec_api/regrid/nccf_inq_regrid_nnodes.c b/gridspec_api/regrid/nccf_inq_regrid_nnodes.c
new file mode 100644
index 0000000..66eb339
--- /dev/null
+++ b/gridspec_api/regrid/nccf_inq_regrid_nnodes.c
@@ -0,0 +1,30 @@
+/**
+ * $Id: nccf_inq_regrid_nnodes.c 742 2011-05-09 19:17:59Z edhartnett $
+ */
+
+#include "nccf_regrid.h"
+#include <math.h>
+#include <netcdf.h>
+
+#include <nccf_utility_functions.h>
+
+/**
+ * \ingroup gs_regrid_grp
+ * Get the number of nodes per cell
+ *
+ * \param regrid_id object Id
+ * \param nnodes (output) number of nodes (2^ndims)
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int 
+nccf_inq_regrid_nnodes(int regrid_id, int *nnodes) {
+
+    struct nccf_regrid_type *self;
+    self = nccf_li_find(&CFLIST_REGRID, regrid_id);
+
+    *nnodes = self->nnodes;
+
+    return NC_NOERR;
+}
diff --git a/gridspec_api/regrid/nccf_inq_regrid_ntargets.c b/gridspec_api/regrid/nccf_inq_regrid_ntargets.c
new file mode 100644
index 0000000..76d1709
--- /dev/null
+++ b/gridspec_api/regrid/nccf_inq_regrid_ntargets.c
@@ -0,0 +1,30 @@
+/**
+ * $Id: nccf_inq_regrid_ntargets.c 742 2011-05-09 19:17:59Z edhartnett $
+ */
+
+#include "nccf_regrid.h"
+#include <math.h>
+#include <netcdf.h>
+
+#include <nccf_utility_functions.h>
+
+/**
+ * \ingroup gs_regrid_grp
+ * Get the number of target points in the domain
+ *
+ * \param regrid_id object Id
+ * \param ntargets (output) number of target values
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int 
+nccf_inq_regrid_ntargets(int regrid_id, int *ntargets) {
+
+    struct nccf_regrid_type *self;
+    self = nccf_li_find(&CFLIST_REGRID, regrid_id);
+
+    *ntargets = self->ntargets;
+
+    return NC_NOERR;
+}
diff --git a/gridspec_api/regrid/nccf_inq_regrid_nvalid.c b/gridspec_api/regrid/nccf_inq_regrid_nvalid.c
new file mode 100644
index 0000000..6a10c08
--- /dev/null
+++ b/gridspec_api/regrid/nccf_inq_regrid_nvalid.c
@@ -0,0 +1,30 @@
+/**
+ * $Id: nccf_inq_regrid_nvalid.c 742 2011-05-09 19:17:59Z edhartnett $
+ */
+
+#include "nccf_regrid.h"
+#include <math.h>
+#include <netcdf.h>
+
+#include <nccf_utility_functions.h>
+
+/**
+ * \ingroup gs_regrid_grp
+ * Get the number of non-masked values in the domain
+ *
+ * \param regrid_id object Id
+ * \param nvalid (output) number of non-masked values
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int 
+nccf_inq_regrid_nvalid(int regrid_id, int *nvalid) {
+
+    struct nccf_regrid_type *self;
+    self = nccf_li_find(&CFLIST_REGRID, regrid_id);
+
+    *nvalid = self->nvalid;
+
+    return NC_NOERR;
+}
diff --git a/gridspec_api/regrid/nccf_inq_regrid_weights.c b/gridspec_api/regrid/nccf_inq_regrid_weights.c
new file mode 100644
index 0000000..1805a5c
--- /dev/null
+++ b/gridspec_api/regrid/nccf_inq_regrid_weights.c
@@ -0,0 +1,101 @@
+/**
+ * $Id: nccf_inq_regrid_weights.c 921 2012-03-22 01:44:24Z dkindig $
+ */
+
+#include "nccf_regrid.h"
+#include <math.h>
+#include <netcdf.h>
+#include <stdio.h>
+
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_utility_functions.h>
+
+/**
+ * \ingroup gs_regrid_grp
+ * Get the weights, should be called after nccf_compute_regrid_weights.
+ *
+ * \param regrid_id object Id
+ * \param tgt_indices index set of the target point, dimensioned ndims
+ * \param ori_nodes flat indices on the original grid, should be dimensioned
+ *                  2^ndims (output)
+ * \param weights interpolation weights for the above flat indices, should be
+                  dimensioned 2^ndims (output)
+ * \return NC_NOERR on success
+ *
+ * \see nccf_compute_regrid_weights
+ *
+ * \note the sum of the weights may be < 1 if some weights fall outside
+ *       the domain
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int 
+nccf_inq_regrid_weights(int regrid_id, const int tgt_indices[],
+                        int ori_nodes[], double weights[]) {
+  
+  struct nccf_regrid_type *self;
+  self = nccf_li_find(&CFLIST_REGRID, regrid_id);
+
+  int totErr = NC_NOERR;
+  int status;
+
+  int i, j, ibig, k, k2;
+
+  double *allweights;
+  status = nccf_varGetDataPtr(&self->weights_stt, 
+                              (void **)&allweights);
+  totErr += abs(status);
+
+  int *lower_corner_indices;
+  status = nccf_varGetDataPtr(&self->lower_corner_indices_stt, 
+                              (void **)&lower_corner_indices);
+  totErr += abs(status);
+
+  const int *displ;
+  status = nccf_varGetAttribPtr(&self->lower_corner_indices_stt,
+                                CF_INDEX_OFFSETS, 
+                                (const void **)&displ);
+  totErr += abs(status);
+
+  const int *ori_dims;
+  status = nccf_varGetAttribPtr(&self->lower_corner_indices_stt,
+                                CF_ORI_DIMS, 
+                                (const void **)&ori_dims);
+  totErr += abs(status);
+  
+  char *inside_domain;
+  status = nccf_varGetDataPtr(&self->inside_domain_stt, 
+                            (void **)&inside_domain);
+  totErr += abs(status);
+
+  int nNodes = 1;
+  int ori_ntot = 1;
+  for (i = 0; i < self->ndims; ++i) {
+    nNodes *= 2;
+    ori_ntot *= ori_dims[i];
+  }
+
+  int tgt_coordids[self->ndims];
+  status = nccf_inq_grid_coordids(self->tgt_grid_id, tgt_coordids);
+  totErr += abs(status);
+
+  int tgt_dims[self->ndims];
+  status = nccf_inq_coord_dims(tgt_coordids[0], tgt_dims);
+  totErr += abs(status);
+
+  /* compute the flat index */
+  ibig = nccf_get_flat_index(self->ndims, tgt_dims, tgt_indices);
+
+  for (j = 0; j < nNodes; ++j) {
+    k2 = lower_corner_indices[ibig] + displ[j];
+    /* adjust if falling out of domain */
+    k2 = (k2 > ori_ntot - 1? lower_corner_indices[ibig]: k2);
+    ori_nodes[j] = k2;
+    k = ibig*nNodes + j;
+    /* weight is zero if outside domain */
+    weights[j] = allweights[k] * inside_domain[ibig];
+  }
+
+  return totErr;
+}
diff --git a/gridspec_api/regrid/nccf_put_regrid.c b/gridspec_api/regrid/nccf_put_regrid.c
new file mode 100644
index 0000000..c4b0be2
--- /dev/null
+++ b/gridspec_api/regrid/nccf_put_regrid.c
@@ -0,0 +1,42 @@
+/*
+ * API to define a structured grid for the gridspec convention to libcf.
+ *
+ * $Id: nccf_put_regrid.c 856 2011-11-08 17:44:01Z pletzer $
+ */
+
+#include <nccf_regrid.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <netcdf.h>
+#include <libcf_src.h>
+#include <nccf_grid.h>
+#include <nccf_coord.h>
+#include <nccf_varObj.h>
+
+/**
+ * \ingroup gs_regrid_grp
+ * Write regrid weights, indices and domain location to a file
+ *
+ * \param regrid_id regrid ID created by nccf_def_regrid
+ * \param ncid netcdf file id
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Dave Kindig, Tech-X Corp.
+ */
+int nccf_put_regrid(int regrid_id, int ncid){
+
+  int status = NC_NOERR;
+  struct nccf_regrid_type *self;
+  self = nccf_li_find(&CFLIST_REGRID, regrid_id);
+
+  if(( status = nccf_varSetAttribInt( &self->inside_domain_stt, 
+                                      "nvalid", self->nvalid )));
+
+  status = nccf_writeListOfVars(ncid, 3, self->weights_stt,
+                                         self->lower_corner_indices_stt,
+                                         self->inside_domain_stt);
+
+  return status;
+}
diff --git a/gridspec_api/regrid/nccf_regrid.h b/gridspec_api/regrid/nccf_regrid.h
new file mode 100644
index 0000000..7ce8389
--- /dev/null
+++ b/gridspec_api/regrid/nccf_regrid.h
@@ -0,0 +1,88 @@
+/*
+ * API to perform regridding operations on structured grids in libcf.
+ *
+ * $Id: nccf_regrid.h 915 2012-01-09 16:58:08Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+#ifndef _NCCF_REGRID_H
+#define _NCCF_REGRID_H
+
+#include <libcf_src.h>
+#include <cflistitem.h>
+
+/* Names we have picked */
+#define CF_REGRID_WEIGHTS            "regrid_weights"
+#define CF_REGRID_INDICES            "regrid_indices"
+#define CF_REGRID_INSIDE_DOMAIN      "regrid_inside_domain"
+#define CF_INDEX_OFFSETS             "flat_index_offsets_from_corner_node"
+#define CF_ORI_DIMS                  "original_grid_dimensions"
+
+extern struct CFLISTITEM *CFLIST_REGRID;
+
+struct nccf_regrid_type {
+
+   /* list of boxes and their lo/hi sets of indices */
+   struct CFLISTITEM *box_lohi;
+
+   /* NetCDF like variable objects */
+   struct nccf_var_obj *weights_stt;
+   struct nccf_var_obj *lower_corner_indices_stt;
+   struct nccf_var_obj *inside_domain_stt;
+
+   /* original grid id */
+   int ori_grid_id;
+
+   /* target grid id */
+   int tgt_grid_id;
+  
+   /* number of space dimensions */
+   int ndims;
+
+   /* number of target points (product of the target dims) */
+   int ntargets;
+
+   /* number of nodes for given cell (should be 2**ndims) */
+   int nnodes;
+
+   /* number of valid target values (number of times cell search succeded) */
+   int nvalid;
+};
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+  int nccf_def_regrid(int ori_grid_id, int tgt_grid_id, int *regrid_id);
+
+  int nccf_free_regrid(int regrid_id);				  
+
+  int nccf_compute_regrid_weights(int regrid_id, int nitermax, double tolpos);
+
+  int nccf_apply_regrid(int regrid_id, int ori_data_id, int tgt_data_id);
+
+  int nccf_inq_regrid_weights(int regrid_id, const int tgt_indices[], 
+                              int ori_nodes[], double weights[]);
+
+  int nccf_get_regrid_weights_pointer(int regrid_id, double **datap);
+
+  int nccf_inq_regrid_ntargets(int regrid_id, int *ntargets);
+
+  int nccf_inq_regrid_nvalid(int regrid_id, int *nvalid);
+
+  int nccf_inq_regrid_nnodes(int regrid_id, int *nnodes);
+
+  int nccf_add_regrid_forbidden(int regrid_id, const int lo[], const int hi[]);
+
+  int nccf_put_regrid(int ncid, int regrid_id);
+
+  int nccf_def_regrid_from_file(const char *filename,
+                                int *regrid_id);
+  
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _NCCF_REGRID_H */
diff --git a/gridspec_api/regrid/tst_cubesphere_to_lonlat_regrid.c b/gridspec_api/regrid/tst_cubesphere_to_lonlat_regrid.c
new file mode 100644
index 0000000..5a4c04b
--- /dev/null
+++ b/gridspec_api/regrid/tst_cubesphere_to_lonlat_regrid.c
@@ -0,0 +1,398 @@
+/**
+ * Test interpolation from one lon-lat grid to another
+ *
+ * $Id: tst_cubesphere_to_lonlat_regrid.c 881 2011-12-17 21:53:14Z pletzer $
+ *
+ * \author Dave Kindig, Tech-X Corp.
+ */
+
+#include "nccf_regrid.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+
+#include <netcdf.h>
+#include <libcf_src.h>
+
+#include <cf_config.h>
+
+#include "nccf_coord.h"
+#include "nccf_grid.h"
+#include "nccf_data.h"
+#include "nccf_constants.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+#include "nccf_global.h"
+
+double checkInterp(int dataId1, int dataId2);
+void computeError(int dataId1, int dataId2);
+int writeData( const int gridId, const int dataId, const char *filename );
+int createData(int gridId, const char *filename, int useBogusData, 
+               const char *coordinates_id );
+int createLonLatGrid(const double xymin[], const double xymax[], 
+                     const int dims[], int coordIds[]);
+int createCubeSphereTile( const int iGrid, const char *gridName, 
+                          const int dims[], int coordIds[], int *gridId );
+
+int main(){
+
+  int status;
+  int tarGridId, tarDataId, tarDataIdRef;
+  const int ndims = 2, nGrid = 6;
+
+  int tarCoordIds[ndims], csCoordIds[ndims], csGridIds[nGrid], csDataId[nGrid];
+
+  /* coordinates_id */
+  char coordinates_id_LL[36+1], coordinates_id_CS[36+1];
+  nccf_generate_id( 123, coordinates_id_LL );
+  nccf_generate_id( 321, coordinates_id_CS );
+
+  /* Create grids */
+  const double tarXymin[] = {-90.0, -180.0};
+  const double tarXymax[] = { 90.0  ,180.0};
+  const int tarDims[] = {121, 121};
+  const int csDims[] = {40, 40};
+  int i, iGrid;
+
+  const char *testName = "tst_cubesphere_to_lonlat_regrid";
+  const char *gridName[] = {"_lonlat",
+                            "_ref",
+                            "_grid", 
+                            "_interp"};
+  char* regrid_filename;
+  regrid_filename = (char*)calloc( STRING_SIZE, sizeof(char));
+  char *csTileFileName;
+  csTileFileName = (char*)calloc( STRING_SIZE, sizeof(char));
+  char *tarTileFileName;
+  tarTileFileName = (char*)calloc( STRING_SIZE, sizeof(char));
+
+  tarGridId = createLonLatGrid(tarXymin, tarXymax, tarDims, tarCoordIds);
+
+  /* Create data Reference file*/
+  sprintf( tarTileFileName, "%s%s.nc", testName, gridName[1] );
+  tarDataIdRef = createData(tarGridId, tarTileFileName, 0, coordinates_id_LL);
+
+  /* Create data Interpolation file*/
+  sprintf( tarTileFileName, "%s%s.nc", testName, gridName[3] );
+  tarDataId = createData(tarGridId, tarTileFileName, 1, coordinates_id_LL);
+
+  //for( iGrid = 0; iGrid < nGrid; iGrid++ ){
+  for( iGrid = 0; iGrid < 3; iGrid++ ){
+    status = createCubeSphereTile( iGrid, testName, csDims, 
+                  csCoordIds, &csGridIds[iGrid] );
+    sprintf( csTileFileName, "%s%s%d.nc", testName, gridName[2], iGrid );
+    csDataId[iGrid]  = createData( csGridIds[iGrid], csTileFileName, 0, coordinates_id_CS );
+#ifdef HAVE_LAPACK_LIB
+    /* Create regrid object */
+    int regrid_id;
+    const int nitermax = 20;
+    const double tolpos = 0.01;
+    if ((status = nccf_def_regrid(csGridIds[iGrid], tarGridId, &regrid_id))) ERR;
+
+    /* The cut needs to be determined before allocation. The cuts
+     * are not in the same place necessarily */
+//    if( iGrid == 2 || iGrid  == 5 || 
+    if( iGrid == 0){
+      const int lo[] = {0, csDims[1]/2 - 1};
+      const int hi[] = {csDims[0], csDims[1]/2};
+      if ((status = nccf_add_regrid_forbidden( regrid_id, lo, hi ))) ERR;
+    }
+
+    if ((status = nccf_compute_regrid_weights(regrid_id, 
+					      nitermax, tolpos))) ERR;
+
+    /* Interpolate */
+    if ((status = nccf_apply_regrid(regrid_id, csDataId[iGrid], 
+				    tarDataId))) ERR;
+
+    /* Compute error and put the new values in tarDataId */
+    //computeError(tarDataIdRef, tarDataId);
+
+    /* Write regrided data*/
+    if ((status = writeData(tarGridId, tarDataId, tarTileFileName))) ERR;
+
+    /* Compute average error */
+    double avgErr = checkInterp(tarDataIdRef, tarDataId);
+    if( avgErr ) assert( 1 == 1 );
+
+    /* Write weights to file */
+    int ncid;
+    sprintf( regrid_filename, "%s_put_test%d.nc", testName, iGrid );
+    if (( status = nc_create( regrid_filename, NC_CLOBBER, &ncid ))) ERR;
+    if (( status = nccf_put_regrid(regrid_id, ncid))) ERR;
+    if (( status = nc_close( ncid ))) ERR;
+
+    /* Check */
+    int nvalid, ntargets;
+    if ((status = nccf_inq_regrid_ntargets(regrid_id, &ntargets))) ERR;
+    if ((status = nccf_inq_regrid_nvalid(regrid_id, &nvalid))) ERR;
+    double ratio = (double)nvalid/(double)ntargets;
+    printf("tst_cubesphere_to_lonlat_regrid: ratio of valid to num target points = %f\n", ratio);
+    //assert(ratio >= 0.9); // WE NEED TO GET THIS RATIO TO ~< 1! (Pletzer);
+
+    /* Clean up */
+    status += nccf_free_regrid(regrid_id);
+#endif
+    status += nccf_free_grid(csGridIds[iGrid]);
+    status += nccf_free_data(csDataId[iGrid]);
+
+  }
+
+  status += nccf_free_data(tarDataId);
+  status += nccf_free_data(tarDataIdRef);
+  status += nccf_free_grid(tarGridId);
+  for (i = 0; i < ndims; ++i) {
+    status += nccf_free_coord(tarCoordIds[i]);
+    status += nccf_free_coord(csCoordIds[i]);
+  }
+
+  free( regrid_filename );
+  free( tarTileFileName );
+  free( csTileFileName );
+
+  return status;
+}
+
+int createCubeSphereTile( const int iGrid, const char *gridName, 
+                          const int dims[], int coordIds[], int *gridId ){
+  int pos, sign; //, i;
+  int faceVec[3] = {0, 0, 0};
+  const int ndims = 2;
+  int nvertex = dims[0]*dims[1];
+  int save = 1, status = 0;
+  int gid;
+  double *clon, *clat; //, dataValues[nvertex];
+
+  const char *dimnames[] = {"nj", "ni"};
+
+  pos  = iGrid % 3;
+  sign = (iGrid/3) == 0 ? 1 : -1;
+  faceVec[pos] = sign;
+
+  clat = ( double* )malloc( nvertex * sizeof( double ));
+  clon = ( double* )malloc( nvertex * sizeof( double ));
+
+  nccf_get_cubedsphere_grid( dims, faceVec, clon, clat );
+
+  status += nccf_def_lat_coord( ndims, dims, dimnames, clat, save, &coordIds[0] );
+  status += nccf_def_lon_coord( ndims, dims, dimnames, clon, save, &coordIds[1] );
+  status += nccf_def_grid( coordIds, gridName, &gid );
+
+  *gridId  =  gid;
+
+  free( clat );
+  free( clon );
+
+  return status;
+
+}
+
+int createLonLatGrid(const double xymin[], const double xymax[], const int dims[], int coordIds[]) {
+  const int save = 1;
+  const int ndims = 2;
+  double dxs[ndims];
+  const char *dimnames[] = {"nj", "ni"};
+  const char *name = "my_lon_lat_grid";
+  int i, j, k;
+  int ntot;
+  int status;
+  int gridId;
+
+  double **coordData;
+  coordData = (double **) malloc(ndims * sizeof(double *));
+  ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+    dxs[i] = (xymax[i] - xymin[i]) / (dims[i] - 1);
+  }
+  for (i = 0; i < ndims; ++i) {
+    coordData[i] = (double *) malloc(ntot * sizeof(double));
+  }
+
+  /* Populate coordinates and create lon/lat coordinate objects */
+  for (j = 0; j < dims[0]; ++j) {
+    for (i = 0; i < dims[1]; ++i) {
+      k = i + dims[1]*j;
+      coordData[0][k] = xymin[0] + j*dxs[0];
+      coordData[1][k] = xymin[1] + i*dxs[1];
+    }
+  }
+
+  /* Create coordinates */
+  status = nccf_def_lat_coord(ndims, dims, dimnames,
+					coordData[0], save,
+					&coordIds[0]);
+  status += nccf_def_lon_coord(ndims, dims, dimnames,
+					coordData[1], save,
+					&coordIds[1]);
+
+  /* Create grid */
+  status += nccf_def_grid(coordIds, name,
+					 &gridId);
+
+  for (i = 0; i < ndims; ++i) {
+    free(coordData[i]);
+  }
+  free(coordData);
+
+  return gridId;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+int createData(int gridId, const char *filename, int useBogusData, 
+               const char *coordinates_id ){
+
+  int dataId, globalIdGrid;
+  int status;
+  int ndims, i, k, ntot;
+  const char *name = "foo";
+  const char *standard_name = NULL;
+  const char *units = NULL;
+  const char *timeDimName = NULL; /* not time dependent */
+  const int save = 1;
+  double *data;
+  char gridname[STRING_SIZE];
+  
+  if ((status = nccf_def_data(gridId,
+				     name, standard_name,
+				     units, timeDimName,
+				     &dataId))) ERR;
+
+  /* get the coordinate data pointers */
+  if ((status = nccf_inq_grid_ndims(gridId, &ndims))) ERR;
+  int coordIds[ndims];
+  double *coordData[ndims];
+  if ((status = nccf_inq_grid_coordids(gridId, coordIds))) ERR;
+  nccf_inq_grid_name( gridId, gridname );
+  int dims[ndims];
+  if ((status = nccf_inq_coord_dims(coordIds[0], dims))) ERR;
+  ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    if ((status = nccf_get_coord_data_pointer(coordIds[i], &coordData[i]))) ERR;
+    ntot *= dims[i];
+  }
+
+  /* set the data */
+  data = (double *) malloc(ntot * sizeof(double));
+  for (k = 0; k < ntot; ++k) {
+    /* coordData[1] = lon */
+    /* coordData[0] = lat */
+    data[k] = cos(M_PI*coordData[1][k]/180.0) * sin(M_PI*coordData[0][k]/180.0);
+    if( useBogusData != 0 ) data[k] = useBogusData;
+  }
+  status += nccf_set_data_double(dataId, data, save, NC_FILL_DOUBLE);
+
+  /* Global Atts for Grid and Data */
+  nccf_def_global( &globalIdGrid );
+  nccf_add_global_att( globalIdGrid, CF_COORDINATES_ID, coordinates_id, 0 );
+  nccf_add_global_att( globalIdGrid, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 );
+  nccf_add_global_att( globalIdGrid, CF_FILETYPE, CF_GLATT_FILETYPE_STATIC_DATA, 1 );
+  nccf_add_global_att( globalIdGrid, CF_GRIDNAME, gridname, 0 );
+
+  /* write lonlat data and coordinates to file */
+  int ncid;
+  if ((status = nc_create(filename, NC_CLOBBER, &ncid))) ERR;
+  status += nccf_put_grid(gridId, ncid);
+  status += nccf_put_data(dataId, ncid);
+  status += nccf_put_global(globalIdGrid, ncid);
+  if ((status = nc_close(ncid))) ERR;
+
+  nccf_free_global( globalIdGrid );
+  free(data);
+
+  return dataId;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+int writeData( const int gridId, const int dataId, 
+                        const char *filename ){
+
+  /* write lonlat data and coordinates to file */
+  int ncid, status;
+  if ((status = nc_open(filename, NC_WRITE, &ncid))) ERR;
+  status = nccf_put_grid(gridId, ncid);
+  status = nccf_put_data(dataId, ncid);
+  if ((status = nc_close(ncid))) ERR;
+
+  return NC_NOERR;
+}
+
+//////////////////////////////////////////////////////////////////////
+/**
+ * Compute data2 as the difference between data1 and data2 
+ */
+void
+computeError(int dataId1, int dataId2) {
+  int status, k, ndims, ntot, i;
+  int gridId;
+  status = nccf_inq_data_gridid(dataId1, &gridId);
+  status += nccf_inq_grid_ndims(gridId, &ndims);
+  int coordIds[ndims];
+  status += nccf_inq_grid_coordids(gridId, coordIds);
+  int dims[ndims];
+  status += nccf_inq_coord_dims(coordIds[0], dims);
+  ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+
+  double *data1;
+  double *data2;
+  nc_type xtype;
+  const void *fill_value;
+  status += nccf_get_data_pointer(dataId1, &xtype, (void **) &data1,
+					 &fill_value);
+  status += nccf_get_data_pointer(dataId2, &xtype, (void **) &data2,
+					 &fill_value);
+
+  /* Set the values of data2 */
+  for (k = 0; k < ntot; ++k) {
+    data2[k] = (data1[k] - data2[k]);
+  }
+}
+
+//////////////////////////////////////////////////////////////////////
+
+double
+checkInterp(int dataId1, int dataId2) {
+  int status, k, ndims, ntot, i;
+  double err;
+  int gridId;
+  status = nccf_inq_data_gridid(dataId1, &gridId);
+  status += nccf_inq_grid_ndims(gridId, &ndims);
+  int coordIds[ndims];
+  status += nccf_inq_grid_coordids(gridId, coordIds);
+  int dims[ndims];
+  status += nccf_inq_coord_dims(coordIds[0], dims);
+  ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+
+  /* compare the two sets of data */
+  double *data1;
+  double *data2;
+  nc_type xtype;
+  const void *fill_value;
+  status += nccf_get_data_pointer(dataId1, &xtype, (void **) &data1,
+					 &fill_value);
+  status += nccf_get_data_pointer(dataId2, &xtype, (void **) &data2,
+					 &fill_value);
+
+  err = 0.0;
+  for (k = 0; k < ntot; ++k) {
+    err += fabs(data1[k] - data2[k]);
+  }
+  err /= ntot;
+
+#ifdef LOGGING
+  printf("Average interpolation error: %lf\n", err);
+#endif
+  return err;
+}
+
+//////////////////////////////////////////////////////////////////////
diff --git a/gridspec_api/regrid/tst_lonlat_regrid.c b/gridspec_api/regrid/tst_lonlat_regrid.c
new file mode 100644
index 0000000..accbe36
--- /dev/null
+++ b/gridspec_api/regrid/tst_lonlat_regrid.c
@@ -0,0 +1,211 @@
+/**
+ * Test interpolation from one lon-lat grid to another
+ *
+ * $Id: tst_lonlat_regrid.c 881 2011-12-17 21:53:14Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+#include "nccf_regrid.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+
+#include <netcdf.h>
+#include <libcf_src.h>
+
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_global.h>
+#include <nccf_data.h>
+#include <nccf_utility_functions.h>
+#include <nccf_handle_error.h>
+
+#include <cf_config.h>
+
+void createLonLat(const double xymin[], const double xymax[], 
+		  const int dims[],
+		  int coordIds[], int *gridId, int *dataId){
+  const int ndims = 2;
+  int nvertex = dims[0]*dims[1];
+  const int save = 1;
+  int status;
+  int i, j, k;
+  double *clon, *clat;
+  double *data;
+  double dxs[ndims];
+
+  const char *dimnames[] = {"nj", "ni"};
+
+  clat = ( double* )malloc( nvertex * sizeof( double ));
+  clon = ( double* )malloc( nvertex * sizeof( double ));
+  data = ( double* )malloc( nvertex * sizeof( double ));
+
+  for (i = 0; i < ndims; ++i) {
+    dxs[i] = (xymax[i] - xymin[i]) / (dims[i] - 1);
+  }
+
+  /* Populate coordinates and create lon/lat coordinate objects */
+  for (j = 0; j < dims[0]; ++j) {
+    for (i = 0; i < dims[1]; ++i) {
+      k = i + dims[1]*j;
+      clat[k] = xymin[0] + j*dxs[0];
+      clon[k] = xymin[1] + i*dxs[1];
+    }
+  }  
+
+  if ((status = nccf_def_lat_coord(ndims, dims, dimnames, clat, save, &coordIds[0]))) ERR;
+  if ((status = nccf_def_lon_coord(ndims, dims, dimnames, clon, save, &coordIds[1]))) ERR;
+  if ((status = nccf_def_grid(coordIds, "lonlat_grid", gridId))) ERR;
+  if ((status = nccf_def_data(*gridId, "data_lonlat", 
+				     NULL, NULL, NULL, dataId))) ERR;
+
+  /* Set the data */
+  for (k = 0; k < nvertex; ++k) {
+    data[k] = cos(M_PI*clon[k]/180.0) * sin(M_PI*clat[k]/180.0);
+  }
+  if ((status = nccf_set_data_double(*dataId, data, save,
+					    NC_FILL_DOUBLE))) ERR;
+
+  free(clat);
+  free(clon);
+  free(data);
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+double 
+checkInterp(int dataId1, int dataId2) {
+  int status, k, ndims, ntot, i;
+  double err;
+  int gridId;
+  if ((status = nccf_inq_data_gridid(dataId1, &gridId))) ERR;
+  if ((status = nccf_inq_grid_ndims(gridId, &ndims))) ERR;
+  int coordIds[ndims];
+  if ((status = nccf_inq_grid_coordids(gridId, coordIds))) ERR;
+  int dims[ndims];
+  if ((status = nccf_inq_coord_dims(coordIds[0], dims))) ERR;
+  ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+  
+  /* compare the two sets of data */
+  double *data1;
+  double *data2;
+  nc_type xtype;
+  const void *fill_value;
+  if ((status = nccf_get_data_pointer(dataId1, &xtype, (void **) &data1,
+					     &fill_value))) ERR;
+  if ((status = nccf_get_data_pointer(dataId2, &xtype, (void **) &data2,
+					     &fill_value))) ERR;
+
+  err = 0.0;
+  for (k = 0; k < ntot; ++k) {
+    err += fabs(data1[k] - data2[k]);
+  }
+  err /= ntot;
+
+#ifdef LOGGING
+    printf("Average interpolation error: %lf\n", err);
+#endif /* LOGGING */
+
+  return err;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+int main(){
+
+  const int ndims = 2;
+  int status;
+  int ori_grid_id, oriDataId, ori_coord_ids[ndims]; 
+  int targetGridId, targetDataId, targetCoordIds[ndims];
+  int targetGridIdRef, targetDataIdRef, targetCoordIdsRef[ndims];
+
+  /* Create grids */
+  const double oriXymin[] = {-90.0, 0.0};
+  const double oriXymax[] = {+90.0, 360.0};
+  const int oriDims[] = {60, 61};
+  const double targetXymin[] = {-89.0, 0.0};
+  const double targetXymax[] = {+89.0, 360.0};
+  const int targetDims[] = {12, 13};
+  int i;
+  char gridname[STRING_SIZE];
+  int globalIdGrid;
+
+  createLonLat(oriXymin, oriXymax, oriDims, ori_coord_ids, 
+	       &ori_grid_id, &oriDataId);
+  createLonLat(targetXymin, targetXymax, targetDims, targetCoordIdsRef, 
+		   &targetGridIdRef, &targetDataIdRef);
+  createLonLat(targetXymin, targetXymax, targetDims, targetCoordIds, 
+		   &targetGridId, &targetDataId);
+
+  nccf_def_global( &globalIdGrid );
+  nccf_add_global_att( globalIdGrid, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 );
+  nccf_inq_grid_name( ori_grid_id, gridname );
+  nccf_add_global_att( globalIdGrid, CF_GRIDNAME, gridname, 0 );
+  nccf_add_global_att( globalIdGrid, CF_COORDINATES_ID, "regrid_test_lonlat", 0 );
+  nccf_add_global_att( globalIdGrid, CF_FILETYPE, CF_GLATT_FILETYPE_STATIC_DATA, 1 );
+
+  
+#ifdef HAVE_LAPACK_LIB
+  /* Create regrid object */
+  int regrid_id;
+  const int nitermax = 100;
+  const double tolpos = 1.e-3;
+  if ((status = nccf_def_regrid(ori_grid_id, targetGridId, &regrid_id))) ERR;
+  if ((status = nccf_compute_regrid_weights(regrid_id, nitermax, 
+					    tolpos))) ERR;
+
+  int ncid;
+  /* Write the data and coordinate files */
+  if ((status = nc_create("tst_lonlat_regrid_target_ref.nc", NC_CLOBBER, &ncid))) ERR;
+  if ((status = nccf_put_grid(targetGridId, ncid))) ERR;
+  if ((status = nccf_put_global(globalIdGrid, ncid))) ERR;
+  if ((status = nccf_put_data(targetDataIdRef, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+
+  /* Interpolate */
+  if ((status = nccf_apply_regrid(regrid_id, oriDataId, targetDataId))) ERR;
+
+  /* Write the data and coordinate files */
+  if ((status = nc_create("tst_lonlat_regrid_target.nc", NC_CLOBBER, &ncid))) ERR;
+  if ((status = nccf_put_grid(targetGridId, ncid))) ERR;
+  if ((status = nccf_put_global(globalIdGrid, ncid))) ERR;
+  if ((status = nccf_put_data(targetDataId, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+
+  /* Check */
+  int nvalid, ntargets;
+  if ((status = nccf_inq_regrid_ntargets(regrid_id, &ntargets))) ERR;
+  if ((status = nccf_inq_regrid_nvalid(regrid_id, &nvalid))) ERR;
+  double ratio = (double)(nvalid) / (double)(ntargets);
+#ifdef LOGGING
+  printf("ratio of valid to num target points = %f\n", ratio);
+#endif /* LOGGING */
+  assert(ratio > 0.99);
+  assert( checkInterp(targetDataId, targetDataIdRef) < 2.e-4 );
+
+  /* Clean up */
+  if ((status = nccf_free_regrid(regrid_id))) ERR;
+#endif
+
+  if ((status = nccf_free_global(globalIdGrid))) ERR;
+  if ((status = nccf_free_data(oriDataId))) ERR;
+  if ((status = nccf_free_data(targetDataId))) ERR;
+  if ((status = nccf_free_data(targetDataIdRef))) ERR;
+  if ((status = nccf_free_grid(ori_grid_id))) ERR;
+  if ((status = nccf_free_grid(targetGridId))) ERR;
+  if ((status = nccf_free_grid(targetGridIdRef))) ERR;
+  for (i = 0; i < ndims; ++i) {
+    if ((status = nccf_free_coord(ori_coord_ids[i]))) ERR;
+    if ((status = nccf_free_coord(targetCoordIds[i]))) ERR;
+    if ((status = nccf_free_coord(targetCoordIdsRef[i]))) ERR;
+  }
+
+  return 0;
+}
diff --git a/gridspec_api/regrid/tst_lonlat_to_lonlat_regrid.c b/gridspec_api/regrid/tst_lonlat_to_lonlat_regrid.c
new file mode 100644
index 0000000..c7223a1
--- /dev/null
+++ b/gridspec_api/regrid/tst_lonlat_to_lonlat_regrid.c
@@ -0,0 +1,254 @@
+/**
+ * Test interpolation from a tripolar grid to a lon-lat grid
+ *
+ * $Id: tst_lonlat_to_lonlat_regrid.c 881 2011-12-17 21:53:14Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+#include "nccf_regrid.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+
+#include <netcdf.h>
+#include <libcf_src.h>
+
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_data.h>
+#include <nccf_utility_functions.h>
+#include <nccf_handle_error.h>
+
+#include <cf_config.h>
+
+void
+setDataToPrescribedValues(int nvertex, const double clon[], const double clat[], 
+			  double data[]) {
+  int k;
+  for (k = 0; k < nvertex; ++k) {
+    data[k] = cos(2.0*M_PI*clon[k]/180.0) * sin(7.0*M_PI*clat[k]/180.0);
+  }
+}
+
+//////////////////////////////////////////////////////////////////////
+
+void
+setDataToMinusTwo(int nvertex, const double clon[], const double clat[],
+		  double data[]) {
+  int k;
+  for (k = 0; k < nvertex; ++k) {
+    data[k] = -2.0;
+  }
+}
+
+//////////////////////////////////////////////////////////////////////
+
+
+
+void 
+createLonLat(const double xymin[], const double xymax[], 
+	     const int dims[], 
+	     void (*setDataFunct)(int nv, const double x[], const double y[], double d[]),
+	     int coordIds[], int *gridId, int *dataId){
+
+  const int ndims = 2;
+  int nvertex = dims[0]*dims[1];
+  const int save = 1;
+  int status;
+  int i, j, k;
+  double *clon, *clat;
+  double *data;
+  double dxs[ndims];
+
+  const char *dimnames[] = {"nj", "ni"};
+
+  clat = ( double* )malloc( nvertex * sizeof( double ));
+  clon = ( double* )malloc( nvertex * sizeof( double ));
+  data = ( double* )malloc( nvertex * sizeof( double ));
+
+  for (i = 0; i < ndims; ++i) {
+    dxs[i] = (xymax[i] - xymin[i]) / (dims[i] - 1);
+  }
+
+  /* Populate coordinates and create lon/lat coordinate objects */
+  for (j = 0; j < dims[0]; ++j) {
+    for (i = 0; i < dims[1]; ++i) {
+      k = i + dims[1]*j;
+      clat[k] = xymin[0] + j*dxs[0];
+      clon[k] = xymin[1] + i*dxs[1];
+    }
+  }  
+
+  if ((status = nccf_def_lat_coord(ndims, dims, dimnames, clat, save, &coordIds[0]))) ERR;
+  if ((status = nccf_def_lon_coord(ndims, dims, dimnames, clon, save, &coordIds[1]))) ERR;
+  if ((status = nccf_def_grid(coordIds, "lonlat_grid", gridId))) ERR;
+  if ((status = nccf_def_data(*gridId, "data", NULL, NULL, NULL, dataId))) ERR;
+
+  /* Set the data */
+  setDataFunct(nvertex, clon, clat, data);
+  if ((status = nccf_set_data_double(*dataId, data, save, 
+					    NC_FILL_DOUBLE))) ERR;
+
+  free(clat);
+  free(clon);
+  free(data);
+}
+
+//////////////////////////////////////////////////////////////////////
+
+void 
+writeData(int dataId, const char *filename){
+
+  /* write lonlat data and coordinates to file */
+  int ncid, status, gridId;
+
+  if ((status = nccf_inq_data_gridid(dataId, &gridId))) ERR;
+  if ((status = nc_create(filename, NC_CLOBBER, &ncid))) ERR;
+  if ((status = nccf_put_grid(gridId, ncid))) ERR;
+  if ((status = nccf_put_data(dataId, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+}
+
+//////////////////////////////////////////////////////////////////////
+/* sv: commenting out since we don't need to check interpolation right now */
+//double
+//checkInterp(int dataId1, int dataId2) {
+//  int status, k, ndims, ntot, i;
+//  double err;
+//  int gridId;
+//  if ((status = nccf_inq_data_gridid(dataId1, &gridId))) ERR;
+//  if ((status = nccf_inq_grid_ndims(gridId, &ndims))) ERR;
+//  int coordIds[ndims];
+//  if ((status = nccf_inq_grid_coordids(gridId, coordIds))) ERR;
+//  int dims[ndims];
+//  if ((status = nccf_inq_coord_dims(coordIds[0], dims))) ERR;
+//  ntot = 1;
+//  for (i = 0; i < ndims; ++i) {
+//    ntot *= dims[i];
+//  }
+//
+//  /* compare the two sets of data */
+//  double *data1;
+//  double *data2;
+//  nc_type xtype;
+//  const void *fill_value;
+//  if ((status = nccf_get_data_pointer(dataId1, &xtype, (void **) &data1,
+//					     &fill_value))) ERR;
+//  if ((status = nccf_get_data_pointer(dataId2, &xtype, (void **) &data2,
+//					     &fill_value))) ERR;
+//
+//  err = 0.0;
+//  for (k = 0; k < ntot; ++k) {
+//    err += fabs(data1[k] - data2[k]);
+//  }
+//  err /= ntot;
+//
+//  return err;
+//}
+
+//////////////////////////////////////////////////////////////////////
+
+int main(){
+
+  int status;
+  const int ndims = 2;
+  int i;
+  
+  //int oriDims[] = {257,257}; // {17,17}; //{257, 257};
+  int oriDims[] = {2,2}; // {17,17}; //{257, 257};
+  int ori_coord_ids[ndims], ori_grid_id, oriDataId;
+  int ori_coord_ids_ref[ndims], ori_grid_id_ref;
+ 
+  //ori_fileprefix=fpvalor;
+
+  //int tgtDims[] = {31, 91}; //{11, 11}; //{31, 91};
+  int tgtDims[] = {4,4}; //{11, 11}; //{31, 91};
+  int tgt_coord_ids[ndims], tgt_grid_id, tgtDataId;
+  int tgt_coord_ids_ref[ndims], tgt_grid_id_ref, tgtDataIdRef;
+  double xymin[] = {60., 60.0};
+  double xymax[] = {90., 90.0};
+
+
+ /* set to a new sin,cos function */
+  createLonLat(xymin, xymax, oriDims, setDataToPrescribedValues,
+	       ori_coord_ids, &ori_grid_id, &oriDataId);
+
+// /* set to a new sin,cos function */
+//  createLonLat(xymin, xymax, oriDims, setDataToPrescribedValues,
+//	       ori_coord_ids_ref, &ori_grid_id_ref, &oriDataIdRef);
+
+  if ((status = nccf_save_grid_scrip(ori_grid_id, "tst_lonlat_to_lonlat_grid_ori_scrip.nc"))) ERR;
+
+  createLonLat(xymin, xymax, tgtDims, setDataToMinusTwo,
+	       tgt_coord_ids, &tgt_grid_id, &tgtDataId);
+  createLonLat(xymin, xymax, tgtDims, setDataToPrescribedValues,
+	       tgt_coord_ids_ref, &tgt_grid_id_ref, &tgtDataIdRef);
+  
+  if ((status = nccf_save_grid_scrip(tgt_grid_id, "tst_lonlat_to_lonlat_grid_tgt_scrip.nc"))) ERR;
+
+  writeData(oriDataId,"tst_lonlat_to_lonlat_ori.nc" );
+  writeData(tgtDataIdRef, "tst_lonlat_to_lonlat_tgt.nc"  );
+
+#ifdef HAVE_LAPACK_LIB
+  /* Create regrid object */
+  int regrid_id;
+  const int nitermax = 20;
+  const double tolpos = 1.e-2;
+  if ((status = nccf_def_regrid(ori_grid_id, tgt_grid_id, &regrid_id))) ERR;
+
+  /* Exclude cut in longitude from searchable domain */
+  const int lo[] = {0, oriDims[1]/2 - 1};
+  const int hi[] = {oriDims[0]/2, oriDims[1]/2};
+  if ((status = nccf_add_regrid_forbidden(regrid_id, lo, hi))) ERR;
+
+  if ((status = nccf_compute_regrid_weights(regrid_id,
+					    nitermax,
+					    tolpos))) ERR;
+
+  /* Interpolate */
+  if ((status = nccf_apply_regrid(regrid_id, oriDataId, tgtDataId))) ERR;
+
+  /* Write regridded data*/
+  writeData(tgtDataId, "tst_lonlat_to_lonlat_regrid_intrp.nc");
+
+  /* Write regrid weights */
+  const char* put_filename = "tst_lonlat_to_lonlat_regrid_weights.nc";
+  int ncid;
+  if (( status = nc_create( put_filename , NC_CLOBBER, &ncid ))) ERR;
+  if (( status = nccf_put_regrid( regrid_id, ncid ))) ERR;
+  if (( status = nc_close( ncid ))) ERR;
+
+  /* Check */
+  int nvalid, ntargets;
+  if ((status = nccf_inq_regrid_ntargets(regrid_id, &ntargets))) ERR;
+  if ((status = nccf_inq_regrid_nvalid(regrid_id, &nvalid))) ERR;
+//  double ratio = (double)(nvalid) / (double)(ntargets);
+//  double error = checkInterp(tgtDataId, tgtDataIdRef);
+//  printf("ratio of valid to num target points = %f  interpolation error: %f\n", 
+//	 ratio, error);
+  //assert(ratio > 0.94);
+  //assert( checkInterp(tgtDataId, tgtDataIdRef) < 0.05 );
+
+  /* Clean up */
+  if ((status = nccf_free_regrid(regrid_id))) ERR;
+#endif
+
+  if ((status = nccf_free_data(oriDataId))) ERR;
+  if ((status = nccf_free_data(tgtDataId))) ERR;
+  if ((status = nccf_free_data(tgtDataIdRef))) ERR;
+
+  if ((status = nccf_free_grid(ori_grid_id))) ERR;
+  if ((status = nccf_free_grid(tgt_grid_id))) ERR;
+  if ((status = nccf_free_grid(tgt_grid_id_ref))) ERR;
+
+  for (i = 0; i < ndims; ++i) {
+    if ((status = nccf_free_coord(ori_coord_ids[i]))) ERR;
+    if ((status = nccf_free_coord(tgt_coord_ids[i]))) ERR;
+    if ((status = nccf_free_coord(tgt_coord_ids_ref[i]))) ERR;
+  }
+
+  return 0;
+}
diff --git a/gridspec_api/regrid/tst_mask.c b/gridspec_api/regrid/tst_mask.c
new file mode 100644
index 0000000..537bbb7
--- /dev/null
+++ b/gridspec_api/regrid/tst_mask.c
@@ -0,0 +1,195 @@
+/**
+ * Test masked interpolation 
+ * $Id: tst_mask.c 881 2011-12-17 21:53:14Z pletzer $
+ */
+
+#include <nccf_regrid.h>
+#include <math.h>
+#include <stdlib.h>
+#include <netcdf.h>
+#include <nccf_utility_functions.h>
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_data.h>
+#include <nccf_handle_error.h>
+
+#include <cf_config.h> // to access HAVE_LAPACK_LIB
+
+const int SAVE = 1;
+
+/** return total number of nodes */
+int get_ntot(int ndims, const int dims[]) {
+  int ntot = 1;
+  int i;
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+  return ntot;
+}
+
+/** create a uniform grid */
+void create_unigrid(int ndims, const int dims[], 
+		    const double lo_corner[], const double hi_corner[],
+		    int coordids[], int *gridid) {
+  int status;
+  int i, j;
+  int indx[ndims];
+  const char *dimnames[] = {"nx", "ny", "nz"};
+  const char *coordnames[] = {"x", "y", "z"};
+  int ntot = get_ntot(ndims, dims);
+  double **coords;
+  coords = (double **) malloc(ndims * sizeof(double *));
+  double deltas[ndims];
+  for (i = 0; i < ndims; ++i) {
+    coords[i] = (double *) malloc(ntot * sizeof(double));
+    deltas[i] = (hi_corner[i]-lo_corner[i])/(double)(dims[i]-1);
+  }
+  for (j = 0; j < ntot; ++j) {
+    nccf_get_multi_index(ndims, dims, j, indx);
+    for (i = 0; i < ndims; ++i) {
+      coords[i][j] = lo_corner[i] + indx[i]*deltas[i];    
+    }
+  }
+  // create the coordinates
+  for (i = 0; i < ndims; ++i) {
+    status = nccf_def_coord(ndims, dims, dimnames, coords[i], SAVE, 
+			    coordnames[i], NULL, NULL, &coordids[i]);
+    if (status) ERR;
+  }
+  // create the grid
+  status = nccf_def_grid (coordids, "xyz", gridid);
+  if (status) ERR;
+  // clean up, all the data are copied
+  for (i = 0; i < ndims; ++i) {
+    free(coords[i]);
+  }
+  free(coords);
+}
+
+int main() {
+
+  int i, j, status;
+
+  // global settings
+  const double fill_value = -1;
+  const int ndims = 3;
+  const double lo_corner[] = {0, 0, 0};
+  const double hi_corner[] = {1, 1, 1};
+  int indx[ndims];
+
+  // target grid
+  const int dims_tgt[] = {50, 51, 52};
+  int coordids_tgt[ndims];
+  int gridid_tgt;
+  create_unigrid(ndims, dims_tgt, lo_corner, hi_corner,
+		 coordids_tgt, &gridid_tgt);
+  status = nccf_save_grid_scrip(gridid_tgt, "tst_mask_tgt_scrip.nc");
+  if (status) ERR;
+
+  // put data on the target grid
+  int ntot_tgt = get_ntot(ndims, dims_tgt);
+  int dataid_tgt;
+  double *data_tgt = (double *) malloc(ntot_tgt * sizeof(double));
+  for (j = 0; j < ntot_tgt; ++j) {
+    // set data to bad value
+    data_tgt[j] = fill_value;
+  }
+  status = nccf_def_data (gridid_tgt, "data_tgt", NULL, NULL, NULL, 
+				 &dataid_tgt);
+  if (status) ERR;
+  status = nccf_set_data_double(dataid_tgt, data_tgt, 
+				       SAVE, fill_value);
+  if (status) ERR;
+
+  // original grid
+  const int dims_ori[] = {100, 101, 102};
+  int coordids_ori[ndims];
+  int gridid_ori;
+  create_unigrid(ndims, dims_ori, lo_corner, hi_corner,
+		 coordids_ori, &gridid_ori);
+  status = nccf_save_grid_scrip(gridid_ori, "tst_mask_ori_scrip.nc");
+  if (status) ERR;
+
+  // put data on the original grid
+  int dataid_ori;
+  int ntot_ori = get_ntot(ndims, dims_ori);
+  int *imask = (int *) malloc(ntot_ori * sizeof(int));
+  double *data_ori = (double *) malloc(ntot_ori * sizeof(double));
+  for (j = 0; j < ntot_ori; ++j) {
+    nccf_get_multi_index(ndims, dims_ori, j, indx);
+    data_ori[j] = 0;
+    for (i = 0; i < ndims; ++i) {
+      double xyz = indx[i]/(double)(dims_ori[i] - 1);
+      data_ori[j] += xyz*xyz;
+      // only data_ori[j] < 1.0 is valid
+      imask[j] = (data_ori[j] < 1.0? 1: 0);
+    }
+    data_ori[j] = sqrt(data_ori[j]);
+
+  }
+  status = nccf_def_data (gridid_ori, "data_ori", NULL, NULL, NULL, 
+				 &dataid_ori);
+  if (status) ERR;
+  status = nccf_set_data_double (dataid_ori, data_ori, 
+					SAVE, NC_FILL_DOUBLE);
+  if (status) ERR;
+
+  // put a mask on the original grid
+  status = nccf_set_grid_validmask(gridid_ori, imask);
+  if (status) ERR;
+
+  // interpolate
+#ifdef HAVE_LAPACK_LIB
+  int regridid;
+  status = nccf_def_regrid(gridid_ori, gridid_tgt, &regridid);
+  if (status) ERR;
+  const int nitermax = 100;
+  double tolpos = 1.e-4;
+  status = nccf_compute_regrid_weights(regridid, nitermax, tolpos);
+  if (status) ERR;
+  status = nccf_apply_regrid(regridid, dataid_ori, dataid_tgt);
+  if (status) ERR;
+  status = nccf_free_regrid(regridid);
+  if (status) ERR;
+#endif
+
+  // save
+  int ncid;
+  status = nc_create("tst_mask_tgt.nc", NC_CLOBBER, &ncid);
+  if (status) ERR;
+  status = nccf_put_grid(gridid_tgt, ncid);
+  if (status) ERR;
+  status = nccf_put_data(dataid_tgt, ncid);
+  if (status) ERR;
+  status = nc_close(ncid);
+  if (status) ERR;
+   status = nc_create("tst_mask_ori.nc", NC_CLOBBER, &ncid);
+  if (status) ERR;
+  status = nccf_put_grid(gridid_ori, ncid);
+  if (status) ERR;
+  status = nccf_put_data(dataid_ori, ncid);
+  if (status) ERR;
+  status = nc_close(ncid);
+  if (status) ERR;
+
+  // clean up
+  free(data_tgt);
+  free(data_ori);
+  status = nccf_free_data(dataid_tgt);
+  if (status) ERR;
+  free(imask);
+  status = nccf_free_data(dataid_ori);
+  if (status) ERR;
+  status = nccf_free_grid(gridid_tgt);
+  if (status) ERR;
+  status = nccf_free_grid(gridid_ori);
+  if (status) ERR;
+  for (i = 0; i < ndims; ++i) {
+    status = nccf_free_coord(coordids_tgt[i]);
+    if (status) ERR;
+    status = nccf_free_coord(coordids_ori[i]);
+    if (status) ERR;
+  }
+ 
+  return 0;
+}
diff --git a/gridspec_api/regrid/tst_mask2.c b/gridspec_api/regrid/tst_mask2.c
new file mode 100644
index 0000000..50c0928
--- /dev/null
+++ b/gridspec_api/regrid/tst_mask2.c
@@ -0,0 +1,232 @@
+/**
+ * Test masked interpolation 
+ * $Id: tst_mask2.c 923 2012-03-22 18:44:09Z dkindig $
+ */
+
+#include <nccf_regrid.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <netcdf.h>
+#include <nccf_utility_functions.h>
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_data.h>
+#include <nccf_handle_error.h>
+
+#include <cf_config.h> // to access HAVE_LAPACK_LIB
+
+const int SAVE = 1;
+
+/** return total number of nodes */
+int get_ntot(int ndims, const int dims[]) {
+  int ntot = 1;
+  int i;
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+  return ntot;
+}
+
+/** create a uniform grid */
+void create_unigrid(const int dims[], 
+		    const double lo_corner[], const double hi_corner[],
+		    int coordids[], int *gridid) {
+  const int ndims = 2;
+  int status;
+  int i, j;
+  int indx[ndims];
+  const char *dimnames[] = {"ny", "nx"};
+  const char *coordnames[] = {"y", "x"};
+  int ntot = get_ntot(ndims, dims);
+  double **coords;
+  coords = (double **) malloc(ndims * sizeof(double *));
+  double deltas[ndims];
+  for (i = 0; i < ndims; ++i) {
+    coords[i] = (double *) malloc(ntot * sizeof(double));
+    deltas[i] = (hi_corner[i] - lo_corner[i])/(double)(dims[i]-1);
+  }
+  for (j = 0; j < ntot; ++j) {
+    nccf_get_multi_index(ndims, dims, j, indx);
+    for (i = 0; i < ndims; ++i) {
+      coords[i][j] = lo_corner[i] + indx[i]*deltas[i];    
+    }
+  }
+  // create the coordinates
+  for (i = 0; i < ndims; ++i) {
+    status = nccf_def_coord(ndims, dims, dimnames, coords[i], SAVE, 
+			    coordnames[i], NULL, NULL, &coordids[i]);
+    if (status) ERR;
+  }
+  // create the grid
+  status = nccf_def_grid(coordids, "yx", gridid);
+  if (status) ERR;
+  // clean up, all the data are copied
+  for (i = 0; i < ndims; ++i) {
+    free(coords[i]);
+  }
+  free(coords);
+}
+
+int main() {
+
+  int i, j, status;
+
+  // global settings
+  const double fill_value = 0;
+  const int ndims = 2;
+  const double lo_corner[] = {0, 0};
+  const double hi_corner[] = {1, 1};
+  int indx[ndims];
+
+  // target grid
+  const int dims_tgt[] = {5, 11};
+  int coordids_tgt[ndims];
+  int gridid_tgt;
+  create_unigrid(dims_tgt, lo_corner, hi_corner,
+		 coordids_tgt, &gridid_tgt);
+
+  // put data on the target grid
+  int ntot_tgt = get_ntot(ndims, dims_tgt);
+  int dataid_tgt;
+  double *data_tgt = (double *) malloc(ntot_tgt * sizeof(double));
+  for (j = 0; j < ntot_tgt; ++j) {
+    // set data to bad value
+    data_tgt[j] = fill_value;
+  }
+  status = nccf_def_data(gridid_tgt, "data_tgt", NULL, NULL, NULL, 
+				 &dataid_tgt);
+  if (status) ERR;
+  status = nccf_set_data_double(dataid_tgt, data_tgt, 
+				       SAVE, fill_value);
+  if (status) ERR;
+
+  // original grid
+  const int dims_ori[] = {11, 21};
+  int coordids_ori[ndims];
+  int gridid_ori;
+  create_unigrid(dims_ori, lo_corner, hi_corner,
+		 coordids_ori, &gridid_ori);
+
+  // put data on the original grid
+  double **coords_ori;
+  coords_ori = (double **) malloc(ndims * sizeof(double *));
+  for (i = 0; i < ndims; ++i) {
+    status = nccf_get_coord_data_pointer(coordids_ori[i], 
+                                         (double **)&coords_ori[i]);
+    if (status) ERR;
+  }
+  
+  int dataid_ori;
+  int ntot_ori = get_ntot(ndims, dims_ori);
+  int *imask = (int *) malloc(ntot_ori * sizeof(int));
+  double *data_ori = (double *) malloc(ntot_ori * sizeof(double));
+  for (j = 0; j < ntot_ori; ++j) {
+    nccf_get_multi_index(ndims, dims_ori, j, indx);
+    double y = coords_ori[0][j];
+    double x = coords_ori[1][j];
+    // set mask
+    imask[j] = (y >= x? 1: 0);
+    data_ori[j] = 1.0;
+  }
+  status = nccf_def_data (gridid_ori, "data_ori", NULL, NULL, NULL, 
+				 &dataid_ori);
+  if (status) ERR;
+  status = nccf_set_data_double (dataid_ori, data_ori, 
+					SAVE, NC_FILL_DOUBLE);
+  if (status) ERR;
+
+  // put a mask on the original grid
+  status = nccf_set_grid_validmask(gridid_ori, imask);
+  if (status) ERR;
+
+  // interpolate
+#ifdef HAVE_LAPACK_LIB
+
+  int regridid;
+  status = nccf_def_regrid(gridid_ori, gridid_tgt, &regridid);
+  if (status) ERR;
+  const int nitermax = 20;
+  double tolpos = 1.e-4;
+  status = nccf_compute_regrid_weights(regridid, nitermax, tolpos);
+  if (status) ERR;
+  status = nccf_apply_regrid(regridid, dataid_ori, dataid_tgt);
+  if (status) ERR;
+
+  // check
+  double **coords_tgt;
+  coords_tgt = (double **) malloc(ndims * sizeof(double *));
+  for (i = 0; i < ndims; ++i) {
+    status = nccf_get_coord_data_pointer(coordids_tgt[i], 
+                                         (double **)&coords_tgt[i]);
+    if (status) ERR;
+  }
+  double *data_tgt_interp;
+  nc_type xtype;
+  const void *fv;
+  status = nccf_get_data_pointer(dataid_tgt, &xtype, 
+                                 (void **)&data_tgt_interp, &fv);
+  if (status) ERR;
+  for (j = 0; j < ntot_tgt; ++j) {
+    nccf_get_multi_index(ndims, dims_tgt, j, indx);
+    double y = coords_tgt[0][j];
+    double x = coords_tgt[1][j];
+    if (y >= x && data_tgt_interp[j] != 1) {
+      printf("node = %d x = %lf y = %lf interp value = %lf (expected 1)\n", 
+             j, x, y, data_tgt_interp[j]);
+      assert(data_tgt_interp[j] == 1);
+    }
+    if (y < x && data_tgt_interp[j] != NC_FILL_DOUBLE) {
+      printf("node = %d x = %lf y = %lf interp value = %lf (expected 0)\n", 
+             j, x, y, data_tgt_interp[j]);
+      assert(data_tgt_interp[j] == NC_FILL_DOUBLE);
+    }
+  }
+  
+  status = nccf_free_regrid(regridid);
+  if (status) ERR;
+  free(coords_tgt);
+#endif
+
+  // save
+  int ncid;
+  status = nc_create("tst_mask2_tgt.nc", NC_CLOBBER, &ncid);
+  if (status) ERR;
+  status = nccf_put_grid(gridid_tgt, ncid);
+  if (status) ERR;
+  status = nccf_put_data(dataid_tgt, ncid);
+  if (status) ERR;
+  status = nc_close(ncid);
+  if (status) ERR;
+   status = nc_create("tst_mask2_ori.nc", NC_CLOBBER, &ncid);
+  if (status) ERR;
+  status = nccf_put_grid(gridid_ori, ncid);
+  if (status) ERR;
+  status = nccf_put_data(dataid_ori, ncid);
+  if (status) ERR;
+  status = nc_close(ncid);
+  if (status) ERR;
+
+  // clean up
+  free(coords_ori);
+  free(data_tgt);
+  free(data_ori);
+  status = nccf_free_data(dataid_tgt);
+  if (status) ERR;
+  free(imask);
+  status = nccf_free_data(dataid_ori);
+  if (status) ERR;
+  status = nccf_free_grid(gridid_tgt);
+  if (status) ERR;
+  status = nccf_free_grid(gridid_ori);
+  if (status) ERR;
+  for (i = 0; i < ndims; ++i) {
+    status = nccf_free_coord(coordids_tgt[i]);
+    if (status) ERR;
+    status = nccf_free_coord(coordids_ori[i]);
+    if (status) ERR;
+  }
+ 
+  return 0;
+}
diff --git a/gridspec_api/regrid/tst_periodic.c b/gridspec_api/regrid/tst_periodic.c
new file mode 100644
index 0000000..d6dab7b
--- /dev/null
+++ b/gridspec_api/regrid/tst_periodic.c
@@ -0,0 +1,247 @@
+/**
+ * Test cell data interpolation on a periodic grid
+ *
+ * $Id: tst_periodic.c 904 2011-12-28 21:58:46Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+#include "nccf_regrid.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+
+#include <netcdf.h>
+#include <libcf_src.h>
+
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_global.h>
+#include <nccf_data.h>
+#include <nccf_utility_functions.h>
+#include <nccf_handle_error.h>
+
+#include <cf_config.h>
+
+void setValues(int data_id) {
+  int lonid, gridid, status, i, n;
+  double *clon, *data;
+  const double *fillval;
+  nc_type xtype;
+  if ((status = nccf_inq_data_gridid(data_id, &gridid))) ERR;
+  if ((status = nccf_inq_grid_coordids(gridid, &lonid))) ERR;
+  if ((status = nccf_get_coord_data_pointer(lonid, &clon))) ERR;
+  if ((status = nccf_inq_coord_dims(lonid, &n))) ERR;
+  if ((status = nccf_get_data_pointer(data_id, &xtype, (void **)&data, 
+                                      (const void **)&fillval))) ERR;
+  for (i = 0; i < n; ++i) {
+    data[i] = sin(M_PI*clon[i]/180.0);
+  }
+}
+
+void createLon1D(int n, int isCell, int *lon_id, int *grid_id, int *data_id) {
+  const int ndims = 1;
+  const int save = 1;
+  int status;
+  int i;
+  double *clon;
+  double *data;
+  double dx;
+
+  const char *dimnames[] = {"ni"};
+
+  clon = (double *) malloc(n * sizeof(double));
+  data = (double *) malloc(n * sizeof(double));
+
+  if (isCell) {
+    dx = 360.0 / ( (double) n );
+    for (i = 0; i < n; ++i) {
+      clon[i] = (i + 0.5) * dx;
+    }
+  }
+  else {
+    // nodal
+    dx = 360.0 / ( (double) n - 1 );
+    for (i = 0; i < n; ++i) {
+      clon[i] = i * dx;
+    } 
+  }
+
+  if ((status = nccf_def_lon_coord(ndims, &n, dimnames, clon, save, 
+                                   lon_id))) ERR;
+  if ((status = nccf_def_grid(lon_id, "lon_grid", grid_id))) ERR;
+  if ((status = nccf_def_data(*grid_id, "lon_data", 
+                              NULL, NULL, NULL, data_id))) ERR;
+
+  /* Initialize the data */
+  for (i = 0; i < n; ++i) {
+    data[i] = NC_FILL_DOUBLE;
+  }
+  if ((status = nccf_set_data_double(*data_id, data, save,
+					    NC_FILL_DOUBLE))) ERR;
+
+  /* Set the data */
+  setValues(*data_id);
+
+  free(clon);
+  free(data);
+}
+
+//////////////////////////////////////////////////////////////////////
+
+double 
+checkInterp(int dataId1, int dataId2) {
+  int status, k, ndims, ntot, i;
+  double err;
+  int gridId;
+  if ((status = nccf_inq_data_gridid(dataId1, &gridId))) ERR;
+  if ((status = nccf_inq_grid_ndims(gridId, &ndims))) ERR;
+  int coordIds[ndims];
+  if ((status = nccf_inq_grid_coordids(gridId, coordIds))) ERR;
+  int dims[ndims];
+  if ((status = nccf_inq_coord_dims(coordIds[0], dims))) ERR;
+  ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+  
+  /* compare the two sets of data */
+  double *data1;
+  double *data2;
+  nc_type xtype;
+  const void *fill_value;
+  if ((status = nccf_get_data_pointer(dataId1, &xtype, (void **) &data1,
+					     &fill_value))) ERR;
+  if ((status = nccf_get_data_pointer(dataId2, &xtype, (void **) &data2,
+					     &fill_value))) ERR;
+
+  err = 0.0;
+  for (k = 0; k < ntot; ++k) {
+    err += fabs(data1[k] - data2[k]);
+  }
+  err /= ntot;
+
+#ifdef LOGGING
+    printf("Average interpolation error: %lf\n", err);
+#endif /* LOGGING */
+
+  return err;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+int main(){
+
+  int status, i;
+  int ori_lon_id, ori_grid_id, ori_data_id; 
+  int ori_celllon_id, ori_cellgrid_id, ori_celldata_id; 
+  int tgt_lon_id, tgt_grid_id, tgt_data_id; 
+  int tgt_celllon_id, tgt_cellgrid_id, tgt_celldata_id; 
+  int tgt_data_ref_id, tgt_celldata_ref_id;
+  double *tgt_data_ref, *tgt_celldata_ref;
+  const int save = 1;
+
+  /* Create grids */
+  const int ori_n = 2;
+  const int tgt_n = 3;
+
+  // original nodal grid
+  createLon1D(ori_n, 0, &ori_lon_id, &ori_grid_id, &ori_data_id);
+  // original cell grid
+  createLon1D(ori_n, 1, &ori_celllon_id, &ori_cellgrid_id, &ori_celldata_id);
+
+  // target nodal grid
+  createLon1D(tgt_n, 0, &tgt_lon_id, &tgt_grid_id, &tgt_data_id);
+  // target cell grid
+  createLon1D(tgt_n, 1, &tgt_celllon_id, &tgt_cellgrid_id, &tgt_celldata_id);
+
+  // reference data on target grid
+  if ((status = nccf_def_data(tgt_grid_id, "data", 
+                              NULL, NULL, NULL, &tgt_data_ref_id))) ERR;
+  if ((status = nccf_def_data(tgt_cellgrid_id, "data", 
+                              NULL, NULL, NULL, &tgt_celldata_ref_id))) ERR;
+  tgt_data_ref = (double *) malloc(tgt_n * sizeof(double));
+  tgt_celldata_ref = (double *) malloc(tgt_n * sizeof(double));
+  for (i = 0; i < tgt_n; ++i) {
+    tgt_data_ref[i] = NC_FILL_DOUBLE;
+    tgt_celldata_ref[i] = NC_FILL_DOUBLE;
+  }
+  if ((status = nccf_set_data_double(tgt_data_ref_id, 
+                                     tgt_data_ref, save,
+                                     NC_FILL_DOUBLE))) ERR;
+  if ((status = nccf_set_data_double(tgt_celldata_ref_id, 
+                                     tgt_celldata_ref, save,
+                                     NC_FILL_DOUBLE))) ERR;
+  setValues(tgt_data_ref_id);
+  setValues(tgt_celldata_ref_id);
+       
+  
+#ifdef HAVE_LAPACK_LIB
+  /* Create regrid object */
+  int regrid_id, regrid_cell_id;
+  const int nitermax = 4;
+  const double tolpos = 1.e-3;
+  if ((status = nccf_def_regrid(ori_grid_id, tgt_grid_id, 
+                                &regrid_id))) ERR;
+  if ((status = nccf_def_regrid(ori_cellgrid_id, tgt_cellgrid_id, 
+                                &regrid_cell_id))) ERR;
+
+  /* if ((status = nccf_compute_regrid_weights(regrid_id, nitermax,  */
+  /*       				    tolpos))) ERR; */
+  if ((status = nccf_compute_regrid_weights(regrid_cell_id, nitermax, 
+					    tolpos))) ERR;
+  /* Interpolate */
+  /* if ((status = nccf_apply_regrid(regrid_id, ori_data_id,  */
+  /*                                 tgt_data_id))) ERR; */
+  if ((status = nccf_apply_regrid(regrid_cell_id, ori_celldata_id, 
+                                  tgt_celldata_id))) ERR;
+
+  /* Check */
+  int nvalid, ntargets;
+  double ratio;
+  /* if ((status = nccf_inq_regrid_ntargets(regrid_id, &ntargets))) ERR; */
+  /* if ((status = nccf_inq_regrid_nvalid(regrid_id, &nvalid))) ERR; */
+  /* ratio = (double)(nvalid) / (double)(ntargets); */
+  /* //#ifdef LOGGING */
+  /* printf("ratio of valid to num target points (nodal) = %f\n", ratio); */
+  /* //#endif /\* LOGGING *\/ */
+
+  if ((status = nccf_inq_regrid_ntargets(regrid_cell_id, &ntargets))) ERR;
+  if ((status = nccf_inq_regrid_nvalid(regrid_cell_id, &nvalid))) ERR;
+  ratio = (double)(nvalid) / (double)(ntargets);
+  //#ifdef LOGGING
+  printf("ratio of valid to num target points (cell) = %f\n", ratio);
+  //assert(ratio > 0.90476);
+  //#endif /* LOGGING */
+
+  checkInterp(tgt_data_id, tgt_data_ref_id);
+
+  /* Clean up */
+  if ((status = nccf_free_regrid(regrid_id))) ERR;
+  if ((status = nccf_free_regrid(regrid_cell_id))) ERR;
+#endif
+
+  if ((status = nccf_free_data(ori_data_id))) ERR;
+  if ((status = nccf_free_data(tgt_data_id))) ERR;
+  if ((status = nccf_free_data(ori_celldata_id))) ERR;
+  if ((status = nccf_free_data(tgt_celldata_id))) ERR;
+  if ((status = nccf_free_data(tgt_data_ref_id))) ERR;
+  if ((status = nccf_free_data(tgt_celldata_ref_id))) ERR;
+    
+  if ((status = nccf_free_grid(ori_grid_id))) ERR;
+  if ((status = nccf_free_grid(ori_cellgrid_id))) ERR;
+  if ((status = nccf_free_grid(tgt_grid_id))) ERR;
+  if ((status = nccf_free_grid(tgt_cellgrid_id))) ERR;
+
+  if ((status = nccf_free_coord(ori_lon_id))) ERR;
+  if ((status = nccf_free_coord(ori_celllon_id))) ERR;
+  if ((status = nccf_free_coord(tgt_lon_id))) ERR;
+  if ((status = nccf_free_coord(tgt_celllon_id))) ERR;
+
+  free(tgt_data_ref);
+  free(tgt_celldata_ref);
+
+  return 0;
+}
diff --git a/gridspec_api/regrid/tst_periodic2.c b/gridspec_api/regrid/tst_periodic2.c
new file mode 100644
index 0000000..31008dc
--- /dev/null
+++ b/gridspec_api/regrid/tst_periodic2.c
@@ -0,0 +1,203 @@
+/**
+ * Test interpolation on a periodic grid with the source grid undoing a 
+ * periodicity jump somewhere in the middle
+ *
+ * $Id: tst_periodic2.c 904 2011-12-28 21:58:46Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+#include "nccf_regrid.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+
+#include <netcdf.h>
+#include <libcf_src.h>
+
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_global.h>
+#include <nccf_data.h>
+#include <nccf_utility_functions.h>
+#include <nccf_handle_error.h>
+
+#include <cf_config.h>
+
+void setValues(int data_id) {
+  int lonid, gridid, status, i, n;
+  double *clon, *data;
+  const double *fillval;
+  nc_type xtype;
+  if ((status = nccf_inq_data_gridid(data_id, &gridid))) ERR;
+  if ((status = nccf_inq_grid_coordids(gridid, &lonid))) ERR;
+  if ((status = nccf_get_coord_data_pointer(lonid, &clon))) ERR;
+  if ((status = nccf_inq_coord_dims(lonid, &n))) ERR;
+  if ((status = nccf_get_data_pointer(data_id, &xtype, (void **)&data, 
+                                      (const void **)&fillval))) ERR;
+  for (i = 0; i < n; ++i) {
+    data[i] = sin(M_PI*clon[i]/180.0);
+  }
+}
+
+void createLon1D(int n, double xmin, int *lon_id, int *grid_id, int *data_id) {
+  const int ndims = 1;
+  const int save = 1;
+  int status;
+  int i;
+  double *clon;
+  double *data;
+  double dx;
+
+  const char *dimnames[] = {"ni"};
+
+  clon = (double *) malloc(n * sizeof(double));
+  data = (double *) malloc(n * sizeof(double));
+
+  dx = 360.0 / ( (double) (n - 1) );
+  for (i = 0; i < n; ++i) {
+    clon[i] = xmin + i * dx;
+  }
+
+  if ((status = nccf_def_lon_coord(ndims, &n, dimnames, clon, save, 
+                                   lon_id))) ERR;
+  if ((status = nccf_def_grid(lon_id, "lon_grid", grid_id))) ERR;
+  if ((status = nccf_def_data(*grid_id, "lon_data", 
+                              NULL, NULL, NULL, data_id))) ERR;
+
+  /* Initialize the data */
+  for (i = 0; i < n; ++i) {
+    data[i] = NC_FILL_DOUBLE;
+  }
+  if ((status = nccf_set_data_double(*data_id, data, save,
+					    NC_FILL_DOUBLE))) ERR;
+
+  /* Set the data */
+  setValues(*data_id);
+
+  free(clon);
+  free(data);
+}
+
+//////////////////////////////////////////////////////////////////////
+
+double 
+checkInterp(int dataId1, int dataId2) {
+  int status, k, ndims, ntot, i;
+  double err;
+  int gridId;
+  if ((status = nccf_inq_data_gridid(dataId1, &gridId))) ERR;
+  if ((status = nccf_inq_grid_ndims(gridId, &ndims))) ERR;
+  int coordIds[ndims];
+  if ((status = nccf_inq_grid_coordids(gridId, coordIds))) ERR;
+  int dims[ndims];
+  if ((status = nccf_inq_coord_dims(coordIds[0], dims))) ERR;
+  ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+  
+  /* compare the two sets of data */
+  double *data1;
+  double *data2;
+  nc_type xtype;
+  const void *fill_value;
+  if ((status = nccf_get_data_pointer(dataId1, &xtype, (void **) &data1,
+					     &fill_value))) ERR;
+  if ((status = nccf_get_data_pointer(dataId2, &xtype, (void **) &data2,
+					     &fill_value))) ERR;
+
+  err = 0.0;
+  for (k = 0; k < ntot; ++k) {
+    err += fabs(data1[k] - data2[k]);
+  }
+  err /= ntot;
+
+#ifdef LOGGING
+    printf("Average interpolation error: %lf\n", err);
+#endif /* LOGGING */
+
+  return err;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+int main(){
+
+  int status, i;
+  int ori_lon_id, ori_grid_id, ori_data_id; 
+  int tgt_lon_id, tgt_grid_id, tgt_data_id; 
+  int tgt_data_ref_id;
+  double *tgt_data_ref;
+  const int save = 1;
+
+  /* Create grids */
+  const int ori_n = 11;
+  const int tgt_n = 11;
+
+  // original nodal grid
+  createLon1D(ori_n, -180.0, &ori_lon_id, &ori_grid_id, &ori_data_id);
+
+  // target nodal grid
+  createLon1D(tgt_n, 0.0, &tgt_lon_id, &tgt_grid_id, &tgt_data_id);
+
+  // reference data on target grid
+  if ((status = nccf_def_data(tgt_grid_id, "data", 
+                              NULL, NULL, NULL, &tgt_data_ref_id))) ERR;
+  tgt_data_ref = (double *) malloc(tgt_n * sizeof(double));
+  for (i = 0; i < tgt_n; ++i) {
+    tgt_data_ref[i] = NC_FILL_DOUBLE;
+  }
+  if ((status = nccf_set_data_double(tgt_data_ref_id, 
+                                     tgt_data_ref, save,
+                                     NC_FILL_DOUBLE))) ERR;
+  setValues(tgt_data_ref_id);       
+  
+#ifdef HAVE_LAPACK_LIB
+  /* Create regrid object */
+  int regrid_id;
+  const int nitermax = 4;
+  const double tolpos = 1.e-3;
+  if ((status = nccf_def_regrid(ori_grid_id, tgt_grid_id, 
+                                &regrid_id))) ERR;
+
+  if ((status = nccf_compute_regrid_weights(regrid_id, nitermax, 
+					    tolpos))) ERR;
+
+  /* Interpolate */
+  if ((status = nccf_apply_regrid(regrid_id, ori_data_id,
+                                  tgt_data_id))) ERR;
+
+  /* Check */
+  int nvalid, ntargets;
+  double ratio;
+  if ((status = nccf_inq_regrid_ntargets(regrid_id, &ntargets))) ERR;
+  if ((status = nccf_inq_regrid_nvalid(regrid_id, &nvalid))) ERR;
+  ratio = (double)(nvalid) / (double)(ntargets);
+#ifdef LOGGING
+  printf("ratio of valid to num target points (nodal) = %f\n", ratio);
+#endif /* LOGGING */
+  assert(ratio == 1.0);
+
+  checkInterp(tgt_data_id, tgt_data_ref_id);
+
+  /* Clean up */
+  if ((status = nccf_free_regrid(regrid_id))) ERR;
+#endif
+
+  if ((status = nccf_free_data(ori_data_id))) ERR;
+  if ((status = nccf_free_data(tgt_data_id))) ERR;
+  if ((status = nccf_free_data(tgt_data_ref_id))) ERR;
+    
+  if ((status = nccf_free_grid(ori_grid_id))) ERR;
+  if ((status = nccf_free_grid(tgt_grid_id))) ERR;
+
+  if ((status = nccf_free_coord(ori_lon_id))) ERR;
+  if ((status = nccf_free_coord(tgt_lon_id))) ERR;
+
+  free(tgt_data_ref);
+
+  return 0;
+}
diff --git a/gridspec_api/regrid/tst_periodic3.c b/gridspec_api/regrid/tst_periodic3.c
new file mode 100644
index 0000000..d63e35d
--- /dev/null
+++ b/gridspec_api/regrid/tst_periodic3.c
@@ -0,0 +1,209 @@
+/**
+ * Test interpolation on a periodic grid with the source grid undoing a 
+ * periodicity jump somewhere in the middle
+ *
+ * $Id: tst_periodic3.c 905 2011-12-29 04:56:48Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+#include "nccf_regrid.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+
+#include <netcdf.h>
+#include <libcf_src.h>
+
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_global.h>
+#include <nccf_data.h>
+#include <nccf_utility_functions.h>
+#include <nccf_handle_error.h>
+
+#include <cf_config.h>
+
+void setValues(int data_id) {
+  int lonid, gridid, status, i, n;
+  double *clon, *data;
+  const double *fillval;
+  nc_type xtype;
+  if ((status = nccf_inq_data_gridid(data_id, &gridid))) ERR;
+  if ((status = nccf_inq_grid_coordids(gridid, &lonid))) ERR;
+  if ((status = nccf_get_coord_data_pointer(lonid, &clon))) ERR;
+  if ((status = nccf_inq_coord_dims(lonid, &n))) ERR;
+  if ((status = nccf_get_data_pointer(data_id, &xtype, (void **)&data, 
+                                      (const void **)&fillval))) ERR;
+  for (i = 0; i < n; ++i) {
+    data[i] = sin(M_PI*clon[i]/180.0);
+  }
+}
+
+void createLon1D(int n, double xmin, int *lon_id, int *grid_id, int *data_id) {
+  const int ndims = 1;
+  const int save = 1;
+  int status;
+  int i;
+  double *clon;
+  double *data;
+  double dx;
+
+  const char *dimnames[] = {"ni"};
+
+  clon = (double *) malloc(n * sizeof(double));
+  data = (double *) malloc(n * sizeof(double));
+
+  dx = 360.0 / ( (double) (n - 1) );
+  for (i = 0; i < n; ++i) {
+    clon[i] = xmin + i * dx;
+    if (clon[i] > 360.0) {
+      clon[i] -= 360.0;
+    }
+    if (clon[i] < 0.0) {
+      clon[i] += 360.0;
+    }
+  }
+
+  if ((status = nccf_def_lon_coord(ndims, &n, dimnames, clon, save, 
+                                   lon_id))) ERR;
+  if ((status = nccf_def_grid(lon_id, "lon_grid", grid_id))) ERR;
+  if ((status = nccf_def_data(*grid_id, "lon_data", 
+                              NULL, NULL, NULL, data_id))) ERR;
+
+  /* Initialize the data */
+  for (i = 0; i < n; ++i) {
+    data[i] = NC_FILL_DOUBLE;
+  }
+  if ((status = nccf_set_data_double(*data_id, data, save,
+					    NC_FILL_DOUBLE))) ERR;
+
+  /* Set the data */
+  setValues(*data_id);
+
+  free(clon);
+  free(data);
+}
+
+//////////////////////////////////////////////////////////////////////
+
+double 
+checkInterp(int dataId1, int dataId2) {
+  int status, k, ndims, ntot, i;
+  double err;
+  int gridId;
+  if ((status = nccf_inq_data_gridid(dataId1, &gridId))) ERR;
+  if ((status = nccf_inq_grid_ndims(gridId, &ndims))) ERR;
+  int coordIds[ndims];
+  if ((status = nccf_inq_grid_coordids(gridId, coordIds))) ERR;
+  int dims[ndims];
+  if ((status = nccf_inq_coord_dims(coordIds[0], dims))) ERR;
+  ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+  
+  /* compare the two sets of data */
+  double *data1;
+  double *data2;
+  nc_type xtype;
+  const void *fill_value;
+  if ((status = nccf_get_data_pointer(dataId1, &xtype, (void **) &data1,
+					     &fill_value))) ERR;
+  if ((status = nccf_get_data_pointer(dataId2, &xtype, (void **) &data2,
+					     &fill_value))) ERR;
+
+  err = 0.0;
+  for (k = 0; k < ntot; ++k) {
+    err += fabs(data1[k] - data2[k]);
+  }
+  err /= ntot;
+
+#ifdef LOGGING
+    printf("Average interpolation error: %lf\n", err);
+#endif /* LOGGING */
+
+  return err;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+int main(){
+
+  int status, i;
+  int ori_lon_id, ori_grid_id, ori_data_id; 
+  int tgt_lon_id, tgt_grid_id, tgt_data_id; 
+  int tgt_data_ref_id;
+  double *tgt_data_ref;
+  const int save = 1;
+
+  /* Create grids */
+  const int ori_n = 5;
+  const int tgt_n = 11;
+
+  // original nodal grid, start at some random value
+  createLon1D(ori_n, 90.0, &ori_lon_id, &ori_grid_id, &ori_data_id);
+
+  // target nodal grid
+  createLon1D(tgt_n, 36.0, &tgt_lon_id, &tgt_grid_id, &tgt_data_id);
+
+  // reference data on target grid
+  if ((status = nccf_def_data(tgt_grid_id, "data", 
+                              NULL, NULL, NULL, &tgt_data_ref_id))) ERR;
+  tgt_data_ref = (double *) malloc(tgt_n * sizeof(double));
+  for (i = 0; i < tgt_n; ++i) {
+    tgt_data_ref[i] = NC_FILL_DOUBLE;
+  }
+  if ((status = nccf_set_data_double(tgt_data_ref_id, 
+                                     tgt_data_ref, save,
+                                     NC_FILL_DOUBLE))) ERR;
+  setValues(tgt_data_ref_id);       
+  
+#ifdef HAVE_LAPACK_LIB
+  /* Create regrid object */
+  int regrid_id;
+  const int nitermax = 10;
+  const double tolpos = 1.e-3;
+  if ((status = nccf_def_regrid(ori_grid_id, tgt_grid_id, 
+                                &regrid_id))) ERR;
+
+  if ((status = nccf_compute_regrid_weights(regrid_id, nitermax, 
+					    tolpos))) ERR;
+
+  /* Interpolate */
+  if ((status = nccf_apply_regrid(regrid_id, ori_data_id,
+                                  tgt_data_id))) ERR;
+
+  /* Check */
+  int nvalid, ntargets;
+  double ratio;
+  if ((status = nccf_inq_regrid_ntargets(regrid_id, &ntargets))) ERR;
+  if ((status = nccf_inq_regrid_nvalid(regrid_id, &nvalid))) ERR;
+  ratio = (double)(nvalid) / (double)(ntargets);
+#ifdef LOGGING
+  printf("ratio of valid to num target points (nodal) = %f\n", ratio);
+#endif /* LOGGING */
+  assert(ratio == 1.0);
+
+  checkInterp(tgt_data_id, tgt_data_ref_id);
+
+  /* Clean up */
+  if ((status = nccf_free_regrid(regrid_id))) ERR;
+#endif
+
+  if ((status = nccf_free_data(ori_data_id))) ERR;
+  if ((status = nccf_free_data(tgt_data_id))) ERR;
+  if ((status = nccf_free_data(tgt_data_ref_id))) ERR;
+    
+  if ((status = nccf_free_grid(ori_grid_id))) ERR;
+  if ((status = nccf_free_grid(tgt_grid_id))) ERR;
+
+  if ((status = nccf_free_coord(ori_lon_id))) ERR;
+  if ((status = nccf_free_coord(tgt_lon_id))) ERR;
+
+  free(tgt_data_ref);
+
+  return 0;
+}
diff --git a/gridspec_api/regrid/tst_put_and_def_from_file.c b/gridspec_api/regrid/tst_put_and_def_from_file.c
new file mode 100644
index 0000000..089e8f4
--- /dev/null
+++ b/gridspec_api/regrid/tst_put_and_def_from_file.c
@@ -0,0 +1,217 @@
+/**
+ * Test interpolation from one lon-lat grid to another
+ *
+ * $Id: tst_put_and_def_from_file.c 881 2011-12-17 21:53:14Z pletzer $
+ *
+ * \author Dave Kindig, Tech-X Corp.
+ */
+
+#include "nccf_regrid.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+
+#include <netcdf.h>
+#include <libcf_src.h>
+
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_data.h>
+#include <nccf_utility_functions.h>
+#include <nccf_handle_error.h>
+
+#include <cf_config.h>
+
+void createLonLat(const double xymin[], const double xymax[], 
+		  const int dims[],
+		  int coordIds[], int *gridId, int *dataId){
+  const int ndims = 2;
+  int nvertex = dims[0]*dims[1];
+  const int save = 1;
+  int status;
+  int i, j, k;
+  double *clon, *clat;
+  double *data;
+  double dxs[ndims];
+
+  const char *dimnames[] = {"nj", "ni"};
+
+  clat = ( double* )malloc( nvertex * sizeof( double ));
+  clon = ( double* )malloc( nvertex * sizeof( double ));
+  data = ( double* )malloc( nvertex * sizeof( double ));
+
+  for (i = 0; i < ndims; ++i) {
+    dxs[i] = (xymax[i] - xymin[i]) / (dims[i] - 1);
+  }
+
+  /* Populate coordinates and create lon/lat coordinate objects */
+  for (j = 0; j < dims[0]; ++j) {
+    for (i = 0; i < dims[1]; ++i) {
+      k = i + dims[1]*j;
+      clat[k] = xymin[0] + j*dxs[0];
+      clon[k] = xymin[1] + i*dxs[1];
+    }
+  }  
+
+  if ((status = nccf_def_lat_coord(ndims, dims, dimnames, clat, save, &coordIds[0]))) ERR;
+  if ((status = nccf_def_lon_coord(ndims, dims, dimnames, clon, save, &coordIds[1]))) ERR;
+  if ((status = nccf_def_grid(coordIds, "tripolar_grid", gridId))) ERR;
+  if ((status = nccf_def_data(*gridId, "data_lonlat", 
+				     NULL, NULL, NULL, dataId))) ERR;
+
+  /* Set the data */
+  for (k = 0; k < nvertex; ++k) {
+    data[k] = cos(M_PI*clon[k]/180.0) * sin(M_PI*clat[k]/180.0);
+  }
+  if ((status = nccf_set_data_double(*dataId, data, save, 
+					    NC_FILL_FLOAT))) ERR;
+
+  free(clat);
+  free(clon);
+  free(data);
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+double 
+checkInterp(int dataId1, int dataId2) {
+  int status, k, ndims, ntot, i;
+  double err;
+  int gridId;
+  if ((status = nccf_inq_data_gridid(dataId1, &gridId))) ERR;
+  if ((status = nccf_inq_grid_ndims(gridId, &ndims))) ERR;
+  int coordIds[ndims];
+  if ((status = nccf_inq_grid_coordids(gridId, coordIds))) ERR;
+  int dims[ndims];
+  if ((status = nccf_inq_coord_dims(coordIds[0], dims))) ERR;
+  ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+  
+  /* compare the two sets of data */
+  double *data1;
+  double *data2;
+  nc_type xtype;
+  const void *fill_value;
+  if ((status = nccf_get_data_pointer(dataId1, &xtype, (void **) &data1,
+					     &fill_value))) ERR;
+  if ((status = nccf_get_data_pointer(dataId2, &xtype, (void **) &data2,
+					     &fill_value))) ERR;
+
+  err = 0.0;
+  for (k = 0; k < ntot; ++k) {
+    err += fabs(data1[k] - data2[k]);
+  }
+  err /= ntot;
+
+#ifdef LOGGING
+    printf("Average interpolation error: %lf\n", err);
+#endif /* LOGGING */
+
+  return err;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+int main(){
+
+  const int ndims = 2;
+  int status;
+  int ori_grid_id, oriDataId, ori_coord_ids[ndims]; 
+  int targetGridId, targetDataId, targetCoordIds[ndims];
+  int targetGridIdRef, targetDataIdRef, targetCoordIdsRef[ndims];
+
+  /* Create grids */
+  const double oriXymin[] = {-90.0, 0.0};
+  const double oriXymax[] = {+90.0, 360.0};
+  const int oriDims[] = {60, 61};
+  const double targetXymin[] = {-89.0, 0.0};
+  const double targetXymax[] = {+89.0, 360.0};
+  const int targetDims[] = {12, 13};
+  int i;
+
+  createLonLat(oriXymin, oriXymax, oriDims, ori_coord_ids, 
+	       &ori_grid_id, &oriDataId);
+  createLonLat(targetXymin, targetXymax, targetDims, targetCoordIdsRef, 
+		   &targetGridIdRef, &targetDataIdRef);
+  createLonLat(targetXymin, targetXymax, targetDims, targetCoordIds, 
+		   &targetGridId, &targetDataId);
+  
+#ifdef HAVE_LAPACK_LIB
+  int ncid;
+  const char* put_filename = "tst_put_and_def_from_file_test.nc";
+  int nnodes, nvalid, ntargets;
+  int nts, nns, rgd_id;
+  /* Create regrid object */
+  int regrid_id;
+  const int nitermax = 100;
+  const double tolpos = 1.e-3;
+  if ((status = nccf_def_regrid(ori_grid_id, targetGridId, &regrid_id))) ERR;
+  if ((status = nccf_compute_regrid_weights(regrid_id, nitermax, 
+					    tolpos))) ERR;
+
+  /* Write the weights, indices and inside_domain vars */
+  if (( status = nc_create( put_filename, NC_CLOBBER, &ncid ))) ERR;
+  if (( status = nccf_put_regrid(regrid_id, ncid)));
+  if (( status = nc_close( ncid ))) ERR; 
+
+  /* Write the data and coordinate files */
+  if ((status = nc_create("tst_lonlat_regrid_target_ref.nc", NC_CLOBBER, &ncid))) ERR;
+  if ((status = nccf_put_grid(targetGridId, ncid))) ERR;
+  if ((status = nccf_put_data(targetDataIdRef, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+
+  /* Interpolate */
+  if ((status = nccf_apply_regrid(regrid_id, oriDataId, targetDataId))) ERR;
+
+  /* Write the data and coordinate files */
+  if ((status = nc_create("tst_lonlat_regrid_target.nc", NC_CLOBBER, &ncid))) ERR;
+  if ((status = nccf_put_grid(targetGridId, ncid))) ERR;
+  if ((status = nccf_put_data(targetDataId, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+
+  /* Check */
+  if ((status = nccf_inq_regrid_ntargets(regrid_id, &ntargets))) ERR;
+  if ((status = nccf_inq_regrid_nvalid(regrid_id, &nvalid))) ERR;
+  if ((status = nccf_inq_regrid_nnodes( regrid_id, &nnodes))) ERR;
+  double ratio = (double)(nvalid) / (double)(ntargets);
+#ifdef LOGGING
+  printf("ratio of valid to num target points = %f\n", ratio);
+  printf( "\n%f\n", ratio );
+#endif /* LOGGING */
+  assert(ratio > 0.995);
+  assert( checkInterp(targetDataId, targetDataIdRef) < 2.e-4 );
+
+  /* Clean up */
+  if ((status = nccf_free_regrid(regrid_id))) ERR;
+#endif
+
+  if ((status = nccf_free_data(oriDataId))) ERR;
+  if ((status = nccf_free_data(targetDataId))) ERR;
+  if ((status = nccf_free_data(targetDataIdRef))) ERR;
+  if ((status = nccf_free_grid(ori_grid_id))) ERR;
+  if ((status = nccf_free_grid(targetGridId))) ERR;
+  if ((status = nccf_free_grid(targetGridIdRef))) ERR;
+  for (i = 0; i < ndims; ++i) {
+    if ((status = nccf_free_coord(ori_coord_ids[i]))) ERR;
+    if ((status = nccf_free_coord(targetCoordIds[i]))) ERR;
+    if ((status = nccf_free_coord(targetCoordIdsRef[i]))) ERR;
+  }
+
+#ifdef HAVE_LAPACK_LIB
+  /* Retrieve the weights etc from file */
+  if (( status = nccf_def_regrid_from_file( put_filename, &rgd_id ))) ERR;
+  if (( status = nccf_inq_regrid_ntargets( rgd_id, &nts ))) ERR;
+  if (( status = nccf_inq_regrid_nnodes( rgd_id, &nns ))) ERR;
+  assert( ntargets == nts );
+  assert( nnodes == nns );
+  if (( status = nccf_free_regrid( rgd_id ))) ERR;
+#endif
+
+
+  return 0;
+}
diff --git a/gridspec_api/regrid/tst_slanted_lonlat_regrid.c b/gridspec_api/regrid/tst_slanted_lonlat_regrid.c
new file mode 100644
index 0000000..5582b3c
--- /dev/null
+++ b/gridspec_api/regrid/tst_slanted_lonlat_regrid.c
@@ -0,0 +1,226 @@
+/**
+ * Interpolation from a slanted lon-lat coordinate system to lon-lat
+ *
+ * $Id: tst_slanted_lonlat_regrid.c 892 2011-12-21 19:48:51Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+#include "nccf_regrid.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+
+#include <netcdf.h>
+#include <libcf_src.h>
+
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_global.h>
+#include <nccf_data.h>
+#include <nccf_utility_functions.h>
+#include <nccf_handle_error.h>
+
+#include <cf_config.h>
+
+/**
+ * Create grid
+ * \param xymin lower set of box coordinates
+ * \param xymax upper set of box coordinates
+ * \param dims dimensions
+ * \param slope a value other than zero will cause the longitudes 
+ *              to slope to the left with increasing latitude
+ * \param coordsId (output) coordinate ids
+ * \param gridId (output) grid id
+ * \param dataId (output) data id
+ */
+void createLonLat(const double xymin[], const double xymax[], 
+		  const int dims[], double slope, 
+		  int coordIds[], int *gridId, int *dataId) {
+  const int ndims = 2;
+  int nvertex = dims[0]*dims[1];
+  const int save = 1;
+  int status;
+  int i, j, k;
+  double *clon, *clat;
+  double *data;
+  double dxs[ndims];
+
+  const char *dimnames[] = {"nj", "ni"};
+
+  clat = (double *) malloc( nvertex * sizeof(double) );
+  clon = (double *) malloc( nvertex * sizeof(double) );
+  data = (double *) malloc( nvertex * sizeof(double) );
+
+  for (i = 0; i < ndims; ++i) {
+    dxs[i] = (xymax[i] - xymin[i]) / (dims[i] - 1);
+  }
+
+  /* Populate coordinates and create lon/lat coordinate objects */
+  for (j = 0; j < dims[0]; ++j) {
+    for (i = 0; i < dims[1]; ++i) {
+      k = i + dims[1]*j;
+      clat[k] = xymin[0] + j*dxs[0];
+      clon[k] = xymin[1] + i*dxs[1] - j*slope;
+    }
+  }  
+
+  if ((status = nccf_def_lat_coord(ndims, dims, dimnames, clat, save, &coordIds[0]))) ERR;
+  if ((status = nccf_def_lon_coord(ndims, dims, dimnames, clon, save, &coordIds[1]))) ERR;
+  if ((status = nccf_def_grid(coordIds, "lonlat_grid", gridId))) ERR;
+  if ((status = nccf_def_data(*gridId, "data_lonlat", 
+				     NULL, NULL, NULL, dataId))) ERR;
+
+  /* Set the data */
+  for (k = 0; k < nvertex; ++k) {
+    data[k] = cos(M_PI*clon[k]/180.0) * sin(M_PI*clat[k]/180.0);
+  }
+  if ((status = nccf_set_data_double(*dataId, data, save,
+					    NC_FILL_DOUBLE))) ERR;
+
+  free(clat);
+  free(clon);
+  free(data);
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+double 
+checkInterp(int dataId1, int dataId2) {
+  int status, k, ndims, ntot, i;
+  double err;
+  int gridId;
+  if ((status = nccf_inq_data_gridid(dataId1, &gridId))) ERR;
+  if ((status = nccf_inq_grid_ndims(gridId, &ndims))) ERR;
+  int coordIds[ndims];
+  if ((status = nccf_inq_grid_coordids(gridId, coordIds))) ERR;
+  int dims[ndims];
+  if ((status = nccf_inq_coord_dims(coordIds[0], dims))) ERR;
+  ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+  
+  /* compare the two sets of data */
+  double *data1;
+  double *data2;
+  nc_type xtype;
+  const void *fill_value;
+  if ((status = nccf_get_data_pointer(dataId1, &xtype, (void **) &data1,
+					     &fill_value))) ERR;
+  if ((status = nccf_get_data_pointer(dataId2, &xtype, (void **) &data2,
+					     &fill_value))) ERR;
+
+  err = 0.0;
+  for (k = 0; k < ntot; ++k) {
+    err += fabs(data1[k] - data2[k]);
+  }
+  err /= ntot;
+
+#ifdef LOGGING
+    printf("average interpolation error: %lf\n", err);
+#endif /* LOGGING */
+
+  return err;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+int main(){
+
+  const double slope = 10.0; // change of lon over one lat cell increase
+  const int ndims = 2;
+  int status;
+  int ori_grid_id, oriDataId, ori_coord_ids[ndims]; 
+  int targetGridId, targetDataId, targetCoordIds[ndims];
+  int targetGridIdRef, targetDataIdRef, targetCoordIdsRef[ndims];
+
+  /* Create grids */
+  const double oriXymin[] = {-90.0, 0.0};
+  const double oriXymax[] = {+90.0, 360.0};
+  const int oriDims[] = {11, 21};
+  const double targetXymin[] = {-89.0, 0.0};
+  const double targetXymax[] = {+89.0, 360.0};
+  const int targetDims[] = {6, 11};
+  int i;
+  char gridname[STRING_SIZE];
+  int globalIdGrid;
+
+  createLonLat(oriXymin, oriXymax, oriDims, slope, ori_coord_ids, 
+	       &ori_grid_id, &oriDataId);
+  // the target grid is a regular lon-lat grid
+  createLonLat(targetXymin, targetXymax, targetDims, 0.0, targetCoordIdsRef, 
+		   &targetGridIdRef, &targetDataIdRef);
+  createLonLat(targetXymin, targetXymax, targetDims, 0.0, targetCoordIds, 
+		   &targetGridId, &targetDataId);
+
+  nccf_def_global( &globalIdGrid );
+  nccf_add_global_att( globalIdGrid, CF_FILETYPE, CF_GLATT_FILETYPE_GRID, 0 );
+  nccf_inq_grid_name( ori_grid_id, gridname );
+  nccf_add_global_att( globalIdGrid, CF_GRIDNAME, gridname, 0 );
+  nccf_add_global_att( globalIdGrid, CF_COORDINATES_ID, "regrid_test_lonlat", 0 );
+  nccf_add_global_att( globalIdGrid, CF_FILETYPE, CF_GLATT_FILETYPE_STATIC_DATA, 1 );
+
+  
+#ifdef HAVE_LAPACK_LIB
+  /* Create regrid object */
+  int regrid_id;
+  const int nitermax = 4;
+  const double tolpos = 1.e-3;
+  if ((status = nccf_def_regrid(ori_grid_id, targetGridId, &regrid_id))) ERR;
+  if ((status = nccf_compute_regrid_weights(regrid_id, nitermax, 
+					    tolpos))) ERR;
+
+  int ncid;
+  /* Write the data and coordinate files */
+  if ((status = nc_create("tst_slanted_lonlat_regrid_target_ref.nc", 
+                          NC_CLOBBER, &ncid))) ERR;
+  if ((status = nccf_put_grid(targetGridId, ncid))) ERR;
+  if ((status = nccf_put_global(globalIdGrid, ncid))) ERR;
+  if ((status = nccf_put_data(targetDataIdRef, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+
+  /* Interpolate */
+  if ((status = nccf_apply_regrid(regrid_id, oriDataId, targetDataId))) ERR;
+
+  /* Write the data and coordinate files */
+  if ((status = nc_create("tst_slanted_lonlat_regrid_target.nc", NC_CLOBBER, &ncid))) ERR;
+  if ((status = nccf_put_grid(targetGridId, ncid))) ERR;
+  if ((status = nccf_put_global(globalIdGrid, ncid))) ERR;
+  if ((status = nccf_put_data(targetDataId, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+
+  /* Check */
+  int nvalid, ntargets;
+  if ((status = nccf_inq_regrid_ntargets(regrid_id, &ntargets))) ERR;
+  if ((status = nccf_inq_regrid_nvalid(regrid_id, &nvalid))) ERR;
+  double ratio = (double)(nvalid) / (double)(ntargets);
+  double error = checkInterp(targetDataId, targetDataIdRef);
+#ifdef LOGGING
+  printf("ratio of valid to num target points = %f\n", ratio);
+#endif /* LOGGING */
+  assert(ratio == 1.0);
+  assert(error < 0.0050);
+
+  /* Clean up */
+  if ((status = nccf_free_regrid(regrid_id))) ERR;
+#endif
+
+  if ((status = nccf_free_global(globalIdGrid))) ERR;
+  if ((status = nccf_free_data(oriDataId))) ERR;
+  if ((status = nccf_free_data(targetDataId))) ERR;
+  if ((status = nccf_free_data(targetDataIdRef))) ERR;
+  if ((status = nccf_free_grid(ori_grid_id))) ERR;
+  if ((status = nccf_free_grid(targetGridId))) ERR;
+  if ((status = nccf_free_grid(targetGridIdRef))) ERR;
+  for (i = 0; i < ndims; ++i) {
+    if ((status = nccf_free_coord(ori_coord_ids[i]))) ERR;
+    if ((status = nccf_free_coord(targetCoordIds[i]))) ERR;
+    if ((status = nccf_free_coord(targetCoordIdsRef[i]))) ERR;
+  }
+
+  return 0;
+}
diff --git a/gridspec_api/regrid/tst_tripolar_to_lonlat_regrid.c b/gridspec_api/regrid/tst_tripolar_to_lonlat_regrid.c
new file mode 100644
index 0000000..bd8a993
--- /dev/null
+++ b/gridspec_api/regrid/tst_tripolar_to_lonlat_regrid.c
@@ -0,0 +1,302 @@
+/**
+ * Test interpolation from a tripolar grid to a lon-lat grid
+ *
+ * $Id: tst_tripolar_to_lonlat_regrid.c 915 2012-01-09 16:58:08Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+#include "nccf_regrid.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+
+#include <netcdf.h>
+#include <libcf_src.h>
+
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_data.h>
+#include <nccf_utility_functions.h>
+#include <nccf_handle_error.h>
+
+#include <cf_config.h>
+
+void
+setDataToPrescribedValues(int nvertex, const double clon[], const double clat[], 
+			  double data[]) {
+  int k;
+  for (k = 0; k < nvertex; ++k) {
+    data[k] = cos(2.0*M_PI*clon[k]/180.0) * sin(7.0*M_PI*clat[k]/180.0);
+  }
+}
+
+//////////////////////////////////////////////////////////////////////
+
+void
+setDataToMinusTwo(int nvertex, const double clon[], const double clat[],
+		  double data[]) {
+  int k;
+  for (k = 0; k < nvertex; ++k) {
+    data[k] = -2.0;
+  }
+}
+
+//////////////////////////////////////////////////////////////////////
+
+void 
+createTriPolar(const int dims[], int capIndex,  
+		     int coordIds[], int *gridId, int *dataId){
+  const int ndims = 2;
+  int nvertex = dims[0]*dims[1];
+  const int save = 1;
+  int status;
+  double *clon, *clat;
+  double *data;
+
+  const char *dimnames[] = {"nj", "ni"};
+
+  clat = ( double* )malloc( nvertex * sizeof( double ));
+  clon = ( double* )malloc( nvertex * sizeof( double ));
+  data = ( double* )malloc( nvertex * sizeof( double ));
+
+  //if ((status = nccf_get_tripolar_grid(dims, capIndex, clon, clat))) ERR;
+  double latPerim = 60.0;
+  if ((status = nccf_get_bipolar_cap(dims, latPerim, -90.0, clon, clat))) ERR;
+
+  if ((status = nccf_def_lat_coord(ndims, dims, dimnames, clat, save, &coordIds[0]))) ERR;
+  if ((status = nccf_def_lon_coord(ndims, dims, dimnames, clon, save, &coordIds[1]))) ERR;
+  if ((status = nccf_def_grid(coordIds, "tripolar_grid", gridId))) ERR;
+  if ((status = nccf_save_grid_scrip(*gridId, "tripolar_grid_scrip.nc"))) ERR;
+  if ((status = nccf_def_data(*gridId, "data", NULL, NULL, NULL, dataId))) ERR;
+
+
+  /* Set the data */
+  setDataToPrescribedValues(nvertex, clon, clat, data);
+  if ((status = nccf_set_data_double(*dataId, data, save, 
+					    NC_FILL_DOUBLE))) ERR;
+
+  free(clat);
+  free(clon);
+  free(data);
+}
+
+//////////////////////////////////////////////////////////////////////
+
+void 
+createLonLat(const double xymin[], const double xymax[], 
+	     const int dims[], 
+	     void (*setDataFunct)(int nv, const double x[], const double y[], double d[]),
+	     int coordIds[], int *gridId, int *dataId){
+
+  const int ndims = 2;
+  int nvertex = dims[0]*dims[1];
+  const int save = 1;
+  int status;
+  int i, j, k;
+  double *clon, *clat;
+  double *data;
+  double dxs[ndims];
+
+  const char *dimnames[] = {"nj", "ni"};
+
+  clat = ( double* )malloc( nvertex * sizeof( double ));
+  clon = ( double* )malloc( nvertex * sizeof( double ));
+  data = ( double* )malloc( nvertex * sizeof( double ));
+
+  for (i = 0; i < ndims; ++i) {
+    dxs[i] = (xymax[i] - xymin[i]) / (dims[i] - 1);
+  }
+
+  /* Populate coordinates and create lon/lat coordinate objects */
+  for (j = 0; j < dims[0]; ++j) {
+    for (i = 0; i < dims[1]; ++i) {
+      k = i + dims[1]*j;
+      clat[k] = xymin[0] + j*dxs[0];
+      clon[k] = xymin[1] + i*dxs[1];
+    }
+  }  
+
+  if ((status = nccf_def_lat_coord(ndims, dims, dimnames, clat, save, 
+                                   &coordIds[0]))) ERR;
+  if ((status = nccf_def_lon_coord(ndims, dims, dimnames, clon, save, 
+                                   &coordIds[1]))) ERR;
+  if ((status = nccf_def_grid(coordIds, "tripolar_grid", gridId))) ERR;
+  if ((status = nccf_save_grid_scrip(*gridId, "lonlat_grid_scrip.nc"))) ERR;
+  if ((status = nccf_def_data(*gridId, "data", NULL, NULL, NULL, dataId))) ERR;
+
+  /* Set the data */
+  setDataFunct(nvertex, clon, clat, data);
+  if ((status = nccf_set_data_double(*dataId, data, save, 
+					    NC_FILL_DOUBLE))) ERR;
+
+  free(clat);
+  free(clon);
+  free(data);
+}
+
+//////////////////////////////////////////////////////////////////////
+
+void 
+writeData(int gridId, int dataId, const char *filename){
+
+  /* write lonlat data and coordinates to file */
+  int ncid, status;
+  if ((status = nc_create(filename, NC_CLOBBER, &ncid))) ERR;
+  if ((status = nccf_put_grid(gridId, ncid))) ERR;
+  if ((status = nccf_put_data(dataId, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+double
+checkInterp(int dataId1, int dataId2) {
+  int status, k, ndims, ntot, i;
+  double err;
+  int gridId;
+  if ((status = nccf_inq_data_gridid(dataId1, &gridId))) ERR;
+  if ((status = nccf_inq_grid_ndims(gridId, &ndims))) ERR;
+  int coordIds[ndims];
+  if ((status = nccf_inq_grid_coordids(gridId, coordIds))) ERR;
+  int dims[ndims];
+  if ((status = nccf_inq_coord_dims(coordIds[0], dims))) ERR;
+  ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+
+  /* compare the two sets of data */
+  double *data1;
+  double *data2;
+  nc_type xtype;
+  const void *fill_value;
+  if ((status = nccf_get_data_pointer(dataId1, &xtype, (void **) &data1,
+					     &fill_value))) ERR;
+  if ((status = nccf_get_data_pointer(dataId2, &xtype, (void **) &data2,
+					     &fill_value))) ERR;
+
+  err = 0.0;
+  for (k = 0; k < ntot; ++k) {
+    err += fabs(data1[k] - data2[k]);
+  }
+  err /= ntot;
+
+  return err;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+int main(){
+
+  int status;
+  const int ndims = 2;
+  int i;
+  
+  int oriDims[] = {257,257}; // {17,17}; //{257, 257};
+  const int capIndex = 60; //oriDims[0] / 2;
+  int ori_coord_ids[ndims], ori_grid_id, oriDataId;
+
+  int tgtDims[] = {31, 91}; //{11, 11}; //{31, 91};
+  int tgt_coord_ids[ndims], tgt_grid_id, tgtDataId;
+  int tgt_coord_ids_ref[ndims], tgt_grid_id_ref, tgtDataIdRef;
+  double xymin[] = {60., -180.0};
+  double xymax[] = {90., +180.0};
+
+  createTriPolar(oriDims, capIndex, ori_coord_ids, &ori_grid_id, &oriDataId);
+  createLonLat(xymin, xymax, tgtDims, setDataToMinusTwo,
+	       tgt_coord_ids, &tgt_grid_id, &tgtDataId);
+  createLonLat(xymin, xymax, tgtDims, setDataToPrescribedValues,
+	       tgt_coord_ids_ref, &tgt_grid_id_ref, &tgtDataIdRef);
+
+  writeData(ori_grid_id, oriDataId, "tst_tripolar_to_lonlat_regrid_ori.nc");
+  writeData(tgt_grid_id_ref, tgtDataIdRef, "tst_tripolar_to_lonlat_regrid_dest.nc");
+
+#ifdef HAVE_LAPACK_LIB
+  /* Create regrid object */
+  int regrid_id;
+  const int nitermax = 20;
+  const double tolpos = 1.e-2;
+  if ((status = nccf_def_regrid(ori_grid_id, tgt_grid_id, &regrid_id))) ERR;
+
+  /* Exclude cut in longitude from searchable domain */
+  const int lo[] = {0, oriDims[1]/2 - 1};
+  const int hi[] = {oriDims[0]/2, oriDims[1]/2};
+  if ((status = nccf_add_regrid_forbidden(regrid_id, lo, hi))) ERR;
+
+  if ((status = nccf_compute_regrid_weights(regrid_id,
+					    nitermax,
+					    tolpos))) ERR;
+
+  /* Interpolate */
+  if ((status = nccf_apply_regrid(regrid_id, oriDataId, tgtDataId))) ERR;
+
+  /* Write regrided data*/
+  writeData(tgt_grid_id, tgtDataId, "tst_tripolar_to_lonlat_regrid_intrp.nc");
+
+  /* Write regrid weights */
+  const char* put_filename = "tst_tripolar_to_lonlat_regrid_weights.nc";
+  int ncid;
+  if (( status = nc_create( put_filename , NC_CLOBBER, &ncid ))) ERR;
+  if (( status = nccf_put_regrid( regrid_id, ncid ))) ERR;
+  if (( status = nc_close( ncid ))) ERR;
+
+  /* Check */
+  int nvalid, ntargets;
+  int tgt_inds[] = {10, 20}, ori_nodes[] = {0, 0, 0, 0};
+  double weights[] = {0.0, 0.0, 0.0, 0.0};
+  float sum = 0;
+
+  if ((status = nccf_inq_regrid_ntargets(regrid_id, &ntargets))) ERR;
+  if ((status = nccf_inq_regrid_nvalid(regrid_id, &nvalid))) ERR;
+  if ((status = nccf_inq_regrid_weights(regrid_id, 
+                                        tgt_inds, ori_nodes, weights))) ERR;
+  int nnodes;
+  if ((status = nccf_inq_regrid_nnodes(regrid_id, &nnodes))) ERR;
+
+  for(i = 0; i < nnodes; i++){ 
+    sum += weights[i];
+  }
+  assert( sum == 1 );
+  double ratio = (double)(nvalid) / (double)(ntargets);
+  double error = checkInterp(tgtDataId, tgtDataIdRef);
+  printf("ratio of valid to num target points = %f  interpolation error: %f\n", 
+	 ratio, error);
+  //assert(ratio > 0.94);
+  //assert( checkInterp(tgtDataId, tgtDataIdRef) < 0.05 );
+
+  // number of nodes on original grid that participate in the interpolation
+  double *allweights;
+  int j;
+  if ((status = nccf_get_regrid_weights_pointer(regrid_id, &allweights))) ERR;
+  for (i = 0; i < ntargets; ++i) {
+    sum = 0;
+    for (j = 0; j < nnodes; ++j) {
+      sum += allweights[j + nnodes*i];
+    }
+    // the sum of the weights == 1, except for cells that are masked
+    assert(fabs(sum - 1.0) < 1.e-6 || fabs(sum) < 1.e-6);
+  }
+
+  /* Clean up */
+  if ((status = nccf_free_regrid(regrid_id))) ERR;
+#endif
+
+  if ((status = nccf_free_data(oriDataId))) ERR;
+  if ((status = nccf_free_data(tgtDataId))) ERR;
+  if ((status = nccf_free_data(tgtDataIdRef))) ERR;
+
+  if ((status = nccf_free_grid(ori_grid_id))) ERR;
+  if ((status = nccf_free_grid(tgt_grid_id))) ERR;
+  if ((status = nccf_free_grid(tgt_grid_id_ref))) ERR;
+
+  for (i = 0; i < ndims; ++i) {
+    if ((status = nccf_free_coord(ori_coord_ids[i]))) ERR;
+    if ((status = nccf_free_coord(tgt_coord_ids[i]))) ERR;
+    if ((status = nccf_free_coord(tgt_coord_ids_ref[i]))) ERR;
+  }
+
+  return 0;
+}
diff --git a/gridspec_api/regrid/tst_tripolar_to_lonlat_regrid_from_weights.c b/gridspec_api/regrid/tst_tripolar_to_lonlat_regrid_from_weights.c
new file mode 100644
index 0000000..cb73086
--- /dev/null
+++ b/gridspec_api/regrid/tst_tripolar_to_lonlat_regrid_from_weights.c
@@ -0,0 +1,266 @@
+/**
+ * Test interpolation from a tripolar grid to a lon-lat grid
+ *
+ * tst_tripolar_to_lonlat_regrid_from_weights.c
+ * Ansley Manke, from tst_tripolar_to_lonlat_regrid.c
+ * Define the data field using a different function than the one used
+ * in tst_tripolar_to_lonlat_regrid. Call nccf_def_regrid_from_file
+ * instead of computing the regridding weights.
+ *
+ * $Id: tst_tripolar_to_lonlat_regrid.c 767 2011-06-06 23:20:19Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+#include "nccf_regrid.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+
+#include <netcdf.h>
+#include <libcf_src.h>
+
+#include <nccf_coord.h>
+#include <nccf_grid.h>
+#include <nccf_data.h>
+#include <nccf_utility_functions.h>
+#include <nccf_handle_error.h>
+
+#include <cf_config.h>
+
+/* Define the values using a different function from that used in tst_tripolar_to_lonlat_regrid.c
+*/
+void
+setDataToPrescribedValues(int nvertex, const double clon[], const double clat[], 
+        double data[]) {
+  int k;
+  for (k = 0; k < nvertex; ++k) {
+    data[k] = sin(3.0*M_PI*clon[k]/180.0) * cos(8.0*M_PI*clat[k]/180.0);
+  }
+}
+
+//////////////////////////////////////////////////////////////////////
+
+void
+setDataToMinusTwo(int nvertex, const double clon[], const double clat[],
+      double data[]) {
+  int k;
+  for (k = 0; k < nvertex; ++k) {
+    data[k] = -2.0;
+  }
+}
+
+//////////////////////////////////////////////////////////////////////
+
+void 
+createTriPolar(const int dims[], int capIndex,  
+         int coordIds[], int *gridId, int *dataId){
+  const int ndims = 2;
+  int nvertex = dims[0]*dims[1];
+  const int save = 1;
+  int status;
+  double *clon, *clat;
+  double *data;
+
+  const char *dimnames[] = {"nj", "ni"};
+
+  clat = ( double* )malloc( nvertex * sizeof( double ));
+  clon = ( double* )malloc( nvertex * sizeof( double ));
+  data = ( double* )malloc( nvertex * sizeof( double ));
+
+  //if ((status = nccf_get_tripolar_grid(dims, capIndex, clon, clat))) ERR;
+  double latPerim = 60.0;
+  if ((status = nccf_get_bipolar_cap(dims, latPerim, -90.0, clon, clat))) ERR;
+
+  if ((status = nccf_def_lat_coord(ndims, dims, dimnames, clat, save, &coordIds[0]))) ERR;
+  if ((status = nccf_def_lon_coord(ndims, dims, dimnames, clon, save, &coordIds[1]))) ERR;
+  if ((status = nccf_def_grid(coordIds, "tripolar_grid", gridId))) ERR;
+  if ((status = nccf_save_grid_scrip(*gridId, "tripolar_grid_scrip.nc"))) ERR;
+  if ((status = nccf_def_data(*gridId, "data", NULL, NULL, NULL, dataId))) ERR;
+
+
+  /* Set the data */
+  setDataToPrescribedValues(nvertex, clon, clat, data);
+  if ((status = nccf_set_data_double(*dataId, data, save, 
+              NC_FILL_DOUBLE))) ERR;
+
+  free(clat);
+  free(clon);
+  free(data);
+}
+
+//////////////////////////////////////////////////////////////////////
+
+void 
+createLonLat(const double xymin[], const double xymax[], 
+       const int dims[], 
+       void (*setDataFunct)(int nv, const double x[], const double y[], double d[]),
+       int coordIds[], int *gridId, int *dataId){
+
+  const int ndims = 2;
+  int nvertex = dims[0]*dims[1];
+  const int save = 1;
+  int status;
+  int i, j, k;
+  double *clon, *clat;
+  double *data;
+  double dxs[ndims];
+
+  const char *dimnames[] = {"nj", "ni"};
+
+  clat = ( double* )malloc( nvertex * sizeof( double ));
+  clon = ( double* )malloc( nvertex * sizeof( double ));
+  data = ( double* )malloc( nvertex * sizeof( double ));
+
+  for (i = 0; i < ndims; ++i) {
+    dxs[i] = (xymax[i] - xymin[i]) / (dims[i] - 1);
+  }
+
+  /* Populate coordinates and create lon/lat coordinate objects */
+  for (j = 0; j < dims[0]; ++j) {
+    for (i = 0; i < dims[1]; ++i) {
+      k = i + dims[1]*j;
+      clat[k] = xymin[0] + j*dxs[0];
+      clon[k] = xymin[1] + i*dxs[1];
+    }
+  }  
+
+  if ((status = nccf_def_lat_coord(ndims, dims, dimnames, clat, save, &coordIds[0]))) ERR;
+  if ((status = nccf_def_lon_coord(ndims, dims, dimnames, clon, save, &coordIds[1]))) ERR;
+  if ((status = nccf_def_grid(coordIds, "lonlat_grid", gridId))) ERR;
+  if ((status = nccf_save_grid_scrip(*gridId, "lonlat_grid_scrip.nc"))) ERR;
+  if ((status = nccf_def_data(*gridId, "data", NULL, NULL, NULL, dataId))) ERR;
+
+  /* Set the data */
+  setDataFunct(nvertex, clon, clat, data);
+  if ((status = nccf_set_data_double(*dataId, data, save, 
+              NC_FILL_DOUBLE))) ERR;
+
+  free(clat);
+  free(clon);
+  free(data);
+}
+
+//////////////////////////////////////////////////////////////////////
+
+void 
+writeData(int gridId, int dataId, const char *filename){
+
+  /* write lonlat data and coordinates to file */
+  int ncid, status;
+  if ((status = nc_create(filename, NC_CLOBBER, &ncid))) ERR;
+  if ((status = nccf_put_grid(gridId, ncid))) ERR;
+  if ((status = nccf_put_data(dataId, ncid))) ERR;
+  if ((status = nc_close(ncid))) ERR;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+double
+checkInterp(int dataId1, int dataId2) {
+  int status, k, ndims, ntot, i;
+  double err;
+  int gridId;
+  if ((status = nccf_inq_data_gridid(dataId1, &gridId))) ERR;
+  if ((status = nccf_inq_grid_ndims(gridId, &ndims))) ERR;
+  int coordIds[ndims];
+  if ((status = nccf_inq_grid_coordids(gridId, coordIds))) ERR;
+  int dims[ndims];
+  if ((status = nccf_inq_coord_dims(coordIds[0], dims))) ERR;
+  ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+
+  /* compare the two sets of data */
+  double *data1;
+  double *data2;
+  nc_type xtype;
+  const double *fill_value;
+  if ((status = nccf_get_data_pointer(dataId1, &xtype, (void **) &data1,
+               (const void**)&fill_value))) ERR;
+  if ((status = nccf_get_data_pointer(dataId2, &xtype, (void **) &data2,
+               (const void**)&fill_value))) ERR;
+
+  err = 0.0;
+  for (k = 0; k < ntot; ++k) {
+    err += fabs(data1[k] - data2[k]);
+  }
+  err /= ntot;
+
+  return err;
+}
+
+//////////////////////////////////////////////////////////////////////
+
+int main(){
+
+  int status;
+  const int ndims = 2;
+  int i;
+  
+  int oriDims[] = {257,257}; // {17,17}; //{257, 257};
+  const int capIndex = 60; //oriDims[0] / 2;
+  int ori_coord_ids[ndims], ori_grid_id, oriDataId;
+
+  int tgtDims[] = {31, 91}; //{11, 11}; //{31, 91};
+  int tgt_coord_ids[ndims], tgt_grid_id, tgtDataId;
+  int tgt_coord_ids_ref[ndims], tgt_grid_id_ref, tgtDataIdRef;
+  double xymin[] = {60., -180.0};
+  double xymax[] = {90., +180.0};
+
+  createTriPolar(oriDims, capIndex, ori_coord_ids, &ori_grid_id, &oriDataId);
+  createLonLat(xymin, xymax, tgtDims, setDataToMinusTwo,
+               tgt_coord_ids, &tgt_grid_id, &tgtDataId);
+  createLonLat(xymin, xymax, tgtDims, setDataToPrescribedValues,
+               tgt_coord_ids_ref, &tgt_grid_id_ref, &tgtDataIdRef);
+
+  writeData(ori_grid_id, oriDataId, "tst_tripolar_to_lonlat_regrid_ori_2.nc");
+  writeData(tgt_grid_id_ref, tgtDataIdRef, "tst_tripolar_to_lonlat_regrid_ref_2.nc");
+
+#ifdef HAVE_LAPACK_LIB
+
+  /* Retrieve the weights etc from file */
+  int regrid_id;
+  if(( status = nccf_def_regrid_from_file( "tst_tripolar_to_lonlat_regrid_weights.nc", 
+                                           &regrid_id ))) ERR;
+
+  /* Interpolate */
+  if ((status = nccf_apply_regrid(regrid_id, oriDataId, tgtDataId))) ERR;
+
+  /* Write regrided data*/
+  writeData(tgt_grid_id, tgtDataId, "curv_to_lonlat_from_saved_weights_intrp.nc");
+
+  /* Check */
+  int nvalid, ntargets;
+  if ((status = nccf_inq_regrid_ntargets(regrid_id, &ntargets))) ERR;
+  if ((status = nccf_inq_regrid_nvalid(regrid_id, &nvalid))) ERR;
+  double ratio = (double)(nvalid) / (double)(ntargets);
+  double error = checkInterp(tgtDataId, tgtDataIdRef);
+  printf("ratio of valid to num target points = %f  interpolation error: %f\n", 
+              ratio, error);
+  assert(ratio > 0.94);
+//  assert( checkInterp(tgtDataId, tgtDataIdRef) < 0.05 );
+
+  /* Clean up */
+  if ((status = nccf_free_regrid(regrid_id))) ERR;
+#endif
+
+  if ((status = nccf_free_data(oriDataId))) ERR;
+  if ((status = nccf_free_data(tgtDataId))) ERR;
+  if ((status = nccf_free_data(tgtDataIdRef))) ERR;
+
+  if ((status = nccf_free_grid(ori_grid_id))) ERR;
+  if ((status = nccf_free_grid(tgt_grid_id))) ERR;
+  if ((status = nccf_free_grid(tgt_grid_id_ref))) ERR;
+
+  for (i = 0; i < ndims; ++i) {
+    if ((status = nccf_free_coord(ori_coord_ids[i]))) ERR;
+    if ((status = nccf_free_coord(tgt_coord_ids[i]))) ERR;
+    if ((status = nccf_free_coord(tgt_coord_ids_ref[i]))) ERR;
+  }
+
+  return 0;
+}
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100644
index 0000000..b151539
--- /dev/null
+++ b/include/Makefile.am
@@ -0,0 +1,19 @@
+## This is a automake file, part of Unidata's libCF package.
+# Copyright 2010, see the COPYRIGHT file for more information.
+# $Id: Makefile.am 662 2011-04-01 16:31:45Z pletzer $
+
+# This automake file generates the Makefile to build the include
+# directory.
+
+include_HEADERS = libcf_src.h \
+cflistitem.h \
+nccf_varObj.h \
+nccf_utility_functions.h \
+nccf_constants.h \
+nccf_handle_error.h \
+nccf_errors.h \
+libcf.h
+
+noinst_HEADERS = cferror.h nc_tests.h
+
+
diff --git a/gridspec/shared/mosaic/Makefile.in b/include/Makefile.in
similarity index 59%
rename from gridspec/shared/mosaic/Makefile.in
rename to include/Makefile.in
index 28b8c8c..2560418 100644
--- a/gridspec/shared/mosaic/Makefile.in
+++ b/include/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,15 +15,11 @@
 
 @SET_MAKE@
 
-# This is an automake file, part of libcf, a NetCDF CF Library
-# package. Libcf is developed by Ed Hartnett at Unidata, copyright
-# 2009; GRIDSPEC code is developed by Zhi Liang, GFDL, copyright 2008.
-# See the COPYRIGHT file for more information.
+# Copyright 2010, see the COPYRIGHT file for more information.
+# $Id: Makefile.am 662 2011-04-01 16:31:45Z pletzer $
 
-# This automake file is in charge of building the gridspec
-# tools/shared convenience library.
-
-# $Id: Makefile.am,v 1.3 2009/09/10 16:30:14 ed Exp $
+# This automake file generates the Makefile to build the include
+# directory.
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
@@ -44,35 +40,9 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
- at USE_NETCDF_DIR_TRUE@am__append_1 = -I at NETCDFDIR@/include
- at USE_NETCDF_DIR_TRUE@am__append_2 = -L at NETCDFDIR@/lib
- at USE_NETCDF_DIR_TRUE@am__append_3 = -lnetcdf
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_4 = ../../../../libsrc4/libnetcdf.la 
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_5 = -I$(top_srcdir)/../libsrc4
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_6 = -L../../../../libsrc4
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_7 = ../../../../libsrc/libnetcdf.la 
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_8 = -I$(top_srcdir)/../libsrc
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_9 = -L../../../../libsrc
- at USE_NETCDF4_TRUE@am__append_10 = -lhdf5_hl -lhdf5 -lz 
- at USE_HDF4_TRUE@am__append_11 = -lmfhdf -ldf -ljpeg
-
-# If the user specified a root for HDF5, use it.
- at USE_HDF5_DIR_TRUE@am__append_12 = -I at HDF5DIR@/include
- at USE_HDF5_DIR_TRUE@am__append_13 = -L at HDF5DIR@/lib
-
-# If the user specified a prefix for the HDF4 library location, use it.
- at USE_HDF4_DIR_TRUE@am__append_14 = -I at HDF4DIR@/include
- at USE_HDF4_DIR_TRUE@am__append_15 = -L at HDF4DIR@/lib
-
-# If the user specified a root location for ZLIB, use it.
- at USE_ZLIB_DIR_TRUE@am__append_16 = -I at ZLIBDIR@/include
- at USE_ZLIB_DIR_TRUE@am__append_17 = -L at ZLIBDIR@/lib
-
-# If the user specified a root location for SZLIB, use it.
- at USE_SZLIB_DIR_TRUE@am__append_18 = -I at SZLIBDIR@/include
- at USE_SZLIB_DIR_TRUE@am__append_19 = -L at SZLIBDIR@/lib
-subdir = gridspec/shared/mosaic
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+subdir = include
+DIST_COMMON = $(include_HEADERS) $(noinst_HEADERS) \
+	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -81,29 +51,35 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
+CONFIG_HEADER = $(top_builddir)/cf_config.h \
+	$(top_builddir)/nfconfig.inc
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libshared_la_LIBADD =
-am_libshared_la_OBJECTS = create_xgrid.lo gradient_c2l.lo interp.lo \
-	mosaic_util.lo read_mosaic.lo
-libshared_la_OBJECTS = $(am_libshared_la_OBJECTS)
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
-SOURCES = $(libshared_la_SOURCES)
-DIST_SOURCES = $(libshared_la_SOURCES)
+SOURCES =
+DIST_SOURCES =
+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__installdirs = "$(DESTDIR)$(includedir)"
+HEADERS = $(include_HEADERS) $(noinst_HEADERS)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -111,7 +87,6 @@ ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
 AR = @AR@
-AS = @AS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -132,15 +107,19 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-F77 = @F77@
 FC = @FC@
 FCFLAGS = @FCFLAGS@
 FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
+FCLIBS = @FCLIBS@
 FGREP = @FGREP@
 GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
+HAVE_DARWIN = @HAVE_DARWIN@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_LAPACK_LIB = @HAVE_LAPACK_LIB@
+HAVE_LAPACK_NO_UNDERSCORE = @HAVE_LAPACK_NO_UNDERSCORE@
+HAVE_LAPACK_UNDERSCORE = @HAVE_LAPACK_UNDERSCORE@
+HAVE_SHARED = @HAVE_SHARED@
+HAVE_UUID = @HAVE_UUID@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -155,8 +134,10 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 MOD_FLAG = @MOD_FLAG@
+NCDUMP = @NCDUMP@
 NCDUMPDIR = @NCDUMPDIR@
 NETCDFDIR = @NETCDFDIR@
 NM = @NM@
@@ -170,23 +151,23 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
 VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
 ac_ct_FC = @ac_ct_FC@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -218,7 +199,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -234,23 +214,19 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-noinst_LTLIBRARIES = libshared.la 
-libshared_la_SOURCES = constant.h create_xgrid.c create_xgrid.h	\
-gradient_c2l.c gradient_c2l.h interp.c interp.h mosaic_util.c	\
-mosaic_util.h read_mosaic.c read_mosaic.h
-
-AM_CPPFLAGS = $(am__append_1) $(am__append_5) $(am__append_8) \
-	$(am__append_12) $(am__append_14) $(am__append_16) \
-	$(am__append_18)
-AM_LDFLAGS = $(am__append_2) $(am__append_6) $(am__append_9) \
-	$(am__append_13) $(am__append_15) $(am__append_17) \
-	$(am__append_19)
-LDADD = -lm $(am__append_3) $(am__append_4) $(am__append_7) \
-	$(am__append_10) $(am__append_11)
+include_HEADERS = libcf_src.h \
+cflistitem.h \
+nccf_varObj.h \
+nccf_utility_functions.h \
+nccf_constants.h \
+nccf_handle_error.h \
+nccf_errors.h \
+libcf.h
+
+noinst_HEADERS = cferror.h nc_tests.h
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -260,9 +236,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gridspec/shared/mosaic/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign gridspec/shared/mosaic/Makefile
+	  $(AUTOMAKE) --foreign include/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -282,58 +258,31 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
-clean-noinstLTLIBRARIES:
-	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
-	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
-	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
-	  test "$$dir" != "$$p" || dir=.; \
-	  echo "rm -f \"$${dir}/so_locations\""; \
-	  rm -f "$${dir}/so_locations"; \
-	done
-libshared.la: $(libshared_la_OBJECTS) $(libshared_la_DEPENDENCIES) 
-	$(LINK)  $(libshared_la_OBJECTS) $(libshared_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
-	-rm -f *.$(OBJEXT)
-
-distclean-compile:
-	-rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/create_xgrid.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gradient_c2l.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/interp.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mosaic_util.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/read_mosaic.Plo at am__quote@
-
-.c.o:
- at am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
- at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
- at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ $<
-
-.c.obj:
- at am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
- at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
- at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
- at am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
- at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
- at am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
-
 mostlyclean-libtool:
 	-rm -f *.lo
 
 clean-libtool:
 	-rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	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|^.*/||'`; \
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(includedir)" && rm -f $$files
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -419,8 +368,11 @@ distdir: $(DISTFILES)
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(LTLIBRARIES)
+all-am: Makefile $(HEADERS)
 installdirs:
+	for dir in "$(DESTDIR)$(includedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
@@ -448,14 +400,11 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
-	mostlyclean-am
+clean-am: clean-generic clean-libtool 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 distclean-tags
 
 dvi: dvi-am
 
@@ -469,7 +418,7 @@ info: info-am
 
 info-am:
 
-install-data-am:
+install-data-am: install-includeHEADERS
 
 install-dvi: install-dvi-am
 
@@ -498,14 +447,12 @@ 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-am: mostlyclean-generic mostlyclean-libtool
 
 pdf: pdf-am
 
@@ -515,22 +462,22 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am:
+uninstall-am: uninstall-includeHEADERS
 
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLTLIBRARIES ctags 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-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 \
-	pdf pdf-am ps ps-am tags uninstall uninstall-am
+	clean-libtool ctags 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-includeHEADERS 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-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am tags uninstall uninstall-am uninstall-includeHEADERS
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/src/cferror.h b/include/cferror.h
similarity index 92%
rename from src/cferror.h
rename to include/cferror.h
index 8cb6af8..3eba867 100644
--- a/src/cferror.h
+++ b/include/cferror.h
@@ -12,7 +12,7 @@
 #ifndef _CFERROR_
 #define _CFERROR_
 
-#include <config.h>
+#include <cf_config.h>
 #include <stdlib.h>
 #include <assert.h>
 
@@ -27,7 +27,8 @@ void cf_log(int severity, const char *fmt, ...);
 /* These definitions will be used unless LOGGING is defined. */
 #define LOG(e)
 #define cf_set_log_level(e)
-#endif
+
+#endif /* LOGGING */
 
 #endif /* _CFERROR_ */
 
diff --git a/include/cflistitem.h b/include/cflistitem.h
new file mode 100644
index 0000000..68ae044
--- /dev/null
+++ b/include/cflistitem.h
@@ -0,0 +1,164 @@
+/**
+ * API for adding, removing, and extracting elements from a linked list
+ * $Id: cflistitem.h 835 2011-09-15 01:00:55Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+#ifndef _CFLISTITEM_H
+#define _CFLISTITEM_H
+
+#define CF_LIST_ITEM_HEAD_ID -1
+
+
+#define _DATATYPE void
+
+struct CFLISTITEM {
+
+  /* a pointer to the head to the linked list 
+     there is at least one element in the list (the head) 
+   */
+  struct CFLISTITEM *first;
+
+  /* a pointer to the next element in the linked list */
+  struct CFLISTITEM *next;
+
+  /* a unique id number for each element */
+  int id;
+
+  /* pointer to the data 
+     USERS MUST #define _DATATYPE BEFORE #include'ing this file
+   */
+  _DATATYPE *data;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Create new list, with a head
+ *
+ * \param lst list object
+ */
+void 
+nccf_li_new(struct CFLISTITEM **lst);
+
+/**
+ * Destroy head of list. Assumes all elements have been removed.
+ *
+ * \param lst list object
+ *
+ * \note Call nccf_li_remove to remove each element in turn.
+ */
+void 
+nccf_li_del(struct CFLISTITEM **lst);
+
+/**
+ * Reset the list to the beginning
+ *
+ * \param lst list object
+ */
+void 
+nccf_li_begin(struct CFLISTITEM **lst);
+
+/** 
+ * Go to the next element (if it is not the last element)
+ *
+ * \param lst list object
+ * \return 0 if it is the last element, otherwise return 1
+ */
+int 
+nccf_li_next(struct CFLISTITEM **lst);
+
+/** 
+ * Get the id of the current element pointer by the linked list
+ *
+ * \param lst list object
+ * \return id
+ */
+int 
+nccf_li_get_id(struct CFLISTITEM **lst);
+
+/**
+ * Add an element to the list
+ * 
+ * \param lst list object
+ * \param data pointer to the data to add
+ * \return new id
+ */
+int
+nccf_li_add(struct CFLISTITEM **lst, const _DATATYPE *data);
+
+
+/**
+ * Find the number of elements in the list - also is the maximum id.
+ * 
+ * \param lst list object
+ * \return nelem - number of elements in list ( maximum id )
+ */
+int
+nccf_li_get_nelem( struct CFLISTITEM **lst );
+
+/**
+ * Insert an element into the list after element with given id.
+ * 
+ * \param lst list object
+ * \param data pointer to the data to add
+ * \param id Id to insert element after. Use id = CF_LIST_ITEM_HEAD_ID to 
+ *           insert at the beginning.
+ * \return new Id of the inserted element. 
+ */
+int
+nccf_li_insert_after(struct CFLISTITEM **lst, const _DATATYPE *data, 
+		     const int id);
+
+/**
+ * Insert an element into a list. The element will be inserted before 
+ * encountering the first list element that is larger than the 
+ * inserted element.
+ * 
+ * \param lst list object
+ * \param data pointer to the data to add
+ * \param comparison User provided, external comparison function, should 
+ *        return:
+ *                       -1 if data < data2  
+ *                        0 if data == data2
+ *                        1 if data > data2
+ * \param ifresult0 Boolean = 0, don't add item,  = 1, Add item to list
+ * \return new Id of the inserted element
+ */
+int
+nccf_li_insert( struct CFLISTITEM **lst, 
+                const _DATATYPE *data,
+                int (*comparison)(const _DATATYPE *data, const _DATATYPE *data2), 
+                int ifresult0 );
+
+/**
+ * Remove element id
+ *
+ * \param lst list object
+ * \param id id of element to remove
+ * \return pointer to the data of the removed element
+ *
+ * \note To destroy the list, remove each element. Then call 
+ *       nccf_li_del to remove the head.
+ */
+_DATATYPE *
+nccf_li_remove(struct CFLISTITEM **lst, int id);
+
+/**
+ * Get data from element with given id, or NULL if no id was found
+ *
+ * \param lst list object
+ * \param id  id of searched element
+ * \return pointer to the data of the element
+ */
+_DATATYPE *
+nccf_li_find(struct CFLISTITEM **lst, int id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CFLISTITEM_H */
diff --git a/include/libcf.h b/include/libcf.h
new file mode 100644
index 0000000..dbb4019
--- /dev/null
+++ b/include/libcf.h
@@ -0,0 +1,23 @@
+/* 
+
+Copyright 2006, University Corporation for Atmospheric Research. See
+COPYRIGHT file for copying and redistribution conditions.
+
+This is the header file for the NetCDF CF Library. 
+
+For more info on the NetCDF CF Library, see:
+http://www.unidata.ucar.edu/software/nccflib/
+
+Ed Hartnett, 8/1/06
+
+$Id: libcf.h 376 2011-01-14 21:09:50Z pletzer $
+*/
+
+#ifndef _NCCFLIB_
+#define _NCCFLIB_
+
+#include <libcf_src.h>
+#include <libcf_gridspec.h>
+
+
+#endif /* _NCCFLIB_ */
diff --git a/src/libcf.h b/include/libcf_src.h
similarity index 74%
rename from src/libcf.h
rename to include/libcf_src.h
index a84713b..53d2b3e 100644
--- a/src/libcf.h
+++ b/include/libcf_src.h
@@ -10,11 +10,11 @@ http://www.unidata.ucar.edu/software/nccflib/
 
 Ed Hartnett, 8/1/06
 
-$Id: libcf.h,v 1.5 2009/10/29 11:51:21 ed Exp $
+$Id: libcf.h,v 1.16 2010/05/06 14:10:57 ed Exp $
 */
 
-#ifndef _NCCFLIB_
-#define _NCCFLIB_
+#ifndef _NCCFLIB_SRC_
+#define _NCCFLIB_SRC_
 
 #include <stdlib.h>
 #include <netcdf.h>
@@ -45,6 +45,9 @@ $Id: libcf.h,v 1.5 2009/10/29 11:51:21 ed Exp $
 #define CF_POSITIVE "positive"
 #define CF_MAX_LEN 40
 
+/* This is for the gridspec code. */
+#define CF_MAX_GS_STRING        255
+
 /* Some maximums for the "formula_terms" attribute used with
  * dimensionless vertical coordinates. There are (currently) at most 7
  * var names in a formula_terms attribute, and each may be NC_MAX_NAME
@@ -223,12 +226,12 @@ extern "C" {
 		    int *ncoord_vars, int *coord_varids);
 
    /* Set attributes to define missing data information. */
-   int nccf_def_var_missing(int ncid, int varid, const void *fill_value,
-			    const void *valid_min, const void *valid_max);
+   int nccf_def_var_missing(int ncid, int varid, const void *fill_valuep,
+			    const void *valid_minp, const void *valid_maxp);
 
    /* Get attributes which define missing data information. */
-   int nccf_inq_var_missing(int ncid, int varid, void *fill_value,
-			    void *valid_min, void *valid_max);
+   int nccf_inq_var_missing(int ncid, int varid, void *fill_valuep,
+			    void *valid_minp, void *valid_maxp);
 
    /* Add any or all of these four attributes to a file or variable. */
    int nccf_def_notes(int ncid, int varid, const char *institution,
@@ -442,6 +445,133 @@ extern "C" {
    int nccf_get_vara(int ncid, int varid, float *lat_range, int *nlat, float *lon_range,
 		     int *nlon, int lvl_index, int timestep, void *data);
 
+   /* The GRIDSPEC API is based on code by Zhi Liang at GFDL. The
+    * nccf_make functions write the grid to a file. The nccf_create
+    * functions just calculate the necessary arrays without writing to
+    * a file. */
+   int nccf_make_regular_latlon_hgrid(int nxbnds, int nybnds, double *xbnds, 
+				      double *ybnds, int *nlon, int *nlat,
+				      int *ndivx, int *ndivy, char *gridname, 
+				      char *center, char *history);
+
+   int nccf_make_tripolar_hgrid(int nxbnds, int nybnds, double *xbnds, 
+				double *ybnds, int *nlon, int *nlat, double lat_join,
+				int *ndivx, int *ndivy, char *gridname, 
+				char *center, char *history);
+
+   int nccf_make_spectral_hgrid(int nxbnds, int nybnds, int *nlon, int *nlat, 
+				int *ndivx, int *ndivy, char *gridname, char *history );
+
+   int nccf_make_simple_cartesian_hgrid(int nxbnds, int nybnds, double *xbnds, double *ybnds,
+					int *nlon, int *nlat, double simple_dx, double simple_dy,
+					int *ndivx, int *ndivy, char *gridname, char *history );
+
+   int nccf_make_conformal_cubic_hgrid(int nxbnds, int *nlon, int nratio, int *ndivx, 
+				       int *ndivy, char *gridname, char *history);
+
+   int nccf_make_gnomonic_cubic_hgrid(int nxbnds, int *nlon, int *ndivx, int *ndivy, 
+				      char *gridname, char *history);
+
+   int nccf_make_hgrid_from_file(int ngrid_file, int *nlon, int *nlat, char my_grid_file[][CF_MAX_GS_STRING],
+				 int *ndivx, int *ndivy, char *gridname, char *history);
+
+
+   int nccf_make_mosaic(char *history, int ntile, char *mosaic_name, int nmosaic, 
+			char mosaicfile[][CF_MAX_GS_STRING], char *grid_descriptor, int n_tilefile, 
+			char tilefile[][CF_MAX_GS_STRING], double periodx, double periody,
+			int  generate_contact, char *dir);
+
+   int nccf_make_coupler_mosaic(char *history, char *amosaic, char *lmosaic, 
+			      char *omosaic, char *imosaic, char *itopog, int interp_order, 
+			      double sea_level, char *mosaic_name, int check);
+
+   int nccf_make_topog(char *history, char *mosaic_file, char *topog_type, 
+		       int x_refine, int y_refine, double basin_depth, 
+		       char *topog_file, char *topog_field, double bottom_depth, 
+		       double min_depth, double scale_factor, int num_filter_pass, 
+		       double gauss_amp, double gauss_scale, double slope_x,
+		       double slope_y, double bowl_south, double bowl_north, 
+		       double bowl_west, double bowl_east, int fill_first_row, 
+		       int filter_topog, int round_shallow, int fill_shallow, 
+		       int deepen_shallow, int smooth_topo_allow_deepening, 
+		       char *topog_mosaic);
+
+   int nccf_fregrid(char *history, char *mosaic_in, char *mosaic_out, char *dir_in, 
+		  char *dir_out, char input_file[][CF_MAX_GS_STRING], int nfiles, char output_file[][CF_MAX_GS_STRING], 
+		  int nfiles_out, char *remap_file, char scalar_name[][CF_MAX_GS_STRING], int nscalar,
+		  char u_name[][CF_MAX_GS_STRING], int nvector, char v_name[][CF_MAX_GS_STRING], int nvector2, 
+		  char *interp_method, char *test_case, double test_param, 
+		  unsigned int opcode, int grid_type, unsigned int finer_step,
+		  int fill_missing, int nlon, int nlat, int check_conserve, 
+		  int y_at_center, double lonbegin, double lonend, double latbegin,
+		  double latend, int kbegin, int kend, int lbegin, int lend);
+   
+   int nccf_make_vgrid(char *history, int nbnds, double *bnds, int n1, 
+		       int n2, int *nz, char *gridname, char *center);
+
+   int nccf_create_regular_lonlat_grid( int *nxbnds, int *nybnds, double *xbnds, double *ybnds,
+					int *nlon, int *nlat, int *isc, int *iec,
+					int *jsc, int *jec, double *x, double *y, double *dx,
+					double *dy, double *area, double *angle_dx, const char *center );
+
+   int nccf_create_simple_cartesian_grid( double *xbnds, double *ybnds, int *nlon, int *nlat,
+					  double *simple_dx, double *simple_dy, int *isc, int *iec,
+					  int *jsc, int *jec, double *x, double *y,
+					  double *dx, double *dy, double *area, double *angle_dx);
+
+   int nccf_create_grid_from_file( char *file, int *nlon, int *nlat, double *x, double *y, double *dx, double *dy,
+				   double *area, double *angle_dx );
+
+   int nccf_create_spectral_grid( int *nlon, int *nlat, int *isc, int *iec,
+				  int *jsc, int *jec, double *x, double *y, double *dx,
+				  double *dy, double *area, double *angle_dx );
+
+   int nccf_create_tripolar_grid( int *nxbnds, int *nybnds, double *xbnds, double *ybnds,
+				  int *nlon, int *nlat, double *lat_join_in, int *isc, int *iec,
+				  int *jsc, int *jec, double *x, double *y, double *dx, double *dy,
+				  double *area, double *angle_dx, const char *center  );
+
+   int nccf_create_conformal_cubic_grid( int *npts, int *nratio, char *orientation, double *x,
+					 double *y, double *dx, double *dy, double *area, double *angle_dx,
+					 double *angle_dy );
+
+   int nccf_create_gnomonic_cubic_grid( char* grid_type, int *npts, double *x, double *y,
+					double *dx, double *dy, double *area, double *angle_dx,
+					double *angle_dy );
+
+   /* There is a gs_ function eqivelent for each of the gridspec
+    * tools. In this way a tool can be called programmatically. */
+   int gs_make_hgrid(char *grid_type, int *nlat, int *nlon, 
+		     int nxbnds0, int nybnds0, int nxbnds1, int nybnds1, 
+		     int nxbnds2, int nybnds2, double lat_join, int nratio, 
+		     double simple_dx, double simple_dy, int ntilex, int *ndivx,
+		     int ntiley, int *ndivy,
+		     char *gridname, char *center, char *history, double *xbnds, 
+		     double *ybnds);
+
+   /* The GRIDSPEC Princeton API. */
+   int nccf_def_regular_latlon_grid(int nxbnds, int nybnds, const double *xbnds, const double *ybnds, 
+				    const int *nlon, const int *nlat, const char *gridname, const char *center, 
+				    const char *history, int *gridid);
+   int nccf_def_tripolar_grid(int nybnds, const double *xbnds, const double *ybnds, 
+			      const int *nlon, const int *nlat, double lat_join, 
+			      const char *gridname, const char *center, const char *history, 
+			      int *gridid);
+   int nccf_def_cartesian_grid(const double *xbnds, const double *ybnds, int nlon, 
+			       int nlat, double simple_dx, double simple_dy, 
+			       const char *gridname, const char *history, int *gridid);
+   int nccf_def_spectral_grid(int nlon, int nlat, const char *gridname, 
+			      const char *history, int *gridid);
+   int nccf_def_conformal_cubic_grid(int nlon, int nratio, const char *gridname, 
+				     const char *history, int *gridid);
+   int nccf_def_gnomonic_cubic_grid(int nlon, const char *gridname, const char *history, 
+				    int *gridid);
+
+   int nccf_close_grid(int gridid);
+
+   int nccf_put_grid(int ncid, int gridid);
+
+
    /* Calandar and time. */
 /* #define cdStandardCal   0x11 */
 /* #define cdClimCal        0x0 */
@@ -492,8 +622,12 @@ extern "C" {
 /*    void cdRel2Comp(cdCalenType timetype, char* relunits, double reltime, cdCompTime* comptime); */
 /*    void cdRel2Rel(cdCalenType timetype, char* inunits, double intime, char* newunits, double* outtime); */
 
+   int nccf_set_log_level(int new_level);
+   int nccf_set_gs_log_level(int new_level);
+
+   
 #if defined(__cplusplus)
 }
 #endif
 
-#endif /* NCCFLIB */
+#endif /* _NCCFLIB_SRC_ */
diff --git a/src/nc_tests.h b/include/nc_tests.h
similarity index 98%
rename from src/nc_tests.h
rename to include/nc_tests.h
index 1015c1b..09cb916 100644
--- a/src/nc_tests.h
+++ b/include/nc_tests.h
@@ -13,7 +13,7 @@ $Id: nc_tests.h,v 1.2 2009/09/08 17:14:53 ed Exp $
 #ifndef _NC_TESTS_
 #define _NC_TESTS_
 
-#include <config.h>
+#include <cf_config.h>
 #include <assert.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/include/nccf_constants.h b/include/nccf_constants.h
new file mode 100644
index 0000000..cf597ca
--- /dev/null
+++ b/include/nccf_constants.h
@@ -0,0 +1,90 @@
+/**
+ * Gobals attributes for all files
+ * $Id: nccf_constants.h 917 2012-01-27 03:53:01Z pletzer $
+ */
+
+#include <math.h> /* for HUGE_VAL */
+#include <netcdf.h>
+#ifdef HAVE_UUID_H
+#include <uuid/uuid.h>
+#endif
+
+
+#ifndef _NCCF_GLOBAL_ATTRS
+#define _NCCF_GLOBAL_ATTRS
+
+/* Some numbers */
+#define CF_HUGE_INT                  2147483647
+#define CF_HUGE_FLOAT                3.402823466e+38f
+#define CF_HUGE_DOUBLE               HUGE_VAL
+
+/* HOST FILE DEFINES */
+#define CF_GS_HOST_MOSAIC_FILENAME   "gridspec_mosaic_filename"
+//#define CF_GS_HOST_TILE_NAMES        "gridspec_tile_names"
+#define CF_GS_HOST_TILE_FILENAMES    "gridspec_tile_filenames"
+#define CF_GS_HOST_STATDATA_FILENAME "gridspec_static_data_filenames"
+#define CF_GS_HOST_TIMEDATA_FILENAME "gridspec_time_data_filenames"
+#define CF_GLATT_FILETYPE_HOST       "gridspec_host_file"
+
+/* MOSAIC FILE DEFINES */
+#define CF_GS_MOSAIC_CONTACT_MAP     "gridspec_contact_map"
+#define CF_GS_MOSAIC_COORDINATE_NAME "gridspec_coord_names"
+#define CF_GS_MOSAIC_TILE_NAMES      "gridspec_tile_names"
+#define CF_GS_MOSAIC_TILE_CONTACTS   "gridspec_tile_contacts"
+#define CF_GLATT_FILETYPE_MOSAIC     "gridspec_mosaic_file"
+#define CF_CONTACT_FORMAT            "gridspec_slice_format"
+#define CF_INDEX_SEPARATOR           " "
+#define CF_TILE_SEPARATOR            " | "
+#define CF_RANGE_SEPARATOR           ":"
+
+/* GRID FILE DEFINES */
+#define CF_GLATT_FILETYPE_GRID       "gridspec_tile_file"
+
+/* STATIC DATA FILE DEFINES */
+#define CF_GLATT_FILETYPE_STATIC_DATA "gridspec_static_data_file"
+
+/* TIME DATA FILE DEFINES */
+#define CF_GLATT_FILETYPE_TIME_DATA "gridspec_time_data_file"
+
+/* Our choice for Convenience NETCDF DIMENSION names */
+#define CF_DIMNAME_STRING        "nstring"
+#define CF_DIMNAME_MOSAIC        "ncontact"
+#define CF_DIMNAME_NDIMS         "ndims"
+#define CF_DIMNAME_NTIMEDATA     "ntimedata"
+#define CF_DIMNAME_NSTATDATA     "nstatdata"
+#define CF_DIMNAME_NGRIDS        "ngrid"
+#define CF_DIMNAME_NCONTACTS     "ncontacts"
+#define CF_DIMNAME_NTARGETS      "ntargets"
+#define CF_DIMNAME_NNODES        "nnodes"
+#define CF_DIMNAME_NTIMES        "ntimes"
+
+/* NETCDF VARIABLE ATTRIBUTE NAMES */
+#define CF_ATTNAME_CF_TYPE_NAME  "gridspec_type_name"
+#define CF_ATTNAME_STANDARD_NAME "standard_name"
+#define CF_ATTNAME_LONG_NAME     "long_name"
+#define CF_ATTNAME_UNITS         "units"
+#define CF_ATTNAME_BOUNDS        "bounds"
+#define CF_ATTNAME_AXIS          "axis"
+#define CF_ATTNAME_POSITIVE      "positive"
+
+/* GLOBAL ATTRIBUTE NAMES */
+#define CF_GLOBAL                ""  // Must be empty
+#define CF_NA                    "N/A"
+#define CF_COORDINATES_ID        "gridspec_coordinates_id"
+#define CF_DATA_ID               "gridspec_data_id"
+#define CF_FILETYPE              "gridspec_file_type"
+#define CF_GRIDNAME              "gridspec_tile_name"
+#define CF_ORIGINALFILENAME      "originalfilename"
+#define CF_GLOBAL_TITLE          "Title"
+#define CF_GLOBAL_IDENTIFIER     "Identifier"
+#define CF_GLOBAL_INSTITUTION    "Institution"
+#define CF_GLOBAL_MODEL          "Model"
+#define CF_GLOBAL_RUN            "Run"
+
+#define CF_FILENAME_GRID         "_grid"
+#define CF_FILENAME_CONTACTS     "_contacts"
+#define CF_FILENAME_MOSAIC       "_mosaic"
+
+#define STRING_SIZE NC_MAX_NAME
+
+#endif /* _NCCF_GLOBAL_ATTRS */
diff --git a/include/nccf_errors.h b/include/nccf_errors.h
new file mode 100644
index 0000000..3a489f9
--- /dev/null
+++ b/include/nccf_errors.h
@@ -0,0 +1,54 @@
+/* $Id: nccf_errors.h 821 2011-09-13 02:07:59Z pletzer $ */
+#include <netcdf.h>
+
+#ifndef _NCCF_ERRORS_
+#define _NCCF_ERRORS_
+
+#define NCCF_ENOAXISID (-1000) /* Not a valid axis id */
+#define NCCF_ENOCOORDID (-1001) /* Not a valid coord id */
+#define NCCF_ENOGRIDID (-1002) /* Not a valid grid iad */
+#define NCCF_ENODATAID (-1003) /* Not a valid data id */
+#define NCCF_ENOREGRIDID (-1004) /* Not a valid regrid id */
+#define NCCF_ENOMOSAICID (-1005) /* Not a valid mosaic id */
+#define NCCF_ENOHOSTID (-1006) /* Not a valid host id */
+
+#define NCCF_VAROBJCREATE (-1007) /* Error when creating a var obj */
+#define NCCF_VAROBJCREATEFROMFILE (-1008) /* Error when creating a var obj from file */
+#define NCCF_VAROBJDESTROY (-1009) /* Error when destroying var obj */
+#define NCCF_VAROBJSETATTRIB (-1010) /* Error when setting an attribute in var obj */
+#define NCCF_VAROBJGETATTRIBPTR (-1011) /* Error when getting an attribute from var obj */
+#define NCCF_VAROBJSETDIMS (-1012) /* Error when setting dims in var obj */
+#define NCCF_VAROBJGETDIMNAMEPTR (-1013) /* Error when getting dims name pointer in var obj */
+#define NCCF_VAROBJSETDATAPTR (-1014) /* Error when setting data pointer in var obj */
+#define NCCF_VAROBJSETDATA (-1015) /* Error when setting data in var obj */
+#define NCCF_VAROBJGETVARNAMEPTR (-1016) /* Error when getting var name pointer in var obj */
+#define NCCF_VAROBJGETDATATYPE (-1017) /* Error when getting data type in var obj */
+#define NCCF_VAROBJGETDATAPTR (-1018) /* Error when getting data pointer in var obj */
+#define NCCF_VAROBJGETNUMDIMS (-1019) /* Error when getting num dims in var obj */
+#define NCCF_VAROBJGETATTRIBLIST (-1020) /* Error when getting attrib list in var obj */
+#define NCCF_VAROBJSETVARNAME (-1021) /* Error when setting var name in var obj */
+#define NCCF_VAROBJWRITELISTOFVARS (-1022) /* Error occurred when writing var objs */
+
+#define NCCF_EINDEXOUTOFRANGE (-1030) /* Error index out of range */
+#define NCCF_EPARSERANGES (-1031) /* Error parsing string ranges/slices */
+
+#define NCCF_ENOTHOSTFILE (-1040) /* Error the file given is not a host file */
+#define NCCF_EPUTCOORD (-1041) /* Error occurred when writing coordinate object to file */
+#define NCCF_EPUTGRID (-1042) /* Error occurred when writing grid object to file */
+#define NCCF_EPUTDATA (-1043) /* Error occurred when writing data object to file */
+#define NCCF_EPUTREGRID (-1044) /* Error occurred when writing regrid object to file */
+#define NCCF_EPUTMOSAIC (-1045) /* Error occurred when writing mosaic object to file */
+#define NCCF_EPUTHOST (-1046) /* Error occurred when writing host object to file */
+
+#define NCCF_ENODATA (-1050) /* Error no data were set in data object */
+#define NCCF_EVERTMISMATCH (-1051) /* Vertices mismatch in polytope viewer */
+#define NCCF_ENGRIDMISMATCH (-1052) /* ngrid from grid don't match ngrid from data */
+#define NCCF_EATTEXISTS (-1053) /* Attribute exists */
+#define NCCF_EBADGRIDINDEX (-1054) /* Bad grid/tile index */
+#define NCCF_EBADVAR (-1055) /* Bad variable name */
+#define NCCF_ENDIMS (-1056) /* Number of dimensions should be > 0 */
+
+#define NCCF_LISTITEMEXISTS ( -1060 ) /* Warning Inserting existing item into a list */
+
+
+#endif /* _NCCF_ERRORS_ */
diff --git a/include/nccf_handle_error.h b/include/nccf_handle_error.h
new file mode 100644
index 0000000..013e390
--- /dev/null
+++ b/include/nccf_handle_error.h
@@ -0,0 +1,20 @@
+/*
+ * "$Id: nccf_handle_error.h 373 2011-01-14 19:53:49Z pletzer $"
+ */
+
+#ifndef _NCCF_HANDLE_ERROR_H
+#define _NCCF_HANDLE_ERROR_H
+
+#define ERR nccf_handle_error(__FILE__,__LINE__,status)
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+void nccf_handle_error(const char *filename, int linenumber, int status);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _NCCF_HANDLE_ERROR_H */
diff --git a/include/nccf_utility_functions.h b/include/nccf_utility_functions.h
new file mode 100644
index 0000000..c316e9a
--- /dev/null
+++ b/include/nccf_utility_functions.h
@@ -0,0 +1,483 @@
+/**
+ * Utility functions
+ * $Id: nccf_utility_functions.h 915 2012-01-09 16:58:08Z pletzer $
+ */
+
+#ifndef _NCCF_GLOBAL_FUNCTIONS
+#define _NCCF_GLOBAL_FUNCTIONS
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*! \defgroup gs_tools_grp Tools
+    \ingroup gridspec_grp
+
+Convenience functions for generating coordinate data for
+cubed-sphere and tripolar grids, for obtaining index ranges 
+for given tile boundaries, mapping sets of 
+indices to a single ``big'' index, generating a unique 
+coordinate system Ids, and for interpolating.
+
+@{*/
+
+/** 
+ * Convert an index (0... 3^ndims - 1) to a corner index vector in ndims
+ * whose elements are -1, 0, or 1. -1 refers to the lower side and +1 to
+ * the upper side while 0 is the interior. 
+ *
+ * \param index (input) from loop over 3^ndims 
+ * \param ndims number of dimensions
+ * \param vector (output) array of ndims elements containing 0, 1, or -1, all elements are zero except one
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_index_to_corner_vector(int index, int ndims, int vector[]);
+
+/** 
+ * Convert an index (0... 2^ndims - 1) to an index vector in ndims
+ *
+ * \param index input from loop over 2^ndims 
+ * \param ndims number of dimensions
+ * \param vector (output) array of ndims elements containing 0, 1, or -1, 
+ *                all elements are zero except one
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig, Tech-X Corp.
+ */
+int nccf_index2vector( int index, int ndims, int vector[] );
+
+/**
+ * Compute the flat array index of a multi-dim index set.
+ *
+ * \param ndims number of elements of index set
+ * \param dims dimensions of each axis
+ * \param inx index array
+ * \return flat array index
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_get_flat_index(int ndims, const int dims[], const int inx[]);
+
+/**
+ * Compute the multi-index set from a flat array index.
+ *
+ * \param ndims number of elements of index set
+ * \param dims dimensions of each axis
+ * \param index flat index
+ * \param inx (output) index array
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+void nccf_get_multi_index(int ndims, const int dims[], int index, int inx[]);
+
+/**
+ * Compute the start and end indices of a grid boundary.
+ *
+ * \param ndims number of elements of index set
+ * \param dims dimensions of each axis
+ * \param normalVect vector of -1, 0, and 1 identifying the boundary
+ * \param exclusive set to 1 if endIndices are exclusive (1 past last), 0 otherwise
+ * \param startIndices (output) index vector of start position
+ * \param endIndices (output) index vector of end position
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+void nccf_get_start_end_bound_indices(int ndims, const int dims[], 
+				      const int normalVect[],
+				      int exclusive,
+				      int startIndices[],
+				      int endIndices[]);
+/**
+ * Compute the longitudes and latitudes of a cubed sphere grid.
+ *
+ * \param dims the 2 dimensions of each axis
+ * \param faceVect 3-element vector perpendicular to the face
+ * \param lon (output) longitudes in deg (memory managed by user)
+ * \param lat (output) latitudes  in deg (memory managed by user)
+ * \return NC_NOERR on success
+ *
+ * \author Matthew Wrobel, Alexander Pletzer, and David Kindig, Tech-X Corp.
+ */
+int nccf_get_cubedsphere_grid(const int dims[], const int faceVect[], 
+			      double lon[], double lat[]);
+
+/**
+ * Compute the longitudes and latitudes of the cap portion of a tripolar grid.
+ *
+ * \param dims the # points on each axis
+ * \param latPerim the latitude at which the north cap region begins
+ * \param lonSing the longitude of one of the two poles, the other +-180 deg away
+ * \param lon (output) longitudes in deg (memory managed by user)
+ * \param lat (output) latitudes  in deg (memory managed by user)
+ * \return NC_NOERR on success
+ *
+ * \author Matthew Wrobel and Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_get_bipolar_cap(const int dims[], 
+			 double latPerim, double lonSing, 
+			 double lon[], double lat[]);
+
+/**
+ * Compute the longitudes and latitudes of entire tripolar grid.
+ *
+ * \param dims the # points on each axis
+ * \param capIndx the index at which the north cap region begins
+ * \param lon (output) longitudes in deg (memory managed by user)
+ * \param lat (output) latitudes  in deg (memory managed by user)
+ * \return NC_NOERR on success
+ *
+ * \author Matthew Wrobel, Tech-X Corp.
+ */
+ int nccf_get_tripolar_grid(const int dims[], int capIndx,
+    double lon[], double lat[]);
+
+/**
+ * Compute the longitudes and latitudes of the east and west halves of entire tripolar grid.
+ *
+ * \param wchHalf which half, 0 is [-180,0] and 1 is [0,180]
+ * \param dims the # points on each axis
+ * \param capIndx the index at which the north cap region begins
+ * \param lon (output) longitudes in deg (memory managed by user)
+ * \param lat (output) latitudes  in deg (memory managed by user)
+ * \return NC_NOERR on success
+ *
+ * \author Matthew Wrobel, Tech-X Corp.
+ */
+int nccf_get_tripolar_halfgrid(const int dims[], int wchHalf, int capIndx,
+    double lon[], double lat[]);
+
+/**
+ * Write multi-dimensional array of strings by blocks of size dims[ndims - 1].
+ *
+ * \param ncid netcdf file id
+ * \param varId variable id
+ * \param ndims number of dimensions
+ * \param dims sizes for each dimension
+ * \param string multi-dim string array to write
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer and David Kindig, Tech-X Corp.
+ */
+int nccf_put_var_slice_text(int ncid, int varId, int ndims, const int *dims, 
+			const char *string);
+
+/**
+ * Create an pseudo-random alpha-numeric id.
+ *
+ * \param seed_adj a user given value to adjust the seed somewhat. This works only if include/uuid/uuid.h does not exist.
+ * \param id (output) a pseudo-random 32 digit string in uuid format (need to allocate for 36 characters at minimum)
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig, Tech-X Corp.
+ */
+int nccf_generate_id(int seed_adj, char *id);
+
+/**
+ * Add the id from nccf_generate_id to a list of files.
+ *
+ * \param id id generated by nccf_generate_id
+ * \param nfiles number of files
+ * \param tile_names char array of tile_names 
+ * \param file_types char array of file_types
+ * \param list_o_files Char array of filenames
+ * \return NC_NOERR on success
+ *
+ * \author David Kindig, Tech-X Corp.
+ */
+int nccf_add_id_to_files(const char *id, int nfiles, const char **tile_names, 
+                         const char **file_types, const char **list_o_files);
+
+/**
+ * Compute the next adjacent index to a given index.
+ * \param ndims number of elements of index set
+ * \param dims dimensions of each axis
+ * \param index flat index 
+ * 
+ * \return 1 if the adjacent index is inside the domain, 0 otherwise
+ * \note the return flag can be used to terminate a while loop.
+ */
+
+int nccf_find_next_adjacent(int ndims, const int dims[], int index[]);
+
+/**
+ * Find next index position iterate. No checks are performed to 
+ * ensure that the returned index position is within the domain. 
+ *
+ * \param ndims number of space dimensions
+ * \param dims dimensions along each axis
+ * \param coordData list of grid vertex arrays, dimensioned [ndims][dims[0]*dims[1]...]
+ * \param coord_periodicity periodicity length in coordinate space, for each axis
+ * \param targetPos target position, dimension [ndims]
+ * \param dIndices_in initial guess for position in index space on input. Array of size [ndims].
+ * \param dIndices_out output index position. Array of size [ndims].
+ * \param position_out output position. Array of size [ndims].
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+  int nccf_find_next_indices_double(int ndims, const int dims[], 
+				    const double **coordData,
+                                    const double coord_periodicity[],
+				    const double targetPos[], 
+				    const double dIndices_in[], 
+				    double dIndices_out[],
+				    double position_out[]);
+  int nccf_find_next_indices_float(int ndims, const int dims[], 
+				   const float **coordData, 
+                                   const float coord_periodicity[],
+				   const float targetPos[], 
+				   const float dIndices_in[], 
+				   float dIndices_out[],
+				   float position_out[]);
+
+/**
+ * Compute distance between position given by indices and target position
+ * in coordinate space.
+ *
+ * \param ndims number of space dimensions
+ * \param dims dimensions along each axis
+ * \param coordData list of grid vertex arrays, dimensioned [ndims][dims[0]*dims[1]...]
+ * \param coord_periodicity periodicity length in coordinate space, for each axis
+ * \param targetPos target position, dimension [ndims]
+ * \param dindices previous guess for position in index space. Array of size [ndims].
+ * \param distance distance from targetPos (output).
+ * \return NC_NOERR on success
+ */
+
+int nccf_get_distance_in_coord_double(int ndims, const int dims[], 
+                                      const double **coordData, 
+                                      const double coord_periodicity[],
+                                      const double targetPos[],
+                                      const double dindices[],
+                                      double *distance);
+int nccf_get_distance_in_coord_float(int ndims, const int dims[], 
+                                     const float **coordData, 
+                                     const float coord_periodicity[],
+                                     const float targetPos[],
+                                     const float dindices[],
+                                     float *distance);
+
+/**
+ * Perform a line search minimization in the direction of 
+ * dindices_new - dindices.
+ *
+ * \param ndims number of space dimensions
+ * \param dims dimensions along each axis
+ * \param coordData list of grid vertex arrays, dimensioned [ndims][dims[0]*dims[1]...]
+ * \param coord_periodicity periodicity length in coordinate space, for each axis
+ * \param targetPos target position, dimension [ndims]
+ * \param indexTol search stops when distance in index space < indexTol
+ * \param dindices previous guess for position in index space. Array of size [ndims].
+ * \param dindices_new (input and output) last guess for position in index space, will be corrected on output. Array of size [ndims].
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_linesearch_indices_double(int ndims, const int dims[], 
+				   const double **coordData, 
+                                   const double coord_periodicity[],
+				   const double targetPos[],
+				   double indexTol, 
+				   const double dindices[], 
+				   double dindices_new[]);
+int nccf_linesearch_indices_float(int ndims, const int dims[], 
+				  const float **coordData, 
+                                  const float coord_periodicity[],
+				  const float targetPos[],
+				  float indexTol, 
+				  const float dindices[], 
+				  float dindices_new[]);
+
+/**
+ * Find index position.
+ *
+ * \param ndims number of space dimensions
+ * \param dims dimensions along each axis
+ * \param coordData list of grid vertex arrays, dimensioned 
+ *                  [ndims][dims[0]*dims[1]...]
+ * \param coord_periodicity periodicity length in coordinate space, for each axis
+ * \param targetPos target position, dimension [ndims]
+ * \param niter max number of iterations on input, used number of iterations
+ *                 on output.
+ * \param tolpos max tolerance in position space on input, achieved
+ *               tolerance on output.
+ * \param adjustFunc function supplied by the user, which is called to 
+ *                   adjust the indices when index leaves the domain. 
+ *                   Supply NULL if you want to exit when indices leave 
+ *                   the domain. 
+ * \param dindices initial guess for position in index space on input, 
+ *                 index position on output. Array of size [ndims].
+ * \param hit_bounds array of -1 (target is below original grid boundary, 
+                     0 (target inside boundary), and 1 (target is above 
+                     original grid boundary). 
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_find_indices_double(int ndims, const int dims[], 
+                             const double **coordData, 
+                             const double coord_periodicity[],
+                             const double targetPos[], 
+                             int *niter, double *tolpos, 
+                             void (*adjustFunc)(int, const int[], double []), 
+                             double dindices[], int hit_bounds[]);
+int nccf_find_indices_float(int ndims, const int dims[], 
+                            const float **coordData, 
+                            const float coord_periodicity[],
+                            const float targetPos[], 
+                            int *niter, float *tolpos, 
+                            void (*adjustFunc)(int, const int[], float []), 
+                            float dindices[], int hit_bounds[]);
+ 
+
+/**
+ * Get the position in coordinate space given a set of indices.
+ *
+ * \param ndims number of space dimensions
+ * \param dims dimensions along each axis
+ * \param coordData list of grid vertex arrays, dimensioned 
+ *                  [ndims][dims[0]*dims[1]...]
+ * \param coord_periodicity periodicity length in coordinate space, for 
+ *                          each axis
+ * \param pos_ref modulo operations will be applied for periodic positions so 
+ *                as to minimize the distance to pos_ref (passing NULL will 
+ *                not apply modulo)
+ * \param dindices index position returned by nccf_find_indices_double
+ * \param position (output) position in coordinate space
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_get_position_double(int ndims, const int dims[],
+			     const double **coordData,
+                             const double coord_periodicity[],
+                             const double pos_ref[],
+			     const double dindices[],
+			     double position[]);
+int nccf_get_position_float(int ndims, const int dims[],
+                            const float **coordData,
+                            const float coord_periodicity[],
+                            const float pos_ref[],
+                            const float dindices[],
+                            float position[]);
+
+/**
+ * Get linear interpolation weights.
+ *
+ * \param ndims number of space dimensions
+ * \param dims dimensions along each axis
+ * \param dindices index position returned by nccf_find_indices_double
+ * \param imask optional mask array (1=valid data, 0=invalid data), can be NULL (meaning all data are valid)
+ * \param weights (output) interpolation weights (array of dimension 2^ndims)
+ *
+ * \return NC_NOERR on success, a positive number indicates that invalid 
+ * data were detected, a negative number indicates that there were too many
+ * invalid data to allow interpolation.
+ * 
+ * \see nccf_find_indices_double
+ * \note the sum of the weights typically amount to 1. In the case of invalid 
+ * data, zero weights may be returned. 
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_get_linear_weights_double(int ndims, const int dims[], 
+				   const double dindices[], 
+				   const int imask[],
+				   double weights[]);
+int nccf_get_linear_weights_float(int ndims, const int dims[], 
+				  const float dindices[], 
+				  const int imask[],
+				  float weights[]);
+
+/**
+ * Perform a linear interpolation for given index position.
+ *
+ * \param ndims number of space dimensions
+ * \param dims dimensions along each axis
+ * \param f_nodes grid values of the function to interpolate
+ * \param dindices interpolation point in index space (returned by 
+ *                 nccf_find_indices_double/nccf_find_indices_float)
+ * \param weights interpolation weights (returned by 
+ *                nccf_get_linear_interp_weights)
+ * \param fill_value the value f_interp will be set to if too many nodal 
+ *                   function values are invalid.
+ * \param f_interp (output) interpolated value
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_linear_interp_double(int ndims, const int dims[],
+			      const double *f_nodes,
+			      const double dindices[],
+			      const double weights[],
+			      double fill_value,
+			      double *f_interp);
+int nccf_linear_interp_float(int ndims, const int dims[], 
+                             const float *f_nodes,
+                             const float dindices[],
+                             const float weights[],
+                             float fill_value,
+                             float *f_interp);
+
+/**
+ * Perform a linear interpolation for given index position, if necessary 
+ * correcting the indices to account for periodicity.
+ *
+ * \param ndims number of space dimensions
+ * \param dims dimensions along each axis
+ * \param f_nodes grid values of the function to interpolate
+ * \param dindices interpolation point in index space (returned by 
+ *                 nccf_find_indices_double/nccf_find_indices_float)
+ * \param weights interpolation weights (returned by 
+ *                nccf_get_linear_interp_weights)
+ * \param fill_value the value f_interp will be set to if too many nodal 
+ *                   function values are invalid.
+ * \param f_interp (output) interpolated value
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_linear_interp_mod_double(int ndims, const int dims[],
+                                  const double *f_nodes,
+                                  double f_ref, 
+                                  double f_periodicity, 
+                                  const double dindices[],
+                                  const double weights[],
+                                  double fill_value,
+                                  double *f_interp);
+int nccf_linear_interp_mod_float(int ndims, const int dims[], 
+                                 const float *f_nodes,
+                                 float f_ref, 
+                                 float f_periodicity, 
+                                 const float dindices[],
+                                 const float weights[],
+                                 float fill_value,
+                                 float *f_interp);
+
+/**
+ * Solve a dense float linear system.
+ *
+ * \param ndims number of space dimensions
+ * \param mat matrix containing ndims*ndims elements
+ * \param rhs right-hand side vector of dimension ndims
+ * \param sol solution vector of size ndims
+ * \return NC_NOERR on success
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+int nccf_solve_float(int ndims, float mat[], const float rhs[], 
+		      float sol[]);
+int nccf_solve_double(int ndims, double mat[], const double rhs[], 
+		      double sol[]);
+
+/*!@}*/
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _NCCF_GLOBAL_FUNCTIONS */
+
+
diff --git a/include/nccf_varObj.h b/include/nccf_varObj.h
new file mode 100644
index 0000000..34df52e
--- /dev/null
+++ b/include/nccf_varObj.h
@@ -0,0 +1,332 @@
+/**
+ * $Id: nccf_varObj.h 895 2011-12-22 13:12:38Z pletzer $
+ *
+ * Methods to populate a netcdf-like variable
+ */
+
+#ifndef _NCCF_VAROBJ_H
+#define _NCCF_VAROBJ_H
+
+#include <netcdf.h>
+#include "nccf_keyvalue.h"
+
+/**
+ * Struct mimicking a netcdf variable but stored in memory
+ * A variable has data (double. float , ..) and attributes,
+ * currently of either string, double, float, or int type.
+ * The attributes are accessed by string name. The variable 
+ * knows how to write itself to a netcdf file and how to load 
+ * itself from a netcdf file.
+ */
+struct nccf_var_obj{
+
+  /* name */
+  char *name;
+
+  /* list of dimension names */
+  char **dimnames;
+
+  /* number of dimensions */
+  int ndims;
+
+  /* list of dimensions */
+  int *dims;
+
+  /* pointer to the data */
+  void *data;
+
+  /* netcdf data type (eg NC_DOUBLE) */
+  nc_type data_type;
+
+  /* map string to string */
+  struct CFLISTITEM *attr;
+
+  /* whether or not this object owns the data */
+  int save;
+
+  /* number of written records for variables with a time-like axis */
+  int numWrittenRecords;
+
+  /* time dimension (-1 if static) */
+  int time_dimension;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Constructor
+ * handle - object handle
+ * name   - name of variable, if empty will denote a global attribute
+ *          name will be strdup-ed, so the callere owns the pointer.
+ * \return 0 on success
+ */
+int nccf_varCreate(struct nccf_var_obj **handle, const char* name);
+
+/**
+ * Constructor from netcdf file
+ * handle       - object handle
+ * name         - name of variable, if empty will denote a global attribute
+ * ncid         - NetCDF file id 
+ * readData     - set to 1 if data should be read
+ * castToDouble - set to 1 if data should be cast into a double array
+ * \return 0 on success
+ */
+int nccf_varCreateFromFile(struct nccf_var_obj **handle, const char* name, 
+			   int ncid, int readData, int castToDouble);
+
+/**
+ * Destructor
+ * handle - object handle
+ */
+int nccf_varDestroy(struct nccf_var_obj **handle);
+
+/**
+ * Retrieve the variable name
+ * handle  - object handle
+ * varname - variable name
+ *           the pointer is owned by the struct handle.
+ * \return 0 on success
+ */
+int nccf_varGetVarNamePtr(struct nccf_var_obj **handle, const char **varname);
+
+/**
+ * name   - name of variable, if empty will denote a global attribute
+ *          name will be strdup-ed, so the caller owns the pointer.
+ * \return 0 on success
+ */
+int nccf_varSetVarName(struct nccf_var_obj **handle, const char *varname);
+
+/**
+ * Set the attribute iterator to the beginning
+ * handle - object handle
+ * \return 0 on success
+ */
+int nccf_varAttribIterBegin(struct nccf_var_obj **handle);
+
+/**
+ * Set the attribute iterator to the next value
+ * handle - object handle
+ * \return 1 if the next attribute exists, 0 otherwise
+ */
+int nccf_varAttribIterNext(struct nccf_var_obj **handle);
+
+/**
+ * Inquire the current attribute name
+ * handle - object handle
+ * name   - name of the attribute
+ * \return 0 on success
+ */
+int nccf_varInqAttribNamePtr(struct nccf_var_obj **handle, const char **name);
+
+/**
+ * Attach an attribute to variable
+ * handle - object handle
+ * name   - attribute name
+ * value  - value of the attribute
+ * \return 0 on success
+ */
+int nccf_varSetAttribText(struct nccf_var_obj **handle, const char *name, 
+			  const char *value);
+int nccf_varSetAttribDouble(struct nccf_var_obj **handle, const char *name, 
+			    double value);
+int nccf_varSetAttribFloat(struct nccf_var_obj **handle, const char *name, 
+			   float value);
+int nccf_varSetAttribInt(struct nccf_var_obj **handle, const char *name, 
+			 int value);
+int nccf_varSetAttribShort(struct nccf_var_obj **handle, const char *name, 
+			   short value);
+/**
+ * Attach an array attribute to variable
+ * handle - object handle
+ * name   - attribute name
+ * n      - number of elements
+ * values - attribute values
+ * \return 0 on success
+ */
+int nccf_varSetAttribDoubleArray(struct nccf_var_obj **handle, 
+                                 const char *name,  int n, 
+                                 const double values[]);
+int nccf_varSetAttribFloatArray(struct nccf_var_obj **handle, 
+                                const char *name, int n, 
+                                const float values[]);
+int nccf_varSetAttribIntArray(struct nccf_var_obj **handle, 
+                              const char *name,  int n, 
+                              const int values[]);
+int nccf_varSetAttribShortArray(struct nccf_var_obj **handle, 
+                                const char *name,  int n, 
+                                const short values[]);
+
+/**
+ * Inquire about an attribute value
+ * handle - object handle
+ * name   - attribute name
+ * xtypep - a valid netcdf type
+ * lenp   - number of elements
+ * \return 0 on success
+ */
+int nccf_varInqAttrib(struct nccf_var_obj **handle, const char *name,
+		      nc_type *xtypep, int *lenp);
+
+/**
+ * Get the attribute pointer value by name
+ * handle - object handle
+ * name   - name of the attribute
+ * value  - The value of the attribute. The caller does not own the pointer
+ *          returned in *value. This pointer will be freed when *v is freed.
+ * \return 0 on success
+ */
+int nccf_varGetAttribPtr(struct nccf_var_obj **handle, 
+			  const char *name, const void **value);
+
+/**
+ * Get number of data values per time slice
+ * handle  - object handle
+ * ntot    - (output) number of data values
+ * \return 0 on success
+ */
+int nccf_varGetNumValsPerTime(struct nccf_var_obj **handle, int *ntot);
+
+/**
+ * Get number of dimensions for a variable
+ * handle  - object handle
+ * numDims - (output) number of dimension attached to the variable
+ * \return 0 on success
+ */
+int nccf_varGetNumDims(struct nccf_var_obj **handle, int *numDims);
+
+/**
+ * Set the dimensions for a variable
+ * handle   - object handle
+ * numDims  - number of dimension attached to the variable
+ * dims     - array of dimensions
+ * dimnames - the names of each dimension (will be copied)
+ * \return 0 on success
+ */
+int nccf_varSetDims(struct nccf_var_obj **handle, int numDims, 
+ 	       const int dims[], const char **dimname);
+
+/**
+ * Get the dimension names for a variable as a pointer
+ * handle   - object handle
+ * index    - index of the dimension
+ * dimname  - the name of the dimension (object owns the pointer)
+ * \return 0 on success
+ */
+int nccf_varGetDimNamePtr(struct nccf_var_obj **handle, int index, 
+                         const char **dimname);
+
+/**
+ * Get a pointer to the dimensions of a variable object.
+ * handle - object handle
+ * dim    - the dimensions
+ * \return 0 on success
+ */
+int nccf_varGetDimsPtr(struct nccf_var_obj **handle, int **dims);
+
+/** 
+ * Set single time slice data pointer (caller owns the pointer)
+ * handle   - object handle
+ * dataType - netcdf var type (e.g. NC_FLOAT)
+ * val      - values
+ * \return 0 on success
+ * \note should be large enough to accommodate tyhe values 
+ * for a single time slice
+ */
+int nccf_varSetDataPtr(struct nccf_var_obj **handle, 
+                       nc_type dataType, void *val);
+
+/**
+ * Read a time slice
+ * handle       - object handle
+ * ncid         - netcdf file handle
+ * time_index   - time index (0 if static)
+ * castToDouble - set to 1 if data should be read as doubles
+ */
+  int nccf_varReadData(struct nccf_var_obj **handle, int ncid, 
+                       int time_index, int castToDouble);
+
+/** 
+ * Set single time slice data (will make a copy)
+ * handle   - object handle
+ * val      - values
+ * \return 0 on success
+ */
+int nccf_varSetDataDouble(struct nccf_var_obj **handle, const double val[]);
+
+/** 
+ * Set single time slice data (will make a copy)
+ * handle   - object handle
+ * val      - values
+ * \return 0 on success
+ */
+int nccf_varSetDataFloat(struct nccf_var_obj **handle, const float val[]);
+
+/** 
+ * Set single time slice data (will make a copy)
+ * handle   - object handle
+ * val      - values
+ * \return 0 on success
+ */
+int nccf_varSetDataInt(struct nccf_var_obj **handle, const int val[]);
+
+/** 
+ * Set single time slice data (will make a copy)
+ * handle   - object handle
+ * val      - values
+ * \return 0 on success
+ */
+int nccf_varSetDataShort(struct nccf_var_obj **handle, const short val[]);
+
+/** 
+ * Set single time slice data (will make a copy)
+ * handle   - object handle
+ * val      - values
+ * \return 0 on success
+ */
+int nccf_varSetDataChar(struct nccf_var_obj **handle, const char val[]);
+
+/**
+ * Get the data type
+ * handle   - object handle
+ * dataType - (output) e.g. NC_FLOAT
+ * \return 0 on success
+ */
+int nccf_varGetDataType(struct nccf_var_obj **handle, nc_type *dataType);
+
+/** 
+ * Get data pointer to a single time slice (object owns the pointer)
+ * handle   - object handle
+ * val      - (output) value pointer
+ * \return 0 on success
+ */
+int nccf_varGetDataPtr(struct nccf_var_obj **handle, void **val);
+
+/** 
+ * Write a list of variables to a NetCDF file
+ * 
+ * ncid     - NetCDF file handle
+ * numVars  - number of var object handles
+ * ...      - var object handles
+ * \return 0 on success
+ */
+int nccf_writeListOfVars(int ncid, int numVars, ...);
+
+/** 
+ * Write data attached to give variables. This will write a new record for 
+ * variables that have the NC_UNLIMITED dimension. Use nccf_writeListOfVars 
+ * to write the header.
+ *
+ * ncid     - NetCDF file handle
+ * numVars  - number of var object handles
+ * ...      - var object handles
+ * \return 0 on success
+ */
+int nccf_writeListOfVarData(int ncid, int numVars, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _NCCF_VAROBJ_H
diff --git a/ltmain.sh b/ltmain.sh
index 174e492..3061e3c 100755
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -1,9 +1,9 @@
-# Generated from ltmain.m4sh.
 
-# ltmain.sh (GNU libtool) 2.2.4
+# libtool (GNU libtool) 2.4
 # Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 # This is free software; see the source for copying conditions.  There is NO
 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
@@ -32,50 +32,56 @@
 #
 # Provide generalized library-building support services.
 #
-#     --config             show all configuration variables
-#     --debug              enable verbose shell tracing
-# -n, --dry-run            display commands without modifying any files
-#     --features           display basic configuration information and exit
-#     --mode=MODE          use operation mode MODE
-#     --preserve-dup-deps  don't remove duplicate dependency libraries
-#     --quiet, --silent    don't print informational messages
-#     --tag=TAG            use configuration variables from tag TAG
-# -v, --verbose            print informational messages (default)
-#     --version            print version information
-# -h, --help               print short or long help message
+#       --config             show all configuration variables
+#       --debug              enable verbose shell tracing
+#   -n, --dry-run            display commands without modifying any files
+#       --features           display basic configuration information and exit
+#       --mode=MODE          use operation mode MODE
+#       --preserve-dup-deps  don't remove duplicate dependency libraries
+#       --quiet, --silent    don't print informational messages
+#       --no-quiet, --no-silent
+#                            print informational messages (default)
+#       --tag=TAG            use configuration variables from tag TAG
+#   -v, --verbose            print more informational messages than default
+#       --no-verbose         don't print the extra informational messages
+#       --version            print version information
+#   -h, --help, --help-all   print short, long, or detailed help message
 #
 # MODE must be one of the following:
 #
-#       clean              remove files from the build directory
-#       compile            compile a source file into a libtool object
-#       execute            automatically set library path, then run a program
-#       finish             complete the installation of libtool libraries
-#       install            install libraries or executables
-#       link               create a library or an executable
-#       uninstall          remove libraries from an installed directory
+#         clean              remove files from the build directory
+#         compile            compile a source file into a libtool object
+#         execute            automatically set library path, then run a program
+#         finish             complete the installation of libtool libraries
+#         install            install libraries or executables
+#         link               create a library or an executable
+#         uninstall          remove libraries from an installed directory
 #
-# MODE-ARGS vary depending on the MODE.
+# MODE-ARGS vary depending on the MODE.  When passed as first option,
+# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
 #
 # When reporting a bug, please describe a test case to reproduce it and
 # include the following information:
 #
-#       host-triplet:	$host
-#       shell:		$SHELL
-#       compiler:		$LTCC
-#       compiler flags:		$LTCFLAGS
-#       linker:		$LD (gnu? $with_gnu_ld)
-#       $progname:		(GNU libtool) 2.2.4
-#       automake:		$automake_version
-#       autoconf:		$autoconf_version
+#         host-triplet:	$host
+#         shell:		$SHELL
+#         compiler:		$LTCC
+#         compiler flags:		$LTCFLAGS
+#         linker:		$LD (gnu? $with_gnu_ld)
+#         $progname:	(GNU libtool) 2.4
+#         automake:	$automake_version
+#         autoconf:	$autoconf_version
 #
 # Report bugs to <bug-libtool at gnu.org>.
+# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
+# General help using GNU software: <http://www.gnu.org/gethelp/>.
 
-PROGRAM=ltmain.sh
+PROGRAM=libtool
 PACKAGE=libtool
-VERSION=2.2.4
+VERSION=2.4
 TIMESTAMP=""
-package_revision=1.2976
+package_revision=1.3293
 
 # Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
@@ -91,10 +97,15 @@ fi
 BIN_SH=xpg4; export BIN_SH # for Tru64
 DUALCASE=1; export DUALCASE # for MKS sh
 
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
 # NLS nuisances: We save the old values to restore during execute mode.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
 lt_user_locale=
 lt_safe_locale=
 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
@@ -107,24 +118,33 @@ do
 	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
 	fi"
 done
+LC_ALL=C
+LANGUAGE=C
+export LANGUAGE LC_ALL
 
 $lt_unset CDPATH
 
 
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
 
 
 
 : ${CP="cp -f"}
-: ${ECHO="echo"}
-: ${EGREP="/usr/bin/grep -E"}
-: ${FGREP="/usr/bin/grep -F"}
-: ${GREP="/usr/bin/grep"}
+test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
+: ${EGREP="grep -E"}
+: ${FGREP="grep -F"}
+: ${GREP="grep"}
 : ${LN_S="ln -s"}
 : ${MAKE="make"}
 : ${MKDIR="mkdir"}
 : ${MV="mv -f"}
 : ${RM="rm -f"}
-: ${SED="/opt/local/bin/gsed"}
+: ${SED="sed"}
 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
 : ${Xsed="$SED -e 1s/^X//"}
 
@@ -144,6 +164,27 @@ IFS=" 	$lt_nl"
 dirname="s,/[^/]*$,,"
 basename="s,^.*/,,"
 
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+    func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
+    if test "X$func_dirname_result" = "X${1}"; then
+      func_dirname_result="${3}"
+    else
+      func_dirname_result="$func_dirname_result${2}"
+    fi
+} # func_dirname may be replaced by extended shell implementation
+
+
+# func_basename file
+func_basename ()
+{
+    func_basename_result=`$ECHO "${1}" | $SED "$basename"`
+} # func_basename may be replaced by extended shell implementation
+
+
 # func_dirname_and_basename file append nondir_replacement
 # perform func_basename and func_dirname in a single function
 # call:
@@ -158,33 +199,183 @@ basename="s,^.*/,,"
 # those functions but instead duplicate the functionality here.
 func_dirname_and_basename ()
 {
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+    # Extract subdirectory from the argument.
+    func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
+    if test "X$func_dirname_result" = "X${1}"; then
+      func_dirname_result="${3}"
+    else
+      func_dirname_result="$func_dirname_result${2}"
+    fi
+    func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
+} # func_dirname_and_basename may be replaced by extended shell implementation
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+    case ${2} in
+      .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+      *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+    esac
+} # func_stripname may be replaced by extended shell implementation
+
+
+# These SED scripts presuppose an absolute path with a trailing slash.
+pathcar='s,^/\([^/]*\).*$,\1,'
+pathcdr='s,^/[^/]*,,'
+removedotparts=':dotsl
+		s@/\./@/@g
+		t dotsl
+		s,/\.$,/,'
+collapseslashes='s@/\{1,\}@/@g'
+finalslash='s,/*$,/,'
+
+# func_normal_abspath PATH
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+#             value returned in "$func_normal_abspath_result"
+func_normal_abspath ()
+{
+  # Start from root dir and reassemble the path.
+  func_normal_abspath_result=
+  func_normal_abspath_tpath=$1
+  func_normal_abspath_altnamespace=
+  case $func_normal_abspath_tpath in
+    "")
+      # Empty path, that just means $cwd.
+      func_stripname '' '/' "`pwd`"
+      func_normal_abspath_result=$func_stripname_result
+      return
+    ;;
+    # The next three entries are used to spot a run of precisely
+    # two leading slashes without using negated character classes;
+    # we take advantage of case's first-match behaviour.
+    ///*)
+      # Unusual form of absolute path, do nothing.
+    ;;
+    //*)
+      # Not necessarily an ordinary path; POSIX reserves leading '//'
+      # and for example Cygwin uses it to access remote file shares
+      # over CIFS/SMB, so we conserve a leading double slash if found.
+      func_normal_abspath_altnamespace=/
+    ;;
+    /*)
+      # Absolute path, do nothing.
+    ;;
+    *)
+      # Relative path, prepend $cwd.
+      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+    ;;
+  esac
+  # Cancel out all the simple stuff to save iterations.  We also want
+  # the path to end with a slash for ease of parsing, so make sure
+  # there is one (and only one) here.
+  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
+  while :; do
+    # Processed it all yet?
+    if test "$func_normal_abspath_tpath" = / ; then
+      # If we ascended to the root using ".." the result may be empty now.
+      if test -z "$func_normal_abspath_result" ; then
+        func_normal_abspath_result=/
+      fi
+      break
+    fi
+    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcar"`
+    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcdr"`
+    # Figure out what to do with it
+    case $func_normal_abspath_tcomponent in
+      "")
+        # Trailing empty path component, ignore it.
+      ;;
+      ..)
+        # Parent dir; strip last assembled component from result.
+        func_dirname "$func_normal_abspath_result"
+        func_normal_abspath_result=$func_dirname_result
+      ;;
+      *)
+        # Actual path component, append it.
+        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
+      ;;
+    esac
+  done
+  # Restore leading double-slash if one was found on entry.
+  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
 }
 
-# Generated shell functions inserted here.
+# func_relative_path SRCDIR DSTDIR
+# generates a relative path from SRCDIR to DSTDIR, with a trailing
+# slash if non-empty, suitable for immediately appending a filename
+# without needing to append a separator.
+#             value returned in "$func_relative_path_result"
+func_relative_path ()
+{
+  func_relative_path_result=
+  func_normal_abspath "$1"
+  func_relative_path_tlibdir=$func_normal_abspath_result
+  func_normal_abspath "$2"
+  func_relative_path_tbindir=$func_normal_abspath_result
+
+  # Ascend the tree starting from libdir
+  while :; do
+    # check if we have found a prefix of bindir
+    case $func_relative_path_tbindir in
+      $func_relative_path_tlibdir)
+        # found an exact match
+        func_relative_path_tcancelled=
+        break
+        ;;
+      $func_relative_path_tlibdir*)
+        # found a matching prefix
+        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+        func_relative_path_tcancelled=$func_stripname_result
+        if test -z "$func_relative_path_result"; then
+          func_relative_path_result=.
+        fi
+        break
+        ;;
+      *)
+        func_dirname $func_relative_path_tlibdir
+        func_relative_path_tlibdir=${func_dirname_result}
+        if test "x$func_relative_path_tlibdir" = x ; then
+          # Have to descend all the way to the root!
+          func_relative_path_result=../$func_relative_path_result
+          func_relative_path_tcancelled=$func_relative_path_tbindir
+          break
+        fi
+        func_relative_path_result=../$func_relative_path_result
+        ;;
+    esac
+  done
 
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
+  # Now calculate path; take care to avoid doubling-up slashes.
+  func_stripname '' '/' "$func_relative_path_result"
+  func_relative_path_result=$func_stripname_result
+  func_stripname '/' '/' "$func_relative_path_tcancelled"
+  if test "x$func_stripname_result" != x ; then
+    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
+  fi
+
+  # Normalisation. If bindir is libdir, return empty string,
+  # else relative path ending with a slash; either way, target
+  # file name can be directly appended.
+  if test ! -z "$func_relative_path_result"; then
+    func_stripname './' '' "$func_relative_path_result/"
+    func_relative_path_result=$func_stripname_result
+  fi
+}
 
 # The name of this program:
-# In the unlikely event $progname began with a '-', it would play havoc with
-# func_echo (imagine progname=-n), so we prepend ./ in that case:
 func_dirname_and_basename "$progpath"
 progname=$func_basename_result
-case $progname in
-  -*) progname=./$progname ;;
-esac
 
 # Make sure we have an absolute path for reexecution:
 case $progpath in
@@ -215,6 +406,15 @@ sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
 # Same as above, but do not quote variable references.
 double_quote_subst='s/\(["`\\]\)/\\\1/g'
 
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
+
+# Sed substitution that converts a w32 file name or path
+# which contains forward slashes, into one that contains
+# (escaped) backslashes.  A very naive implementation.
+lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+
 # Re-`\' parameter expansions in output of double_quote_subst that were
 # `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
 # in input to double_quote_subst, that '$' was protected from expansion.
@@ -243,7 +443,7 @@ opt_warning=:
 # name if it has been set yet.
 func_echo ()
 {
-    $ECHO "$progname${mode+: }$mode: $*"
+    $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
 }
 
 # func_verbose arg...
@@ -258,18 +458,25 @@ func_verbose ()
     :
 }
 
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*"
+}
+
 # func_error arg...
 # Echo program name prefixed message to standard error.
 func_error ()
 {
-    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
+    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
 }
 
 # func_warning arg...
 # Echo program name prefixed warning message to standard error.
 func_warning ()
 {
-    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
+    $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
 
     # bash bug again:
     :
@@ -326,9 +533,9 @@ func_mkdir_p ()
         case $my_directory_path in */*) ;; *) break ;; esac
 
         # ...otherwise throw away the child directory and loop
-        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
+        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
       done
-      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
+      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
 
       save_mkdir_p_IFS="$IFS"; IFS=':'
       for my_dir in $my_dir_list; do
@@ -378,7 +585,7 @@ func_mktempdir ()
         func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
     fi
 
-    $ECHO "X$my_tmpdir" | $Xsed
+    $ECHO "$my_tmpdir"
 }
 
 
@@ -392,7 +599,7 @@ func_quote_for_eval ()
 {
     case $1 in
       *[\\\`\"\$]*)
-	func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
+	func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
       *)
         func_quote_for_eval_unquoted_result="$1" ;;
     esac
@@ -419,7 +626,7 @@ func_quote_for_expand ()
 {
     case $1 in
       *[\\\`\"]*)
-	my_arg=`$ECHO "X$1" | $Xsed \
+	my_arg=`$ECHO "$1" | $SED \
 	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
       *)
         my_arg="$1" ;;
@@ -488,15 +695,39 @@ func_show_eval_locale ()
     fi
 }
 
-
-
+# func_tr_sh
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result.  All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+  case $1 in
+  [0-9]* | *[!a-zA-Z0-9_]*)
+    func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
+    ;;
+  * )
+    func_tr_sh_result=$1
+    ;;
+  esac
+}
 
 
 # func_version
 # Echo version message to standard output and exit.
 func_version ()
 {
-    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
+    $opt_debug
+
+    $SED -n '/(C)/!b go
+	:more
+	/\./!{
+	  N
+	  s/\n# / /
+	  b more
+	}
+	:go
+	/^# '$PROGRAM' (GNU /,/# warranty; / {
         s/^# //
 	s/^# *$//
         s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
@@ -509,22 +740,28 @@ func_version ()
 # Echo short help message to standard output and exit.
 func_usage ()
 {
-    $SED -n '/^# Usage:/,/# -h/ {
+    $opt_debug
+
+    $SED -n '/^# Usage:/,/^#  *.*--help/ {
         s/^# //
 	s/^# *$//
 	s/\$progname/'$progname'/
 	p
     }' < "$progpath"
-    $ECHO
+    echo
     $ECHO "run \`$progname --help | more' for full usage"
     exit $?
 }
 
-# func_help
-# Echo long help message to standard output and exit.
+# func_help [NOEXIT]
+# Echo long help message to standard output and exit,
+# unless 'noexit' is passed as argument.
 func_help ()
 {
+    $opt_debug
+
     $SED -n '/^# Usage:/,/# Report bugs to/ {
+	:print
         s/^# //
 	s/^# *$//
 	s*\$progname*'$progname'*
@@ -537,8 +774,15 @@ func_help ()
 	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
 	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
 	p
-     }' < "$progpath"
-    exit $?
+	d
+     }
+     /^# .* home page:/b print
+     /^# General help using/b print
+     ' < "$progpath"
+    ret=$?
+    if test -z "$1"; then
+      exit $ret
+    fi
 }
 
 # func_missing_arg argname
@@ -546,63 +790,106 @@ func_help ()
 # exit_cmd.
 func_missing_arg ()
 {
-    func_error "missing argument for $1"
+    $opt_debug
+
+    func_error "missing argument for $1."
     exit_cmd=exit
 }
 
-exit_cmd=:
 
+# func_split_short_opt shortopt
+# Set func_split_short_opt_name and func_split_short_opt_arg shell
+# variables after splitting SHORTOPT after the 2nd character.
+func_split_short_opt ()
+{
+    my_sed_short_opt='1s/^\(..\).*$/\1/;q'
+    my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
 
+    func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
+    func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
+} # func_split_short_opt may be replaced by extended shell implementation
+
+
+# func_split_long_opt longopt
+# Set func_split_long_opt_name and func_split_long_opt_arg shell
+# variables after splitting LONGOPT at the `=' sign.
+func_split_long_opt ()
+{
+    my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
+    my_sed_long_arg='1s/^--[^=]*=//'
+
+    func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
+    func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
+} # func_split_long_opt may be replaced by extended shell implementation
+
+exit_cmd=:
 
 
 
-# Check that we have a working $ECHO.
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
-  # Yippee, $ECHO works!
-  :
-else
-  # Restart under the correct shell, and then maybe $ECHO will work.
-  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
-fi
 
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<EOF
-$*
-EOF
-  exit $EXIT_SUCCESS
-fi
 
 magic="%%%MAGIC variable%%%"
 magic_exe="%%%MAGIC EXE variable%%%"
 
 # Global variables.
-# $mode is unset
 nonopt=
-execute_dlfiles=
 preserve_args=
 lo2o="s/\\.lo\$/.${objext}/"
 o2lo="s/\\.${objext}\$/.lo/"
 extracted_archives=
 extracted_serial=0
 
-opt_dry_run=false
-opt_duplicate_deps=false
-opt_silent=false
-opt_debug=:
-
 # If this variable is set in any of the actions, the command in it
 # will be execed at the end.  This prevents here-documents from being
 # left over by shells.
 exec_cmd=
 
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+    eval "${1}=\$${1}\${2}"
+} # func_append may be replaced by extended shell implementation
+
+# func_append_quoted var value
+# Quote VALUE and append to the end of shell variable VAR, separated
+# by a space.
+func_append_quoted ()
+{
+    func_quote_for_eval "${2}"
+    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
+} # func_append_quoted may be replaced by extended shell implementation
+
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+    func_arith_result=`expr "${@}"`
+} # func_arith may be replaced by extended shell implementation
+
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+    func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
+} # func_len may be replaced by extended shell implementation
+
+
+# func_lo2o object
+func_lo2o ()
+{
+    func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+} # func_lo2o may be replaced by extended shell implementation
+
+
+# func_xform libobj-or-source
+func_xform ()
+{
+    func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
+} # func_xform may be replaced by extended shell implementation
+
+
 # func_fatal_configuration arg...
 # Echo program name prefixed message to standard error, followed by
 # a configuration failure hint, and exit.
@@ -636,16 +923,16 @@ func_config ()
 # Display the features supported by this script.
 func_features ()
 {
-    $ECHO "host: $host"
+    echo "host: $host"
     if test "$build_libtool_libs" = yes; then
-      $ECHO "enable shared libraries"
+      echo "enable shared libraries"
     else
-      $ECHO "disable shared libraries"
+      echo "disable shared libraries"
     fi
     if test "$build_old_libs" = yes; then
-      $ECHO "enable static libraries"
+      echo "enable static libraries"
     else
-      $ECHO "disable static libraries"
+      echo "disable static libraries"
     fi
 
     exit $?
@@ -692,133 +979,6 @@ func_enable_tag ()
   esac
 }
 
-# Parse options once, thoroughly.  This comes as soon as possible in
-# the script to make things like `libtool --version' happen quickly.
-{
-
-  # Shorthand for --mode=foo, only valid as the first argument
-  case $1 in
-  clean|clea|cle|cl)
-    shift; set dummy --mode clean ${1+"$@"}; shift
-    ;;
-  compile|compil|compi|comp|com|co|c)
-    shift; set dummy --mode compile ${1+"$@"}; shift
-    ;;
-  execute|execut|execu|exec|exe|ex|e)
-    shift; set dummy --mode execute ${1+"$@"}; shift
-    ;;
-  finish|finis|fini|fin|fi|f)
-    shift; set dummy --mode finish ${1+"$@"}; shift
-    ;;
-  install|instal|insta|inst|ins|in|i)
-    shift; set dummy --mode install ${1+"$@"}; shift
-    ;;
-  link|lin|li|l)
-    shift; set dummy --mode link ${1+"$@"}; shift
-    ;;
-  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
-    shift; set dummy --mode uninstall ${1+"$@"}; shift
-    ;;
-  esac
-
-  # Parse non-mode specific arguments:
-  while test "$#" -gt 0; do
-    opt="$1"
-    shift
-
-    case $opt in
-      --config)		func_config					;;
-
-      --debug)		preserve_args="$preserve_args $opt"
-			func_echo "enabling shell trace mode"
-			opt_debug='set -x'
-			$opt_debug
-			;;
-
-      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
-			execute_dlfiles="$execute_dlfiles $1"
-			shift
-			;;
-
-      --dry-run | -n)	opt_dry_run=:					;;
-      --features)       func_features					;;
-      --finish)		mode="finish"					;;
-
-      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
-			case $1 in
-			  # Valid mode arguments:
-			  clean)	;;
-			  compile)	;;
-			  execute)	;;
-			  finish)	;;
-			  install)	;;
-			  link)		;;
-			  relink)	;;
-			  uninstall)	;;
-
-			  # Catch anything else as an error
-			  *) func_error "invalid argument for $opt"
-			     exit_cmd=exit
-			     break
-			     ;;
-		        esac
-
-			mode="$1"
-			shift
-			;;
-
-      --preserve-dup-deps)
-			opt_duplicate_deps=:				;;
-
-      --quiet|--silent)	preserve_args="$preserve_args $opt"
-			opt_silent=:
-			;;
-
-      --verbose| -v)	preserve_args="$preserve_args $opt"
-			opt_silent=false
-			;;
-
-      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
-			preserve_args="$preserve_args $opt $1"
-			func_enable_tag "$1"	# tagname is set here
-			shift
-			;;
-
-      # Separate optargs to long options:
-      -dlopen=*|--mode=*|--tag=*)
-			func_opt_split "$opt"
-			set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
-			shift
-			;;
-
-      -\?|-h)		func_usage					;;
-      --help)		opt_help=:					;;
-      --version)	func_version					;;
-
-      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
-
-      *)		nonopt="$opt"
-			break
-			;;
-    esac
-  done
-
-
-  case $host in
-    *cygwin* | *mingw* | *pw32*)
-      # don't eliminate duplications in $postdeps and $predeps
-      opt_duplicate_compiler_generated_deps=:
-      ;;
-    *)
-      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
-      ;;
-  esac
-
-  # Having warned about all mis-specified options, bail out if
-  # anything was wrong.
-  $exit_cmd $EXIT_FAILURE
-}
-
 # func_check_version_match
 # Ensure that we are using m4 macros, and libtool script from the same
 # release of libtool.
@@ -855,46 +1015,223 @@ _LT_EOF
 }
 
 
-## ----------- ##
-##    Main.    ##
-## ----------- ##
+# Shorthand for --mode=foo, only valid as the first argument
+case $1 in
+clean|clea|cle|cl)
+  shift; set dummy --mode clean ${1+"$@"}; shift
+  ;;
+compile|compil|compi|comp|com|co|c)
+  shift; set dummy --mode compile ${1+"$@"}; shift
+  ;;
+execute|execut|execu|exec|exe|ex|e)
+  shift; set dummy --mode execute ${1+"$@"}; shift
+  ;;
+finish|finis|fini|fin|fi|f)
+  shift; set dummy --mode finish ${1+"$@"}; shift
+  ;;
+install|instal|insta|inst|ins|in|i)
+  shift; set dummy --mode install ${1+"$@"}; shift
+  ;;
+link|lin|li|l)
+  shift; set dummy --mode link ${1+"$@"}; shift
+  ;;
+uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+  shift; set dummy --mode uninstall ${1+"$@"}; shift
+  ;;
+esac
 
-$opt_help || {
-  # Sanity checks first:
-  func_check_version_match
 
-  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
-    func_fatal_configuration "not configured to build any kind of library"
-  fi
 
-  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
+# Option defaults:
+opt_debug=:
+opt_dry_run=false
+opt_config=false
+opt_preserve_dup_deps=false
+opt_features=false
+opt_finish=false
+opt_help=false
+opt_help_all=false
+opt_silent=:
+opt_verbose=:
+opt_silent=false
+opt_verbose=false
+
+
+# Parse options once, thoroughly.  This comes as soon as possible in the
+# script to make things like `--version' happen as quickly as we can.
+{
+  # this just eases exit handling
+  while test $# -gt 0; do
+    opt="$1"
+    shift
+    case $opt in
+      --debug|-x)	opt_debug='set -x'
+			func_echo "enabling shell trace mode"
+			$opt_debug
+			;;
+      --dry-run|--dryrun|-n)
+			opt_dry_run=:
+			;;
+      --config)
+			opt_config=:
+func_config
+			;;
+      --dlopen|-dlopen)
+			optarg="$1"
+			opt_dlopen="${opt_dlopen+$opt_dlopen
+}$optarg"
+			shift
+			;;
+      --preserve-dup-deps)
+			opt_preserve_dup_deps=:
+			;;
+      --features)
+			opt_features=:
+func_features
+			;;
+      --finish)
+			opt_finish=:
+set dummy --mode finish ${1+"$@"}; shift
+			;;
+      --help)
+			opt_help=:
+			;;
+      --help-all)
+			opt_help_all=:
+opt_help=': help-all'
+			;;
+      --mode)
+			test $# = 0 && func_missing_arg $opt && break
+			optarg="$1"
+			opt_mode="$optarg"
+case $optarg in
+  # Valid mode arguments:
+  clean|compile|execute|finish|install|link|relink|uninstall) ;;
+
+  # Catch anything else as an error
+  *) func_error "invalid argument for $opt"
+     exit_cmd=exit
+     break
+     ;;
+esac
+			shift
+			;;
+      --no-silent|--no-quiet)
+			opt_silent=false
+func_append preserve_args " $opt"
+			;;
+      --no-verbose)
+			opt_verbose=false
+func_append preserve_args " $opt"
+			;;
+      --silent|--quiet)
+			opt_silent=:
+func_append preserve_args " $opt"
+        opt_verbose=false
+			;;
+      --verbose|-v)
+			opt_verbose=:
+func_append preserve_args " $opt"
+opt_silent=false
+			;;
+      --tag)
+			test $# = 0 && func_missing_arg $opt && break
+			optarg="$1"
+			opt_tag="$optarg"
+func_append preserve_args " $opt $optarg"
+func_enable_tag "$optarg"
+			shift
+			;;
+
+      -\?|-h)		func_usage				;;
+      --help)		func_help				;;
+      --version)	func_version				;;
 
+      # Separate optargs to long options:
+      --*=*)
+			func_split_long_opt "$opt"
+			set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
+			shift
+			;;
+
+      # Separate non-argument short options:
+      -\?*|-h*|-n*|-v*)
+			func_split_short_opt "$opt"
+			set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
+			shift
+			;;
 
-  # Darwin sucks
-  eval std_shrext=\"$shrext_cmds\"
+      --)		break					;;
+      -*)		func_fatal_help "unrecognized option \`$opt'" ;;
+      *)		set dummy "$opt" ${1+"$@"};	shift; break  ;;
+    esac
+  done
 
+  # Validate options:
 
-  # Only execute mode is allowed to have -dlopen flags.
-  if test -n "$execute_dlfiles" && test "$mode" != execute; then
-    func_error "unrecognized option \`-dlopen'"
-    $ECHO "$help" 1>&2
-    exit $EXIT_FAILURE
+  # save first non-option argument
+  if test "$#" -gt 0; then
+    nonopt="$opt"
+    shift
   fi
 
-  # Change the help message to a mode-specific one.
-  generic_help="$help"
-  help="Try \`$progname --help --mode=$mode' for more information."
+  # preserve --debug
+  test "$opt_debug" = : || func_append preserve_args " --debug"
+
+  case $host in
+    *cygwin* | *mingw* | *pw32* | *cegcc*)
+      # don't eliminate duplications in $postdeps and $predeps
+      opt_duplicate_compiler_generated_deps=:
+      ;;
+    *)
+      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+      ;;
+  esac
+
+  $opt_help || {
+    # Sanity checks first:
+    func_check_version_match
+
+    if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+      func_fatal_configuration "not configured to build any kind of library"
+    fi
+
+    # Darwin sucks
+    eval std_shrext=\"$shrext_cmds\"
+
+    # Only execute mode is allowed to have -dlopen flags.
+    if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
+      func_error "unrecognized option \`-dlopen'"
+      $ECHO "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Change the help message to a mode-specific one.
+    generic_help="$help"
+    help="Try \`$progname --help --mode=$opt_mode' for more information."
+  }
+
+
+  # Bail if the options were screwed
+  $exit_cmd $EXIT_FAILURE
 }
 
 
+
+
+## ----------- ##
+##    Main.    ##
+## ----------- ##
+
 # func_lalib_p file
 # True iff FILE is a libtool `.la' library or `.lo' object file.
 # This function is only a basic sanity check; it will hardly flush out
 # determined imposters.
 func_lalib_p ()
 {
-    $SED -e 4q "$1" 2>/dev/null \
-      | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+    test -f "$1" &&
+      $SED -e 4q "$1" 2>/dev/null \
+        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
 }
 
 # func_lalib_unsafe_p file
@@ -907,7 +1244,7 @@ func_lalib_p ()
 func_lalib_unsafe_p ()
 {
     lalib_p=no
-    if test -r "$1" && exec 5<&0 <"$1"; then
+    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
 	for lalib_p_l in 1 2 3 4
 	do
 	    read lalib_p_line
@@ -949,12 +1286,9 @@ func_ltwrapper_executable_p ()
 # temporary ltwrapper_script.
 func_ltwrapper_scriptname ()
 {
-    func_ltwrapper_scriptname_result=""
-    if func_ltwrapper_executable_p "$1"; then
-	func_dirname_and_basename "$1" "" "."
-	func_stripname '' '.exe' "$func_basename_result"
-	func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
-    fi
+    func_dirname_and_basename "$1" "" "."
+    func_stripname '' '.exe' "$func_basename_result"
+    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
 }
 
 # func_ltwrapper_p file
@@ -1000,6 +1334,37 @@ func_source ()
 }
 
 
+# func_resolve_sysroot PATH
+# Replace a leading = in PATH with a sysroot.  Store the result into
+# func_resolve_sysroot_result
+func_resolve_sysroot ()
+{
+  func_resolve_sysroot_result=$1
+  case $func_resolve_sysroot_result in
+  =*)
+    func_stripname '=' '' "$func_resolve_sysroot_result"
+    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
+    ;;
+  esac
+}
+
+# func_replace_sysroot PATH
+# If PATH begins with the sysroot, replace it with = and
+# store the result into func_replace_sysroot_result.
+func_replace_sysroot ()
+{
+  case "$lt_sysroot:$1" in
+  ?*:"$lt_sysroot"*)
+    func_stripname "$lt_sysroot" '' "$1"
+    func_replace_sysroot_result="=$func_stripname_result"
+    ;;
+  *)
+    # Including no sysroot.
+    func_replace_sysroot_result=$1
+    ;;
+  esac
+}
+
 # func_infer_tag arg
 # Infer tagged configuration to use if any are available and
 # if one wasn't chosen via the "--tag" command line option.
@@ -1012,13 +1377,15 @@ func_infer_tag ()
     if test -n "$available_tags" && test -z "$tagname"; then
       CC_quoted=
       for arg in $CC; do
-        func_quote_for_eval "$arg"
-	CC_quoted="$CC_quoted $func_quote_for_eval_result"
+	func_append_quoted CC_quoted "$arg"
       done
+      CC_expanded=`func_echo_all $CC`
+      CC_quoted_expanded=`func_echo_all $CC_quoted`
       case $@ in
       # Blanks in the command may have been stripped by the calling shell,
       # but not from the CC environment variable when configure was run.
-      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
+      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
       # Blanks at the start of $base_compile will cause this to fail
       # if we don't check for them as well.
       *)
@@ -1029,11 +1396,13 @@ func_infer_tag ()
 	    CC_quoted=
 	    for arg in $CC; do
 	      # Double-quote args containing other shell metacharacters.
-	      func_quote_for_eval "$arg"
-	      CC_quoted="$CC_quoted $func_quote_for_eval_result"
+	      func_append_quoted CC_quoted "$arg"
 	    done
+	    CC_expanded=`func_echo_all $CC`
+	    CC_quoted_expanded=`func_echo_all $CC_quoted`
 	    case "$@ " in
-	      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
+	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
 	      # The compiler in the base compile command matches
 	      # the one in the tagged configuration.
 	      # Assume this is the tagged configuration we want.
@@ -1059,42 +1428,522 @@ func_infer_tag ()
 
 
 
-# func_write_libtool_object output_name pic_name nonpic_name
-# Create a libtool object file (analogous to a ".la" file),
-# but don't create it if we're doing a dry run.
-func_write_libtool_object ()
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+    write_libobj=${1}
+    if test "$build_libtool_libs" = yes; then
+      write_lobj=\'${2}\'
+    else
+      write_lobj=none
+    fi
+
+    if test "$build_old_libs" = yes; then
+      write_oldobj=\'${3}\'
+    else
+      write_oldobj=none
+    fi
+
+    $opt_dry_run || {
+      cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+      $MV "${write_libobj}T" "${write_libobj}"
+    }
+}
+
+
+##################################################
+# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
+##################################################
+
+# func_convert_core_file_wine_to_w32 ARG
+# Helper function used by file name conversion functions when $build is *nix,
+# and $host is mingw, cygwin, or some other w32 environment. Relies on a
+# correctly configured wine environment available, with the winepath program
+# in $build's $PATH.
+#
+# ARG is the $build file name to be converted to w32 format.
+# Result is available in $func_convert_core_file_wine_to_w32_result, and will
+# be empty on error (or when ARG is empty)
+func_convert_core_file_wine_to_w32 ()
+{
+  $opt_debug
+  func_convert_core_file_wine_to_w32_result="$1"
+  if test -n "$1"; then
+    # Unfortunately, winepath does not exit with a non-zero error code, so we
+    # are forced to check the contents of stdout. On the other hand, if the
+    # command is not found, the shell will set an exit code of 127 and print
+    # *an error message* to stdout. So we must check for both error code of
+    # zero AND non-empty stdout, which explains the odd construction:
+    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
+    if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
+      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
+        $SED -e "$lt_sed_naive_backslashify"`
+    else
+      func_convert_core_file_wine_to_w32_result=
+    fi
+  fi
+}
+# end: func_convert_core_file_wine_to_w32
+
+
+# func_convert_core_path_wine_to_w32 ARG
+# Helper function used by path conversion functions when $build is *nix, and
+# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
+# configured wine environment available, with the winepath program in $build's
+# $PATH. Assumes ARG has no leading or trailing path separator characters.
+#
+# ARG is path to be converted from $build format to win32.
+# Result is available in $func_convert_core_path_wine_to_w32_result.
+# Unconvertible file (directory) names in ARG are skipped; if no directory names
+# are convertible, then the result may be empty.
+func_convert_core_path_wine_to_w32 ()
+{
+  $opt_debug
+  # unfortunately, winepath doesn't convert paths, only file names
+  func_convert_core_path_wine_to_w32_result=""
+  if test -n "$1"; then
+    oldIFS=$IFS
+    IFS=:
+    for func_convert_core_path_wine_to_w32_f in $1; do
+      IFS=$oldIFS
+      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
+      if test -n "$func_convert_core_file_wine_to_w32_result" ; then
+        if test -z "$func_convert_core_path_wine_to_w32_result"; then
+          func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
+        else
+          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
+        fi
+      fi
+    done
+    IFS=$oldIFS
+  fi
+}
+# end: func_convert_core_path_wine_to_w32
+
+
+# func_cygpath ARGS...
+# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
+# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
+# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
+# (2), returns the Cygwin file name or path in func_cygpath_result (input
+# file name or path is assumed to be in w32 format, as previously converted
+# from $build's *nix or MSYS format). In case (3), returns the w32 file name
+# or path in func_cygpath_result (input file name or path is assumed to be in
+# Cygwin format). Returns an empty string on error.
+#
+# ARGS are passed to cygpath, with the last one being the file name or path to
+# be converted.
+#
+# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
+# environment variable; do not put it in $PATH.
+func_cygpath ()
+{
+  $opt_debug
+  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
+    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
+    if test "$?" -ne 0; then
+      # on failure, ensure result is empty
+      func_cygpath_result=
+    fi
+  else
+    func_cygpath_result=
+    func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
+  fi
+}
+#end: func_cygpath
+
+
+# func_convert_core_msys_to_w32 ARG
+# Convert file name or path ARG from MSYS format to w32 format.  Return
+# result in func_convert_core_msys_to_w32_result.
+func_convert_core_msys_to_w32 ()
+{
+  $opt_debug
+  # awkward: cmd appends spaces to result
+  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
+    $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+}
+#end: func_convert_core_msys_to_w32
+
+
+# func_convert_file_check ARG1 ARG2
+# Verify that ARG1 (a file name in $build format) was converted to $host
+# format in ARG2. Otherwise, emit an error message, but continue (resetting
+# func_to_host_file_result to ARG1).
+func_convert_file_check ()
+{
+  $opt_debug
+  if test -z "$2" && test -n "$1" ; then
+    func_error "Could not determine host file name corresponding to"
+    func_error "  \`$1'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback:
+    func_to_host_file_result="$1"
+  fi
+}
+# end func_convert_file_check
+
+
+# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
+# Verify that FROM_PATH (a path in $build format) was converted to $host
+# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
+# func_to_host_file_result to a simplistic fallback value (see below).
+func_convert_path_check ()
+{
+  $opt_debug
+  if test -z "$4" && test -n "$3"; then
+    func_error "Could not determine the host path corresponding to"
+    func_error "  \`$3'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback.  This is a deliberately simplistic "conversion" and
+    # should not be "improved".  See libtool.info.
+    if test "x$1" != "x$2"; then
+      lt_replace_pathsep_chars="s|$1|$2|g"
+      func_to_host_path_result=`echo "$3" |
+        $SED -e "$lt_replace_pathsep_chars"`
+    else
+      func_to_host_path_result="$3"
+    fi
+  fi
+}
+# end func_convert_path_check
+
+
+# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
+# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
+# and appending REPL if ORIG matches BACKPAT.
+func_convert_path_front_back_pathsep ()
+{
+  $opt_debug
+  case $4 in
+  $1 ) func_to_host_path_result="$3$func_to_host_path_result"
+    ;;
+  esac
+  case $4 in
+  $2 ) func_append func_to_host_path_result "$3"
+    ;;
+  esac
+}
+# end func_convert_path_front_back_pathsep
+
+
+##################################################
+# $build to $host FILE NAME CONVERSION FUNCTIONS #
+##################################################
+# invoked via `$to_host_file_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# Result will be available in $func_to_host_file_result.
+
+
+# func_to_host_file ARG
+# Converts the file name ARG from $build format to $host format. Return result
+# in func_to_host_file_result.
+func_to_host_file ()
+{
+  $opt_debug
+  $to_host_file_cmd "$1"
+}
+# end func_to_host_file
+
+
+# func_to_tool_file ARG LAZY
+# converts the file name ARG from $build format to toolchain format. Return
+# result in func_to_tool_file_result.  If the conversion in use is listed
+# in (the comma separated) LAZY, no conversion takes place.
+func_to_tool_file ()
+{
+  $opt_debug
+  case ,$2, in
+    *,"$to_tool_file_cmd",*)
+      func_to_tool_file_result=$1
+      ;;
+    *)
+      $to_tool_file_cmd "$1"
+      func_to_tool_file_result=$func_to_host_file_result
+      ;;
+  esac
+}
+# end func_to_tool_file
+
+
+# func_convert_file_noop ARG
+# Copy ARG to func_to_host_file_result.
+func_convert_file_noop ()
+{
+  func_to_host_file_result="$1"
+}
+# end func_convert_file_noop
+
+
+# func_convert_file_msys_to_w32 ARG
+# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_file_result.
+func_convert_file_msys_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_to_host_file_result="$func_convert_core_msys_to_w32_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_w32
+
+
+# func_convert_file_cygwin_to_w32 ARG
+# Convert file name ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_file_cygwin_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
+    # LT_CYGPATH in this case.
+    func_to_host_file_result=`cygpath -m "$1"`
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_cygwin_to_w32
+
+
+# func_convert_file_nix_to_w32 ARG
+# Convert file name ARG from *nix to w32 format.  Requires a wine environment
+# and a working winepath. Returns result in func_to_host_file_result.
+func_convert_file_nix_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_file_wine_to_w32 "$1"
+    func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_w32
+
+
+# func_convert_file_msys_to_cygwin ARG
+# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_file_msys_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_msys_to_w32_result"
+    func_to_host_file_result="$func_cygpath_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_cygwin
+
+
+# func_convert_file_nix_to_cygwin ARG
+# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
+# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
+# in func_to_host_file_result.
+func_convert_file_nix_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
+    func_convert_core_file_wine_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
+    func_to_host_file_result="$func_cygpath_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_cygwin
+
+
+#############################################
+# $build to $host PATH CONVERSION FUNCTIONS #
+#############################################
+# invoked via `$to_host_path_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# The result will be available in $func_to_host_path_result.
+#
+# Path separators are also converted from $build format to $host format.  If
+# ARG begins or ends with a path separator character, it is preserved (but
+# converted to $host format) on output.
+#
+# All path conversion functions are named using the following convention:
+#   file name conversion function    : func_convert_file_X_to_Y ()
+#   path conversion function         : func_convert_path_X_to_Y ()
+# where, for any given $build/$host combination the 'X_to_Y' value is the
+# same.  If conversion functions are added for new $build/$host combinations,
+# the two new functions must follow this pattern, or func_init_to_host_path_cmd
+# will break.
+
+
+# func_init_to_host_path_cmd
+# Ensures that function "pointer" variable $to_host_path_cmd is set to the
+# appropriate value, based on the value of $to_host_file_cmd.
+to_host_path_cmd=
+func_init_to_host_path_cmd ()
+{
+  $opt_debug
+  if test -z "$to_host_path_cmd"; then
+    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
+    to_host_path_cmd="func_convert_path_${func_stripname_result}"
+  fi
+}
+
+
+# func_to_host_path ARG
+# Converts the path ARG from $build format to $host format. Return result
+# in func_to_host_path_result.
+func_to_host_path ()
+{
+  $opt_debug
+  func_init_to_host_path_cmd
+  $to_host_path_cmd "$1"
+}
+# end func_to_host_path
+
+
+# func_convert_path_noop ARG
+# Copy ARG to func_to_host_path_result.
+func_convert_path_noop ()
+{
+  func_to_host_path_result="$1"
+}
+# end func_convert_path_noop
+
+
+# func_convert_path_msys_to_w32 ARG
+# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_path_result.
+func_convert_path_msys_to_w32 ()
 {
-    write_libobj=${1}
-    if test "$build_libtool_libs" = yes; then
-      write_lobj=\'${2}\'
-    else
-      write_lobj=none
-    fi
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from ARG.  MSYS
+    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
+    # and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result="$func_convert_core_msys_to_w32_result"
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_msys_to_w32
 
-    if test "$build_old_libs" = yes; then
-      write_oldobj=\'${3}\'
-    else
-      write_oldobj=none
-    fi
 
-    $opt_dry_run || {
-      cat >${write_libobj}T <<EOF
-# $write_libobj - a libtool object file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
+# func_convert_path_cygwin_to_w32 ARG
+# Convert path ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_path_cygwin_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_cygwin_to_w32
 
-# Name of the PIC object.
-pic_object=$write_lobj
 
-# Name of the non-PIC object
-non_pic_object=$write_oldobj
+# func_convert_path_nix_to_w32 ARG
+# Convert path ARG from *nix to w32 format.  Requires a wine environment and
+# a working winepath.  Returns result in func_to_host_file_result.
+func_convert_path_nix_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_nix_to_w32
 
-EOF
-      $MV "${write_libobj}T" "${write_libobj}"
-    }
+
+# func_convert_path_msys_to_cygwin ARG
+# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_path_msys_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
+    func_to_host_path_result="$func_cygpath_result"
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
+}
+# end func_convert_path_msys_to_cygwin
+
+
+# func_convert_path_nix_to_cygwin ARG
+# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
+# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
+# func_to_host_file_result.
+func_convert_path_nix_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from
+    # ARG. msys behavior is inconsistent here, cygpath turns them
+    # into '.;' and ';.', and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
+    func_to_host_path_result="$func_cygpath_result"
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
 }
+# end func_convert_path_nix_to_cygwin
+
 
 # func_mode_compile arg...
 func_mode_compile ()
@@ -1136,12 +1985,12 @@ func_mode_compile ()
 	  ;;
 
 	-pie | -fpie | -fPIE)
-          pie_flag="$pie_flag $arg"
+          func_append pie_flag " $arg"
 	  continue
 	  ;;
 
 	-shared | -static | -prefer-pic | -prefer-non-pic)
-	  later="$later $arg"
+	  func_append later " $arg"
 	  continue
 	  ;;
 
@@ -1162,15 +2011,14 @@ func_mode_compile ()
 	  save_ifs="$IFS"; IFS=','
 	  for arg in $args; do
 	    IFS="$save_ifs"
-	    func_quote_for_eval "$arg"
-	    lastarg="$lastarg $func_quote_for_eval_result"
+	    func_append_quoted lastarg "$arg"
 	  done
 	  IFS="$save_ifs"
 	  func_stripname ' ' '' "$lastarg"
 	  lastarg=$func_stripname_result
 
 	  # Add the arguments to base_compile.
-	  base_compile="$base_compile $lastarg"
+	  func_append base_compile " $lastarg"
 	  continue
 	  ;;
 
@@ -1186,8 +2034,7 @@ func_mode_compile ()
       esac    #  case $arg_mode
 
       # Aesthetically quote the previous argument.
-      func_quote_for_eval "$lastarg"
-      base_compile="$base_compile $func_quote_for_eval_result"
+      func_append_quoted base_compile "$lastarg"
     done # for arg
 
     case $arg_mode in
@@ -1212,7 +2059,7 @@ func_mode_compile ()
     *.[cCFSifmso] | \
     *.ada | *.adb | *.ads | *.asm | \
     *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
-    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
+    *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
       func_xform "$libobj"
       libobj=$func_xform_result
       ;;
@@ -1275,7 +2122,7 @@ func_mode_compile ()
 
     # On Cygwin there's no "real" PIC flag so we must build both object types
     case $host_os in
-    cygwin* | mingw* | pw32* | os2*)
+    cygwin* | mingw* | pw32* | os2* | cegcc*)
       pic_mode=default
       ;;
     esac
@@ -1287,7 +2134,7 @@ func_mode_compile ()
     # Calculate the filename of the output object if compiler does
     # not support -o with -c
     if test "$compiler_c_o" = no; then
-      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
       lockfile="$output_obj.lock"
     else
       output_obj=
@@ -1318,17 +2165,16 @@ compiler."
 	$opt_dry_run || $RM $removelist
 	exit $EXIT_FAILURE
       fi
-      removelist="$removelist $output_obj"
+      func_append removelist " $output_obj"
       $ECHO "$srcfile" > "$lockfile"
     fi
 
     $opt_dry_run || $RM $removelist
-    removelist="$removelist $lockfile"
+    func_append removelist " $lockfile"
     trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
 
-    if test -n "$fix_srcfile_path"; then
-      eval srcfile=\"$fix_srcfile_path\"
-    fi
+    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
+    srcfile=$func_to_tool_file_result
     func_quote_for_eval "$srcfile"
     qsrcfile=$func_quote_for_eval_result
 
@@ -1348,7 +2194,7 @@ compiler."
 
       if test -z "$output_obj"; then
 	# Place PIC objects in $objdir
-	command="$command -o $lobj"
+	func_append command " -o $lobj"
       fi
 
       func_show_eval_locale "$command"	\
@@ -1395,11 +2241,11 @@ compiler."
 	command="$base_compile $qsrcfile $pic_flag"
       fi
       if test "$compiler_c_o" = yes; then
-	command="$command -o $obj"
+	func_append command " -o $obj"
       fi
 
       # Suppress compiler output if we already did a PIC compilation.
-      command="$command$suppress_output"
+      func_append command "$suppress_output"
       func_show_eval_locale "$command" \
         '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
 
@@ -1444,13 +2290,13 @@ compiler."
 }
 
 $opt_help || {
-test "$mode" = compile && func_mode_compile ${1+"$@"}
+  test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
 }
 
 func_mode_help ()
 {
     # We need to display help for each of the modes.
-    case $mode in
+    case $opt_mode in
       "")
         # Generic help is extracted from the usage comments
         # at the start of this file.
@@ -1481,10 +2327,11 @@ This mode accepts the following additional options:
 
   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
   -no-suppress      do not suppress compiler output for multiple passes
-  -prefer-pic       try to building PIC objects only
-  -prefer-non-pic   try to building non-PIC objects only
+  -prefer-pic       try to build PIC objects only
+  -prefer-non-pic   try to build non-PIC objects only
   -shared           do not build a \`.o' file suitable for static linking
   -static           only build a \`.o' file suitable for static linking
+  -Wc,FLAG          pass FLAG directly to the compiler
 
 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
 from the given SOURCEFILE.
@@ -1537,7 +2384,7 @@ either the \`install' or \`cp' program.
 
 The following components of INSTALL-COMMAND are treated specially:
 
-  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
+  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
 
 The rest of the components are interpreted as arguments to that command (only
 BSD-compatible install options are recognized)."
@@ -1557,6 +2404,8 @@ The following components of LINK-COMMAND are treated specially:
 
   -all-static       do not do any dynamic linking at all
   -avoid-version    do not add a version suffix if possible
+  -bindir BINDIR    specify path to binaries directory (for systems where
+                    libraries must be found in the PATH setting at runtime)
   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
@@ -1585,6 +2434,11 @@ The following components of LINK-COMMAND are treated specially:
   -version-info CURRENT[:REVISION[:AGE]]
                     specify library version info [each variable defaults to 0]
   -weak LIBNAME     declare that the target provides the LIBNAME interface
+  -Wc,FLAG
+  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
+  -Wl,FLAG
+  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
+  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
 
 All other options (arguments beginning with \`-') are ignored.
 
@@ -1618,18 +2472,44 @@ Otherwise, only FILE itself is deleted using RM."
         ;;
 
       *)
-        func_fatal_help "invalid operation mode \`$mode'"
+        func_fatal_help "invalid operation mode \`$opt_mode'"
         ;;
     esac
 
-    $ECHO
+    echo
     $ECHO "Try \`$progname --help' for more information about other modes."
-
-    exit $?
 }
 
-  # Now that we've collected a possible --mode arg, show help if necessary
-  $opt_help && func_mode_help
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+  if test "$opt_help" = :; then
+    func_mode_help
+  else
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+	func_mode_help
+      done
+    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+	echo
+	func_mode_help
+      done
+    } |
+    sed '1d
+      /^When reporting/,/^Report/{
+	H
+	d
+      }
+      $x
+      /information about other modes/d
+      /more detailed .*MODE/d
+      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+  fi
+  exit $?
+fi
 
 
 # func_mode_execute arg...
@@ -1642,13 +2522,16 @@ func_mode_execute ()
       func_fatal_help "you must specify a COMMAND"
 
     # Handle -dlopen flags immediately.
-    for file in $execute_dlfiles; do
+    for file in $opt_dlopen; do
       test -f "$file" \
 	|| func_fatal_help "\`$file' is not a file"
 
       dir=
       case $file in
       *.la)
+	func_resolve_sysroot "$file"
+	file=$func_resolve_sysroot_result
+
 	# Check to see that this really is a libtool archive.
 	func_lalib_unsafe_p "$file" \
 	  || func_fatal_help "\`$lib' is not a valid libtool archive"
@@ -1670,7 +2553,7 @@ func_mode_execute ()
 	dir="$func_dirname_result"
 
 	if test -f "$dir/$objdir/$dlname"; then
-	  dir="$dir/$objdir"
+	  func_append dir "/$objdir"
 	else
 	  if test ! -f "$dir/$dlname"; then
 	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
@@ -1711,7 +2594,7 @@ func_mode_execute ()
     for file
     do
       case $file in
-      -*) ;;
+      -* | *.la | *.lo ) ;;
       *)
 	# Do a test to see if this is really a libtool program.
 	if func_ltwrapper_script_p "$file"; then
@@ -1727,8 +2610,7 @@ func_mode_execute ()
 	;;
       esac
       # Quote arguments (to preserve shell metacharacters).
-      func_quote_for_eval "$file"
-      args="$args $func_quote_for_eval_result"
+      func_append_quoted args "$file"
     done
 
     if test "X$opt_dry_run" = Xfalse; then
@@ -1753,29 +2635,66 @@ func_mode_execute ()
       # Display what would be done.
       if test -n "$shlibpath_var"; then
 	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
-	$ECHO "export $shlibpath_var"
+	echo "export $shlibpath_var"
       fi
       $ECHO "$cmd$args"
       exit $EXIT_SUCCESS
     fi
 }
 
-test "$mode" = execute && func_mode_execute ${1+"$@"}
+test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
 
 
 # func_mode_finish arg...
 func_mode_finish ()
 {
     $opt_debug
-    libdirs="$nonopt"
+    libs=
+    libdirs=
     admincmds=
 
-    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
-      for dir
-      do
-	libdirs="$libdirs $dir"
-      done
+    for opt in "$nonopt" ${1+"$@"}
+    do
+      if test -d "$opt"; then
+	func_append libdirs " $opt"
+
+      elif test -f "$opt"; then
+	if func_lalib_unsafe_p "$opt"; then
+	  func_append libs " $opt"
+	else
+	  func_warning "\`$opt' is not a valid libtool archive"
+	fi
+
+      else
+	func_fatal_error "invalid argument \`$opt'"
+      fi
+    done
+
+    if test -n "$libs"; then
+      if test -n "$lt_sysroot"; then
+        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
+        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
+      else
+        sysroot_cmd=
+      fi
+
+      # Remove sysroot references
+      if $opt_dry_run; then
+        for lib in $libs; do
+          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
+        done
+      else
+        tmpdir=`func_mktempdir`
+        for lib in $libs; do
+	  sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+	    > $tmpdir/tmp-la
+	  mv -f $tmpdir/tmp-la $lib
+	done
+        ${RM}r "$tmpdir"
+      fi
+    fi
 
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
       for libdir in $libdirs; do
 	if test -n "$finish_cmds"; then
 	  # Do each command in the finish commands.
@@ -1785,7 +2704,7 @@ func_mode_finish ()
 	if test -n "$finish_eval"; then
 	  # Do the single finish_eval.
 	  eval cmds=\"$finish_eval\"
-	  $opt_dry_run || eval "$cmds" || admincmds="$admincmds
+	  $opt_dry_run || eval "$cmds" || func_append admincmds "
        $cmds"
 	fi
       done
@@ -1794,53 +2713,55 @@ func_mode_finish ()
     # Exit here if they wanted silent mode.
     $opt_silent && exit $EXIT_SUCCESS
 
-    $ECHO "X----------------------------------------------------------------------" | $Xsed
-    $ECHO "Libraries have been installed in:"
-    for libdir in $libdirs; do
-      $ECHO "   $libdir"
-    done
-    $ECHO
-    $ECHO "If you ever happen to want to link against installed libraries"
-    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
-    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
-    $ECHO "flag during linking and do at least one of the following:"
-    if test -n "$shlibpath_var"; then
-      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
-      $ECHO "     during execution"
-    fi
-    if test -n "$runpath_var"; then
-      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
-      $ECHO "     during linking"
-    fi
-    if test -n "$hardcode_libdir_flag_spec"; then
-      libdir=LIBDIR
-      eval flag=\"$hardcode_libdir_flag_spec\"
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      echo "----------------------------------------------------------------------"
+      echo "Libraries have been installed in:"
+      for libdir in $libdirs; do
+	$ECHO "   $libdir"
+      done
+      echo
+      echo "If you ever happen to want to link against installed libraries"
+      echo "in a given directory, LIBDIR, you must either use libtool, and"
+      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+      echo "flag during linking and do at least one of the following:"
+      if test -n "$shlibpath_var"; then
+	echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+	echo "     during execution"
+      fi
+      if test -n "$runpath_var"; then
+	echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+	echo "     during linking"
+      fi
+      if test -n "$hardcode_libdir_flag_spec"; then
+	libdir=LIBDIR
+	eval flag=\"$hardcode_libdir_flag_spec\"
 
-      $ECHO "   - use the \`$flag' linker flag"
-    fi
-    if test -n "$admincmds"; then
-      $ECHO "   - have your system administrator run these commands:$admincmds"
-    fi
-    if test -f /etc/ld.so.conf; then
-      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
-    fi
-    $ECHO
+	$ECHO "   - use the \`$flag' linker flag"
+      fi
+      if test -n "$admincmds"; then
+	$ECHO "   - have your system administrator run these commands:$admincmds"
+      fi
+      if test -f /etc/ld.so.conf; then
+	echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+      fi
+      echo
 
-    $ECHO "See any operating system documentation about shared libraries for"
-    case $host in
-      solaris2.[6789]|solaris2.1[0-9])
-        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
-	$ECHO "pages."
-	;;
-      *)
-        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
-        ;;
-    esac
-    $ECHO "X----------------------------------------------------------------------" | $Xsed
+      echo "See any operating system documentation about shared libraries for"
+      case $host in
+	solaris2.[6789]|solaris2.1[0-9])
+	  echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+	  echo "pages."
+	  ;;
+	*)
+	  echo "more information, such as the ld(1) and ld.so(8) manual pages."
+	  ;;
+      esac
+      echo "----------------------------------------------------------------------"
+    fi
     exit $EXIT_SUCCESS
 }
 
-test "$mode" = finish && func_mode_finish ${1+"$@"}
+test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
 
 
 # func_mode_install arg...
@@ -1851,7 +2772,7 @@ func_mode_install ()
     # install_prog (especially on Windows NT).
     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
        # Allow the use of GNU shtool's install command.
-       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
+       case $nonopt in *shtool*) :;; *) false;; esac; then
       # Aesthetically quote it.
       func_quote_for_eval "$nonopt"
       install_prog="$func_quote_for_eval_result "
@@ -1865,7 +2786,12 @@ func_mode_install ()
     # The real first argument should be the name of the installation program.
     # Aesthetically quote it.
     func_quote_for_eval "$arg"
-    install_prog="$install_prog$func_quote_for_eval_result"
+    func_append install_prog "$func_quote_for_eval_result"
+    install_shared_prog=$install_prog
+    case " $install_prog " in
+      *[\\\ /]cp\ *) install_cp=: ;;
+      *) install_cp=false ;;
+    esac
 
     # We need to accept at least all the BSD install flags.
     dest=
@@ -1875,10 +2801,12 @@ func_mode_install ()
     install_type=
     isdir=no
     stripme=
+    no_mode=:
     for arg
     do
+      arg2=
       if test -n "$dest"; then
-	files="$files $dest"
+	func_append files " $dest"
 	dest=$arg
 	continue
       fi
@@ -1886,10 +2814,9 @@ func_mode_install ()
       case $arg in
       -d) isdir=yes ;;
       -f)
-	case " $install_prog " in
-	*[\\\ /]cp\ *) ;;
-	*) prev=$arg ;;
-	esac
+	if $install_cp; then :; else
+	  prev=$arg
+	fi
 	;;
       -g | -m | -o)
 	prev=$arg
@@ -1903,6 +2830,10 @@ func_mode_install ()
       *)
 	# If the previous option needed an argument, then skip it.
 	if test -n "$prev"; then
+	  if test "x$prev" = x-m && test -n "$install_override_mode"; then
+	    arg2=$install_override_mode
+	    no_mode=false
+	  fi
 	  prev=
 	else
 	  dest=$arg
@@ -1913,7 +2844,11 @@ func_mode_install ()
 
       # Aesthetically quote the argument.
       func_quote_for_eval "$arg"
-      install_prog="$install_prog $func_quote_for_eval_result"
+      func_append install_prog " $func_quote_for_eval_result"
+      if test -n "$arg2"; then
+	func_quote_for_eval "$arg2"
+      fi
+      func_append install_shared_prog " $func_quote_for_eval_result"
     done
 
     test -z "$install_prog" && \
@@ -1922,6 +2857,13 @@ func_mode_install ()
     test -n "$prev" && \
       func_fatal_help "the \`$prev' option requires an argument"
 
+    if test -n "$install_override_mode" && $no_mode; then
+      if $install_cp; then :; else
+	func_quote_for_eval "$install_override_mode"
+	func_append install_shared_prog " -m $func_quote_for_eval_result"
+      fi
+    fi
+
     if test -z "$files"; then
       if test -z "$dest"; then
 	func_fatal_help "no file or destination specified"
@@ -1976,10 +2918,13 @@ func_mode_install ()
       case $file in
       *.$libext)
 	# Do the static libraries later.
-	staticlibs="$staticlibs $file"
+	func_append staticlibs " $file"
 	;;
 
       *.la)
+	func_resolve_sysroot "$file"
+	file=$func_resolve_sysroot_result
+
 	# Check to see that this really is a libtool archive.
 	func_lalib_unsafe_p "$file" \
 	  || func_fatal_help "\`$file' is not a valid libtool archive"
@@ -1993,23 +2938,23 @@ func_mode_install ()
 	if test "X$destdir" = "X$libdir"; then
 	  case "$current_libdirs " in
 	  *" $libdir "*) ;;
-	  *) current_libdirs="$current_libdirs $libdir" ;;
+	  *) func_append current_libdirs " $libdir" ;;
 	  esac
 	else
 	  # Note the libdir as a future libdir.
 	  case "$future_libdirs " in
 	  *" $libdir "*) ;;
-	  *) future_libdirs="$future_libdirs $libdir" ;;
+	  *) func_append future_libdirs " $libdir" ;;
 	  esac
 	fi
 
 	func_dirname "$file" "/" ""
 	dir="$func_dirname_result"
-	dir="$dir$objdir"
+	func_append dir "$objdir"
 
 	if test -n "$relink_command"; then
 	  # Determine the prefix the user has applied to our future dir.
-	  inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
+	  inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
 
 	  # Don't allow the user to place us outside of our expected
 	  # location b/c this prevents finding dependent libraries that
@@ -2022,9 +2967,9 @@ func_mode_install ()
 
 	  if test -n "$inst_prefix_dir"; then
 	    # Stick the inst_prefix_dir data into the link command.
-	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 	  else
-	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
+	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 	  fi
 
 	  func_warning "relinking \`$file'"
@@ -2042,11 +2987,11 @@ func_mode_install ()
 	  test -n "$relink_command" && srcname="$realname"T
 
 	  # Install the shared library and build the symlinks.
-	  func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
+	  func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
 	      'exit $?'
 	  tstripme="$stripme"
 	  case $host_os in
-	  cygwin* | mingw* | pw32*)
+	  cygwin* | mingw* | pw32* | cegcc*)
 	    case $realname in
 	    *.dll.a)
 	      tstripme=""
@@ -2082,7 +3027,7 @@ func_mode_install ()
 	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
 
 	# Maybe install the static library, too.
-	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+	test -n "$old_library" && func_append staticlibs " $dir/$old_library"
 	;;
 
       *.lo)
@@ -2152,7 +3097,7 @@ func_mode_install ()
 
 	# Do a test to see if this is really a libtool program.
 	case $host in
-	*cygwin*|*mingw*)
+	*cygwin* | *mingw*)
 	    if func_ltwrapper_executable_p "$file"; then
 	      func_ltwrapper_scriptname "$file"
 	      wrapper=$func_ltwrapper_scriptname_result
@@ -2182,7 +3127,7 @@ func_mode_install ()
 	    if test -f "$lib"; then
 	      func_source "$lib"
 	    fi
-	    libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
 	    if test -n "$libdir" && test ! -f "$libfile"; then
 	      func_warning "\`$lib' has not been installed in \`$libdir'"
 	      finalize=no
@@ -2201,7 +3146,7 @@ func_mode_install ()
 		file="$func_basename_result"
 	        outputname="$tmpdir/$file"
 	        # Replace the output file specification.
-	        relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+	        relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
 
 	        $opt_silent || {
 	          func_quote_for_expand "$relink_command"
@@ -2220,7 +3165,7 @@ func_mode_install ()
 	    }
 	  else
 	    # Install the binary that we compiled earlier.
-	    file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+	    file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
 	  fi
 	fi
 
@@ -2279,7 +3224,7 @@ func_mode_install ()
     fi
 }
 
-test "$mode" = install && func_mode_install ${1+"$@"}
+test "$opt_mode" = install && func_mode_install ${1+"$@"}
 
 
 # func_generate_dlsyms outputname originator pic_p
@@ -2322,6 +3267,22 @@ func_generate_dlsyms ()
 extern \"C\" {
 #endif
 
+#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+#endif
+
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
 /* External symbol declarations for the compiler. */\
 "
 
@@ -2331,10 +3292,11 @@ extern \"C\" {
 	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
 
 	  # Add our own program objects to the symbol list.
-	  progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	  progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
 	  for progfile in $progfiles; do
-	    func_verbose "extracting global C symbols from \`$progfile'"
-	    $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
+	    func_to_tool_file "$progfile" func_convert_file_msys_to_w32
+	    func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
+	    $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
 	  done
 
 	  if test -n "$exclude_expsyms"; then
@@ -2358,7 +3320,7 @@ extern \"C\" {
 	      $RM $export_symbols
 	      eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 	      case $host in
-	      *cygwin* | *mingw* )
+	      *cygwin* | *mingw* | *cegcc* )
                 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
                 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
 	        ;;
@@ -2370,7 +3332,7 @@ extern \"C\" {
 	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
 	      eval '$MV "$nlist"T "$nlist"'
 	      case $host in
-	        *cygwin | *mingw* )
+	        *cygwin* | *mingw* | *cegcc* )
 	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 	          ;;
@@ -2383,10 +3345,52 @@ extern \"C\" {
 	  func_verbose "extracting global C symbols from \`$dlprefile'"
 	  func_basename "$dlprefile"
 	  name="$func_basename_result"
-	  $opt_dry_run || {
-	    eval '$ECHO ": $name " >> "$nlist"'
-	    eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
-	  }
+          case $host in
+	    *cygwin* | *mingw* | *cegcc* )
+	      # if an import library, we need to obtain dlname
+	      if func_win32_import_lib_p "$dlprefile"; then
+	        func_tr_sh "$dlprefile"
+	        eval "curr_lafile=\$libfile_$func_tr_sh_result"
+	        dlprefile_dlbasename=""
+	        if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
+	          # Use subshell, to avoid clobbering current variable values
+	          dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
+	          if test -n "$dlprefile_dlname" ; then
+	            func_basename "$dlprefile_dlname"
+	            dlprefile_dlbasename="$func_basename_result"
+	          else
+	            # no lafile. user explicitly requested -dlpreopen <import library>.
+	            $sharedlib_from_linklib_cmd "$dlprefile"
+	            dlprefile_dlbasename=$sharedlib_from_linklib_result
+	          fi
+	        fi
+	        $opt_dry_run || {
+	          if test -n "$dlprefile_dlbasename" ; then
+	            eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
+	          else
+	            func_warning "Could not compute DLL name from $name"
+	            eval '$ECHO ": $name " >> "$nlist"'
+	          fi
+	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
+	            $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
+	        }
+	      else # not an import lib
+	        $opt_dry_run || {
+	          eval '$ECHO ": $name " >> "$nlist"'
+	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	        }
+	      fi
+	    ;;
+	    *)
+	      $opt_dry_run || {
+	        eval '$ECHO ": $name " >> "$nlist"'
+	        func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	        eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	      }
+	    ;;
+          esac
 	done
 
 	$opt_dry_run || {
@@ -2414,36 +3418,19 @@ extern \"C\" {
 	  if test -f "$nlist"S; then
 	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
 	  else
-	    $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
+	    echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
 	  fi
 
-	  $ECHO >> "$output_objdir/$my_dlsyms" "\
+	  echo >> "$output_objdir/$my_dlsyms" "\
 
 /* The mapping between symbol names and symbols.  */
 typedef struct {
   const char *name;
   void *address;
 } lt_dlsymlist;
-"
-	  case $host in
-	  *cygwin* | *mingw* )
-	    $ECHO >> "$output_objdir/$my_dlsyms" "\
-/* DATA imports from DLLs on WIN32 con't be const, because
-   runtime relocations are performed -- see ld's documentation
-   on pseudo-relocs.  */"
-	    lt_dlsym_const= ;;
-	  *osf5*)
-	    echo >> "$output_objdir/$my_dlsyms" "\
-/* This system does not cope well with relocations in const data */"
-	    lt_dlsym_const= ;;
-	  *)
-	    lt_dlsym_const=const ;;
-	  esac
-
-	  $ECHO >> "$output_objdir/$my_dlsyms" "\
-extern $lt_dlsym_const lt_dlsymlist
+extern LT_DLSYM_CONST lt_dlsymlist
 lt_${my_prefix}_LTX_preloaded_symbols[];
-$lt_dlsym_const lt_dlsymlist
+LT_DLSYM_CONST lt_dlsymlist
 lt_${my_prefix}_LTX_preloaded_symbols[] =
 {\
   { \"$my_originator\", (void *) 0 },"
@@ -2456,7 +3443,7 @@ lt_${my_prefix}_LTX_preloaded_symbols[] =
 	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
 	    ;;
 	  esac
-	  $ECHO >> "$output_objdir/$my_dlsyms" "\
+	  echo >> "$output_objdir/$my_dlsyms" "\
   {0, (void *) 0}
 };
 
@@ -2499,7 +3486,7 @@ static const void *lt_preloaded_setup() {
 	for arg in $LTCFLAGS; do
 	  case $arg in
 	  -pie | -fpie | -fPIE) ;;
-	  *) symtab_cflags="$symtab_cflags $arg" ;;
+	  *) func_append symtab_cflags " $arg" ;;
 	  esac
 	done
 
@@ -2512,18 +3499,18 @@ static const void *lt_preloaded_setup() {
 	# Transform the symbol file into the correct name.
 	symfileobj="$output_objdir/${my_outputname}S.$objext"
 	case $host in
-	*cygwin* | *mingw* )
+	*cygwin* | *mingw* | *cegcc* )
 	  if test -f "$output_objdir/$my_outputname.def"; then
-	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
-	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
 	  else
-	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 	  fi
 	  ;;
 	*)
-	  compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-	  finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	  compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
 	  ;;
 	esac
 	;;
@@ -2537,8 +3524,8 @@ static const void *lt_preloaded_setup() {
       # really was required.
 
       # Nullify the symbol file.
-      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
-      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
+      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
     fi
 }
 
@@ -2548,6 +3535,7 @@ static const void *lt_preloaded_setup() {
 # Need a lot of goo to handle *both* DLLs and import libs
 # Has to be a shell function in order to 'eat' the argument
 # that is supplied when $file_magic_command is called.
+# Despite the name, also deal with 64 bit binaries.
 func_win32_libid ()
 {
   $opt_debug
@@ -2558,9 +3546,11 @@ func_win32_libid ()
     win32_libid_type="x86 archive import"
     ;;
   *ar\ archive*) # could be an import, or static
+    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
-       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
-      win32_nmres=`eval $NM -f posix -A $1 |
+       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+      func_to_tool_file "$1" func_convert_file_msys_to_w32
+      win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
 	$SED -n -e '
 	    1,100{
 		/ I /{
@@ -2589,6 +3579,131 @@ func_win32_libid ()
   $ECHO "$win32_libid_type"
 }
 
+# func_cygming_dll_for_implib ARG
+#
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib ()
+{
+  $opt_debug
+  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
+}
+
+# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
+#
+# The is the core of a fallback implementation of a
+# platform-specific function to extract the name of the
+# DLL associated with the specified import library LIBNAME.
+#
+# SECTION_NAME is either .idata$6 or .idata$7, depending
+# on the platform and compiler that created the implib.
+#
+# Echos the name of the DLL associated with the
+# specified import library.
+func_cygming_dll_for_implib_fallback_core ()
+{
+  $opt_debug
+  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
+  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
+    $SED '/^Contents of section '"$match_literal"':/{
+      # Place marker at beginning of archive member dllname section
+      s/.*/====MARK====/
+      p
+      d
+    }
+    # These lines can sometimes be longer than 43 characters, but
+    # are always uninteresting
+    /:[	 ]*file format pe[i]\{,1\}-/d
+    /^In archive [^:]*:/d
+    # Ensure marker is printed
+    /^====MARK====/p
+    # Remove all lines with less than 43 characters
+    /^.\{43\}/!d
+    # From remaining lines, remove first 43 characters
+    s/^.\{43\}//' |
+    $SED -n '
+      # Join marker and all lines until next marker into a single line
+      /^====MARK====/ b para
+      H
+      $ b para
+      b
+      :para
+      x
+      s/\n//g
+      # Remove the marker
+      s/^====MARK====//
+      # Remove trailing dots and whitespace
+      s/[\. \t]*$//
+      # Print
+      /./p' |
+    # we now have a list, one entry per line, of the stringified
+    # contents of the appropriate section of all members of the
+    # archive which possess that section. Heuristic: eliminate
+    # all those which have a first or second character that is
+    # a '.' (that is, objdump's representation of an unprintable
+    # character.) This should work for all archives with less than
+    # 0x302f exports -- but will fail for DLLs whose name actually
+    # begins with a literal '.' or a single character followed by
+    # a '.'.
+    #
+    # Of those that remain, print the first one.
+    $SED -e '/^\./d;/^.\./d;q'
+}
+
+# func_cygming_gnu_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is a GNU/binutils-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_gnu_implib_p ()
+{
+  $opt_debug
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
+  test -n "$func_cygming_gnu_implib_tmp"
+}
+
+# func_cygming_ms_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is an MS-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_ms_implib_p ()
+{
+  $opt_debug
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
+  test -n "$func_cygming_ms_implib_tmp"
+}
+
+# func_cygming_dll_for_implib_fallback ARG
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+#
+# This fallback implementation is for use when $DLLTOOL
+# does not support the --identify-strict option.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib_fallback ()
+{
+  $opt_debug
+  if func_cygming_gnu_implib_p "$1" ; then
+    # binutils import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
+  elif func_cygming_ms_implib_p "$1" ; then
+    # ms-generated import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
+  else
+    # unknown
+    sharedlib_from_linklib_result=""
+  fi
+}
 
 
 # func_extract_an_archive dir oldlib
@@ -2597,7 +3712,18 @@ func_extract_an_archive ()
     $opt_debug
     f_ex_an_ar_dir="$1"; shift
     f_ex_an_ar_oldlib="$1"
-    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
+    if test "$lock_old_archive_extraction" = yes; then
+      lockfile=$f_ex_an_ar_oldlib.lock
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+	func_echo "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    fi
+    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
+		   'stat=$?; rm -f "$lockfile"; exit $stat'
+    if test "$lock_old_archive_extraction" = yes; then
+      $opt_dry_run || rm -f "$lockfile"
+    fi
     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
      :
     else
@@ -2668,7 +3794,7 @@ func_extract_archives ()
 	    darwin_file=
 	    darwin_files=
 	    for darwin_file in $darwin_filelist; do
-	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
 	      $LIPO -create -output "$darwin_file" $darwin_files
 	    done # $darwin_filelist
 	    $RM -rf unfat-$$
@@ -2683,34 +3809,30 @@ func_extract_archives ()
         func_extract_an_archive "$my_xdir" "$my_xabs"
 	;;
       esac
-      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
     done
 
     func_extract_archives_result="$my_oldobjs"
 }
 
 
-
-# func_emit_wrapper arg
+# func_emit_wrapper [arg=no]
 #
-# emit a libtool wrapper script on stdout
-# don't directly open a file because we may want to
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
 # incorporate the script contents within a cygwin/mingw
 # wrapper executable.  Must ONLY be called from within
-# func_mode_link because it depends on a number of variable
+# func_mode_link because it depends on a number of variables
 # set therein.
 #
-# arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
 # variable will take.  If 'yes', then the emitted script
 # will assume that the directory in which it is stored is
-# the '.lib' directory.  This is a cygwin/mingw-specific
+# the $objdir directory.  This is a cygwin/mingw-specific
 # behavior.
 func_emit_wrapper ()
 {
-	func_emit_wrapper_arg1=no
-	if test -n "$1" ; then
-	  func_emit_wrapper_arg1=$1
-	fi
+	func_emit_wrapper_arg1=${1-no}
 
 	$ECHO "\
 #! $SHELL
@@ -2726,7 +3848,6 @@ func_emit_wrapper ()
 
 # Sed substitution that helps us do robust quoting.  It backslashifies
 # metacharacters that are still active within double-quoted strings.
-Xsed='${SED} -e 1s/^X//'
 sed_quote_subst='$sed_quote_subst'
 
 # Be Bourne compatible
@@ -2757,31 +3878,132 @@ if test \"\$libtool_install_magic\" = \"$magic\"; then
 else
   # When we are sourced in execute mode, \$file and \$ECHO are already set.
   if test \"\$libtool_execute_magic\" != \"$magic\"; then
-    ECHO=\"$qecho\"
-    file=\"\$0\"
-    # Make sure echo works.
-    if test \"X\$1\" = X--no-reexec; then
-      # Discard the --no-reexec flag, and continue.
-      shift
-    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
-      # Yippee, \$ECHO works!
-      :
-    else
-      # Restart under the correct shell, and then maybe \$ECHO will work.
-      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
-    fi
-  fi\
+    file=\"\$0\""
+
+    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
+    $ECHO "\
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+    ECHO=\"$qECHO\"
+  fi
+
+# Very basic option parsing. These options are (a) specific to
+# the libtool wrapper, (b) are identical between the wrapper
+# /script/ and the wrapper /executable/ which is used only on
+# windows platforms, and (c) all begin with the string "--lt-"
+# (application programs are unlikely to have options which match
+# this pattern).
+#
+# There are only two supported options: --lt-debug and
+# --lt-dump-script. There is, deliberately, no --lt-help.
+#
+# The first argument to this parsing function should be the
+# script's $0 value, followed by "$@".
+lt_option_debug=
+func_parse_lt_options ()
+{
+  lt_script_arg0=\$0
+  shift
+  for lt_opt
+  do
+    case \"\$lt_opt\" in
+    --lt-debug) lt_option_debug=1 ;;
+    --lt-dump-script)
+        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
+        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
+        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
+        cat \"\$lt_dump_D/\$lt_dump_F\"
+        exit 0
+      ;;
+    --lt-*)
+        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
+        exit 1
+      ;;
+    esac
+  done
+
+  # Print the debug banner immediately:
+  if test -n \"\$lt_option_debug\"; then
+    echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+  fi
+}
+
+# Used when --lt-debug. Prints its arguments to stdout
+# (redirection is the responsibility of the caller)
+func_lt_dump_args ()
+{
+  lt_dump_args_N=1;
+  for lt_arg
+  do
+    \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
+    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
+  done
+}
+
+# Core function for launching the target application
+func_exec_program_core ()
+{
 "
-	$ECHO "\
+  case $host in
+  # Backslashes separate directories on plain windows
+  *-*-mingw | *-*-os2* | *-cegcc*)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+    ;;
+
+  *)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+    ;;
+  esac
+  $ECHO "\
+      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+      exit 1
+}
+
+# A function to encapsulate launching the target application
+# Strips options in the --lt-* namespace from \$@ and
+# launches target application with the remaining arguments.
+func_exec_program ()
+{
+  for lt_wr_arg
+  do
+    case \$lt_wr_arg in
+    --lt-*) ;;
+    *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+    esac
+    shift
+  done
+  func_exec_program_core \${1+\"\$@\"}
+}
+
+  # Parse options
+  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
 
   # Find the directory that this script lives in.
-  thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
 
   # Follow symbolic links until we get to the real thisdir.
-  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
   while test -n \"\$file\"; do
-    destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
 
     # If there was a directory component, then change thisdir.
     if test \"x\$destdir\" != \"x\$file\"; then
@@ -2791,8 +4013,8 @@ else
       esac
     fi
 
-    file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
-    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
   done
 
   # Usually 'no', except on cygwin/mingw when embedded into
@@ -2805,7 +4027,7 @@ else
     fi
     # remove .libs from thisdir
     case \"\$thisdir\" in
-    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
+    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
     $objdir )   thisdir=. ;;
     esac
   fi
@@ -2860,21 +4082,11 @@ else
 
   if test -f \"\$progdir/\$program\"; then"
 
-	# Export our shlibpath_var if we have one.
-	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
-	  $ECHO "\
-    # Add our own library path to $shlibpath_var
-    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
-
-    # Some systems cannot cope with colon-terminated $shlibpath_var
-    # The second colon is a workaround for a bug in BeOS R4 sed
-    $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
-
-    export $shlibpath_var
-"
-	fi
-
 	# fixup the dll searchpath if we need to.
+	#
+	# Fix the DLL searchpath if we need to.  Do this before prepending
+	# to shlibpath, because on Windows, both are PATH and uninstalled
+	# libraries must come first.
 	if test -n "$dllsearchpath"; then
 	  $ECHO "\
     # Add the dll search path components to the executable PATH
@@ -2882,39 +4094,36 @@ else
 "
 	fi
 
-	$ECHO "\
-    if test \"\$libtool_execute_magic\" != \"$magic\"; then
-      # Run the actual program with our arguments.
-"
-	case $host in
-	# Backslashes separate directories on plain windows
-	*-*-mingw | *-*-os2*)
+	# Export our shlibpath_var if we have one.
+	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
 	  $ECHO "\
-      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
-	  ;;
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
 
-	*)
-	  $ECHO "\
-      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+    export $shlibpath_var
 "
-	  ;;
-	esac
+	fi
+
 	$ECHO "\
-      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
-      exit 1
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+      func_exec_program \${1+\"\$@\"}
     fi
   else
     # The program doesn't exist.
     \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
     \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
-    $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
     exit 1
   fi
 fi\
 "
 }
-# end: func_emit_wrapper
+
 
 # func_emit_cwrapperexe_src
 # emit the source code for a wrapper executable on stdout
@@ -2932,20 +4141,18 @@ func_emit_cwrapperexe_src ()
 
    This wrapper executable should never be moved out of the build directory.
    If it is, it will not operate correctly.
-
-   Currently, it simply execs the wrapper *script* "$SHELL $output",
-   but could eventually absorb all of the scripts functionality and
-   exec $objdir/$outputname directly.
 */
 EOF
 	    cat <<"EOF"
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_DEPRECATE 1
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #ifdef _MSC_VER
 # include <direct.h>
 # include <process.h>
 # include <io.h>
-# define setmode _setmode
 #else
 # include <unistd.h>
 # include <stdint.h>
@@ -2962,6 +4169,44 @@ EOF
 #include <fcntl.h>
 #include <sys/stat.h>
 
+/* declarations of non-ANSI functions */
+#if defined(__MINGW32__)
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined(__CYGWIN__)
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined (other platforms) ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined(_MSC_VER)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+# define S_IXUSR _S_IEXEC
+# ifndef _INTPTR_T_DEFINED
+#  define _INTPTR_T_DEFINED
+#  define intptr_t int
+# endif
+#elif defined(__MINGW32__)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+#elif defined(__CYGWIN__)
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined (other platforms) ... */
+#endif
+
 #if defined(PATH_MAX)
 # define LT_PATHMAX PATH_MAX
 #elif defined(MAXPATHLEN)
@@ -2977,14 +4222,7 @@ EOF
 # define S_IXGRP 0
 #endif
 
-#ifdef _MSC_VER
-# define S_IXUSR _S_IEXEC
-# define stat _stat
-# ifndef _INTPTR_T_DEFINED
-#  define intptr_t int
-# endif
-#endif
-
+/* path handling portability macros */
 #ifndef DIR_SEPARATOR
 # define DIR_SEPARATOR '/'
 # define PATH_SEPARATOR ':'
@@ -3015,10 +4253,6 @@ EOF
 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 #endif /* PATH_SEPARATOR_2 */
 
-#ifdef __CYGWIN__
-# define FOPEN_WB "wb"
-#endif
-
 #ifndef FOPEN_WB
 # define FOPEN_WB "w"
 #endif
@@ -3031,22 +4265,13 @@ EOF
   if (stale) { free ((void *) stale); stale = 0; } \
 } while (0)
 
-#undef LTWRAPPER_DEBUGPRINTF
-#if defined DEBUGWRAPPER
-# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
-static void
-ltwrapper_debugprintf (const char *fmt, ...)
-{
-    va_list args;
-    va_start (args, fmt);
-    (void) vfprintf (stderr, fmt, args);
-    va_end (args);
-}
+#if defined(LT_DEBUGWRAPPER)
+static int lt_debug = 1;
 #else
-# define LTWRAPPER_DEBUGPRINTF(args)
+static int lt_debug = 0;
 #endif
 
-const char *program_name = NULL;
+const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
 
 void *xmalloc (size_t num);
 char *xstrdup (const char *string);
@@ -3056,37 +4281,88 @@ char *chase_symlinks (const char *pathspec);
 int make_executable (const char *path);
 int check_executable (const char *path);
 char *strendzap (char *str, const char *pat);
-void lt_fatal (const char *message, ...);
+void lt_debugprintf (const char *file, int line, const char *fmt, ...);
+void lt_fatal (const char *file, int line, const char *message, ...);
+static const char *nonnull (const char *s);
+static const char *nonempty (const char *s);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+char **prepare_spawn (char **argv);
+void lt_dump_script (FILE *f);
+EOF
 
-static const char *script_text =
+	    cat <<EOF
+volatile const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
 EOF
 
-	    func_emit_wrapper yes |
-	        $SED -e 's/\([\\"]\)/\\\1/g' \
-	             -e 's/^/  "/' -e 's/$/\\n"/'
-	    echo ";"
+	    if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+              func_to_host_path "$temp_rpath"
+	      cat <<EOF
+const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
+EOF
+	    else
+	      cat <<"EOF"
+const char * LIB_PATH_VALUE   = "";
+EOF
+	    fi
 
-	    cat <<EOF
-const char * MAGIC_EXE = "$magic_exe";
+	    if test -n "$dllsearchpath"; then
+              func_to_host_path "$dllsearchpath:"
+	      cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
+EOF
+	    else
+	      cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE   = "";
+EOF
+	    fi
+
+	    if test "$fast_install" = yes; then
+	      cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+	    else
+	      cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+	    fi
+
+
+	    cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX         "--lt-"
+
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
+static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
 
 int
 main (int argc, char *argv[])
 {
   char **newargz;
+  int  newargc;
   char *tmp_pathspec;
   char *actual_cwrapper_path;
-  char *shwrapper_name;
+  char *actual_cwrapper_name;
+  char *target_name;
+  char *lt_argv_zero;
   intptr_t rval = 127;
-  FILE *shwrapper;
 
-  const char *dumpscript_opt = "--lt-dump-script";
   int i;
 
   program_name = (char *) xstrdup (base_name (argv[0]));
-  LTWRAPPER_DEBUGPRINTF (("(main) argv[0]      : %s\n", argv[0]));
-  LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
+  newargz = XMALLOC (char *, argc + 1);
 
-  /* very simple arg parsing; don't want to rely on getopt */
+  /* very simple arg parsing; don't want to rely on getopt
+   * also, copy all non cwrapper options to newargz, except
+   * argz[0], which is handled differently
+   */
+  newargc=0;
   for (i = 1; i < argc; i++)
     {
       if (strcmp (argv[i], dumpscript_opt) == 0)
@@ -3099,82 +4375,112 @@ EOF
 		;;
 	      esac
 
-	    cat <<EOF
-	  printf ("%s", script_text);
+	    cat <<"EOF"
+	  lt_dump_script (stdout);
 	  return 0;
 	}
+      if (strcmp (argv[i], debug_opt) == 0)
+	{
+          lt_debug = 1;
+          continue;
+	}
+      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
+        {
+          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+             namespace, but it is not one of the ones we know about and
+             have already dealt with, above (inluding dump-script), then
+             report an error. Otherwise, targets might begin to believe
+             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+             namespace. The first time any user complains about this, we'll
+             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+             or a configure.ac-settable value.
+           */
+          lt_fatal (__FILE__, __LINE__,
+		    "unrecognized %s option: '%s'",
+                    ltwrapper_option_prefix, argv[i]);
+        }
+      /* otherwise ... */
+      newargz[++newargc] = xstrdup (argv[i]);
     }
+  newargz[++newargc] = NULL;
 
-  newargz = XMALLOC (char *, argc + 2);
 EOF
-
-	    if test -n "$TARGETSHELL" ; then
-	      # no path translation at all
-	      lt_newargv0=$TARGETSHELL
-	    else
-	      case "$host" in
-		*mingw* )
-		  # awkward: cmd appends spaces to result
-		  lt_sed_strip_trailing_spaces="s/[ ]*\$//"
-		  lt_newargv0=`( cmd //c echo $SHELL | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo $SHELL`
-		  case $lt_newargv0 in
-		    *.exe | *.EXE) ;;
-		    *) lt_newargv0=$lt_newargv0.exe ;;
-		  esac
-		  ;;
-		* ) lt_newargv0=$SHELL ;;
-	      esac
-	    fi
-
-		cat <<EOF
-  newargz[0] = (char *) xstrdup ("$lt_newargv0");
+	    cat <<EOF
+  /* The GNU banner must be the first non-error debug message */
+  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
 EOF
-
 	    cat <<"EOF"
+  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
+
   tmp_pathspec = find_executable (argv[0]);
   if (tmp_pathspec == NULL)
-    lt_fatal ("Couldn't find %s", argv[0]);
-  LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
-			  tmp_pathspec));
+    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (before symlink chase) at: %s\n",
+		  tmp_pathspec);
 
   actual_cwrapper_path = chase_symlinks (tmp_pathspec);
-  LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
-			  actual_cwrapper_path));
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (after symlink chase) at: %s\n",
+		  actual_cwrapper_path);
   XFREE (tmp_pathspec);
 
-  shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path));
-  strendzap (actual_cwrapper_path, shwrapper_name);
-
-  /* shwrapper_name transforms */
-  strendzap (shwrapper_name, ".exe");
-  tmp_pathspec = XMALLOC (char, (strlen (shwrapper_name) +
-				 strlen ("_ltshwrapperTMP") + 1));
-  strcpy (tmp_pathspec, shwrapper_name);
-  strcat (tmp_pathspec, "_ltshwrapperTMP");
-  XFREE (shwrapper_name);
-  shwrapper_name = tmp_pathspec;
+  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
+  strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+  /* wrapper name transforms */
+  strendzap (actual_cwrapper_name, ".exe");
+  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+  XFREE (actual_cwrapper_name);
+  actual_cwrapper_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  /* target_name transforms -- use actual target program name; might have lt- prefix */
+  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+  strendzap (target_name, ".exe");
+  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+  XFREE (target_name);
+  target_name = tmp_pathspec;
   tmp_pathspec = 0;
-  LTWRAPPER_DEBUGPRINTF (("(main) libtool shell wrapper name: %s\n",
-			  shwrapper_name));
+
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(main) libtool target name: %s\n",
+		  target_name);
 EOF
 
 	    cat <<EOF
-  newargz[1] =
+  newargz[0] =
     XMALLOC (char, (strlen (actual_cwrapper_path) +
-		    strlen ("$objdir") + 1 + strlen (shwrapper_name) + 1));
-  strcpy (newargz[1], actual_cwrapper_path);
-  strcat (newargz[1], "$objdir");
-  strcat (newargz[1], "/");
-  strcat (newargz[1], shwrapper_name);
+		    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+  strcpy (newargz[0], actual_cwrapper_path);
+  strcat (newargz[0], "$objdir");
+  strcat (newargz[0], "/");
 EOF
 
+	    cat <<"EOF"
+  /* stop here, and copy so we don't have to do this twice */
+  tmp_pathspec = xstrdup (newargz[0]);
+
+  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+  strcat (newargz[0], actual_cwrapper_name);
+
+  /* DO want the lt- prefix here if it exists, so use target_name */
+  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+  XFREE (tmp_pathspec);
+  tmp_pathspec = NULL;
+EOF
 
 	    case $host_os in
 	      mingw*)
 	    cat <<"EOF"
   {
     char* p;
-    while ((p = strchr (newargz[1], '\\')) != NULL)
+    while ((p = strchr (newargz[0], '\\')) != NULL)
+      {
+	*p = '/';
+      }
+    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
       {
 	*p = '/';
       }
@@ -3184,62 +4490,63 @@ EOF
 	    esac
 
 	    cat <<"EOF"
-  XFREE (shwrapper_name);
+  XFREE (target_name);
   XFREE (actual_cwrapper_path);
-
-  /* always write in binary mode */
-  if ((shwrapper = fopen (newargz[1], FOPEN_WB)) == 0)
-    {
-      lt_fatal ("Could not open %s for writing", newargz[1]);
-    }
-  fprintf (shwrapper, "%s", script_text);
-  fclose (shwrapper);
-
-  make_executable (newargz[1]);
-
-  for (i = 1; i < argc; i++)
-    newargz[i + 1] = xstrdup (argv[i]);
-  newargz[argc + 1] = NULL;
-
-  for (i = 0; i < argc + 1; i++)
+  XFREE (actual_cwrapper_name);
+
+  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
+  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
+     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
+     because on Windows, both *_VARNAMEs are PATH but uninstalled
+     libraries must come first. */
+  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+
+  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
+		  nonnull (lt_argv_zero));
+  for (i = 0; i < newargc; i++)
     {
-      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, newargz[i]));
+      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
+		      i, nonnull (newargz[i]));
     }
 
 EOF
 
 	    case $host_os in
 	      mingw*)
-		cat <<EOF
+		cat <<"EOF"
   /* execv doesn't actually work on mingw as expected on unix */
-  rval = _spawnv (_P_WAIT, "$lt_newargv0", (const char * const *) newargz);
+  newargz = prepare_spawn (newargz);
+  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
   if (rval == -1)
     {
       /* failed to start process */
-      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"$lt_newargv0\": errno = %d\n", errno));
+      lt_debugprintf (__FILE__, __LINE__,
+		      "(main) failed to launch target \"%s\": %s\n",
+		      lt_argv_zero, nonnull (strerror (errno)));
       return 127;
     }
   return rval;
-}
 EOF
 		;;
 	      *)
-		cat <<EOF
-  execv ("$lt_newargv0", newargz);
+		cat <<"EOF"
+  execv (lt_argv_zero, newargz);
   return rval; /* =127, but avoids unused variable warning */
-}
 EOF
 		;;
 	    esac
 
 	    cat <<"EOF"
+}
 
 void *
 xmalloc (size_t num)
 {
   void *p = (void *) malloc (num);
   if (!p)
-    lt_fatal ("Memory exhausted");
+    lt_fatal (__FILE__, __LINE__, "memory exhausted");
 
   return p;
 }
@@ -3273,8 +4580,8 @@ check_executable (const char *path)
 {
   struct stat st;
 
-  LTWRAPPER_DEBUGPRINTF (("(check_executable)  : %s\n",
-			  path ? (*path ? path : "EMPTY!") : "NULL!"));
+  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
+                  nonempty (path));
   if ((!path) || (!*path))
     return 0;
 
@@ -3291,8 +4598,8 @@ make_executable (const char *path)
   int rval = 0;
   struct stat st;
 
-  LTWRAPPER_DEBUGPRINTF (("(make_executable)   : %s\n",
-			  path ? (*path ? path : "EMPTY!") : "NULL!"));
+  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
+                  nonempty (path));
   if ((!path) || (!*path))
     return 0;
 
@@ -3318,8 +4625,8 @@ find_executable (const char *wrapper)
   int tmp_len;
   char *concat_name;
 
-  LTWRAPPER_DEBUGPRINTF (("(find_executable)   : %s\n",
-			  wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
+  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
+                  nonempty (wrapper));
 
   if ((wrapper == NULL) || (*wrapper == '\0'))
     return NULL;
@@ -3372,7 +4679,8 @@ find_executable (const char *wrapper)
 		{
 		  /* empty path: current directory */
 		  if (getcwd (tmp, LT_PATHMAX) == NULL)
-		    lt_fatal ("getcwd failed");
+		    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+                              nonnull (strerror (errno)));
 		  tmp_len = strlen (tmp);
 		  concat_name =
 		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
@@ -3397,7 +4705,8 @@ find_executable (const char *wrapper)
     }
   /* Relative path | not found in path: prepend cwd */
   if (getcwd (tmp, LT_PATHMAX) == NULL)
-    lt_fatal ("getcwd failed");
+    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+              nonnull (strerror (errno)));
   tmp_len = strlen (tmp);
   concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
   memcpy (concat_name, tmp, tmp_len);
@@ -3423,8 +4732,9 @@ chase_symlinks (const char *pathspec)
   int has_symlinks = 0;
   while (strlen (tmp_pathspec) && !has_symlinks)
     {
-      LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
-			      tmp_pathspec));
+      lt_debugprintf (__FILE__, __LINE__,
+		      "checking path component for symlinks: %s\n",
+		      tmp_pathspec);
       if (lstat (tmp_pathspec, &s) == 0)
 	{
 	  if (S_ISLNK (s.st_mode) != 0)
@@ -3446,8 +4756,9 @@ chase_symlinks (const char *pathspec)
 	}
       else
 	{
-	  char *errstr = strerror (errno);
-	  lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
+	  lt_fatal (__FILE__, __LINE__,
+		    "error accessing file \"%s\": %s",
+		    tmp_pathspec, nonnull (strerror (errno)));
 	}
     }
   XFREE (tmp_pathspec);
@@ -3460,7 +4771,8 @@ chase_symlinks (const char *pathspec)
   tmp_pathspec = realpath (pathspec, buf);
   if (tmp_pathspec == 0)
     {
-      lt_fatal ("Could not follow symlinks for %s", pathspec);
+      lt_fatal (__FILE__, __LINE__,
+		"could not follow symlinks for %s", pathspec);
     }
   return xstrdup (tmp_pathspec);
 #endif
@@ -3486,11 +4798,25 @@ strendzap (char *str, const char *pat)
   return str;
 }
 
+void
+lt_debugprintf (const char *file, int line, const char *fmt, ...)
+{
+  va_list args;
+  if (lt_debug)
+    {
+      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
+      va_start (args, fmt);
+      (void) vfprintf (stderr, fmt, args);
+      va_end (args);
+    }
+}
+
 static void
-lt_error_core (int exit_status, const char *mode,
+lt_error_core (int exit_status, const char *file,
+	       int line, const char *mode,
 	       const char *message, va_list ap)
 {
-  fprintf (stderr, "%s: %s: ", program_name, mode);
+  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
   vfprintf (stderr, message, ap);
   fprintf (stderr, ".\n");
 
@@ -3499,23 +4825,264 @@ lt_error_core (int exit_status, const char *mode,
 }
 
 void
-lt_fatal (const char *message, ...)
+lt_fatal (const char *file, int line, const char *message, ...)
 {
   va_list ap;
   va_start (ap, message);
-  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
   va_end (ap);
 }
+
+static const char *
+nonnull (const char *s)
+{
+  return s ? s : "(null)";
+}
+
+static const char *
+nonempty (const char *s)
+{
+  return (s && !*s) ? "(empty)" : nonnull (s);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_setenv) setting '%s' to '%s'\n",
+                  nonnull (name), nonnull (value));
+  {
+#ifdef HAVE_SETENV
+    /* always make a copy, for consistency with !HAVE_SETENV */
+    char *str = xstrdup (value);
+    setenv (name, str, 1);
+#else
+    int len = strlen (name) + 1 + strlen (value) + 1;
+    char *str = XMALLOC (char, len);
+    sprintf (str, "%s=%s", name, value);
+    if (putenv (str) != EXIT_SUCCESS)
+      {
+        XFREE (str);
+      }
+#endif
+  }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+  char *new_value;
+  if (orig_value && *orig_value)
+    {
+      int orig_value_len = strlen (orig_value);
+      int add_len = strlen (add);
+      new_value = XMALLOC (char, add_len + orig_value_len + 1);
+      if (to_end)
+        {
+          strcpy (new_value, orig_value);
+          strcpy (new_value + orig_value_len, add);
+        }
+      else
+        {
+          strcpy (new_value, add);
+          strcpy (new_value + add_len, orig_value);
+        }
+    }
+  else
+    {
+      new_value = xstrdup (add);
+    }
+  return new_value;
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      /* some systems can't cope with a ':'-terminated path #' */
+      int len = strlen (new_value);
+      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+        {
+          new_value[len-1] = '\0';
+        }
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+EOF
+	    case $host_os in
+	      mingw*)
+		cat <<"EOF"
+
+/* Prepares an argument vector before calling spawn().
+   Note that spawn() does not by itself call the command interpreter
+     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
+      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+         GetVersionEx(&v);
+         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
+      }) ? "cmd.exe" : "command.com").
+   Instead it simply concatenates the arguments, separated by ' ', and calls
+   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
+   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
+   special way:
+   - Space and tab are interpreted as delimiters. They are not treated as
+     delimiters if they are surrounded by double quotes: "...".
+   - Unescaped double quotes are removed from the input. Their only effect is
+     that within double quotes, space and tab are treated like normal
+     characters.
+   - Backslashes not followed by double quotes are not special.
+   - But 2*n+1 backslashes followed by a double quote become
+     n backslashes followed by a double quote (n >= 0):
+       \" -> "
+       \\\" -> \"
+       \\\\\" -> \\"
+ */
+#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+char **
+prepare_spawn (char **argv)
+{
+  size_t argc;
+  char **new_argv;
+  size_t i;
+
+  /* Count number of arguments.  */
+  for (argc = 0; argv[argc] != NULL; argc++)
+    ;
+
+  /* Allocate new argument vector.  */
+  new_argv = XMALLOC (char *, argc + 1);
+
+  /* Put quoted arguments into the new argument vector.  */
+  for (i = 0; i < argc; i++)
+    {
+      const char *string = argv[i];
+
+      if (string[0] == '\0')
+	new_argv[i] = xstrdup ("\"\"");
+      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
+	{
+	  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
+	  size_t length;
+	  unsigned int backslashes;
+	  const char *s;
+	  char *quoted_string;
+	  char *p;
+
+	  length = 0;
+	  backslashes = 0;
+	  if (quote_around)
+	    length++;
+	  for (s = string; *s != '\0'; s++)
+	    {
+	      char c = *s;
+	      if (c == '"')
+		length += backslashes + 1;
+	      length++;
+	      if (c == '\\')
+		backslashes++;
+	      else
+		backslashes = 0;
+	    }
+	  if (quote_around)
+	    length += backslashes + 1;
+
+	  quoted_string = XMALLOC (char, length + 1);
+
+	  p = quoted_string;
+	  backslashes = 0;
+	  if (quote_around)
+	    *p++ = '"';
+	  for (s = string; *s != '\0'; s++)
+	    {
+	      char c = *s;
+	      if (c == '"')
+		{
+		  unsigned int j;
+		  for (j = backslashes + 1; j > 0; j--)
+		    *p++ = '\\';
+		}
+	      *p++ = c;
+	      if (c == '\\')
+		backslashes++;
+	      else
+		backslashes = 0;
+	    }
+	  if (quote_around)
+	    {
+	      unsigned int j;
+	      for (j = backslashes; j > 0; j--)
+		*p++ = '\\';
+	      *p++ = '"';
+	    }
+	  *p = '\0';
+
+	  new_argv[i] = quoted_string;
+	}
+      else
+	new_argv[i] = (char *) string;
+    }
+  new_argv[argc] = NULL;
+
+  return new_argv;
+}
+EOF
+		;;
+	    esac
+
+            cat <<"EOF"
+void lt_dump_script (FILE* f)
+{
+EOF
+	    func_emit_wrapper yes |
+              $SED -e 's/\([\\"]\)/\\\1/g' \
+	           -e 's/^/  fputs ("/' -e 's/$/\\n", f);/'
+
+            cat <<"EOF"
+}
 EOF
 }
 # end: func_emit_cwrapperexe_src
 
+# func_win32_import_lib_p ARG
+# True if ARG is an import lib, as indicated by $file_magic_cmd
+func_win32_import_lib_p ()
+{
+    $opt_debug
+    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
+    *import*) : ;;
+    *) false ;;
+    esac
+}
+
 # func_mode_link arg...
 func_mode_link ()
 {
     $opt_debug
     case $host in
-    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
       # It is impossible to link a dll without this setting, and
       # we shouldn't force the makefile maintainer to figure out
       # which system we are compiling for in order to pass an extra
@@ -3554,6 +5121,7 @@ func_mode_link ()
     new_inherited_linker_flags=
 
     avoid_version=no
+    bindir=
     dlfiles=
     dlprefiles=
     dlself=no
@@ -3646,6 +5214,11 @@ func_mode_link ()
 	esac
 
 	case $prev in
+	bindir)
+	  bindir="$arg"
+	  prev=
+	  continue
+	  ;;
 	dlfiles|dlprefiles)
 	  if test "$preload" = no; then
 	    # Add the symbol object into the linking commands.
@@ -3677,9 +5250,9 @@ func_mode_link ()
 	    ;;
 	  *)
 	    if test "$prev" = dlfiles; then
-	      dlfiles="$dlfiles $arg"
+	      func_append dlfiles " $arg"
 	    else
-	      dlprefiles="$dlprefiles $arg"
+	      func_append dlprefiles " $arg"
 	    fi
 	    prev=
 	    continue
@@ -3703,7 +5276,7 @@ func_mode_link ()
 	    *-*-darwin*)
 	      case "$deplibs " in
 		*" $qarg.ltframework "*) ;;
-		*) deplibs="$deplibs $qarg.ltframework" # this is fixed later
+		*) func_append deplibs " $qarg.ltframework" # this is fixed later
 		   ;;
 	      esac
 	      ;;
@@ -3722,7 +5295,7 @@ func_mode_link ()
 	    moreargs=
 	    for fil in `cat "$save_arg"`
 	    do
-#	      moreargs="$moreargs $fil"
+#	      func_append moreargs " $fil"
 	      arg=$fil
 	      # A libtool-controlled object.
 
@@ -3751,7 +5324,7 @@ func_mode_link ()
 
 		  if test "$prev" = dlfiles; then
 		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		      dlfiles="$dlfiles $pic_object"
+		      func_append dlfiles " $pic_object"
 		      prev=
 		      continue
 		    else
@@ -3763,7 +5336,7 @@ func_mode_link ()
 		  # CHECK ME:  I think I busted this.  -Ossama
 		  if test "$prev" = dlprefiles; then
 		    # Preload the old-style object.
-		    dlprefiles="$dlprefiles $pic_object"
+		    func_append dlprefiles " $pic_object"
 		    prev=
 		  fi
 
@@ -3833,12 +5406,12 @@ func_mode_link ()
 	  if test "$prev" = rpath; then
 	    case "$rpath " in
 	    *" $arg "*) ;;
-	    *) rpath="$rpath $arg" ;;
+	    *) func_append rpath " $arg" ;;
 	    esac
 	  else
 	    case "$xrpath " in
 	    *" $arg "*) ;;
-	    *) xrpath="$xrpath $arg" ;;
+	    *) func_append xrpath " $arg" ;;
 	    esac
 	  fi
 	  prev=
@@ -3850,28 +5423,28 @@ func_mode_link ()
 	  continue
 	  ;;
 	weak)
-	  weak_libs="$weak_libs $arg"
+	  func_append weak_libs " $arg"
 	  prev=
 	  continue
 	  ;;
 	xcclinker)
-	  linker_flags="$linker_flags $qarg"
-	  compiler_flags="$compiler_flags $qarg"
+	  func_append linker_flags " $qarg"
+	  func_append compiler_flags " $qarg"
 	  prev=
 	  func_append compile_command " $qarg"
 	  func_append finalize_command " $qarg"
 	  continue
 	  ;;
 	xcompiler)
-	  compiler_flags="$compiler_flags $qarg"
+	  func_append compiler_flags " $qarg"
 	  prev=
 	  func_append compile_command " $qarg"
 	  func_append finalize_command " $qarg"
 	  continue
 	  ;;
 	xlinker)
-	  linker_flags="$linker_flags $qarg"
-	  compiler_flags="$compiler_flags $wl$qarg"
+	  func_append linker_flags " $qarg"
+	  func_append compiler_flags " $wl$qarg"
 	  prev=
 	  func_append compile_command " $wl$qarg"
 	  func_append finalize_command " $wl$qarg"
@@ -3907,6 +5480,11 @@ func_mode_link ()
 	continue
 	;;
 
+      -bindir)
+	prev=bindir
+	continue
+	;;
+
       -dlopen)
 	prev=dlfiles
 	continue
@@ -3957,8 +5535,16 @@ func_mode_link ()
 	;;
 
       -L*)
-	func_stripname '-L' '' "$arg"
-	dir=$func_stripname_result
+	func_stripname "-L" '' "$arg"
+	if test -z "$func_stripname_result"; then
+	  if test "$#" -gt 0; then
+	    func_fatal_error "require no space between \`-L' and \`$1'"
+	  else
+	    func_fatal_error "need path for \`-L' option"
+	  fi
+	fi
+	func_resolve_sysroot "$func_stripname_result"
+	dir=$func_resolve_sysroot_result
 	# We need an absolute path.
 	case $dir in
 	[\\/]* | [A-Za-z]:[\\/]*) ;;
@@ -3970,22 +5556,30 @@ func_mode_link ()
 	  ;;
 	esac
 	case "$deplibs " in
-	*" -L$dir "*) ;;
+	*" -L$dir "* | *" $arg "*)
+	  # Will only happen for absolute or sysroot arguments
+	  ;;
 	*)
-	  deplibs="$deplibs -L$dir"
-	  lib_search_path="$lib_search_path $dir"
+	  # Preserve sysroot, but never include relative directories
+	  case $dir in
+	    [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
+	    *) func_append deplibs " -L$dir" ;;
+	  esac
+	  func_append lib_search_path " $dir"
 	  ;;
 	esac
 	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
-	  testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
 	  case :$dllsearchpath: in
 	  *":$dir:"*) ;;
-	  *) dllsearchpath="$dllsearchpath:$dir";;
+	  ::) dllsearchpath=$dir;;
+	  *) func_append dllsearchpath ":$dir";;
 	  esac
 	  case :$dllsearchpath: in
 	  *":$testbindir:"*) ;;
-	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  ::) dllsearchpath=$testbindir;;
+	  *) func_append dllsearchpath ":$testbindir";;
 	  esac
 	  ;;
 	esac
@@ -3995,7 +5589,7 @@ func_mode_link ()
       -l*)
 	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
 	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
 	    # These systems don't actually have a C or math library (as such)
 	    continue
 	    ;;
@@ -4009,7 +5603,7 @@ func_mode_link ()
 	    ;;
 	  *-*-rhapsody* | *-*-darwin1.[012])
 	    # Rhapsody C and math libraries are in the System framework
-	    deplibs="$deplibs System.ltframework"
+	    func_append deplibs " System.ltframework"
 	    continue
 	    ;;
 	  *-*-sco3.2v5* | *-*-sco5v6*)
@@ -4029,7 +5623,7 @@ func_mode_link ()
 	   ;;
 	 esac
 	fi
-	deplibs="$deplibs $arg"
+	func_append deplibs " $arg"
 	continue
 	;;
 
@@ -4041,8 +5635,8 @@ func_mode_link ()
       # Tru64 UNIX uses -model [arg] to determine the layout of C++
       # classes, name mangling, and exception handling.
       # Darwin uses the -arch flag to determine output architecture.
-      -model|-arch|-isysroot)
-	compiler_flags="$compiler_flags $arg"
+      -model|-arch|-isysroot|--sysroot)
+	func_append compiler_flags " $arg"
 	func_append compile_command " $arg"
 	func_append finalize_command " $arg"
 	prev=xcompiler
@@ -4050,12 +5644,12 @@ func_mode_link ()
 	;;
 
       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
-	compiler_flags="$compiler_flags $arg"
+	func_append compiler_flags " $arg"
 	func_append compile_command " $arg"
 	func_append finalize_command " $arg"
 	case "$new_inherited_linker_flags " in
 	    *" $arg "*) ;;
-	    * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
+	    * ) func_append new_inherited_linker_flags " $arg" ;;
 	esac
 	continue
 	;;
@@ -4072,7 +5666,7 @@ func_mode_link ()
 
       -no-install)
 	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
 	  # The PATH hackery in wrapper scripts is required on Windows
 	  # and Darwin in order for the loader to find any dlls it needs.
 	  func_warning "\`-no-install' is ignored for $host"
@@ -4122,13 +5716,17 @@ func_mode_link ()
 	# We need an absolute path.
 	case $dir in
 	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	=*)
+	  func_stripname '=' '' "$dir"
+	  dir=$lt_sysroot$func_stripname_result
+	  ;;
 	*)
 	  func_fatal_error "only absolute run-paths are allowed"
 	  ;;
 	esac
 	case "$xrpath " in
 	*" $dir "*) ;;
-	*) xrpath="$xrpath $dir" ;;
+	*) func_append xrpath " $dir" ;;
 	esac
 	continue
 	;;
@@ -4181,8 +5779,8 @@ func_mode_link ()
 	for flag in $args; do
 	  IFS="$save_ifs"
           func_quote_for_eval "$flag"
-	  arg="$arg $wl$func_quote_for_eval_result"
-	  compiler_flags="$compiler_flags $func_quote_for_eval_result"
+	  func_append arg " $func_quote_for_eval_result"
+	  func_append compiler_flags " $func_quote_for_eval_result"
 	done
 	IFS="$save_ifs"
 	func_stripname ' ' '' "$arg"
@@ -4197,9 +5795,9 @@ func_mode_link ()
 	for flag in $args; do
 	  IFS="$save_ifs"
           func_quote_for_eval "$flag"
-	  arg="$arg $wl$func_quote_for_eval_result"
-	  compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
-	  linker_flags="$linker_flags $func_quote_for_eval_result"
+	  func_append arg " $wl$func_quote_for_eval_result"
+	  func_append compiler_flags " $wl$func_quote_for_eval_result"
+	  func_append linker_flags " $func_quote_for_eval_result"
 	done
 	IFS="$save_ifs"
 	func_stripname ' ' '' "$arg"
@@ -4227,23 +5825,27 @@ func_mode_link ()
 	arg="$func_quote_for_eval_result"
 	;;
 
-      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
-      # -r[0-9][0-9]* specifies the processor on the SGI compiler
-      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
-      # +DA*, +DD* enable 64-bit mode on the HP compiler
-      # -q* pass through compiler args for the IBM compiler
-      # -m*, -t[45]*, -txscale* pass through architecture-specific
-      # compiler args for GCC
-      # -F/path gives path to uninstalled frameworks, gcc on darwin
-      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
-      # @file GCC response files
+      # Flags to be passed through unchanged, with rationale:
+      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
+      # -r[0-9][0-9]*        specify processor for the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
+      # +DA*, +DD*           enable 64-bit mode for the HP compiler
+      # -q*                  compiler args for the IBM compiler
+      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
+      # -F/path              path to uninstalled frameworks, gcc on darwin
+      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
+      # @file                GCC response files
+      # -tp=*                Portland pgcc target processor selection
+      # --sysroot=*          for sysroot support
+      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
         func_quote_for_eval "$arg"
 	arg="$func_quote_for_eval_result"
         func_append compile_command " $arg"
         func_append finalize_command " $arg"
-        compiler_flags="$compiler_flags $arg"
+        func_append compiler_flags " $arg"
         continue
         ;;
 
@@ -4255,7 +5857,7 @@ func_mode_link ()
 
       *.$objext)
 	# A standard object.
-	objs="$objs $arg"
+	func_append objs " $arg"
 	;;
 
       *.lo)
@@ -4286,7 +5888,7 @@ func_mode_link ()
 
 	    if test "$prev" = dlfiles; then
 	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		dlfiles="$dlfiles $pic_object"
+		func_append dlfiles " $pic_object"
 		prev=
 		continue
 	      else
@@ -4298,7 +5900,7 @@ func_mode_link ()
 	    # CHECK ME:  I think I busted this.  -Ossama
 	    if test "$prev" = dlprefiles; then
 	      # Preload the old-style object.
-	      dlprefiles="$dlprefiles $pic_object"
+	      func_append dlprefiles " $pic_object"
 	      prev=
 	    fi
 
@@ -4343,24 +5945,25 @@ func_mode_link ()
 
       *.$libext)
 	# An archive.
-	deplibs="$deplibs $arg"
-	old_deplibs="$old_deplibs $arg"
+	func_append deplibs " $arg"
+	func_append old_deplibs " $arg"
 	continue
 	;;
 
       *.la)
 	# A libtool-controlled library.
 
+	func_resolve_sysroot "$arg"
 	if test "$prev" = dlfiles; then
 	  # This library was specified with -dlopen.
-	  dlfiles="$dlfiles $arg"
+	  func_append dlfiles " $func_resolve_sysroot_result"
 	  prev=
 	elif test "$prev" = dlprefiles; then
 	  # The library was specified with -dlpreopen.
-	  dlprefiles="$dlprefiles $arg"
+	  func_append dlprefiles " $func_resolve_sysroot_result"
 	  prev=
 	else
-	  deplibs="$deplibs $arg"
+	  func_append deplibs " $func_resolve_sysroot_result"
 	fi
 	continue
 	;;
@@ -4398,7 +6001,7 @@ func_mode_link ()
 
     if test -n "$shlibpath_var"; then
       # get the directories listed in $shlibpath_var
-      eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
     else
       shlib_search_path=
     fi
@@ -4407,6 +6010,8 @@ func_mode_link ()
 
     func_dirname "$output" "/" ""
     output_objdir="$func_dirname_result$objdir"
+    func_to_tool_file "$output_objdir/"
+    tool_output_objdir=$func_to_tool_file_result
     # Create the object directory.
     func_mkdir_p "$output_objdir"
 
@@ -4427,12 +6032,12 @@ func_mode_link ()
     # Find all interdependent deplibs by searching for libraries
     # that are linked more than once (e.g. -la -lb -la)
     for deplib in $deplibs; do
-      if $opt_duplicate_deps ; then
+      if $opt_preserve_dup_deps ; then
 	case "$libs " in
-	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	*" $deplib "*) func_append specialdeplibs " $deplib" ;;
 	esac
       fi
-      libs="$libs $deplib"
+      func_append libs " $deplib"
     done
 
     if test "$linkmode" = lib; then
@@ -4445,9 +6050,9 @@ func_mode_link ()
       if $opt_duplicate_compiler_generated_deps; then
 	for pre_post_dep in $predeps $postdeps; do
 	  case "$pre_post_deps " in
-	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+	  *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
 	  esac
-	  pre_post_deps="$pre_post_deps $pre_post_dep"
+	  func_append pre_post_deps " $pre_post_dep"
 	done
       fi
       pre_post_deps=
@@ -4514,17 +6119,19 @@ func_mode_link ()
 	for lib in $dlprefiles; do
 	  # Ignore non-libtool-libs
 	  dependency_libs=
+	  func_resolve_sysroot "$lib"
 	  case $lib in
-	  *.la)	func_source "$lib" ;;
+	  *.la)	func_source "$func_resolve_sysroot_result" ;;
 	  esac
 
 	  # Collect preopened libtool deplibs, except any this library
 	  # has declared as weak libs
 	  for deplib in $dependency_libs; do
-            deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
+	    func_basename "$deplib"
+            deplib_base=$func_basename_result
 	    case " $weak_libs " in
 	    *" $deplib_base "*) ;;
-	    *) deplibs="$deplibs $deplib" ;;
+	    *) func_append deplibs " $deplib" ;;
 	    esac
 	  done
 	done
@@ -4545,11 +6152,11 @@ func_mode_link ()
 	    compile_deplibs="$deplib $compile_deplibs"
 	    finalize_deplibs="$deplib $finalize_deplibs"
 	  else
-	    compiler_flags="$compiler_flags $deplib"
+	    func_append compiler_flags " $deplib"
 	    if test "$linkmode" = lib ; then
 		case "$new_inherited_linker_flags " in
 		    *" $deplib "*) ;;
-		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+		    * ) func_append new_inherited_linker_flags " $deplib" ;;
 		esac
 	    fi
 	  fi
@@ -4634,7 +6241,7 @@ func_mode_link ()
 	    if test "$linkmode" = lib ; then
 		case "$new_inherited_linker_flags " in
 		    *" $deplib "*) ;;
-		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+		    * ) func_append new_inherited_linker_flags " $deplib" ;;
 		esac
 	    fi
 	  fi
@@ -4647,7 +6254,8 @@ func_mode_link ()
 	    test "$pass" = conv && continue
 	    newdependency_libs="$deplib $newdependency_libs"
 	    func_stripname '-L' '' "$deplib"
-	    newlib_search_path="$newlib_search_path $func_stripname_result"
+	    func_resolve_sysroot "$func_stripname_result"
+	    func_append newlib_search_path " $func_resolve_sysroot_result"
 	    ;;
 	  prog)
 	    if test "$pass" = conv; then
@@ -4661,7 +6269,8 @@ func_mode_link ()
 	      finalize_deplibs="$deplib $finalize_deplibs"
 	    fi
 	    func_stripname '-L' '' "$deplib"
-	    newlib_search_path="$newlib_search_path $func_stripname_result"
+	    func_resolve_sysroot "$func_stripname_result"
+	    func_append newlib_search_path " $func_resolve_sysroot_result"
 	    ;;
 	  *)
 	    func_warning "\`-L' is ignored for archives/objects"
@@ -4672,17 +6281,21 @@ func_mode_link ()
 	-R*)
 	  if test "$pass" = link; then
 	    func_stripname '-R' '' "$deplib"
-	    dir=$func_stripname_result
+	    func_resolve_sysroot "$func_stripname_result"
+	    dir=$func_resolve_sysroot_result
 	    # Make sure the xrpath contains only unique directories.
 	    case "$xrpath " in
 	    *" $dir "*) ;;
-	    *) xrpath="$xrpath $dir" ;;
+	    *) func_append xrpath " $dir" ;;
 	    esac
 	  fi
 	  deplibs="$deplib $deplibs"
 	  continue
 	  ;;
-	*.la) lib="$deplib" ;;
+	*.la)
+	  func_resolve_sysroot "$deplib"
+	  lib=$func_resolve_sysroot_result
+	  ;;
 	*.$libext)
 	  if test "$pass" = conv; then
 	    deplibs="$deplib $deplibs"
@@ -4700,7 +6313,7 @@ func_mode_link ()
 		match_pattern*)
 		  set dummy $deplibs_check_method; shift
 		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
-		  if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
+		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
 		    | $EGREP "$match_pattern_regex" > /dev/null; then
 		    valid_a_lib=yes
 		  fi
@@ -4710,15 +6323,15 @@ func_mode_link ()
 		;;
 	      esac
 	      if test "$valid_a_lib" != yes; then
-		$ECHO
+		echo
 		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
-		$ECHO "*** I have the capability to make that library automatically link in when"
-		$ECHO "*** you link to this library.  But I can only do this if you have a"
-		$ECHO "*** shared version of the library, which you do not appear to have"
-		$ECHO "*** because the file extensions .$libext of this argument makes me believe"
-		$ECHO "*** that it is just a static archive that I should not use here."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because the file extensions .$libext of this argument makes me believe"
+		echo "*** that it is just a static archive that I should not use here."
 	      else
-		$ECHO
+		echo
 		$ECHO "*** Warning: Linking the shared library $output against the"
 		$ECHO "*** static library $deplib is not portable!"
 		deplibs="$deplib $deplibs"
@@ -4745,11 +6358,11 @@ func_mode_link ()
 	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 	      # If there is no dlopen support or we're linking statically,
 	      # we need to preload.
-	      newdlprefiles="$newdlprefiles $deplib"
+	      func_append newdlprefiles " $deplib"
 	      compile_deplibs="$deplib $compile_deplibs"
 	      finalize_deplibs="$deplib $finalize_deplibs"
 	    else
-	      newdlfiles="$newdlfiles $deplib"
+	      func_append newdlfiles " $deplib"
 	    fi
 	  fi
 	  continue
@@ -4791,20 +6404,20 @@ func_mode_link ()
 
 	# Convert "-framework foo" to "foo.ltframework"
 	if test -n "$inherited_linker_flags"; then
-	  tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
+	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
 	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
 	    case " $new_inherited_linker_flags " in
 	      *" $tmp_inherited_linker_flag "*) ;;
-	      *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
+	      *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
 	    esac
 	  done
 	fi
-	dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 	if test "$linkmode,$pass" = "lib,link" ||
 	   test "$linkmode,$pass" = "prog,scan" ||
 	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
-	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
-	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+	  test -n "$dlopen" && func_append dlfiles " $dlopen"
+	  test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
 	fi
 
 	if test "$pass" = conv; then
@@ -4815,20 +6428,20 @@ func_mode_link ()
 	      func_fatal_error "cannot find name of link library for \`$lib'"
 	    fi
 	    # It is a libtool convenience library, so add in its objects.
-	    convenience="$convenience $ladir/$objdir/$old_library"
-	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
+	    func_append convenience " $ladir/$objdir/$old_library"
+	    func_append old_convenience " $ladir/$objdir/$old_library"
 	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
 	    func_fatal_error "\`$lib' is not a convenience library"
 	  fi
 	  tmp_libs=
 	  for deplib in $dependency_libs; do
 	    deplibs="$deplib $deplibs"
-	    if $opt_duplicate_deps ; then
+	    if $opt_preserve_dup_deps ; then
 	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
 	      esac
 	    fi
-	    tmp_libs="$tmp_libs $deplib"
+	    func_append tmp_libs " $deplib"
 	  done
 	  continue
 	fi # $pass = conv
@@ -4836,9 +6449,15 @@ func_mode_link ()
 
 	# Get the name of the library we link against.
 	linklib=
-	for l in $old_library $library_names; do
-	  linklib="$l"
-	done
+	if test -n "$old_library" &&
+	   { test "$prefer_static_libs" = yes ||
+	     test "$prefer_static_libs,$installed" = "built,no"; }; then
+	  linklib=$old_library
+	else
+	  for l in $old_library $library_names; do
+	    linklib="$l"
+	  done
+	fi
 	if test -z "$linklib"; then
 	  func_fatal_error "cannot find name of link library for \`$lib'"
 	fi
@@ -4855,9 +6474,9 @@ func_mode_link ()
 	    # statically, we need to preload.  We also need to preload any
 	    # dependent libraries so libltdl's deplib preloader doesn't
 	    # bomb out in the load deplibs phase.
-	    dlprefiles="$dlprefiles $lib $dependency_libs"
+	    func_append dlprefiles " $lib $dependency_libs"
 	  else
-	    newdlfiles="$newdlfiles $lib"
+	    func_append newdlfiles " $lib"
 	  fi
 	  continue
 	fi # $pass = dlopen
@@ -4879,14 +6498,14 @@ func_mode_link ()
 
 	# Find the relevant object directory and library name.
 	if test "X$installed" = Xyes; then
-	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	  if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 	    func_warning "library \`$lib' was moved."
 	    dir="$ladir"
 	    absdir="$abs_ladir"
 	    libdir="$abs_ladir"
 	  else
-	    dir="$libdir"
-	    absdir="$libdir"
+	    dir="$lt_sysroot$libdir"
+	    absdir="$lt_sysroot$libdir"
 	  fi
 	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
 	else
@@ -4894,12 +6513,12 @@ func_mode_link ()
 	    dir="$ladir"
 	    absdir="$abs_ladir"
 	    # Remove this search path later
-	    notinst_path="$notinst_path $abs_ladir"
+	    func_append notinst_path " $abs_ladir"
 	  else
 	    dir="$ladir/$objdir"
 	    absdir="$abs_ladir/$objdir"
 	    # Remove this search path later
-	    notinst_path="$notinst_path $abs_ladir"
+	    func_append notinst_path " $abs_ladir"
 	  fi
 	fi # $installed = yes
 	func_stripname 'lib' '.la' "$laname"
@@ -4910,20 +6529,46 @@ func_mode_link ()
 	  if test -z "$libdir" && test "$linkmode" = prog; then
 	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
 	  fi
-	  # Prefer using a static library (so that no silly _DYNAMIC symbols
-	  # are required to link).
-	  if test -n "$old_library"; then
-	    newdlprefiles="$newdlprefiles $dir/$old_library"
-	    # Keep a list of preopened convenience libraries to check
-	    # that they are being used correctly in the link pass.
-	    test -z "$libdir" && \
-		dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
-	  # Otherwise, use the dlname, so that lt_dlopen finds it.
-	  elif test -n "$dlname"; then
-	    newdlprefiles="$newdlprefiles $dir/$dlname"
-	  else
-	    newdlprefiles="$newdlprefiles $dir/$linklib"
-	  fi
+	  case "$host" in
+	    # special handling for platforms with PE-DLLs.
+	    *cygwin* | *mingw* | *cegcc* )
+	      # Linker will automatically link against shared library if both
+	      # static and shared are present.  Therefore, ensure we extract
+	      # symbols from the import library if a shared library is present
+	      # (otherwise, the dlopen module name will be incorrect).  We do
+	      # this by putting the import library name into $newdlprefiles.
+	      # We recover the dlopen module name by 'saving' the la file
+	      # name in a special purpose variable, and (later) extracting the
+	      # dlname from the la file.
+	      if test -n "$dlname"; then
+	        func_tr_sh "$dir/$linklib"
+	        eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
+	        func_append newdlprefiles " $dir/$linklib"
+	      else
+	        func_append newdlprefiles " $dir/$old_library"
+	        # Keep a list of preopened convenience libraries to check
+	        # that they are being used correctly in the link pass.
+	        test -z "$libdir" && \
+	          func_append dlpreconveniencelibs " $dir/$old_library"
+	      fi
+	    ;;
+	    * )
+	      # Prefer using a static library (so that no silly _DYNAMIC symbols
+	      # are required to link).
+	      if test -n "$old_library"; then
+	        func_append newdlprefiles " $dir/$old_library"
+	        # Keep a list of preopened convenience libraries to check
+	        # that they are being used correctly in the link pass.
+	        test -z "$libdir" && \
+	          func_append dlpreconveniencelibs " $dir/$old_library"
+	      # Otherwise, use the dlname, so that lt_dlopen finds it.
+	      elif test -n "$dlname"; then
+	        func_append newdlprefiles " $dir/$dlname"
+	      else
+	        func_append newdlprefiles " $dir/$linklib"
+	      fi
+	    ;;
+	  esac
 	fi # $pass = dlpreopen
 
 	if test -z "$libdir"; then
@@ -4941,7 +6586,7 @@ func_mode_link ()
 
 
 	if test "$linkmode" = prog && test "$pass" != link; then
-	  newlib_search_path="$newlib_search_path $ladir"
+	  func_append newlib_search_path " $ladir"
 	  deplibs="$lib $deplibs"
 
 	  linkalldeplibs=no
@@ -4954,7 +6599,8 @@ func_mode_link ()
 	  for deplib in $dependency_libs; do
 	    case $deplib in
 	    -L*) func_stripname '-L' '' "$deplib"
-	         newlib_search_path="$newlib_search_path $func_stripname_result"
+	         func_resolve_sysroot "$func_stripname_result"
+	         func_append newlib_search_path " $func_resolve_sysroot_result"
 		 ;;
 	    esac
 	    # Need to link against all dependency_libs?
@@ -4965,12 +6611,12 @@ func_mode_link ()
 	      # or/and link against static libraries
 	      newdependency_libs="$deplib $newdependency_libs"
 	    fi
-	    if $opt_duplicate_deps ; then
+	    if $opt_preserve_dup_deps ; then
 	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
 	      esac
 	    fi
-	    tmp_libs="$tmp_libs $deplib"
+	    func_append tmp_libs " $deplib"
 	  done # for deplib
 	  continue
 	fi # $linkmode = prog...
@@ -4985,7 +6631,7 @@ func_mode_link ()
 	      # Make sure the rpath contains only unique directories.
 	      case "$temp_rpath:" in
 	      *"$absdir:"*) ;;
-	      *) temp_rpath="$temp_rpath$absdir:" ;;
+	      *) func_append temp_rpath "$absdir:" ;;
 	      esac
 	    fi
 
@@ -4997,7 +6643,7 @@ func_mode_link ()
 	    *)
 	      case "$compile_rpath " in
 	      *" $absdir "*) ;;
-	      *) compile_rpath="$compile_rpath $absdir"
+	      *) func_append compile_rpath " $absdir" ;;
 	      esac
 	      ;;
 	    esac
@@ -5006,7 +6652,7 @@ func_mode_link ()
 	    *)
 	      case "$finalize_rpath " in
 	      *" $libdir "*) ;;
-	      *) finalize_rpath="$finalize_rpath $libdir"
+	      *) func_append finalize_rpath " $libdir" ;;
 	      esac
 	      ;;
 	    esac
@@ -5029,14 +6675,14 @@ func_mode_link ()
 	if test -n "$library_names" &&
 	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
 	  case $host in
-	  *cygwin* | *mingw*)
+	  *cygwin* | *mingw* | *cegcc*)
 	      # No point in relinking DLLs because paths are not encoded
-	      notinst_deplibs="$notinst_deplibs $lib"
+	      func_append notinst_deplibs " $lib"
 	      need_relink=no
 	    ;;
 	  *)
 	    if test "$installed" = no; then
-	      notinst_deplibs="$notinst_deplibs $lib"
+	      func_append notinst_deplibs " $lib"
 	      need_relink=yes
 	    fi
 	    ;;
@@ -5053,7 +6699,7 @@ func_mode_link ()
 	    fi
 	  done
 	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
-	    $ECHO
+	    echo
 	    if test "$linkmode" = prog; then
 	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
 	    else
@@ -5071,7 +6717,7 @@ func_mode_link ()
 	    *)
 	      case "$compile_rpath " in
 	      *" $absdir "*) ;;
-	      *) compile_rpath="$compile_rpath $absdir"
+	      *) func_append compile_rpath " $absdir" ;;
 	      esac
 	      ;;
 	    esac
@@ -5080,7 +6726,7 @@ func_mode_link ()
 	    *)
 	      case "$finalize_rpath " in
 	      *" $libdir "*) ;;
-	      *) finalize_rpath="$finalize_rpath $libdir"
+	      *) func_append finalize_rpath " $libdir" ;;
 	      esac
 	      ;;
 	    esac
@@ -5099,7 +6745,7 @@ func_mode_link ()
 	    elif test -n "$soname_spec"; then
 	      # bleh windows
 	      case $host in
-	      *cygwin* | mingw*)
+	      *cygwin* | mingw* | *cegcc*)
 	        func_arith $current - $age
 		major=$func_arith_result
 		versuffix="-$major"
@@ -5134,7 +6780,7 @@ func_mode_link ()
 	    linklib=$newlib
 	  fi # test -n "$old_archive_from_expsyms_cmds"
 
-	  if test "$linkmode" = prog || test "$mode" != relink; then
+	  if test "$linkmode" = prog || test "$opt_mode" != relink; then
 	    add_shlibpath=
 	    add_dir=
 	    add=
@@ -5156,9 +6802,9 @@ func_mode_link ()
 		      if test "X$dlopenmodule" != "X$lib"; then
 			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
 			if test -z "$old_library" ; then
-			  $ECHO
-			  $ECHO "*** And there doesn't seem to be a static archive available"
-			  $ECHO "*** The link will probably fail, sorry"
+			  echo
+			  echo "*** And there doesn't seem to be a static archive available"
+			  echo "*** The link will probably fail, sorry"
 			else
 			  add="$dir/$old_library"
 			fi
@@ -5190,7 +6836,7 @@ func_mode_link ()
 		if test -n "$inst_prefix_dir"; then
 		  case $libdir in
 		    [\\/]*)
-		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		      func_append add_dir " -L$inst_prefix_dir$libdir"
 		      ;;
 		  esac
 		fi
@@ -5212,7 +6858,7 @@ func_mode_link ()
 	    if test -n "$add_shlibpath"; then
 	      case :$compile_shlibpath: in
 	      *":$add_shlibpath:"*) ;;
-	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+	      *) func_append compile_shlibpath "$add_shlibpath:" ;;
 	      esac
 	    fi
 	    if test "$linkmode" = prog; then
@@ -5226,13 +6872,13 @@ func_mode_link ()
 		 test "$hardcode_shlibpath_var" = yes; then
 		case :$finalize_shlibpath: in
 		*":$libdir:"*) ;;
-		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+		*) func_append finalize_shlibpath "$libdir:" ;;
 		esac
 	      fi
 	    fi
 	  fi
 
-	  if test "$linkmode" = prog || test "$mode" = relink; then
+	  if test "$linkmode" = prog || test "$opt_mode" = relink; then
 	    add_shlibpath=
 	    add_dir=
 	    add=
@@ -5246,7 +6892,7 @@ func_mode_link ()
 	    elif test "$hardcode_shlibpath_var" = yes; then
 	      case :$finalize_shlibpath: in
 	      *":$libdir:"*) ;;
-	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+	      *) func_append finalize_shlibpath "$libdir:" ;;
 	      esac
 	      add="-l$name"
 	    elif test "$hardcode_automatic" = yes; then
@@ -5263,7 +6909,7 @@ func_mode_link ()
 	      if test -n "$inst_prefix_dir"; then
 		case $libdir in
 		  [\\/]*)
-		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		    func_append add_dir " -L$inst_prefix_dir$libdir"
 		    ;;
 		esac
 	      fi
@@ -5298,21 +6944,21 @@ func_mode_link ()
 
 	    # Just print a warning and add the library to dependency_libs so
 	    # that the program can be linked against the static library.
-	    $ECHO
+	    echo
 	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
-	    $ECHO "*** I have the capability to make that library automatically link in when"
-	    $ECHO "*** you link to this library.  But I can only do this if you have a"
-	    $ECHO "*** shared version of the library, which you do not appear to have."
+	    echo "*** I have the capability to make that library automatically link in when"
+	    echo "*** you link to this library.  But I can only do this if you have a"
+	    echo "*** shared version of the library, which you do not appear to have."
 	    if test "$module" = yes; then
-	      $ECHO "*** But as you try to build a module library, libtool will still create "
-	      $ECHO "*** a static module, that should work as long as the dlopening application"
-	      $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      echo "*** But as you try to build a module library, libtool will still create "
+	      echo "*** a static module, that should work as long as the dlopening application"
+	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
 	      if test -z "$global_symbol_pipe"; then
-		$ECHO
-		$ECHO "*** However, this would only work if libtool was able to extract symbol"
-		$ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
-		$ECHO "*** not find such a program.  So, this module is probably useless."
-		$ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
+		echo
+		echo "*** However, this would only work if libtool was able to extract symbol"
+		echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		echo "*** not find such a program.  So, this module is probably useless."
+		echo "*** \`nm' from GNU binutils and a full rebuild may help."
 	      fi
 	      if test "$build_old_libs" = no; then
 		build_libtool_libs=module
@@ -5340,37 +6986,46 @@ func_mode_link ()
 	           temp_xrpath=$func_stripname_result
 		   case " $xrpath " in
 		   *" $temp_xrpath "*) ;;
-		   *) xrpath="$xrpath $temp_xrpath";;
+		   *) func_append xrpath " $temp_xrpath";;
 		   esac;;
-	      *) temp_deplibs="$temp_deplibs $libdir";;
+	      *) func_append temp_deplibs " $libdir";;
 	      esac
 	    done
 	    dependency_libs="$temp_deplibs"
 	  fi
 
-	  newlib_search_path="$newlib_search_path $absdir"
+	  func_append newlib_search_path " $absdir"
 	  # Link against this library
 	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
 	  # ... and its dependency_libs
 	  tmp_libs=
 	  for deplib in $dependency_libs; do
 	    newdependency_libs="$deplib $newdependency_libs"
-	    if $opt_duplicate_deps ; then
+	    case $deplib in
+              -L*) func_stripname '-L' '' "$deplib"
+                   func_resolve_sysroot "$func_stripname_result";;
+              *) func_resolve_sysroot "$deplib" ;;
+            esac
+	    if $opt_preserve_dup_deps ; then
 	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      *" $func_resolve_sysroot_result "*)
+                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
 	      esac
 	    fi
-	    tmp_libs="$tmp_libs $deplib"
+	    func_append tmp_libs " $func_resolve_sysroot_result"
 	  done
 
 	  if test "$link_all_deplibs" != no; then
 	    # Add the search paths of all dependency libraries
 	    for deplib in $dependency_libs; do
+	      path=
 	      case $deplib in
 	      -L*) path="$deplib" ;;
 	      *.la)
+	        func_resolve_sysroot "$deplib"
+	        deplib=$func_resolve_sysroot_result
 	        func_dirname "$deplib" "" "."
-		dir="$func_dirname_result"
+		dir=$func_dirname_result
 		# We need an absolute path.
 		case $dir in
 		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
@@ -5397,8 +7052,8 @@ func_mode_link ()
                       if test -z "$darwin_install_name"; then
                           darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
                       fi
-		      compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
-		      linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
+		      func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+		      func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
 		      path=
 		    fi
 		  fi
@@ -5431,7 +7086,7 @@ func_mode_link ()
 	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
 	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
 	else
-	  compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 	fi
       fi
       dependency_libs="$newdependency_libs"
@@ -5448,7 +7103,7 @@ func_mode_link ()
 	  for dir in $newlib_search_path; do
 	    case "$lib_search_path " in
 	    *" $dir "*) ;;
-	    *) lib_search_path="$lib_search_path $dir" ;;
+	    *) func_append lib_search_path " $dir" ;;
 	    esac
 	  done
 	  newlib_search_path=
@@ -5506,10 +7161,10 @@ func_mode_link ()
 	    -L*)
 	      case " $tmp_libs " in
 	      *" $deplib "*) ;;
-	      *) tmp_libs="$tmp_libs $deplib" ;;
+	      *) func_append tmp_libs " $deplib" ;;
 	      esac
 	      ;;
-	    *) tmp_libs="$tmp_libs $deplib" ;;
+	    *) func_append tmp_libs " $deplib" ;;
 	    esac
 	  done
 	  eval $var=\"$tmp_libs\"
@@ -5525,7 +7180,7 @@ func_mode_link ()
 	  ;;
 	esac
 	if test -n "$i" ; then
-	  tmp_libs="$tmp_libs $i"
+	  func_append tmp_libs " $i"
 	fi
       done
       dependency_libs=$tmp_libs
@@ -5566,7 +7221,7 @@ func_mode_link ()
       # Now set the variables for building old libraries.
       build_libtool_libs=no
       oldlibs="$output"
-      objs="$objs$old_deplibs"
+      func_append objs "$old_deplibs"
       ;;
 
     lib)
@@ -5599,10 +7254,10 @@ func_mode_link ()
 	if test "$deplibs_check_method" != pass_all; then
 	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
 	else
-	  $ECHO
+	  echo
 	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
 	  $ECHO "*** objects $objs is not portable!"
-	  libobjs="$libobjs $objs"
+	  func_append libobjs " $objs"
 	fi
       fi
 
@@ -5667,7 +7322,7 @@ func_mode_link ()
 	    age="$number_minor"
 	    revision="$number_revision"
 	    ;;
-	  freebsd-aout|freebsd-elf|sunos)
+	  freebsd-aout|freebsd-elf|qnx|sunos)
 	    current="$number_major"
 	    revision="$number_minor"
 	    age="0"
@@ -5800,7 +7455,7 @@ func_mode_link ()
 	  done
 
 	  # Make executables depend on our current version.
-	  verstring="$verstring:${current}.0"
+	  func_append verstring ":${current}.0"
 	  ;;
 
 	qnx)
@@ -5868,17 +7523,17 @@ func_mode_link ()
       fi
 
       func_generate_dlsyms "$libname" "$libname" "yes"
-      libobjs="$libobjs $symfileobj"
+      func_append libobjs " $symfileobj"
       test "X$libobjs" = "X " && libobjs=
 
-      if test "$mode" != relink; then
+      if test "$opt_mode" != relink; then
 	# Remove our outputs, but don't remove object files since they
 	# may have been created when compiling PIC objects.
 	removelist=
 	tempremovelist=`$ECHO "$output_objdir/*"`
 	for p in $tempremovelist; do
 	  case $p in
-	    *.$objext)
+	    *.$objext | *.gcno)
 	       ;;
 	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
 	       if test "X$precious_files_regex" != "X"; then
@@ -5887,7 +7542,7 @@ func_mode_link ()
 		   continue
 		 fi
 	       fi
-	       removelist="$removelist $p"
+	       func_append removelist " $p"
 	       ;;
 	    *) ;;
 	  esac
@@ -5898,27 +7553,28 @@ func_mode_link ()
 
       # Now set the variables for building old libraries.
       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
-	oldlibs="$oldlibs $output_objdir/$libname.$libext"
+	func_append oldlibs " $output_objdir/$libname.$libext"
 
 	# Transform .lo files to .o files.
-	oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
       fi
 
       # Eliminate all temporary directories.
       #for path in $notinst_path; do
-      #	lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
-      #	deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
-      #	dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
+      #	lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
+      #	deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
+      #	dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
       #done
 
       if test -n "$xrpath"; then
 	# If the user specified any rpath flags, then add them.
 	temp_xrpath=
 	for libdir in $xrpath; do
-	  temp_xrpath="$temp_xrpath -R$libdir"
+	  func_replace_sysroot "$libdir"
+	  func_append temp_xrpath " -R$func_replace_sysroot_result"
 	  case "$finalize_rpath " in
 	  *" $libdir "*) ;;
-	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  *) func_append finalize_rpath " $libdir" ;;
 	  esac
 	done
 	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
@@ -5932,7 +7588,7 @@ func_mode_link ()
       for lib in $old_dlfiles; do
 	case " $dlprefiles $dlfiles " in
 	*" $lib "*) ;;
-	*) dlfiles="$dlfiles $lib" ;;
+	*) func_append dlfiles " $lib" ;;
 	esac
       done
 
@@ -5942,19 +7598,19 @@ func_mode_link ()
       for lib in $old_dlprefiles; do
 	case "$dlprefiles " in
 	*" $lib "*) ;;
-	*) dlprefiles="$dlprefiles $lib" ;;
+	*) func_append dlprefiles " $lib" ;;
 	esac
       done
 
       if test "$build_libtool_libs" = yes; then
 	if test -n "$rpath"; then
 	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
 	    # these systems don't actually have a c library (as such)!
 	    ;;
 	  *-*-rhapsody* | *-*-darwin1.[012])
 	    # Rhapsody C library is in the System framework
-	    deplibs="$deplibs System.ltframework"
+	    func_append deplibs " System.ltframework"
 	    ;;
 	  *-*-netbsd*)
 	    # Don't link with libc until the a.out ld.so is fixed.
@@ -5971,7 +7627,7 @@ func_mode_link ()
 	  *)
 	    # Add libc to deplibs on all other systems if necessary.
 	    if test "$build_libtool_need_lc" = "yes"; then
-	      deplibs="$deplibs -lc"
+	      func_append deplibs " -lc"
 	    fi
 	    ;;
 	  esac
@@ -6020,7 +7676,7 @@ EOF
 		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		  case " $predeps $postdeps " in
 		  *" $i "*)
-		    newdeplibs="$newdeplibs $i"
+		    func_append newdeplibs " $i"
 		    i=""
 		    ;;
 		  esac
@@ -6031,21 +7687,21 @@ EOF
 		  set dummy $deplib_matches; shift
 		  deplib_match=$1
 		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		    newdeplibs="$newdeplibs $i"
+		    func_append newdeplibs " $i"
 		  else
 		    droppeddeps=yes
-		    $ECHO
+		    echo
 		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-		    $ECHO "*** I have the capability to make that library automatically link in when"
-		    $ECHO "*** you link to this library.  But I can only do this if you have a"
-		    $ECHO "*** shared version of the library, which I believe you do not have"
-		    $ECHO "*** because a test_compile did reveal that the linker did not use it for"
-		    $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
+		    echo "*** I have the capability to make that library automatically link in when"
+		    echo "*** you link to this library.  But I can only do this if you have a"
+		    echo "*** shared version of the library, which I believe you do not have"
+		    echo "*** because a test_compile did reveal that the linker did not use it for"
+		    echo "*** its dynamic dependency list that programs get resolved with at runtime."
 		  fi
 		fi
 		;;
 	      *)
-		newdeplibs="$newdeplibs $i"
+		func_append newdeplibs " $i"
 		;;
 	      esac
 	    done
@@ -6063,7 +7719,7 @@ EOF
 		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		    case " $predeps $postdeps " in
 		    *" $i "*)
-		      newdeplibs="$newdeplibs $i"
+		      func_append newdeplibs " $i"
 		      i=""
 		      ;;
 		    esac
@@ -6074,29 +7730,29 @@ EOF
 		    set dummy $deplib_matches; shift
 		    deplib_match=$1
 		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		      newdeplibs="$newdeplibs $i"
+		      func_append newdeplibs " $i"
 		    else
 		      droppeddeps=yes
-		      $ECHO
+		      echo
 		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-		      $ECHO "*** I have the capability to make that library automatically link in when"
-		      $ECHO "*** you link to this library.  But I can only do this if you have a"
-		      $ECHO "*** shared version of the library, which you do not appear to have"
-		      $ECHO "*** because a test_compile did reveal that the linker did not use this one"
-		      $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
+		      echo "*** I have the capability to make that library automatically link in when"
+		      echo "*** you link to this library.  But I can only do this if you have a"
+		      echo "*** shared version of the library, which you do not appear to have"
+		      echo "*** because a test_compile did reveal that the linker did not use this one"
+		      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
 		    fi
 		  fi
 		else
 		  droppeddeps=yes
-		  $ECHO
+		  echo
 		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
-		  $ECHO "*** make it link in!  You will probably need to install it or some"
-		  $ECHO "*** library that it depends on before this library will be fully"
-		  $ECHO "*** functional.  Installing it before continuing would be even better."
+		  echo "*** make it link in!  You will probably need to install it or some"
+		  echo "*** library that it depends on before this library will be fully"
+		  echo "*** functional.  Installing it before continuing would be even better."
 		fi
 		;;
 	      *)
-		newdeplibs="$newdeplibs $i"
+		func_append newdeplibs " $i"
 		;;
 	      esac
 	    done
@@ -6113,15 +7769,27 @@ EOF
 	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		case " $predeps $postdeps " in
 		*" $a_deplib "*)
-		  newdeplibs="$newdeplibs $a_deplib"
+		  func_append newdeplibs " $a_deplib"
 		  a_deplib=""
 		  ;;
 		esac
 	      fi
 	      if test -n "$a_deplib" ; then
 		libname=`eval "\\$ECHO \"$libname_spec\""`
+		if test -n "$file_magic_glob"; then
+		  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
+		else
+		  libnameglob=$libname
+		fi
+		test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
 		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  if test "$want_nocaseglob" = yes; then
+		    shopt -s nocaseglob
+		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+		    $nocaseglob
+		  else
+		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+		  fi
 		  for potent_lib in $potential_libs; do
 		      # Follow soft links.
 		      if ls -lLd "$potent_lib" 2>/dev/null |
@@ -6138,13 +7806,13 @@ EOF
 			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
 			case $potliblink in
 			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
-			*) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+			*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
 			esac
 		      done
 		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
 			 $SED -e 10q |
 			 $EGREP "$file_magic_regex" > /dev/null; then
-			newdeplibs="$newdeplibs $a_deplib"
+			func_append newdeplibs " $a_deplib"
 			a_deplib=""
 			break 2
 		      fi
@@ -6153,12 +7821,12 @@ EOF
 	      fi
 	      if test -n "$a_deplib" ; then
 		droppeddeps=yes
-		$ECHO
+		echo
 		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-		$ECHO "*** I have the capability to make that library automatically link in when"
-		$ECHO "*** you link to this library.  But I can only do this if you have a"
-		$ECHO "*** shared version of the library, which you do not appear to have"
-		$ECHO "*** because I did check the linker path looking for a file starting"
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
 		if test -z "$potlib" ; then
 		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
 		else
@@ -6169,7 +7837,7 @@ EOF
 	      ;;
 	    *)
 	      # Add a -L argument.
-	      newdeplibs="$newdeplibs $a_deplib"
+	      func_append newdeplibs " $a_deplib"
 	      ;;
 	    esac
 	  done # Gone through all deplibs.
@@ -6185,7 +7853,7 @@ EOF
 	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		case " $predeps $postdeps " in
 		*" $a_deplib "*)
-		  newdeplibs="$newdeplibs $a_deplib"
+		  func_append newdeplibs " $a_deplib"
 		  a_deplib=""
 		  ;;
 		esac
@@ -6196,9 +7864,9 @@ EOF
 		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 		  for potent_lib in $potential_libs; do
 		    potlib="$potent_lib" # see symlink-check above in file_magic test
-		    if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
+		    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
 		       $EGREP "$match_pattern_regex" > /dev/null; then
-		      newdeplibs="$newdeplibs $a_deplib"
+		      func_append newdeplibs " $a_deplib"
 		      a_deplib=""
 		      break 2
 		    fi
@@ -6207,12 +7875,12 @@ EOF
 	      fi
 	      if test -n "$a_deplib" ; then
 		droppeddeps=yes
-		$ECHO
+		echo
 		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-		$ECHO "*** I have the capability to make that library automatically link in when"
-		$ECHO "*** you link to this library.  But I can only do this if you have a"
-		$ECHO "*** shared version of the library, which you do not appear to have"
-		$ECHO "*** because I did check the linker path looking for a file starting"
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
 		if test -z "$potlib" ; then
 		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
 		else
@@ -6223,32 +7891,32 @@ EOF
 	      ;;
 	    *)
 	      # Add a -L argument.
-	      newdeplibs="$newdeplibs $a_deplib"
+	      func_append newdeplibs " $a_deplib"
 	      ;;
 	    esac
 	  done # Gone through all deplibs.
 	  ;;
 	none | unknown | *)
 	  newdeplibs=""
-	  tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
-	      -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
+	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
 	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 	    for i in $predeps $postdeps ; do
 	      # can't use Xsed below, because $i might contain '/'
-	      tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
+	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
 	    done
 	  fi
-	  if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[	 ]//g' |
-	     $GREP . >/dev/null; then
-	    $ECHO
+	  case $tmp_deplibs in
+	  *[!\	\ ]*)
+	    echo
 	    if test "X$deplibs_check_method" = "Xnone"; then
-	      $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
+	      echo "*** Warning: inter-library dependencies are not supported in this platform."
 	    else
-	      $ECHO "*** Warning: inter-library dependencies are not known to be supported."
+	      echo "*** Warning: inter-library dependencies are not known to be supported."
 	    fi
-	    $ECHO "*** All declared inter-library dependencies are being dropped."
+	    echo "*** All declared inter-library dependencies are being dropped."
 	    droppeddeps=yes
-	  fi
+	    ;;
+	  esac
 	  ;;
 	esac
 	versuffix=$versuffix_save
@@ -6260,23 +7928,23 @@ EOF
 	case $host in
 	*-*-rhapsody* | *-*-darwin1.[012])
 	  # On Rhapsody replace the C library with the System framework
-	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
 	  ;;
 	esac
 
 	if test "$droppeddeps" = yes; then
 	  if test "$module" = yes; then
-	    $ECHO
-	    $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
+	    echo
+	    echo "*** Warning: libtool could not satisfy all declared inter-library"
 	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
-	    $ECHO "*** a static module, that should work as long as the dlopening"
-	    $ECHO "*** application is linked with the -dlopen flag."
+	    echo "*** a static module, that should work as long as the dlopening"
+	    echo "*** application is linked with the -dlopen flag."
 	    if test -z "$global_symbol_pipe"; then
-	      $ECHO
-	      $ECHO "*** However, this would only work if libtool was able to extract symbol"
-	      $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
-	      $ECHO "*** not find such a program.  So, this module is probably useless."
-	      $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
+	      echo
+	      echo "*** However, this would only work if libtool was able to extract symbol"
+	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      echo "*** not find such a program.  So, this module is probably useless."
+	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
 	    fi
 	    if test "$build_old_libs" = no; then
 	      oldlibs="$output_objdir/$libname.$libext"
@@ -6286,16 +7954,16 @@ EOF
 	      build_libtool_libs=no
 	    fi
 	  else
-	    $ECHO "*** The inter-library dependencies that have been dropped here will be"
-	    $ECHO "*** automatically added whenever a program is linked with this library"
-	    $ECHO "*** or is declared to -dlopen it."
+	    echo "*** The inter-library dependencies that have been dropped here will be"
+	    echo "*** automatically added whenever a program is linked with this library"
+	    echo "*** or is declared to -dlopen it."
 
 	    if test "$allow_undefined" = no; then
-	      $ECHO
-	      $ECHO "*** Since this library must not contain undefined symbols,"
-	      $ECHO "*** because either the platform does not support them or"
-	      $ECHO "*** it was explicitly requested with -no-undefined,"
-	      $ECHO "*** libtool will only create a static version of it."
+	      echo
+	      echo "*** Since this library must not contain undefined symbols,"
+	      echo "*** because either the platform does not support them or"
+	      echo "*** it was explicitly requested with -no-undefined,"
+	      echo "*** libtool will only create a static version of it."
 	      if test "$build_old_libs" = no; then
 		oldlibs="$output_objdir/$libname.$libext"
 		build_libtool_libs=module
@@ -6312,9 +7980,9 @@ EOF
       # Time to change all our "foo.ltframework" stuff back to "-framework foo"
       case $host in
 	*-*-darwin*)
-	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 	  ;;
       esac
 
@@ -6327,7 +7995,7 @@ EOF
 	*)
 	  case " $deplibs " in
 	  *" -L$path/$objdir "*)
-	    new_libs="$new_libs -L$path/$objdir" ;;
+	    func_append new_libs " -L$path/$objdir" ;;
 	  esac
 	  ;;
 	esac
@@ -6337,10 +8005,10 @@ EOF
 	-L*)
 	  case " $new_libs " in
 	  *" $deplib "*) ;;
-	  *) new_libs="$new_libs $deplib" ;;
+	  *) func_append new_libs " $deplib" ;;
 	  esac
 	  ;;
-	*) new_libs="$new_libs $deplib" ;;
+	*) func_append new_libs " $deplib" ;;
 	esac
       done
       deplibs="$new_libs"
@@ -6357,10 +8025,12 @@ EOF
 	  hardcode_libdirs=
 	  dep_rpath=
 	  rpath="$finalize_rpath"
-	  test "$mode" != relink && rpath="$compile_rpath$rpath"
+	  test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
 	  for libdir in $rpath; do
 	    if test -n "$hardcode_libdir_flag_spec"; then
 	      if test -n "$hardcode_libdir_separator"; then
+		func_replace_sysroot "$libdir"
+		libdir=$func_replace_sysroot_result
 		if test -z "$hardcode_libdirs"; then
 		  hardcode_libdirs="$libdir"
 		else
@@ -6369,18 +8039,18 @@ EOF
 		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 		    ;;
 		  *)
-		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		    func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
 		    ;;
 		  esac
 		fi
 	      else
 		eval flag=\"$hardcode_libdir_flag_spec\"
-		dep_rpath="$dep_rpath $flag"
+		func_append dep_rpath " $flag"
 	      fi
 	    elif test -n "$runpath_var"; then
 	      case "$perm_rpath " in
 	      *" $libdir "*) ;;
-	      *) perm_rpath="$perm_rpath $libdir" ;;
+	      *) func_apped perm_rpath " $libdir" ;;
 	      esac
 	    fi
 	  done
@@ -6398,7 +8068,7 @@ EOF
 	    # We should set the runpath_var.
 	    rpath=
 	    for dir in $perm_rpath; do
-	      rpath="$rpath$dir:"
+	      func_append rpath "$dir:"
 	    done
 	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
 	  fi
@@ -6406,7 +8076,7 @@ EOF
 	fi
 
 	shlibpath="$finalize_shlibpath"
-	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
 	if test -n "$shlibpath"; then
 	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
 	fi
@@ -6432,23 +8102,23 @@ EOF
 	linknames=
 	for link
 	do
-	  linknames="$linknames $link"
+	  func_append linknames " $link"
 	done
 
 	# Use standard objects if they are pic
-	test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
 	test "X$libobjs" = "X " && libobjs=
 
 	delfiles=
 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
 	  export_symbols="$output_objdir/$libname.uexp"
-	  delfiles="$delfiles $export_symbols"
+	  func_append delfiles " $export_symbols"
 	fi
 
 	orig_export_symbols=
 	case $host_os in
-	cygwin* | mingw*)
+	cygwin* | mingw* | cegcc*)
 	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
 	    # exporting using user supplied symfile
 	    if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
@@ -6474,13 +8144,45 @@ EOF
 	    $opt_dry_run || $RM $export_symbols
 	    cmds=$export_symbols_cmds
 	    save_ifs="$IFS"; IFS='~'
-	    for cmd in $cmds; do
+	    for cmd1 in $cmds; do
 	      IFS="$save_ifs"
-	      eval cmd=\"$cmd\"
-	      func_len " $cmd"
-	      len=$func_len_result
-	      if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	      # Take the normal branch if the nm_file_list_spec branch
+	      # doesn't work or if tool conversion is not needed.
+	      case $nm_file_list_spec~$to_tool_file_cmd in
+		*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
+		  try_normal_branch=yes
+		  eval cmd=\"$cmd1\"
+		  func_len " $cmd"
+		  len=$func_len_result
+		  ;;
+		*)
+		  try_normal_branch=no
+		  ;;
+	      esac
+	      if test "$try_normal_branch" = yes \
+		 && { test "$len" -lt "$max_cmd_len" \
+		      || test "$max_cmd_len" -le -1; }
+	      then
+		func_show_eval "$cmd" 'exit $?'
+		skipped_export=false
+	      elif test -n "$nm_file_list_spec"; then
+		func_basename "$output"
+		output_la=$func_basename_result
+		save_libobjs=$libobjs
+		save_output=$output
+		output=${output_objdir}/${output_la}.nm
+		func_to_tool_file "$output"
+		libobjs=$nm_file_list_spec$func_to_tool_file_result
+		func_append delfiles " $output"
+		func_verbose "creating $NM input file list: $output"
+		for obj in $save_libobjs; do
+		  func_to_tool_file "$obj"
+		  $ECHO "$func_to_tool_file_result"
+		done > "$output"
+		eval cmd=\"$cmd1\"
 		func_show_eval "$cmd" 'exit $?'
+		output=$save_output
+		libobjs=$save_libobjs
 		skipped_export=false
 	      else
 		# The command line is too long to execute in one step.
@@ -6502,7 +8204,7 @@ EOF
 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	  tmp_export_symbols="$export_symbols"
 	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-	  $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+	  $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
 	fi
 
 	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
@@ -6514,7 +8216,7 @@ EOF
 	  # global variables. join(1) would be nice here, but unfortunately
 	  # isn't a blessed tool.
 	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-	  delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+	  func_append delfiles " $export_symbols $output_objdir/$libname.filter"
 	  export_symbols=$output_objdir/$libname.def
 	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
 	fi
@@ -6524,7 +8226,7 @@ EOF
 	  case " $convenience " in
 	  *" $test_deplib "*) ;;
 	  *)
-	    tmp_deplibs="$tmp_deplibs $test_deplib"
+	    func_append tmp_deplibs " $test_deplib"
 	    ;;
 	  esac
 	done
@@ -6544,21 +8246,21 @@ EOF
 	    test "X$libobjs" = "X " && libobjs=
 	  else
 	    gentop="$output_objdir/${outputname}x"
-	    generated="$generated $gentop"
+	    func_append generated " $gentop"
 
 	    func_extract_archives $gentop $convenience
-	    libobjs="$libobjs $func_extract_archives_result"
+	    func_append libobjs " $func_extract_archives_result"
 	    test "X$libobjs" = "X " && libobjs=
 	  fi
 	fi
 
 	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
 	  eval flag=\"$thread_safe_flag_spec\"
-	  linker_flags="$linker_flags $flag"
+	  func_append linker_flags " $flag"
 	fi
 
 	# Make a backup of the uninstalled library when relinking
-	if test "$mode" = relink; then
+	if test "$opt_mode" = relink; then
 	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
 	fi
 
@@ -6603,7 +8305,8 @@ EOF
 	    save_libobjs=$libobjs
 	  fi
 	  save_output=$output
-	  output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
+	  func_basename "$output"
+	  output_la=$func_basename_result
 
 	  # Clear the reloadable object creation command queue and
 	  # initialize k to one.
@@ -6616,13 +8319,16 @@ EOF
 	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
 	    output=${output_objdir}/${output_la}.lnkscript
 	    func_verbose "creating GNU ld script: $output"
-	    $ECHO 'INPUT (' > $output
+	    echo 'INPUT (' > $output
 	    for obj in $save_libobjs
 	    do
-	      $ECHO "$obj" >> $output
+	      func_to_tool_file "$obj"
+	      $ECHO "$func_to_tool_file_result" >> $output
 	    done
-	    $ECHO ')' >> $output
-	    delfiles="$delfiles $output"
+	    echo ')' >> $output
+	    func_append delfiles " $output"
+	    func_to_tool_file "$output"
+	    output=$func_to_tool_file_result
 	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
 	    output=${output_objdir}/${output_la}.lnk
 	    func_verbose "creating linker input file list: $output"
@@ -6636,10 +8342,12 @@ EOF
 	    fi
 	    for obj
 	    do
-	      $ECHO "$obj" >> $output
+	      func_to_tool_file "$obj"
+	      $ECHO "$func_to_tool_file_result" >> $output
 	    done
-	    delfiles="$delfiles $output"
-	    output=$firstobj\"$file_list_spec$output\"
+	    func_append delfiles " $output"
+	    func_to_tool_file "$output"
+	    output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
 	  else
 	    if test -n "$save_libobjs"; then
 	      func_verbose "creating reloadable object files..."
@@ -6663,17 +8371,19 @@ EOF
 		  # command to the queue.
 		  if test "$k" -eq 1 ; then
 		    # The first file doesn't have a previous command to add.
-		    eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+		    reload_objs=$objlist
+		    eval concat_cmds=\"$reload_cmds\"
 		  else
 		    # All subsequent reloadable object files will link in
 		    # the last one created.
-		    eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
+		    reload_objs="$objlist $last_robj"
+		    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
 		  fi
 		  last_robj=$output_objdir/$output_la-${k}.$objext
 		  func_arith $k + 1
 		  k=$func_arith_result
 		  output=$output_objdir/$output_la-${k}.$objext
-		  objlist=$obj
+		  objlist=" $obj"
 		  func_len " $last_robj"
 		  func_arith $len0 + $func_len_result
 		  len=$func_arith_result
@@ -6683,11 +8393,12 @@ EOF
 	      # reloadable object file.  All subsequent reloadable object
 	      # files will link in the last one created.
 	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	      eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+	      reload_objs="$objlist $last_robj"
+	      eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
 	      if test -n "$last_robj"; then
 	        eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
 	      fi
-	      delfiles="$delfiles $output"
+	      func_append delfiles " $output"
 
 	    else
 	      output=
@@ -6721,7 +8432,7 @@ EOF
 		lt_exit=$?
 
 		# Restore the uninstalled library and exit
-		if test "$mode" = relink; then
+		if test "$opt_mode" = relink; then
 		  ( cd "$output_objdir" && \
 		    $RM "${realname}T" && \
 		    $MV "${realname}U" "$realname" )
@@ -6742,7 +8453,7 @@ EOF
 	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	      tmp_export_symbols="$export_symbols"
 	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-	      $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+	      $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
 	    fi
 
 	    if test -n "$orig_export_symbols"; then
@@ -6754,7 +8465,7 @@ EOF
 	      # global variables. join(1) would be nice here, but unfortunately
 	      # isn't a blessed tool.
 	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-	      delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+	      func_append delfiles " $export_symbols $output_objdir/$libname.filter"
 	      export_symbols=$output_objdir/$libname.def
 	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
 	    fi
@@ -6795,10 +8506,10 @@ EOF
 	# Add any objects from preloaded convenience libraries
 	if test -n "$dlprefiles"; then
 	  gentop="$output_objdir/${outputname}x"
-	  generated="$generated $gentop"
+	  func_append generated " $gentop"
 
 	  func_extract_archives $gentop $dlprefiles
-	  libobjs="$libobjs $func_extract_archives_result"
+	  func_append libobjs " $func_extract_archives_result"
 	  test "X$libobjs" = "X " && libobjs=
 	fi
 
@@ -6814,7 +8525,7 @@ EOF
 	    lt_exit=$?
 
 	    # Restore the uninstalled library and exit
-	    if test "$mode" = relink; then
+	    if test "$opt_mode" = relink; then
 	      ( cd "$output_objdir" && \
 	        $RM "${realname}T" && \
 		$MV "${realname}U" "$realname" )
@@ -6826,7 +8537,7 @@ EOF
 	IFS="$save_ifs"
 
 	# Restore the uninstalled library and exit
-	if test "$mode" = relink; then
+	if test "$opt_mode" = relink; then
 	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
 
 	  if test -n "$convenience"; then
@@ -6907,18 +8618,21 @@ EOF
       if test -n "$convenience"; then
 	if test -n "$whole_archive_flag_spec"; then
 	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
-	  reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
+	  reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
 	else
 	  gentop="$output_objdir/${obj}x"
-	  generated="$generated $gentop"
+	  func_append generated " $gentop"
 
 	  func_extract_archives $gentop $convenience
 	  reload_conv_objs="$reload_objs $func_extract_archives_result"
 	fi
       fi
 
+      # If we're not building shared, we need to use non_pic_objs
+      test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
+
       # Create the old-style object.
-      reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
 
       output="$obj"
       func_execute_cmds "$reload_cmds" 'exit $?'
@@ -6978,8 +8692,8 @@ EOF
       case $host in
       *-*-rhapsody* | *-*-darwin1.[012])
 	# On Rhapsody replace the C library is the System framework
-	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
-	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
+	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
 	;;
       esac
 
@@ -6990,14 +8704,14 @@ EOF
 	if test "$tagname" = CXX ; then
 	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
 	    10.[0123])
-	      compile_command="$compile_command ${wl}-bind_at_load"
-	      finalize_command="$finalize_command ${wl}-bind_at_load"
+	      func_append compile_command " ${wl}-bind_at_load"
+	      func_append finalize_command " ${wl}-bind_at_load"
 	    ;;
 	  esac
 	fi
 	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
-	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 	;;
       esac
 
@@ -7011,7 +8725,7 @@ EOF
 	*)
 	  case " $compile_deplibs " in
 	  *" -L$path/$objdir "*)
-	    new_libs="$new_libs -L$path/$objdir" ;;
+	    func_append new_libs " -L$path/$objdir" ;;
 	  esac
 	  ;;
 	esac
@@ -7021,17 +8735,17 @@ EOF
 	-L*)
 	  case " $new_libs " in
 	  *" $deplib "*) ;;
-	  *) new_libs="$new_libs $deplib" ;;
+	  *) func_append new_libs " $deplib" ;;
 	  esac
 	  ;;
-	*) new_libs="$new_libs $deplib" ;;
+	*) func_append new_libs " $deplib" ;;
 	esac
       done
       compile_deplibs="$new_libs"
 
 
-      compile_command="$compile_command $compile_deplibs"
-      finalize_command="$finalize_command $finalize_deplibs"
+      func_append compile_command " $compile_deplibs"
+      func_append finalize_command " $finalize_deplibs"
 
       if test -n "$rpath$xrpath"; then
 	# If the user specified any rpath flags, then add them.
@@ -7039,7 +8753,7 @@ EOF
 	  # This is the magic to use -rpath.
 	  case "$finalize_rpath " in
 	  *" $libdir "*) ;;
-	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  *) func_append finalize_rpath " $libdir" ;;
 	  esac
 	done
       fi
@@ -7058,30 +8772,32 @@ EOF
 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 		;;
 	      *)
-		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
 		;;
 	      esac
 	    fi
 	  else
 	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    rpath="$rpath $flag"
+	    func_append rpath " $flag"
 	  fi
 	elif test -n "$runpath_var"; then
 	  case "$perm_rpath " in
 	  *" $libdir "*) ;;
-	  *) perm_rpath="$perm_rpath $libdir" ;;
+	  *) func_append perm_rpath " $libdir" ;;
 	  esac
 	fi
 	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
 	  testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
 	  case :$dllsearchpath: in
 	  *":$libdir:"*) ;;
-	  *) dllsearchpath="$dllsearchpath:$libdir";;
+	  ::) dllsearchpath=$libdir;;
+	  *) func_append dllsearchpath ":$libdir";;
 	  esac
 	  case :$dllsearchpath: in
 	  *":$testbindir:"*) ;;
-	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  ::) dllsearchpath=$testbindir;;
+	  *) func_append dllsearchpath ":$testbindir";;
 	  esac
 	  ;;
 	esac
@@ -7107,18 +8823,18 @@ EOF
 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 		;;
 	      *)
-		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
 		;;
 	      esac
 	    fi
 	  else
 	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    rpath="$rpath $flag"
+	    func_append rpath " $flag"
 	  fi
 	elif test -n "$runpath_var"; then
 	  case "$finalize_perm_rpath " in
 	  *" $libdir "*) ;;
-	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+	  *) func_append finalize_perm_rpath " $libdir" ;;
 	  esac
 	fi
       done
@@ -7132,8 +8848,8 @@ EOF
 
       if test -n "$libobjs" && test "$build_old_libs" = yes; then
 	# Transform all the library objects into standard objects.
-	compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-	finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
       fi
 
       func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
@@ -7145,6 +8861,10 @@ EOF
 
       wrappers_required=yes
       case $host in
+      *cegcc* | *mingw32ce*)
+        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
+        wrappers_required=no
+        ;;
       *cygwin* | *mingw* )
         if test "$build_libtool_libs" != yes; then
           wrappers_required=no
@@ -7158,13 +8878,19 @@ EOF
       esac
       if test "$wrappers_required" = no; then
 	# Replace the output file specification.
-	compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
 	link_command="$compile_command$compile_rpath"
 
 	# We have no uninstalled library dependencies, so finalize right now.
 	exit_status=0
 	func_show_eval "$link_command" 'exit_status=$?'
 
+	if test -n "$postlink_cmds"; then
+	  func_to_tool_file "$output"
+	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	  func_execute_cmds "$postlink_cmds" 'exit $?'
+	fi
+
 	# Delete the generated files.
 	if test -f "$output_objdir/${outputname}S.${objext}"; then
 	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
@@ -7187,7 +8913,7 @@ EOF
 	  # We should set the runpath_var.
 	  rpath=
 	  for dir in $perm_rpath; do
-	    rpath="$rpath$dir:"
+	    func_append rpath "$dir:"
 	  done
 	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
 	fi
@@ -7195,7 +8921,7 @@ EOF
 	  # We should set the runpath_var.
 	  rpath=
 	  for dir in $finalize_perm_rpath; do
-	    rpath="$rpath$dir:"
+	    func_append rpath "$dir:"
 	  done
 	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
 	fi
@@ -7205,11 +8931,18 @@ EOF
 	# We don't need to create a wrapper script.
 	link_command="$compile_var$compile_command$compile_rpath"
 	# Replace the output file specification.
-	link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
 	# Delete the old output file.
 	$opt_dry_run || $RM $output
 	# Link the executable and exit
 	func_show_eval "$link_command" 'exit $?'
+
+	if test -n "$postlink_cmds"; then
+	  func_to_tool_file "$output"
+	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	  func_execute_cmds "$postlink_cmds" 'exit $?'
+	fi
+
 	exit $EXIT_SUCCESS
       fi
 
@@ -7224,7 +8957,7 @@ EOF
 	if test "$fast_install" != no; then
 	  link_command="$finalize_var$compile_command$finalize_rpath"
 	  if test "$fast_install" = yes; then
-	    relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+	    relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
 	  else
 	    # fast_install is set to needless
 	    relink_command=
@@ -7236,13 +8969,19 @@ EOF
       fi
 
       # Replace the output file specification.
-      link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
 
       # Delete the old output files.
       $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
 
       func_show_eval "$link_command" 'exit $?'
 
+      if test -n "$postlink_cmds"; then
+	func_to_tool_file "$output_objdir/$outputname"
+	postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	func_execute_cmds "$postlink_cmds" 'exit $?'
+      fi
+
       # Now create the wrapper script.
       func_verbose "creating $output"
 
@@ -7260,18 +8999,7 @@ EOF
 	  fi
 	done
 	relink_command="(cd `pwd`; $relink_command)"
-	relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
-      fi
-
-      # Quote $ECHO for shipping.
-      if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
-	case $progpath in
-	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
-	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
-	esac
-	qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
-      else
-	qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
+	relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
       fi
 
       # Only actually do things if not in dry run mode.
@@ -7302,11 +9030,10 @@ EOF
 
 	    func_emit_cwrapperexe_src > $cwrappersource
 
-	    # we should really use a build-platform specific compiler
-	    # here, but OTOH, the wrappers (shell script and this C one)
-	    # are only useful if you want to execute the "real" binary.
-	    # Since the "real" binary is built for $host, then this
-	    # wrapper might as well be built for $host, too.
+	    # The wrapper executable is built using the $host compiler,
+	    # because it contains $host paths and files. If cross-
+	    # compiling, it, like the target executable, must be
+	    # executed on the $host or under an emulation environment.
 	    $opt_dry_run || {
 	      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
 	      $STRIP $cwrapper
@@ -7352,7 +9079,7 @@ EOF
 	else
 	  oldobjs="$old_deplibs $non_pic_objects"
 	  if test "$preload" = yes && test -f "$symfileobj"; then
-	    oldobjs="$oldobjs $symfileobj"
+	    func_append oldobjs " $symfileobj"
 	  fi
 	fi
 	addlibs="$old_convenience"
@@ -7360,10 +9087,10 @@ EOF
 
       if test -n "$addlibs"; then
 	gentop="$output_objdir/${outputname}x"
-	generated="$generated $gentop"
+	func_append generated " $gentop"
 
 	func_extract_archives $gentop $addlibs
-	oldobjs="$oldobjs $func_extract_archives_result"
+	func_append oldobjs " $func_extract_archives_result"
       fi
 
       # Do each command in the archive commands.
@@ -7374,10 +9101,10 @@ EOF
 	# Add any objects from preloaded convenience libraries
 	if test -n "$dlprefiles"; then
 	  gentop="$output_objdir/${outputname}x"
-	  generated="$generated $gentop"
+	  func_append generated " $gentop"
 
 	  func_extract_archives $gentop $dlprefiles
-	  oldobjs="$oldobjs $func_extract_archives_result"
+	  func_append oldobjs " $func_extract_archives_result"
 	fi
 
 	# POSIX demands no paths to be encoded in archives.  We have
@@ -7393,9 +9120,9 @@ EOF
 	    done | sort | sort -uc >/dev/null 2>&1); then
 	  :
 	else
-	  $ECHO "copying selected object files to avoid basename conflicts..."
+	  echo "copying selected object files to avoid basename conflicts..."
 	  gentop="$output_objdir/${outputname}x"
-	  generated="$generated $gentop"
+	  func_append generated " $gentop"
 	  func_mkdir_p "$gentop"
 	  save_oldobjs=$oldobjs
 	  oldobjs=
@@ -7419,9 +9146,9 @@ EOF
 		esac
 	      done
 	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
-	      oldobjs="$oldobjs $gentop/$newobj"
+	      func_append oldobjs " $gentop/$newobj"
 	      ;;
-	    *) oldobjs="$oldobjs $obj" ;;
+	    *) func_append oldobjs " $obj" ;;
 	    esac
 	  done
 	fi
@@ -7431,6 +9158,16 @@ EOF
 	len=$func_len_result
 	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 	  cmds=$old_archive_cmds
+	elif test -n "$archiver_list_spec"; then
+	  func_verbose "using command file archive linking..."
+	  for obj in $oldobjs
+	  do
+	    func_to_tool_file "$obj"
+	    $ECHO "$func_to_tool_file_result"
+	  done > $output_objdir/$libname.libcmd
+	  func_to_tool_file "$output_objdir/$libname.libcmd"
+	  oldobjs=" $archiver_list_spec$func_to_tool_file_result"
+	  cmds=$old_archive_cmds
 	else
 	  # the command line is too long to link in one step, link in parts
 	  func_verbose "using piecewise archive linking..."
@@ -7504,7 +9241,7 @@ EOF
       done
       # Quote the link command for shipping.
       relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
-      relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
       if test "$hardcode_automatic" = yes ; then
 	relink_command=
       fi
@@ -7527,9 +9264,19 @@ EOF
 		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$deplib' is not a valid libtool archive"
-		newdependency_libs="$newdependency_libs $libdir/$name"
+		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
+		;;
+	      -L*)
+		func_stripname -L '' "$deplib"
+		func_replace_sysroot "$func_stripname_result"
+		func_append newdependency_libs " -L$func_replace_sysroot_result"
 		;;
-	      *) newdependency_libs="$newdependency_libs $deplib" ;;
+	      -R*)
+		func_stripname -R '' "$deplib"
+		func_replace_sysroot "$func_stripname_result"
+		func_append newdependency_libs " -R$func_replace_sysroot_result"
+		;;
+	      *) func_append newdependency_libs " $deplib" ;;
 	      esac
 	    done
 	    dependency_libs="$newdependency_libs"
@@ -7543,9 +9290,9 @@ EOF
 		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$lib' is not a valid libtool archive"
-		newdlfiles="$newdlfiles $libdir/$name"
+		func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
 		;;
-	      *) newdlfiles="$newdlfiles $lib" ;;
+	      *) func_append newdlfiles " $lib" ;;
 	      esac
 	    done
 	    dlfiles="$newdlfiles"
@@ -7562,7 +9309,7 @@ EOF
 		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$lib' is not a valid libtool archive"
-		newdlprefiles="$newdlprefiles $libdir/$name"
+		func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
 		;;
 	      esac
 	    done
@@ -7574,7 +9321,7 @@ EOF
 		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 		*) abs=`pwd`"/$lib" ;;
 	      esac
-	      newdlfiles="$newdlfiles $abs"
+	      func_append newdlfiles " $abs"
 	    done
 	    dlfiles="$newdlfiles"
 	    newdlprefiles=
@@ -7583,15 +9330,33 @@ EOF
 		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 		*) abs=`pwd`"/$lib" ;;
 	      esac
-	      newdlprefiles="$newdlprefiles $abs"
+	      func_append newdlprefiles " $abs"
 	    done
 	    dlprefiles="$newdlprefiles"
 	  fi
 	  $RM $output
 	  # place dlname in correct position for cygwin
+	  # In fact, it would be nice if we could use this code for all target
+	  # systems that can't hard-code library paths into their executables
+	  # and that have no shared library path variable independent of PATH,
+	  # but it turns out we can't easily determine that from inspecting
+	  # libtool variables, so we have to hard-code the OSs to which it
+	  # applies here; at the moment, that means platforms that use the PE
+	  # object format with DLL files.  See the long comment at the top of
+	  # tests/bindir.at for full details.
 	  tdlname=$dlname
 	  case $host,$output,$installed,$module,$dlname in
-	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+	      # If a -bindir argument was supplied, place the dll there.
+	      if test "x$bindir" != x ;
+	      then
+		func_relative_path "$install_libdir" "$bindir"
+		tdlname=$func_relative_path_result$dlname
+	      else
+		# Otherwise fall back on heuristic.
+		tdlname=../bin/$dlname
+	      fi
+	      ;;
 	  esac
 	  $ECHO > $output "\
 # $outputname - a libtool library file
@@ -7650,7 +9415,7 @@ relink_command=\"$relink_command\""
     exit $EXIT_SUCCESS
 }
 
-{ test "$mode" = link || test "$mode" = relink; } &&
+{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
     func_mode_link ${1+"$@"}
 
 
@@ -7670,9 +9435,9 @@ func_mode_uninstall ()
     for arg
     do
       case $arg in
-      -f) RM="$RM $arg"; rmforce=yes ;;
-      -*) RM="$RM $arg" ;;
-      *) files="$files $arg" ;;
+      -f) func_append RM " $arg"; rmforce=yes ;;
+      -*) func_append RM " $arg" ;;
+      *) func_append files " $arg" ;;
       esac
     done
 
@@ -7681,24 +9446,23 @@ func_mode_uninstall ()
 
     rmdirs=
 
-    origobjdir="$objdir"
     for file in $files; do
       func_dirname "$file" "" "."
       dir="$func_dirname_result"
       if test "X$dir" = X.; then
-	objdir="$origobjdir"
+	odir="$objdir"
       else
-	objdir="$dir/$origobjdir"
+	odir="$dir/$objdir"
       fi
       func_basename "$file"
       name="$func_basename_result"
-      test "$mode" = uninstall && objdir="$dir"
+      test "$opt_mode" = uninstall && odir="$dir"
 
-      # Remember objdir for removal later, being careful to avoid duplicates
-      if test "$mode" = clean; then
+      # Remember odir for removal later, being careful to avoid duplicates
+      if test "$opt_mode" = clean; then
 	case " $rmdirs " in
-	  *" $objdir "*) ;;
-	  *) rmdirs="$rmdirs $objdir" ;;
+	  *" $odir "*) ;;
+	  *) func_append rmdirs " $odir" ;;
 	esac
       fi
 
@@ -7724,18 +9488,17 @@ func_mode_uninstall ()
 
 	  # Delete the libtool libraries and symlinks.
 	  for n in $library_names; do
-	    rmfiles="$rmfiles $objdir/$n"
+	    func_append rmfiles " $odir/$n"
 	  done
-	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+	  test -n "$old_library" && func_append rmfiles " $odir/$old_library"
 
-	  case "$mode" in
+	  case "$opt_mode" in
 	  clean)
-	    case "  $library_names " in
-	    # "  " in the beginning catches empty $dlname
+	    case " $library_names " in
 	    *" $dlname "*) ;;
-	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
+	    *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
 	    esac
-	    test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+	    test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
 	    ;;
 	  uninstall)
 	    if test -n "$library_names"; then
@@ -7763,19 +9526,19 @@ func_mode_uninstall ()
 	  # Add PIC object to the list of files to remove.
 	  if test -n "$pic_object" &&
 	     test "$pic_object" != none; then
-	    rmfiles="$rmfiles $dir/$pic_object"
+	    func_append rmfiles " $dir/$pic_object"
 	  fi
 
 	  # Add non-PIC object to the list of files to remove.
 	  if test -n "$non_pic_object" &&
 	     test "$non_pic_object" != none; then
-	    rmfiles="$rmfiles $dir/$non_pic_object"
+	    func_append rmfiles " $dir/$non_pic_object"
 	  fi
 	fi
 	;;
 
       *)
-	if test "$mode" = clean ; then
+	if test "$opt_mode" = clean ; then
 	  noexename=$name
 	  case $file in
 	  *.exe)
@@ -7785,7 +9548,7 @@ func_mode_uninstall ()
 	    noexename=$func_stripname_result
 	    # $file with .exe has already been added to rmfiles,
 	    # add $file without .exe
-	    rmfiles="$rmfiles $file"
+	    func_append rmfiles " $file"
 	    ;;
 	  esac
 	  # Do a test to see if this is a libtool program.
@@ -7794,7 +9557,7 @@ func_mode_uninstall ()
 	      func_ltwrapper_scriptname "$file"
 	      relink_command=
 	      func_source $func_ltwrapper_scriptname_result
-	      rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
+	      func_append rmfiles " $func_ltwrapper_scriptname_result"
 	    else
 	      relink_command=
 	      func_source $dir/$noexename
@@ -7802,12 +9565,12 @@ func_mode_uninstall ()
 
 	    # note $name still contains .exe if it was in $file originally
 	    # as does the version of $file that was added into $rmfiles
-	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+	    func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
 	    if test "$fast_install" = yes && test -n "$relink_command"; then
-	      rmfiles="$rmfiles $objdir/lt-$name"
+	      func_append rmfiles " $odir/lt-$name"
 	    fi
 	    if test "X$noexename" != "X$name" ; then
-	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+	      func_append rmfiles " $odir/lt-${noexename}.c"
 	    fi
 	  fi
 	fi
@@ -7815,7 +9578,6 @@ func_mode_uninstall ()
       esac
       func_show_eval "$RM $rmfiles" 'exit_status=1'
     done
-    objdir="$origobjdir"
 
     # Try to remove the ${objdir}s in the directories where we deleted files
     for dir in $rmdirs; do
@@ -7827,16 +9589,16 @@ func_mode_uninstall ()
     exit $exit_status
 }
 
-{ test "$mode" = uninstall || test "$mode" = clean; } &&
+{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
     func_mode_uninstall ${1+"$@"}
 
-test -z "$mode" && {
+test -z "$opt_mode" && {
   help="$generic_help"
   func_fatal_help "you must specify a MODE"
 }
 
 test -z "$exec_cmd" && \
-  func_fatal_help "invalid operation mode \`$mode'"
+  func_fatal_help "invalid operation mode \`$opt_mode'"
 
 if test -n "$exec_cmd"; then
   eval exec "$exec_cmd"
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 4ceb7f1..d812584 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1,7 +1,8 @@
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 # This file is free software; the Free Software Foundation gives
@@ -10,7 +11,8 @@
 
 m4_define([_LT_COPYING], [dnl
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -37,7 +39,7 @@ m4_define([_LT_COPYING], [dnl
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 ])
 
-# serial 56 LT_INIT
+# serial 57 LT_INIT
 
 
 # LT_PREREQ(VERSION)
@@ -66,6 +68,7 @@ esac
 # ------------------
 AC_DEFUN([LT_INIT],
 [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 AC_BEFORE([$0], [LT_LANG])dnl
 AC_BEFORE([$0], [LT_OUTPUT])dnl
 AC_BEFORE([$0], [LTDL_INIT])dnl
@@ -82,6 +85,8 @@ AC_REQUIRE([LTVERSION_VERSION])dnl
 AC_REQUIRE([LTOBSOLETE_VERSION])dnl
 m4_require([_LT_PROG_LTMAIN])dnl
 
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
 dnl Parse OPTIONS
 _LT_SET_OPTIONS([$0], [$1])
 
@@ -118,7 +123,7 @@ m4_defun([_LT_CC_BASENAME],
     *) break;;
   esac
 done
-cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
 ])
 
 
@@ -138,6 +143,9 @@ m4_defun([_LT_FILEUTILS_DEFAULTS],
 m4_defun([_LT_SETUP],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
 _LT_DECL([], [host_alias], [0], [The host system])dnl
 _LT_DECL([], [host], [0])dnl
 _LT_DECL([], [host_os], [0])dnl
@@ -160,10 +168,13 @@ _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
 dnl
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
 m4_require([_LT_CMD_RELOAD])dnl
 m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
 m4_require([_LT_CMD_OLD_ARCHIVE])dnl
 m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
 
 _LT_CONFIG_LIBTOOL_INIT([
 # See if we are running on zsh, and set the options which allow our
@@ -179,7 +190,6 @@ fi
 _LT_CHECK_OBJDIR
 
 m4_require([_LT_TAG_COMPILER])dnl
-_LT_PROG_ECHO_BACKSLASH
 
 case $host_os in
 aix3*)
@@ -193,23 +203,6 @@ aix3*)
   ;;
 esac
 
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\([["`\\]]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
 # Global variables:
 ofile=libtool
 can_build_shared=yes
@@ -250,6 +243,28 @@ _LT_CONFIG_COMMANDS
 ])# _LT_SETUP
 
 
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
 # _LT_PROG_LTMAIN
 # ---------------
 # Note that this code is called both from `configure', and `config.status'
@@ -380,12 +395,12 @@ m4_define([lt_decl_dquote_varnames],
 # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
 # ---------------------------------------------------
 m4_define([lt_decl_varnames_tagged],
-[_$0(m4_quote(m4_default([$1], [[, ]])),
-     m4_quote(m4_if([$2], [],
-		     m4_quote(lt_decl_tag_varnames),
-		  m4_quote(m4_shift($@)))),
-     m4_split(m4_normalize(m4_quote(_LT_TAGS))))])
-m4_define([_lt_decl_varnames_tagged], [lt_combine([$1], [$2], [_], $3)])
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
 
 
 # lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
@@ -408,7 +423,7 @@ m4_define([_lt_decl_all_varnames],
 # declaration there will have the same value as in `configure'.  VARNAME
 # must have a single quote delimited value for this to work.
 m4_define([_LT_CONFIG_STATUS_DECLARE],
-[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`'])
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
 
 
 # _LT_CONFIG_STATUS_DECLARATIONS
@@ -418,7 +433,7 @@ m4_define([_LT_CONFIG_STATUS_DECLARE],
 # embedded single quotes properly.  In configure, this macro expands
 # each variable declared with _LT_DECL (and _LT_TAGDECL) into:
 #
-#    <var>='`$ECHO "X$<var>" | $Xsed -e "$delay_single_quote_subst"`'
+#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
 m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
 [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
     [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
@@ -517,12 +532,20 @@ LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
 compiler='$compiler_DEFAULT'
 
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
 # Quote evaled strings.
 for var in lt_decl_all_varnames([[ \
 ]], lt_decl_quote_varnames); do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -533,9 +556,9 @@ done
 # Double-quote double-evaled strings.
 for var in lt_decl_all_varnames([[ \
 ]], lt_decl_dquote_varnames); do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -543,16 +566,38 @@ for var in lt_decl_all_varnames([[ \
     esac
 done
 
-# Fix-up fallback echo if it was mangled by the above quoting rules.
-case \$lt_ECHO in
-*'\\\[$]0 --fallback-echo"')dnl "
-  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\`
-  ;;
-esac
-
 _LT_OUTPUT_LIBTOOL_INIT
 ])
 
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable.  If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins.  After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script.  The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
 
 # LT_OUTPUT
 # ---------
@@ -562,20 +607,11 @@ _LT_OUTPUT_LIBTOOL_INIT
 AC_DEFUN([LT_OUTPUT],
 [: ${CONFIG_LT=./config.lt}
 AC_MSG_NOTICE([creating $CONFIG_LT])
-cat >"$CONFIG_LT" <<_LTEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate a libtool stub with the current configuration.
-
-lt_cl_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_LTEOF
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
 
 cat >>"$CONFIG_LT" <<\_LTEOF
-AS_SHELL_SANITIZE
-_AS_PREPARE
-
-exec AS_MESSAGE_FD>&1
+lt_cl_silent=false
 exec AS_MESSAGE_LOG_FD>>config.log
 {
   echo
@@ -601,7 +637,7 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
 m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
 configured by $[0], generated by m4_PACKAGE_STRING.
 
-Copyright (C) 2008 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This config.lt script is free software; the Free Software Foundation
 gives unlimited permision to copy, distribute and modify it."
 
@@ -646,15 +682,13 @@ chmod +x "$CONFIG_LT"
 # appending to config.log, which fails on DOS, as config.log is still kept
 # open by configure.  Here we exec the FD to /dev/null, effectively closing
 # config.log, so it can be properly (re)opened and appended to by config.lt.
-if test "$no_create" != yes; then
-  lt_cl_success=:
-  test "$silent" = yes &&
-    lt_config_lt_args="$lt_config_lt_args --quiet"
-  exec AS_MESSAGE_LOG_FD>/dev/null
-  $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
-  exec AS_MESSAGE_LOG_FD>>config.log
-  $lt_cl_success || AS_EXIT(1)
-fi
+lt_cl_success=:
+test "$silent" = yes &&
+  lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
 ])# LT_OUTPUT
 
 
@@ -717,15 +751,12 @@ _LT_EOF
   # if finds mixed CR/LF and LF-only lines.  Since sed operates in
   # text mode, it properly converts lines to CR/LF.  This bash problem
   # is reportedly fixed, but why not run on old versions too?
-  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
-
-  _LT_PROG_XSI_SHELLFNS
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
 
-  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
-    || (rm -f "$cfgfile"; exit 1)
+  _LT_PROG_REPLACE_SHELLFNS
 
-  mv -f "$cfgfile" "$ofile" ||
+   mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
 ],
@@ -831,11 +862,13 @@ AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
 AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
 AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
 AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
 dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
 dnl AC_DEFUN([AC_LIBTOOL_F77], [])
 dnl AC_DEFUN([AC_LIBTOOL_FC], [])
 dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
 
 
 # _LT_TAG_COMPILER
@@ -940,15 +973,40 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	[lt_cv_ld_exported_symbols_list=no])
 	LDFLAGS="$save_LDFLAGS"
     ])
+    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+      [lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+    ])
     case $host_os in
     rhapsody* | darwin1.[[012]])
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
     darwin1.*)
       _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-    darwin*) # darwin 5.x on 
+    darwin*) # darwin 5.x on
       # if running on 10.5 or later, the deployment target defaults
       # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it? 
+      # target defaults to 10.4. Don't you love it?
       case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
 	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
 	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
@@ -967,7 +1025,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
     else
       _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
     fi
-    if test "$DSYMUTIL" != ":"; then
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -987,11 +1045,19 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   _LT_TAGVAR(hardcode_direct, $1)=no
   _LT_TAGVAR(hardcode_automatic, $1)=yes
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  else
+    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  fi
   _LT_TAGVAR(link_all_deplibs, $1)=yes
   _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
-  if test "$GCC" = "yes"; then
-    output_verbose_link_cmd=echo
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
     _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
@@ -1007,203 +1073,142 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   fi
 ])
 
-# _LT_SYS_MODULE_PATH_AIX
-# -----------------------
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
 # Links a minimal program and checks the executable
 # for the system default hardcoded library path. In most cases,
 # this is /usr/lib:/lib, but when the MPI compilers are used
 # the location of the communication and MPI libs are included too.
 # If we don't find anything, use the default library path according
 # to the aix ld manual.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
 m4_defun([_LT_SYS_MODULE_PATH_AIX],
 [m4_require([_LT_DECL_SED])dnl
-AC_LINK_IFELSE(AC_LANG_PROGRAM,[
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi],[])
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+  lt_aix_libpath_sed='[
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }]'
+  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi],[])
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+  fi
+  ])
+  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
 ])# _LT_SYS_MODULE_PATH_AIX
 
 
 # _LT_SHELL_INIT(ARG)
 # -------------------
 m4_define([_LT_SHELL_INIT],
-[ifdef([AC_DIVERSION_NOTICE],
-	     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
-	 [AC_DIVERT_PUSH(NOTICE)])
-$1
-AC_DIVERT_POP
-])# _LT_SHELL_INIT
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
 
 
 # _LT_PROG_ECHO_BACKSLASH
 # -----------------------
-# Add some code to the start of the generated configure script which
-# will find an echo command which doesn't interpret backslashes.
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
 m4_defun([_LT_PROG_ECHO_BACKSLASH],
-[_LT_SHELL_INIT([
-# Check that we are running under the correct shell.
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-case X$lt_ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
-  ;;
-esac
-
-ECHO=${lt_ECHO-echo}
-if test "X[$]1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X[$]1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
-  # Yippee, $ECHO works!
-  :
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
 else
-  # Restart under the correct shell.
-  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
-fi
-
-if test "X[$]1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<_LT_EOF
-[$]*
-_LT_EOF
-  exit 0
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
 fi
 
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$lt_ECHO"; then
-  if test "X${echo_test_string+set}" != Xset; then
-    # find a string as large as possible, as long as the shell can cope with it
-    for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
-      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
-      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
-	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
-      then
-        break
-      fi
-    done
-  fi
-
-  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-     test "X$echo_testing_string" = "X$echo_test_string"; then
-    :
-  else
-    # The Solaris, AIX, and Digital Unix default echo programs unquote
-    # backslashes.  This makes it impossible to quote backslashes using
-    #   echo "$something" | sed 's/\\/\\\\/g'
-    #
-    # So, first we look for a working echo in the user's PATH.
-
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for dir in $PATH /usr/ucb; do
-      IFS="$lt_save_ifs"
-      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
-         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        ECHO="$dir/echo"
-        break
-      fi
-    done
-    IFS="$lt_save_ifs"
-
-    if test "X$ECHO" = Xecho; then
-      # We didn't find a better echo, so look for alternatives.
-      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        # This shell has a builtin print -r that does the trick.
-        ECHO='print -r'
-      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
-	   test "X$CONFIG_SHELL" != X/bin/ksh; then
-        # If we have ksh, try running configure again with it.
-        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-        export ORIGINAL_CONFIG_SHELL
-        CONFIG_SHELL=/bin/ksh
-        export CONFIG_SHELL
-        exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
-      else
-        # Try using printf.
-        ECHO='printf %s\n'
-        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	  # Cool, printf works
-	  :
-        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
-	  export CONFIG_SHELL
-	  SHELL="$CONFIG_SHELL"
-	  export SHELL
-	  ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
-        elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
-	     test "X$echo_testing_string" = 'X\t' &&
-	     echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	     test "X$echo_testing_string" = "X$echo_test_string"; then
-	  ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
-        else
-	  # maybe with a smaller string...
-	  prev=:
-
-	  for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
-	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
-	    then
-	      break
-	    fi
-	    prev="$cmd"
-	  done
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*" 
+}
 
-	  if test "$prev" != 'sed 50q "[$]0"'; then
-	    echo_test_string=`eval $prev`
-	    export echo_test_string
-	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
-	  else
-	    # Oops.  We lost completely, so just stick with echo.
-	    ECHO=echo
-	  fi
-        fi
-      fi
-    fi
-  fi
-fi
+case "$ECHO" in
+  printf*) AC_MSG_RESULT([printf]) ;;
+  print*) AC_MSG_RESULT([print -r]) ;;
+  *) AC_MSG_RESULT([cat]) ;;
+esac
 
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-lt_ECHO=$ECHO
-if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
-   lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
-fi
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test "X`printf %s $ECHO`" = "X$ECHO" \
+      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
 
-AC_SUBST(lt_ECHO)
-])
 _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
-_LT_DECL([], [ECHO], [1],
-    [An echo program that does not interpret backslashes])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
 ])# _LT_PROG_ECHO_BACKSLASH
 
 
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[  --with-sysroot[=DIR] Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted.  We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   AC_MSG_RESULT([${with_sysroot}])
+   AC_MSG_ERROR([The sysroot must be an absolute path.])
+   ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
 # _LT_ENABLE_LOCK
 # ---------------
 m4_defun([_LT_ENABLE_LOCK],
@@ -1232,7 +1237,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     if test "$lt_cv_prog_gnu_ld" = yes; then
       case `/usr/bin/file conftest.$ac_objext` in
@@ -1350,14 +1355,47 @@ need_locks="$enable_libtool_lock"
 ])# _LT_ENABLE_LOCK
 
 
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+  [lt_cv_ar_at_file=no
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+     [echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+      AC_TRY_EVAL([lt_ar_try])
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	AC_TRY_EVAL([lt_ar_try])
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+     ])
+  ])
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+  [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
 # _LT_CMD_OLD_ARCHIVE
 # -------------------
 m4_defun([_LT_CMD_OLD_ARCHIVE],
-[AC_CHECK_TOOL(AR, ar, false)
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
-_LT_DECL([], [AR], [1], [The archiver])
-_LT_DECL([], [AR_FLAGS], [1])
+[_LT_PROG_AR
 
 AC_CHECK_TOOL(STRIP, strip, :)
 test -z "$STRIP" && STRIP=:
@@ -1384,10 +1422,19 @@ if test -n "$RANLIB"; then
   esac
   old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
 fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
 _LT_DECL([], [old_postinstall_cmds], [2])
 _LT_DECL([], [old_postuninstall_cmds], [2])
 _LT_TAGDECL([], [old_archive_cmds], [2],
     [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+    [Whether to use a lock for old archive extraction])
 ])# _LT_CMD_OLD_ARCHIVE
 
 
@@ -1412,15 +1459,15 @@ AC_CACHE_CHECK([$1], [$2],
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        $2=yes
@@ -1460,7 +1507,7 @@ AC_CACHE_CHECK([$1], [$2],
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&AS_MESSAGE_LOG_FD
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          $2=yes
@@ -1512,7 +1559,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=-1;
     ;;
 
-  cygwin* | mingw*)
+  cygwin* | mingw* | cegcc*)
     # On Win9x/ME, this test blows up -- it succeeds, but takes
     # about 5 minutes as the teststring grows exponentially.
     # Worse, since 9x/ME are not pre-emptively multitasking,
@@ -1523,6 +1570,11 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -1587,8 +1639,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
-	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
@@ -1639,7 +1691,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-[#line __oline__ "configure"
+[#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -1680,11 +1732,13 @@ else
 #  endif
 #endif
 
-#ifdef __cplusplus
-extern "C" void exit (int);
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
 #endif
 
-void fnord() { int i=42;}
+int fnord () { return 42; }
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -1693,13 +1747,17 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
       /* dlclose (self); */
     }
   else
     puts (dlerror ());
 
-    exit (status);
+  return status;
 }]
 _LT_EOF
   if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
@@ -1738,7 +1796,7 @@ else
     lt_cv_dlopen_self=yes
     ;;
 
-  mingw* | pw32*)
+  mingw* | pw32* | cegcc*)
     lt_cv_dlopen="LoadLibrary"
     lt_cv_dlopen_libs=
     ;;
@@ -1869,16 +1927,16 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
@@ -2035,7 +2093,9 @@ m4_defun([_LT_SYS_DYNAMIC_LINKER],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 m4_require([_LT_DECL_EGREP])dnl
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
 m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
 AC_MSG_CHECKING([dynamic linker characteristics])
 m4_if([$1],
 	[], [
@@ -2044,16 +2104,23 @@ if test "$GCC" = yes; then
     darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
     *) lt_awk_arg="/^libraries:/" ;;
   esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
   # Ok, now we have the path, separated by spaces, we can step through it
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
@@ -2066,7 +2133,7 @@ if test "$GCC" = yes; then
 	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
-  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
 BEGIN {RS=" "; FS="/|\n";} {
   lt_foo="";
   lt_count=0;
@@ -2086,7 +2153,13 @@ BEGIN {RS=" "; FS="/|\n";} {
   if (lt_foo != "") { lt_freq[[lt_foo]]++; }
   if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
 }'`
-  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 fi])
@@ -2174,7 +2247,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
@@ -2199,14 +2272,15 @@ bsdi[[45]]*)
   # libtool to hard-code these into programs
   ;;
 
-cygwin* | mingw* | pw32*)
+cygwin* | mingw* | pw32* | cegcc*)
   version_type=windows
   shrext_cmds=".dll"
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32*)
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -2227,36 +2301,83 @@ cygwin* | mingw* | pw32*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+m4_if([$1], [],[
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
       ;;
-    mingw*)
+    mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
       library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
     ;;
 
   *)
+    # Assume MSVC wrapper
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
     ;;
   esac
-  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -2343,6 +2464,19 @@ gnu*)
   hardcode_into_libs=yes
   ;;
 
+haiku*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
 hpux9* | hpux10* | hpux11*)
   # Give a soname corresponding to the major version so that dld.sl refuses to
   # link against other versions.
@@ -2385,8 +2519,10 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='${libname}${release}${shared_ext}$major'
     ;;
   esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
   postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
   ;;
 
 interix[[3-9]]*)
@@ -2444,7 +2580,7 @@ linux*oldld* | linux*aout* | linux*coff*)
   ;;
 
 # This must be Linux ELF.
-linux* | k*bsd*-gnu)
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -2453,16 +2589,21 @@ linux* | k*bsd*-gnu)
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
+
   # Some binutils ld are patched to set DT_RUNPATH
-  save_LDFLAGS=$LDFLAGS
-  save_libdir=$libdir
-  eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
-       LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-    [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
-       [shlibpath_overrides_runpath=yes])])
-  LDFLAGS=$save_LDFLAGS
-  libdir=$save_libdir
+  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+    [lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+	 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+	 [lt_cv_shlibpath_overrides_runpath=yes])])
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+    ])
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
 
   # This implies no fast_install, which is unacceptable.
   # Some rework will be needed to allow for fast_install
@@ -2471,7 +2612,7 @@ linux* | k*bsd*-gnu)
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -2655,7 +2796,7 @@ tpf*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
-  library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
@@ -2679,7 +2820,7 @@ variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
 if test "$GCC" = yes; then
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
- 
+
 if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
   sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
 fi
@@ -2704,6 +2845,8 @@ _LT_DECL([], [library_names_spec], [1],
     The last name is the one that the linker finds with -lNAME]])
 _LT_DECL([], [soname_spec], [1],
     [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+    [Permission mode override for installation of shared libraries])
 _LT_DECL([], [postinstall_cmds], [2],
     [Command to use after installation of a shared archive])
 _LT_DECL([], [postuninstall_cmds], [2],
@@ -2816,6 +2959,7 @@ AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 m4_require([_LT_DECL_SED])dnl
 m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
 
 AC_ARG_WITH([gnu-ld],
     [AS_HELP_STRING([--with-gnu-ld],
@@ -2937,6 +3081,11 @@ case $reload_flag in
 esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
   darwin*)
     if test "$GCC" = yes; then
       reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
@@ -2945,8 +3094,8 @@ case $host_os in
     fi
     ;;
 esac
-_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl
-_LT_DECL([], [reload_cmds], [2])dnl
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
 ])# _LT_CMD_RELOAD
 
 
@@ -2956,6 +3105,7 @@ _LT_DECL([], [reload_cmds], [2])dnl
 #  -- PORTME fill in with the dynamic library characteristics
 m4_defun([_LT_CHECK_MAGIC_METHOD],
 [m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
 AC_CACHE_CHECK([how to recognize dependent libraries],
 lt_cv_deplibs_check_method,
 [lt_cv_file_magic_cmd='$MAGIC_CMD'
@@ -2997,15 +3147,23 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
     lt_cv_file_magic_cmd='$OBJDUMP -f'
   fi
   ;;
 
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
 darwin* | rhapsody*)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -3030,6 +3188,10 @@ gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
 hpux10.20* | hpux11*)
   lt_cv_file_magic_cmd=/usr/bin/file
   case $host_cpu in
@@ -3038,11 +3200,11 @@ hpux10.20* | hpux11*)
     lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
     ;;
   hppa*64*)
-    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
     lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
     ;;
   *)
-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
     lt_cv_file_magic_test_file=/usr/lib/libc.sl
     ;;
   esac
@@ -3064,7 +3226,7 @@ irix5* | irix6* | nonstopux*)
   ;;
 
 # This must be Linux ELF.
-linux* | k*bsd*-gnu)
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -3142,6 +3304,21 @@ tpf*)
   ;;
 esac
 ])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -3149,7 +3326,11 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
 _LT_DECL([], [deplibs_check_method], [1],
     [Method to check whether dependent libraries are shared objects])
 _LT_DECL([], [file_magic_cmd], [1],
-    [Command to use when deplibs_check_method == "file_magic"])
+    [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+    [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
 ])# _LT_CHECK_MAGIC_METHOD
 
 
@@ -3206,7 +3387,19 @@ if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
-  AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
   AC_SUBST([DUMPBIN])
   if test "$DUMPBIN" != ":"; then
     NM="$DUMPBIN"
@@ -3219,13 +3412,13 @@ _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
 AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
   [lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
   cat conftest.out >&AS_MESSAGE_LOG_FD
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -3240,6 +3433,67 @@ dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([AM_PROG_NM], [])
 dnl AC_DEFUN([AC_PROG_NM], [])
 
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+    [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+  [lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*])
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
 
 # LT_LIB_M
 # --------
@@ -3248,7 +3502,7 @@ AC_DEFUN([LT_LIB_M],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 LIBM=
 case $host in
-*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
   # These system don't have libm, or don't need it
   ;;
 *-ncr-sysv4.3*)
@@ -3276,9 +3530,14 @@ m4_defun([_LT_COMPILER_NO_RTTI],
 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
 
 if test "$GCC" = yes; then
-  _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
-
-  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+  case $cc_basename in
+  nvcc*)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+  esac
+
+  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
     lt_cv_prog_compiler_rtti_exceptions,
     [-fno-rtti -fno-exceptions], [],
     [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
@@ -3293,6 +3552,7 @@ _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
 m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
 AC_REQUIRE([LT_PATH_NM])dnl
 AC_REQUIRE([LT_PATH_LD])dnl
 m4_require([_LT_DECL_SED])dnl
@@ -3317,7 +3577,7 @@ case $host_os in
 aix*)
   symcode='[[BCDT]]'
   ;;
-cygwin* | mingw* | pw32*)
+cygwin* | mingw* | pw32* | cegcc*)
   symcode='[[ABCDGISTW]]'
   ;;
 hpux*)
@@ -3360,8 +3620,8 @@ esac
 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -3397,6 +3657,7 @@ for ac_symprfx in "" "_"; do
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
   fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
 
   # Check to see that the pipe works correctly.
   pipe_works=no
@@ -3418,7 +3679,7 @@ _LT_EOF
   if AC_TRY_EVAL(ac_compile); then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
       # Try sorting and uniquifying the output.
       if sort "$nlist" | uniq > "$nlist"T; then
 	mv -f "$nlist"T "$nlist"
@@ -3430,6 +3691,18 @@ _LT_EOF
       if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
 	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
 	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT@&t at _DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT@&t at _DLSYM_CONST
+#else
+# define LT@&t at _DLSYM_CONST const
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -3441,7 +3714,7 @@ _LT_EOF
 	  cat <<_LT_EOF >> conftest.$ac_ext
 
 /* The mapping between symbol names and symbols.  */
-const struct {
+LT@&t at _DLSYM_CONST struct {
   const char *name;
   void       *address;
 }
@@ -3467,15 +3740,15 @@ static const void *lt_preloaded_setup() {
 _LT_EOF
 	  # Now try linking the two files.
 	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_save_LIBS="$LIBS"
-	  lt_save_CFLAGS="$CFLAGS"
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
 	  LIBS="conftstm.$ac_objext"
 	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
 	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
 	    pipe_works=yes
 	  fi
-	  LIBS="$lt_save_LIBS"
-	  CFLAGS="$lt_save_CFLAGS"
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
 	else
 	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
 	fi
@@ -3508,6 +3781,13 @@ else
   AC_MSG_RESULT(ok)
 fi
 
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
 _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
     [Take the output of nm and produce a listing of raw symbols and C names])
 _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
@@ -3518,6 +3798,8 @@ _LT_DECL([global_symbol_to_c_name_address],
 _LT_DECL([global_symbol_to_c_name_address_lib_prefix],
     [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
     [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+    [Specify filename containing input files for $NM])
 ]) # _LT_CMD_GLOBAL_SYMBOLS
 
 
@@ -3529,7 +3811,6 @@ _LT_TAGVAR(lt_prog_compiler_wl, $1)=
 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
 _LT_TAGVAR(lt_prog_compiler_static, $1)=
 
-AC_MSG_CHECKING([for $compiler option to produce PIC])
 m4_if([$1], [CXX], [
   # C++ specific cases for pic, static, wl, etc.
   if test "$GXX" = yes; then
@@ -3563,7 +3844,7 @@ m4_if([$1], [CXX], [
     beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
       # PIC is the default for these OSes.
       ;;
-    mingw* | cygwin* | os2* | pw32*)
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       # Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -3580,6 +3861,11 @@ m4_if([$1], [CXX], [
       # DJGPP does not support shared libraries at all
       _LT_TAGVAR(lt_prog_compiler_pic, $1)=
       ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
     interix[[3-9]]*)
       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
       # Instead, we relocate shared libraries at runtime.
@@ -3590,10 +3876,11 @@ m4_if([$1], [CXX], [
       fi
       ;;
     hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
       case $host_cpu in
-      hppa*64*|ia64*)
+      hppa*64*)
 	;;
       *)
 	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
@@ -3628,6 +3915,12 @@ m4_if([$1], [CXX], [
 	  ;;
 	esac
 	;;
+      mingw* | cygwin* | os2* | pw32* | cegcc*)
+	# This hack is so that the source file can tell whether it is being
+	# built for inclusion in a dll (and should export symbols for example).
+	m4_if([$1], [GCJ], [],
+	  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+	;;
       dgux*)
 	case $cc_basename in
 	  ec++*)
@@ -3684,19 +3977,26 @@ m4_if([$1], [CXX], [
 	    ;;
 	esac
 	;;
-      linux* | k*bsd*-gnu)
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
 	case $cc_basename in
 	  KCC*)
 	    # KAI C++ Compiler
 	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
 	    ;;
-	  icpc* | ecpc* )
-	    # Intel C++
+	  ecpc* )
+	    # old Intel C++ for x86_64 which still supported -KPIC.
 	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
 	    ;;
+	  icpc* )
+	    # Intel C++, used to be incompatible with GCC.
+	    # ICC 10 doesn't accept -KPIC any more.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
 	  pgCC* | pgcpp*)
 	    # Portland Group C++ compiler
 	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
@@ -3710,8 +4010,8 @@ m4_if([$1], [CXX], [
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
 	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
 	    ;;
-	  xlc* | xlC*)
-	    # IBM XL 8.0 on PPC
+	  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+	    # IBM XL 8.0, 9.0 on PPC and BlueGene
 	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
 	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
@@ -3773,7 +4073,7 @@ m4_if([$1], [CXX], [
 	;;
       solaris*)
 	case $cc_basename in
-	  CC*)
+	  CC* | sunCC*)
 	    # Sun C++ 4.2, 5.x and Centerline C++
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
@@ -3862,7 +4162,7 @@ m4_if([$1], [CXX], [
       # PIC is the default for these OSes.
       ;;
 
-    mingw* | cygwin* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       # Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -3877,11 +4177,18 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
       ;;
 
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+
     hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
       case $host_cpu in
-      hppa*64*|ia64*)
+      hppa*64*)
 	# +Z the default
 	;;
       *)
@@ -3918,6 +4225,13 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
       ;;
     esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC'
+      ;;
+    esac
   else
     # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
@@ -3931,7 +4245,7 @@ m4_if([$1], [CXX], [
       fi
       ;;
 
-    mingw* | cygwin* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       m4_if([$1], [GCJ], [],
@@ -3960,14 +4274,34 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
       ;;
 
-    linux* | k*bsd*-gnu)
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
       case $cc_basename in
-      icc* | ecc* | ifort*)
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
         ;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+	;;
+      nagfor*)
+	# NAG Fortran compiler
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
 	# which looks to be a dead project)
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
@@ -3979,25 +4313,25 @@ m4_if([$1], [CXX], [
         # All Alpha code is PIC.
         _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
         ;;
-      xl*)
-	# IBM XL C 8.0/Fortran 10.1 on PPC
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
 	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
+	*Sun\ F* | *Sun*Fortran*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
 	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
 	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	*Sun\ C*)
+	  # Sun C 5.9
 	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	  ;;
 	esac
 	;;
@@ -4029,7 +4363,7 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
       case $cc_basename in
-      f77* | f90* | f95*)
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
       *)
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
@@ -4086,9 +4420,11 @@ case $host_os in
     _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
     ;;
 esac
-AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
-_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
-	[How to pass a linker flag through the compiler])
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
 
 #
 # Check to make sure the PIC flag actually works.
@@ -4107,6 +4443,8 @@ fi
 _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
 	[Additional compiler flags for building library objects])
 
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+	[How to pass a linker flag through the compiler])
 #
 # Check to make sure the static flag actually works.
 #
@@ -4127,6 +4465,7 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
 m4_defun([_LT_LINKER_SHLIBS],
 [AC_REQUIRE([LT_PATH_LD])dnl
 AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_EGREP])dnl
 m4_require([_LT_DECL_SED])dnl
@@ -4135,27 +4474,35 @@ m4_require([_LT_TAG_COMPILER])dnl
 AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
 m4_if([$1], [CXX], [
   _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
   case $host_os in
   aix[[4-9]]*)
     # If we're using GNU nm, then we don't want the "-C" option.
     # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    # Also, AIX nm treats weak defined symbols like other global defined
+    # symbols, whereas GNU nm marks them as "W".
     if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     else
       _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     fi
     ;;
   pw32*)
     _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
-  ;;
-  cygwin* | mingw*)
-    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
-  ;;
+    ;;
+  cygwin* | mingw* | cegcc*)
+    case $cc_basename in
+    cl*) ;;
+    *)
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+      ;;
+    esac
+    ;;
   *)
     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  ;;
+    ;;
   esac
-  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
 ], [
   runpath_var=
   _LT_TAGVAR(allow_undefined_flag, $1)=
@@ -4200,7 +4547,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
   extract_expsyms_cmds=
 
   case $host_os in
-  cygwin* | mingw* | pw32*)
+  cygwin* | mingw* | pw32* | cegcc*)
     # FIXME: the MSVC++ port hasn't been tested in a loooong time
     # When not using gcc, we currently assume that we are using
     # Microsoft Visual C++.
@@ -4218,7 +4565,33 @@ dnl Note also adjust exclude_expsyms for C++ above.
   esac
 
   _LT_TAGVAR(ld_shlibs, $1)=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
   if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+	  *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
@@ -4236,6 +4609,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
     fi
     supports_anon_versioning=no
     case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
       *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
       *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
       *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
@@ -4251,11 +4625,12 @@ dnl Note also adjust exclude_expsyms for C++ above.
 	_LT_TAGVAR(ld_shlibs, $1)=no
 	cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** Warning: the GNU linker, at least up to release 2.19, is reported
 *** to be unable to reliably create shared libraries on AIX.
 *** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
 
 _LT_EOF
       fi
@@ -4287,14 +4662,16 @@ _LT_EOF
       fi
       ;;
 
-    cygwin* | mingw* | pw32*)
+    cygwin* | mingw* | pw32* | cegcc*)
       # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
       # as there is no search path for DLLs.
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
       _LT_TAGVAR(always_export_symbols, $1)=no
       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -4312,6 +4689,11 @@ _LT_EOF
       fi
       ;;
 
+    haiku*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
     interix[[3-9]]*)
       _LT_TAGVAR(hardcode_direct, $1)=no
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -4327,7 +4709,7 @@ _LT_EOF
       _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
-    gnu* | linux* | tpf* | k*bsd*-gnu)
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
       tmp_diet=no
       if test "$host_os" = linux-dietlibc; then
 	case $cc_basename in
@@ -4337,15 +4719,16 @@ _LT_EOF
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
 	 && test "$tmp_diet" = no
       then
-	tmp_addflag=
+	tmp_addflag=' $pic_flag'
 	tmp_sharedflag='-shared'
 	case $cc_basename,$host_cpu in
         pgcc*)				# Portland Group C compiler
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag'
 	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
 	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
@@ -4353,13 +4736,20 @@ _LT_EOF
 	  tmp_addflag=' -i_dynamic -nofor_main' ;;
 	ifc* | ifort*)			# Intel Fortran compiler
 	  tmp_addflag=' -nofor_main' ;;
-	xl[[cC]]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
+	lf95*)				# Lahey Fortran 8.1
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+	  tmp_sharedflag='--shared' ;;
+	xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
 	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  ;;
 	esac
 	case `$CC -V 2>&1 | sed 5q` in
 	*Sun\ C*)			# Sun C 5.9
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	  _LT_TAGVAR(compiler_needs_object, $1)=yes
 	  tmp_sharedflag='-G' ;;
 	*Sun\ F*)			# Sun Fortran 8.3
@@ -4375,17 +4765,17 @@ _LT_EOF
         fi
 
 	case $cc_basename in
-	xlf*)
+	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
 	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
 	  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
 	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
 	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
@@ -4399,8 +4789,8 @@ _LT_EOF
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
       else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -4418,8 +4808,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	_LT_TAGVAR(ld_shlibs, $1)=no
       fi
@@ -4465,8 +4855,8 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	_LT_TAGVAR(ld_shlibs, $1)=no
       fi
@@ -4506,8 +4896,10 @@ _LT_EOF
       else
 	# If we're using GNU nm, then we don't want the "-C" option.
 	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
 	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	else
 	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	fi
@@ -4584,6 +4976,7 @@ _LT_EOF
 	fi
       fi
 
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
       # It seems that -bexpall does not export symbols beginning with
       # underscore (_), so it is better to generate a list of symbols to export.
       _LT_TAGVAR(always_export_symbols, $1)=yes
@@ -4593,9 +4986,9 @@ _LT_EOF
 	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        _LT_SYS_MODULE_PATH_AIX
+        _LT_SYS_MODULE_PATH_AIX([$1])
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
       else
 	if test "$host_cpu" = ia64; then
 	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
@@ -4604,14 +4997,19 @@ _LT_EOF
 	else
 	 # Determine the default libpath from the value encoded in an
 	 # empty executable.
-	 _LT_SYS_MODULE_PATH_AIX
+	 _LT_SYS_MODULE_PATH_AIX([$1])
 	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
 	  # Warning - without using the other run time loading flags,
 	  # -berok will link without error, but may produce a broken library.
 	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
 	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  fi
 	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
 	  # This is similar to how AIX traditionally builds its shared libraries.
 	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
@@ -4638,25 +5036,68 @@ _LT_EOF
       _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
       ;;
 
-    cygwin* | mingw* | pw32*)
+    cygwin* | mingw* | pw32* | cegcc*)
       # When not using gcc, we currently assume that we are using
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-      # FIXME: Should let the user specify the lib program.
-      _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
-      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	_LT_TAGVAR(always_export_symbols, $1)=yes
+	_LT_TAGVAR(file_list_spec, $1)='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	# FIXME: Should let the user specify the lib program.
+	_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	;;
+      esac
       ;;
 
     darwin* | rhapsody*)
@@ -4694,7 +5135,7 @@ _LT_EOF
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
     freebsd* | dragonfly*)
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
       _LT_TAGVAR(hardcode_direct, $1)=yes
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -4702,7 +5143,7 @@ _LT_EOF
 
     hpux9*)
       if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       else
 	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       fi
@@ -4717,8 +5158,8 @@ _LT_EOF
       ;;
 
     hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
 	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
@@ -4736,16 +5177,16 @@ _LT_EOF
       ;;
 
     hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
 	case $host_cpu in
 	hppa*64*)
 	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       else
@@ -4757,7 +5198,14 @@ _LT_EOF
 	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	m4_if($1, [], [
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  _LT_LINKER_OPTION([if $CC understands -b],
+	    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+	    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+	  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
 	  ;;
 	esac
       fi
@@ -4785,19 +5233,34 @@ _LT_EOF
 
     irix5* | irix6* | nonstopux*)
       if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	# Try to use the -exported_symbol ld option, if it does not
 	# work, assume that -exports_file does not work either and
 	# implicitly export all symbols.
-        save_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-        AC_LINK_IFELSE(int foo(void) {},
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-        )
-        LDFLAGS="$save_LDFLAGS"
+	# This should be the same for all languages, so no per-tag cache variable.
+	AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+	  [lt_cv_irix_exported_symbol],
+	  [save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   AC_LINK_IFELSE(
+	     [AC_LANG_SOURCE(
+	        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+			      [C++], [[int foo (void) { return 0; }]],
+			      [Fortran 77], [[
+      subroutine foo
+      end]],
+			      [Fortran], [[
+      subroutine foo
+      end]])])],
+	      [lt_cv_irix_exported_symbol=yes],
+	      [lt_cv_irix_exported_symbol=no])
+           LDFLAGS="$save_LDFLAGS"])
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
       else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
       fi
       _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
@@ -4859,17 +5322,17 @@ _LT_EOF
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
       _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
       ;;
 
     osf3*)
       if test "$GCC" = yes; then
 	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
       else
 	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
       fi
       _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
@@ -4879,13 +5342,13 @@ _LT_EOF
     osf4* | osf5*)	# as osf3* with the addition of -msym flag
       if test "$GCC" = yes; then
 	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
       else
 	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
 	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
@@ -4898,9 +5361,9 @@ _LT_EOF
       _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
       if test "$GCC" = yes; then
 	wlarc='${wl}'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
@@ -5076,36 +5539,38 @@ x|xyes)
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
-      $RM conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
-	pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
-        _LT_TAGVAR(allow_undefined_flag, $1)=
-        if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
-        then
-	  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-        else
-	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-        fi
-        _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $RM conftest*
-      AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])
+      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+	[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+	[$RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+	if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+	  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+	  _LT_TAGVAR(allow_undefined_flag, $1)=
+	  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+	  then
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	  else
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  fi
+	  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+	])
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
       ;;
     esac
   fi
@@ -5170,8 +5635,6 @@ _LT_TAGDECL([], [inherit_rpath], [0],
     to runtime path list])
 _LT_TAGDECL([], [link_all_deplibs], [0],
     [Whether libtool must link a program against all its dependency libraries])
-_LT_TAGDECL([], [fix_srcfile_path], [1],
-    [Fix the shell variable $srcfile for the compiler])
 _LT_TAGDECL([], [always_export_symbols], [0],
     [Set to "yes" if exported symbols are required])
 _LT_TAGDECL([], [export_symbols_cmds], [2],
@@ -5182,6 +5645,8 @@ _LT_TAGDECL([], [include_expsyms], [1],
     [Symbols that must always be exported])
 _LT_TAGDECL([], [prelink_cmds], [2],
     [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+    [Commands necessary for finishing linking programs])
 _LT_TAGDECL([], [file_list_spec], [1],
     [Specify filename containing input files])
 dnl FIXME: Not yet implemented
@@ -5275,37 +5740,22 @@ CC="$lt_save_CC"
 ])# _LT_LANG_C_CONFIG
 
 
-# _LT_PROG_CXX
-# ------------
-# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++
-# compiler, we have our own version here.
-m4_defun([_LT_PROG_CXX],
-[
-pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])
-AC_PROG_CXX
-if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
-    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
-    (test "X$CXX" != "Xg++"))) ; then
-  AC_PROG_CXXCPP
-else
-  _lt_caught_CXX_error=yes
-fi
-popdef([AC_MSG_ERROR])
-])# _LT_PROG_CXX
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([_LT_PROG_CXX], [])
-
-
 # _LT_LANG_CXX_CONFIG([TAG])
 # --------------------------
 # Ensure that the configuration variables for a C++ compiler are suitably
 # defined.  These variables are subsequently used by _LT_CONFIG to write
 # the compiler configuration to `libtool'.
 m4_defun([_LT_LANG_CXX_CONFIG],
-[AC_REQUIRE([_LT_PROG_CXX])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+else
+  _lt_caught_CXX_error=yes
+fi
 
 AC_LANG_PUSH(C++)
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
@@ -5327,6 +5777,8 @@ _LT_TAGVAR(module_cmds, $1)=
 _LT_TAGVAR(module_expsym_cmds, $1)=
 _LT_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 _LT_TAGVAR(no_undefined_flag, $1)=
 _LT_TAGVAR(whole_archive_flag_spec, $1)=
 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
@@ -5358,6 +5810,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 
   # Allow CC to be a program name with arguments.
   lt_save_CC=$CC
+  lt_save_CFLAGS=$CFLAGS
   lt_save_LD=$LD
   lt_save_GCC=$GCC
   GCC=$GXX
@@ -5375,6 +5828,7 @@ if test "$_lt_caught_CXX_error" != yes; then
   fi
   test -z "${LDCXX+set}" || LD=$LDCXX
   CC=${CXX-"c++"}
+  CFLAGS=$CXXFLAGS
   compiler=$CC
   _LT_TAGVAR(compiler, $1)=$CC
   _LT_CC_BASENAME([$compiler])
@@ -5396,8 +5850,8 @@ if test "$_lt_caught_CXX_error" != yes; then
       # Check if GNU C++ uses GNU ld as the underlying linker, since the
       # archiving commands below assume that GNU ld is being used.
       if test "$with_gnu_ld" = yes; then
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
 
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
         _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -5429,7 +5883,7 @@ if test "$_lt_caught_CXX_error" != yes; then
       # Commands to make compiler produce verbose output that lists
       # what "hidden" libraries, object files and flags are used when
       # linking a shared library.
-      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
 
     else
       GXX=no
@@ -5527,6 +5981,7 @@ if test "$_lt_caught_CXX_error" != yes; then
           fi
         fi
 
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
         # It seems that -bexpall does not export symbols beginning with
         # underscore (_), so it is better to generate a list of symbols to
 	# export.
@@ -5537,10 +5992,10 @@ if test "$_lt_caught_CXX_error" != yes; then
           _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
           # Determine the default libpath from the value encoded in an empty
           # executable.
-          _LT_SYS_MODULE_PATH_AIX
+          _LT_SYS_MODULE_PATH_AIX([$1])
           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
 
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
         else
           if test "$host_cpu" = ia64; then
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
@@ -5549,14 +6004,19 @@ if test "$_lt_caught_CXX_error" != yes; then
           else
 	    # Determine the default libpath from the value encoded in an
 	    # empty executable.
-	    _LT_SYS_MODULE_PATH_AIX
+	    _LT_SYS_MODULE_PATH_AIX([$1])
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
 	    # Warning - without using the other run time loading flags,
 	    # -berok will link without error, but may produce a broken library.
 	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
 	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	    # Exported symbols can be pulled into shared objects from archives
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	    if test "$with_gnu_ld" = yes; then
+	      # We only use this code for GNU lds that support --whole-archive.
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    else
+	      # Exported symbols can be pulled into shared objects from archives
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	    fi
 	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
 	    # This is similar to how AIX traditionally builds its shared
 	    # libraries.
@@ -5585,29 +6045,76 @@ if test "$_lt_caught_CXX_error" != yes; then
         esac
         ;;
 
-      cygwin* | mingw* | pw32*)
-        # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-        # as there is no search path for DLLs.
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-        _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-        _LT_TAGVAR(always_export_symbols, $1)=no
-        _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-
-        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-          # If the export-symbols file already is a .def file (1st line
-          # is EXPORTS), use it as is; otherwise, prepend...
-          _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	    cp $export_symbols $output_objdir/$soname.def;
-          else
-	    echo EXPORTS > $output_objdir/$soname.def;
-	    cat $export_symbols >> $output_objdir/$soname.def;
-          fi~
-          $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-        else
-          _LT_TAGVAR(ld_shlibs, $1)=no
-        fi
-        ;;
+      cygwin* | mingw* | pw32* | cegcc*)
+	case $GXX,$cc_basename in
+	,cl* | no,cl*)
+	  # Native MSVC
+	  # hardcode_libdir_flag_spec is actually meaningless, as there is
+	  # no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=yes
+	  _LT_TAGVAR(file_list_spec, $1)='@'
+	  # Tell ltmain to make .lib files, not .a files.
+	  libext=lib
+	  # Tell ltmain to make .dll files, not .so files.
+	  shrext_cmds=".dll"
+	  # FIXME: Setting linknames here is a bad hack.
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	    else
+	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	    fi~
+	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	    linknames='
+	  # The linker will not automatically build a static lib if we build a DLL.
+	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	  # Don't use ranlib
+	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	    lt_tool_outputfile="@TOOL_OUTPUT@"~
+	    case $lt_outputfile in
+	      *.exe|*.EXE) ;;
+	      *)
+		lt_outputfile="$lt_outputfile.exe"
+		lt_tool_outputfile="$lt_tool_outputfile.exe"
+		;;
+	    esac~
+	    func_to_tool_file "$lt_outputfile"~
+	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	      $RM "$lt_outputfile.manifest";
+	    fi'
+	  ;;
+	*)
+	  # g++
+	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+	  # as there is no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=no
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	    # If the export-symbols file already is a .def file (1st line
+	    # is EXPORTS), use it as is; otherwise, prepend...
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      cp $export_symbols $output_objdir/$soname.def;
+	    else
+	      echo EXPORTS > $output_objdir/$soname.def;
+	      cat $export_symbols >> $output_objdir/$soname.def;
+	    fi~
+	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	  ;;
+	esac
+	;;
       darwin* | rhapsody*)
         _LT_DARWIN_LINKER_FEATURES($1)
 	;;
@@ -5649,6 +6156,11 @@ if test "$_lt_caught_CXX_error" != yes; then
       gnu*)
         ;;
 
+      haiku*)
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        ;;
+
       hpux9*)
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
         _LT_TAGVAR(hardcode_libdir_separator, $1)=:
@@ -5673,11 +6185,11 @@ if test "$_lt_caught_CXX_error" != yes; then
             # explicitly linking system object files so we need to strip them
             # from the output so that they don't get included in the library
             # dependencies.
-            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
             ;;
           *)
             if test "$GXX" = yes; then
-              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
             else
               # FIXME: insert proper C++ library support
               _LT_TAGVAR(ld_shlibs, $1)=no
@@ -5738,7 +6250,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
 	    ;;
           *)
 	    if test "$GXX" = yes; then
@@ -5748,10 +6260,10 @@ if test "$_lt_caught_CXX_error" != yes; then
 	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	          ia64*)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	          *)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	        esac
 	      fi
@@ -5781,7 +6293,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         case $cc_basename in
           CC*)
 	    # SGI C++
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
 
 	    # Archives containing C++ object files must be created using
 	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
@@ -5792,9 +6304,9 @@ if test "$_lt_caught_CXX_error" != yes; then
           *)
 	    if test "$GXX" = yes; then
 	      if test "$with_gnu_ld" = no; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	      else
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
 	      fi
 	    fi
 	    _LT_TAGVAR(link_all_deplibs, $1)=yes
@@ -5805,7 +6317,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_TAGVAR(inherit_rpath, $1)=yes
         ;;
 
-      linux* | k*bsd*-gnu)
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
         case $cc_basename in
           KCC*)
 	    # Kuck and Associates, Inc. (KAI) C++ Compiler
@@ -5823,7 +6335,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
 
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -5860,26 +6372,26 @@ if test "$_lt_caught_CXX_error" != yes; then
           pgCC* | pgcpp*)
             # Portland Group C++ compiler
 	    case `$CC -V` in
-	    *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*)
+	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
 	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
-		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
+		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
 	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
 		$RANLIB $oldlib'
 	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
 	      ;;
-	    *) # Version 6 will use weak symbols
+	    *) # Version 6 and above use weak symbols
 	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
 	      ;;
@@ -5887,7 +6399,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
             ;;
 	  cxx*)
 	    # Compaq C++
@@ -5906,9 +6418,9 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
 	    ;;
-	  xl*)
+	  xl* | mpixl* | bgxl*)
 	    # IBM XL 8.0 on PPC, with GNU ld
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -5928,13 +6440,13 @@ if test "$_lt_caught_CXX_error" != yes; then
 	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
 	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
 	      _LT_TAGVAR(compiler_needs_object, $1)=yes
 
 	      # Not sure whether something based on
 	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
 	      # would be better.
-	      output_verbose_link_cmd='echo'
+	      output_verbose_link_cmd='func_echo_all'
 
 	      # Archives containing C++ object files must be created using
 	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
@@ -6003,7 +6515,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
 	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
 	  fi
-	  output_verbose_link_cmd=echo
+	  output_verbose_link_cmd=func_echo_all
 	else
 	  _LT_TAGVAR(ld_shlibs, $1)=no
 	fi
@@ -6038,15 +6550,15 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    case $host in
 	      osf3*)
 	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
 	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
 		;;
 	      *)
 	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
 	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
 	          echo "-hidden">> $lib.exp~
-	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
 	          $RM $lib.exp'
 	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
 		;;
@@ -6062,17 +6574,17 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
 	    ;;
 	  *)
 	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
 	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
 	      case $host in
 	        osf3*)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 		  ;;
 	        *)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 		  ;;
 	      esac
 
@@ -6082,7 +6594,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	      # Commands to make compiler produce verbose output that lists
 	      # what "hidden" libraries, object files and flags are used when
 	      # linking a shared library.
-	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
 
 	    else
 	      # FIXME: insert proper C++ library support
@@ -6118,7 +6630,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 
       solaris*)
         case $cc_basename in
-          CC*)
+          CC* | sunCC*)
 	    # Sun C++ 4.2, 5.x and Centerline C++
             _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
 	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
@@ -6139,7 +6651,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    esac
 	    _LT_TAGVAR(link_all_deplibs, $1)=yes
 
-	    output_verbose_link_cmd='echo'
+	    output_verbose_link_cmd='func_echo_all'
 
 	    # Archives containing C++ object files must be created using
 	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
@@ -6159,14 +6671,14 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
 	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
 	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
 	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 
 	        # Commands to make compiler produce verbose output that lists
 	        # what "hidden" libraries, object files and flags are used when
 	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
 	      else
 	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
 	        # platform.
@@ -6177,7 +6689,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	        # Commands to make compiler produce verbose output that lists
 	        # what "hidden" libraries, object files and flags are used when
 	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
 	      fi
 
 	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
@@ -6231,6 +6743,10 @@ if test "$_lt_caught_CXX_error" != yes; then
           CC*)
 	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
+	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+	      '"$_LT_TAGVAR(reload_cmds, $1)"
 	    ;;
 	  *)
 	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
@@ -6286,6 +6802,7 @@ if test "$_lt_caught_CXX_error" != yes; then
   fi # test -n "$compiler"
 
   CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
   LDCXX=$LD
   LD=$lt_save_LD
   GCC=$lt_save_GCC
@@ -6300,6 +6817,29 @@ AC_LANG_POP
 ])# _LT_LANG_CXX_CONFIG
 
 
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+  case ${2} in
+  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
 # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
 # ---------------------------------
 # Figure out "hidden" library dependencies from verbose
@@ -6308,6 +6848,7 @@ AC_LANG_POP
 # objects, libraries and library flags.
 m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
 # Dependencies to place before and after the object being linked:
 _LT_TAGVAR(predep_objects, $1)=
 _LT_TAGVAR(postdep_objects, $1)=
@@ -6358,6 +6899,13 @@ public class foo {
 };
 _LT_EOF
 ])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+esac
+
 dnl Parse the compiler output and extract the necessary
 dnl objects, libraries and library flags.
 if AC_TRY_EVAL(ac_compile); then
@@ -6369,7 +6917,7 @@ if AC_TRY_EVAL(ac_compile); then
   pre_test_object_deps_done=no
 
   for p in `eval "$output_verbose_link_cmd"`; do
-    case $p in
+    case ${prev}${p} in
 
     -L* | -R* | -l*)
        # Some compilers place space between "-{L,R}" and the path.
@@ -6378,13 +6926,22 @@ if AC_TRY_EVAL(ac_compile); then
           test $p = "-R"; then
 	 prev=$p
 	 continue
-       else
-	 prev=
        fi
 
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
        if test "$pre_test_object_deps_done" = no; then
-	 case $p in
-	 -L* | -R*)
+	 case ${prev} in
+	 -L | -R)
 	   # Internal compiler library paths should come after those
 	   # provided the user.  The postdeps already come after the
 	   # user supplied libs so there is no need to process them.
@@ -6404,8 +6961,10 @@ if AC_TRY_EVAL(ac_compile); then
 	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
 	 fi
        fi
+       prev=
        ;;
 
+    *.lto.$objext) ;; # Ignore GCC LTO objects
     *.$objext)
        # This assumes that the test object file only shows up
        # once in the compiler output.
@@ -6441,6 +7000,7 @@ else
 fi
 
 $RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
 
 # PORTME: override above test on systems where it is broken
 m4_if([$1], [CXX],
@@ -6477,7 +7037,7 @@ linux*)
 
 solaris*)
   case $cc_basename in
-  CC*)
+  CC* | sunCC*)
     # The more standards-conforming stlport4 library is
     # incompatible with the Cstd library. Avoid specifying
     # it if it's in CXXFLAGS. Ignore libCrun as
@@ -6521,32 +7081,16 @@ _LT_TAGDECL([], [compiler_lib_search_path], [1],
 ])# _LT_SYS_HIDDEN_LIBDEPS
 
 
-# _LT_PROG_F77
-# ------------
-# Since AC_PROG_F77 is broken, in that it returns the empty string
-# if there is no fortran compiler, we have our own version here.
-m4_defun([_LT_PROG_F77],
-[
-pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes])
-AC_PROG_F77
-if test -z "$F77" || test "X$F77" = "Xno"; then
-  _lt_disable_F77=yes
-fi
-popdef([AC_MSG_ERROR])
-])# _LT_PROG_F77
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([_LT_PROG_F77], [])
-
-
 # _LT_LANG_F77_CONFIG([TAG])
 # --------------------------
 # Ensure that the configuration variables for a Fortran 77 compiler are
 # suitably defined.  These variables are subsequently used by _LT_CONFIG
 # to write the compiler configuration to `libtool'.
 m4_defun([_LT_LANG_F77_CONFIG],
-[AC_REQUIRE([_LT_PROG_F77])dnl
-AC_LANG_PUSH(Fortran 77)
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
 
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
 _LT_TAGVAR(allow_undefined_flag, $1)=
@@ -6565,6 +7109,8 @@ _LT_TAGVAR(module_cmds, $1)=
 _LT_TAGVAR(module_expsym_cmds, $1)=
 _LT_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 _LT_TAGVAR(no_undefined_flag, $1)=
 _LT_TAGVAR(whole_archive_flag_spec, $1)=
 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
@@ -6604,7 +7150,9 @@ if test "$_lt_disable_F77" != yes; then
   # Allow CC to be a program name with arguments.
   lt_save_CC="$CC"
   lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
   CC=${F77-"f77"}
+  CFLAGS=$FFLAGS
   compiler=$CC
   _LT_TAGVAR(compiler, $1)=$CC
   _LT_CC_BASENAME([$compiler])
@@ -6658,38 +7206,24 @@ if test "$_lt_disable_F77" != yes; then
 
   GCC=$lt_save_GCC
   CC="$lt_save_CC"
+  CFLAGS="$lt_save_CFLAGS"
 fi # test "$_lt_disable_F77" != yes
 
 AC_LANG_POP
 ])# _LT_LANG_F77_CONFIG
 
 
-# _LT_PROG_FC
-# -----------
-# Since AC_PROG_FC is broken, in that it returns the empty string
-# if there is no fortran compiler, we have our own version here.
-m4_defun([_LT_PROG_FC],
-[
-pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes])
-AC_PROG_FC
-if test -z "$FC" || test "X$FC" = "Xno"; then
-  _lt_disable_FC=yes
-fi
-popdef([AC_MSG_ERROR])
-])# _LT_PROG_FC
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([_LT_PROG_FC], [])
-
-
 # _LT_LANG_FC_CONFIG([TAG])
 # -------------------------
 # Ensure that the configuration variables for a Fortran compiler are
 # suitably defined.  These variables are subsequently used by _LT_CONFIG
 # to write the compiler configuration to `libtool'.
 m4_defun([_LT_LANG_FC_CONFIG],
-[AC_REQUIRE([_LT_PROG_FC])dnl
-AC_LANG_PUSH(Fortran)
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
 
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
 _LT_TAGVAR(allow_undefined_flag, $1)=
@@ -6708,6 +7242,8 @@ _LT_TAGVAR(module_cmds, $1)=
 _LT_TAGVAR(module_expsym_cmds, $1)=
 _LT_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 _LT_TAGVAR(no_undefined_flag, $1)=
 _LT_TAGVAR(whole_archive_flag_spec, $1)=
 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
@@ -6747,7 +7283,9 @@ if test "$_lt_disable_FC" != yes; then
   # Allow CC to be a program name with arguments.
   lt_save_CC="$CC"
   lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
   CC=${FC-"f95"}
+  CFLAGS=$FCFLAGS
   compiler=$CC
   GCC=$ac_cv_fc_compiler_gnu
 
@@ -6803,7 +7341,8 @@ if test "$_lt_disable_FC" != yes; then
   fi # test -n "$compiler"
 
   GCC=$lt_save_GCC
-  CC="$lt_save_CC"
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
 fi # test "$_lt_disable_FC" != yes
 
 AC_LANG_POP
@@ -6840,10 +7379,12 @@ _LT_COMPILER_BOILERPLATE
 _LT_LINKER_BOILERPLATE
 
 # Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
 lt_save_GCC=$GCC
 GCC=yes
 CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
 compiler=$CC
 _LT_TAGVAR(compiler, $1)=$CC
 _LT_TAGVAR(LD, $1)="$LD"
@@ -6853,6 +7394,8 @@ _LT_CC_BASENAME([$compiler])
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
 
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 
 ## CAVEAT EMPTOR:
 ## There is no encapsulation within the following macros, do not change
@@ -6872,7 +7415,8 @@ fi
 AC_LANG_RESTORE
 
 GCC=$lt_save_GCC
-CC="$lt_save_CC"
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
 ])# _LT_LANG_GCJ_CONFIG
 
 
@@ -6907,9 +7451,11 @@ _LT_LINKER_BOILERPLATE
 
 # Allow CC to be a program name with arguments.
 lt_save_CC="$CC"
+lt_save_CFLAGS=$CFLAGS
 lt_save_GCC=$GCC
 GCC=
 CC=${RC-"windres"}
+CFLAGS=
 compiler=$CC
 _LT_TAGVAR(compiler, $1)=$CC
 _LT_CC_BASENAME([$compiler])
@@ -6922,7 +7468,8 @@ fi
 
 GCC=$lt_save_GCC
 AC_LANG_RESTORE
-CC="$lt_save_CC"
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
 ])# _LT_LANG_RC_CONFIG
 
 
@@ -6970,6 +7517,27 @@ AC_SUBST([GREP])
 ])
 
 
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
+
 # _LT_DECL_SED
 # ------------
 # Check for a fully-functional sed program, that truncates
@@ -7062,8 +7630,8 @@ m4_defun([_LT_CHECK_SHELL_FEATURES],
 # Try some XSI features
 xsi_shell=no
 ( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,, \
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
     && eval 'test $(( 1 + 1 )) -eq 2 \
     && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
   && xsi_shell=yes
@@ -7102,208 +7670,162 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
 ])# _LT_CHECK_SHELL_FEATURES
 
 
-# _LT_PROG_XSI_SHELLFNS
-# ---------------------
-# Bourne and XSI compatible variants of some useful shell functions.
-m4_defun([_LT_PROG_XSI_SHELLFNS],
-[case $xsi_shell in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-}
-
-# func_basename file
-func_basename ()
-{
-  func_basename_result="${1##*/}"
-}
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-  case ${1} in
-    */*) func_dirname_result="${1%/*}${2}" ;;
-    *  ) func_dirname_result="${3}" ;;
-  esac
-  func_basename_result="${1##*/}"
-}
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-func_stripname ()
-{
-  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-  # positional parameters, so assign one to ordinary parameter first.
-  func_stripname_result=${3}
-  func_stripname_result=${func_stripname_result#"${1}"}
-  func_stripname_result=${func_stripname_result%"${2}"}
-}
-
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=${1%%=*}
-  func_opt_split_arg=${1#*=}
-}
-
-# func_lo2o object
-func_lo2o ()
-{
-  case ${1} in
-    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-    *)    func_lo2o_result=${1} ;;
-  esac
-}
-
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=${1%.*}.lo
-}
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=$(( $[*] ))
-}
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=${#1}
-}
+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
+# ------------------------------------------------------
+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
+m4_defun([_LT_PROG_FUNCTION_REPLACE],
+[dnl {
+sed -e '/^$1 ()$/,/^} # $1 /c\
+$1 ()\
+{\
+m4_bpatsubsts([$2], [$], [\\], [^\([	 ]\)], [\\\1])
+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+])
 
-_LT_EOF
-    ;;
-  *) # Bourne compatible functions.
-    cat << \_LT_EOF >> "$cfgfile"
 
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-}
+# _LT_PROG_REPLACE_SHELLFNS
+# -------------------------
+# Replace existing portable implementations of several shell functions with
+# equivalent extended shell implementations where those features are available..
+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
+[if test x"$xsi_shell" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac
+    func_basename_result="${1##*/}"])
 
-# func_basename file
-func_basename ()
-{
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
+  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
+    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+    # positional parameters, so assign one to ordinary parameter first.
+    func_stripname_result=${3}
+    func_stripname_result=${func_stripname_result#"${1}"}
+    func_stripname_result=${func_stripname_result%"${2}"}])
 
-dnl func_dirname_and_basename
-dnl A portable version of this function is already defined in general.m4sh
-dnl so there is no need for it here.
+  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
+    func_split_long_opt_name=${1%%=*}
+    func_split_long_opt_arg=${1#*=}])
 
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-  case ${2} in
-    .*) func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
-    *)  func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
-  esac
-}
+  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
+    func_split_short_opt_arg=${1#??}
+    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
 
-# sed scripts:
-my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
-my_sed_long_arg='1s/^-[[^=]]*=//'
+  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
+    case ${1} in
+      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+      *)    func_lo2o_result=${1} ;;
+    esac])
 
-# func_opt_split
-func_opt_split ()
-{
-  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
-  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
-}
+  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
 
-# func_lo2o object
-func_lo2o ()
-{
-  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
-}
+  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
 
-# func_xform libobj-or-source
-func_xform ()
-{
-  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'`
-}
+  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
+fi
 
-# func_arith arithmetic-term...
-func_arith ()
-{
-  func_arith_result=`expr "$[@]"`
-}
+if test x"$lt_shell_append" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
 
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-  func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len`
-}
+  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
+    func_quote_for_eval "${2}"
+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
+    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
 
-_LT_EOF
-esac
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
 
-case $lt_shell_append in
-  yes)
-    cat << \_LT_EOF >> "$cfgfile"
+if test x"$_lt_function_replace_fail" = x":"; then
+  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
+fi
+])
 
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$[1]+=\$[2]"
-}
-_LT_EOF
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine which file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
     ;;
-  *)
-    cat << \_LT_EOF >> "$cfgfile"
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-  eval "$[1]=\$$[1]\$[2]"
-}
-
-_LT_EOF
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
     ;;
-  esac
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+         [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
 ])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+         [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4
index e970119..17cfd51 100644
--- a/m4/ltoptions.m4
+++ b/m4/ltoptions.m4
@@ -1,13 +1,14 @@
 # Helper functions for option handling.                    -*- Autoconf -*-
 #
-#   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+#   Inc.
 #   Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 6 ltoptions.m4
+# serial 7 ltoptions.m4
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
@@ -125,7 +126,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll],
 [enable_win32_dll=yes
 
 case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
   AC_CHECK_TOOL(AS, as, false)
   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
   AC_CHECK_TOOL(OBJDUMP, objdump, false)
@@ -133,13 +134,13 @@ case $host in
 esac
 
 test -z "$AS" && AS=as
-_LT_DECL([], [AS],      [0], [Assembler program])dnl
+_LT_DECL([], [AS],      [1], [Assembler program])dnl
 
 test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
 
 test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
 ])# win32-dll
 
 AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4
index 0d258e0..9000a05 100644
--- a/m4/ltsugar.m4
+++ b/m4/ltsugar.m4
@@ -1,13 +1,13 @@
 # ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
 #
-#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
-#   Written by Gary V. Vaughan, 2004
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 5 ltsugar.m4
+# serial 6 ltsugar.m4
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
@@ -63,14 +63,14 @@ m4_define([lt_append],
 # Produce a SEP delimited list of all paired combinations of elements of
 # PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
 # has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
 m4_define([lt_combine],
-[m4_if([$2], [], [],
-  [m4_if([$4], [], [],
-    [lt_join(m4_quote(m4_default([$1], [[, ]])),
-      lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_prefix, [$2],
-		   [m4_foreach(_Lt_suffix, lt_car([m4_shiftn(3, $@)]),
-			       [_Lt_prefix[]$3[]_Lt_suffix ])])))))])])dnl
-])
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+	     [m4_foreach([_Lt_suffix],
+		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
 
 
 # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
diff --git a/m4/ltversion.m4 b/m4/ltversion.m4
index 45cb155..9c7b5d4 100644
--- a/m4/ltversion.m4
+++ b/m4/ltversion.m4
@@ -7,17 +7,17 @@
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# Generated from ltversion.in.
+# @configure_input@
 
-# serial 2976 ltversion.m4
+# serial 3293 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.2.4])
-m4_define([LT_PACKAGE_REVISION], [1.2976])
+m4_define([LT_PACKAGE_VERSION], [2.4])
+m4_define([LT_PACKAGE_REVISION], [1.3293])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.2.4'
-macro_revision='1.2976'
+[macro_version='2.4'
+macro_revision='1.3293'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])
diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4
index 637bb20..c573da9 100644
--- a/m4/lt~obsolete.m4
+++ b/m4/lt~obsolete.m4
@@ -1,13 +1,13 @@
 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
 #
-#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
 #   Written by Scott James Remnant, 2004.
 #
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 4 lt~obsolete.m4
+# serial 5 lt~obsolete.m4
 
 # These exist entirely to fool aclocal when bootstrapping libtool.
 #
@@ -77,7 +77,6 @@ m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
 m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
 m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
 m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
-m4_ifndef([AC_LIBTOOL_RC],		[AC_DEFUN([AC_LIBTOOL_RC])])
 m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
 m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
 m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
@@ -90,3 +89,10 @@ m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
 m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
 m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
 m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],	[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP],		[AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],	[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
diff --git a/pycf/Makefile.am b/pycf/Makefile.am
new file mode 100644
index 0000000..c084d66
--- /dev/null
+++ b/pycf/Makefile.am
@@ -0,0 +1,19 @@
+#
+# $Id: $
+#
+
+libcfpydir = $(exec_prefix)/pycf
+
+if HAVE_PYTHON
+libCFConfig.py: $(top_builddir)/config.log
+	@PYTHON@ $(top_srcdir)/pycf/generateLibCFConfig.py -b $(top_builddir) -s $(top_srcdir) -c $@
+
+dist_libcfpy_SCRIPTS = libCFConfig.py __init__.py
+endif
+
+EXTRA_DIST = generateLibCFConfig.py
+
+clean-local:
+	-rm -rf libCFConfig.py
+
+
diff --git a/pycf/Makefile.in b/pycf/Makefile.in
new file mode 100644
index 0000000..6563bdb
--- /dev/null
+++ b/pycf/Makefile.in
@@ -0,0 +1,451 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#
+# $Id: $
+#
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = pycf
+DIST_COMMON = $(am__dist_libcfpy_SCRIPTS_DIST) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(srcdir)/__init__.py.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/cf_config.h \
+	$(top_builddir)/nfconfig.inc
+CONFIG_CLEAN_FILES = __init__.py
+CONFIG_CLEAN_VPATH_FILES =
+am__dist_libcfpy_SCRIPTS_DIST = libCFConfig.py __init__.py
+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__installdirs = "$(DESTDIR)$(libcfpydir)"
+SCRIPTS = $(dist_libcfpy_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FCFLAGS_f90 = @FCFLAGS_f90@
+FCLIBS = @FCLIBS@
+FGREP = @FGREP@
+GREP = @GREP@
+HAVE_DARWIN = @HAVE_DARWIN@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_LAPACK_LIB = @HAVE_LAPACK_LIB@
+HAVE_LAPACK_NO_UNDERSCORE = @HAVE_LAPACK_NO_UNDERSCORE@
+HAVE_LAPACK_UNDERSCORE = @HAVE_LAPACK_UNDERSCORE@
+HAVE_SHARED = @HAVE_SHARED@
+HAVE_UUID = @HAVE_UUID@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MOD_FLAG = @MOD_FLAG@
+NCDUMP = @NCDUMP@
+NCDUMPDIR = @NCDUMPDIR@
+NETCDFDIR = @NETCDFDIR@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_FC = @ac_ct_FC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+libcfpydir = $(exec_prefix)/pycf
+ at HAVE_PYTHON_TRUE@dist_libcfpy_SCRIPTS = libCFConfig.py __init__.py
+EXTRA_DIST = generateLibCFConfig.py
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign pycf/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign pycf/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+__init__.py: $(top_builddir)/config.status $(srcdir)/__init__.py.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-dist_libcfpySCRIPTS: $(dist_libcfpy_SCRIPTS)
+	@$(NORMAL_INSTALL)
+	test -z "$(libcfpydir)" || $(MKDIR_P) "$(DESTDIR)$(libcfpydir)"
+	@list='$(dist_libcfpy_SCRIPTS)'; test -n "$(libcfpydir)" || list=; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n' \
+	    -e 'h;s|.*|.|' \
+	    -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+	      if (++n[d] == $(am__install_max)) { \
+		print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+	    else { print "f", d "/" $$4, $$1 } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	     if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	     test -z "$$files" || { \
+	       echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(libcfpydir)$$dir'"; \
+	       $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(libcfpydir)$$dir" || exit $$?; \
+	     } \
+	; done
+
+uninstall-dist_libcfpySCRIPTS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dist_libcfpy_SCRIPTS)'; test -n "$(libcfpydir)" || exit 0; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	       sed -e 's,.*/,,;$(transform)'`; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(libcfpydir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(libcfpydir)" && rm -f $$files
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(SCRIPTS)
+installdirs:
+	for dir in "$(DESTDIR)$(libcfpydir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+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)
+
+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-generic clean-libtool clean-local mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_libcfpySCRIPTS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_libcfpySCRIPTS
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	clean-local distclean distclean-generic distclean-libtool \
+	distdir dvi dvi-am html html-am info info-am install \
+	install-am install-data install-data-am \
+	install-dist_libcfpySCRIPTS 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-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-dist_libcfpySCRIPTS
+
+
+ at HAVE_PYTHON_TRUE@libCFConfig.py: $(top_builddir)/config.log
+ at HAVE_PYTHON_TRUE@	@PYTHON@ $(top_srcdir)/pycf/generateLibCFConfig.py -b $(top_builddir) -s $(top_srcdir) -c $@
+
+clean-local:
+	-rm -rf libCFConfig.py
+
+# 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.
+.NOEXPORT:
diff --git a/pycf/__init__.py b/pycf/__init__.py
new file mode 100644
index 0000000..520a62f
--- /dev/null
+++ b/pycf/__init__.py
@@ -0,0 +1,4 @@
+# $Id: __init__.py.in 575 2011-03-16 21:07:02Z pletzer $
+
+# this is to allow from pycf import *
+__all__ = ["libCFConfig"]
diff --git a/pycf/__init__.py.in b/pycf/__init__.py.in
new file mode 100644
index 0000000..520a62f
--- /dev/null
+++ b/pycf/__init__.py.in
@@ -0,0 +1,4 @@
+# $Id: __init__.py.in 575 2011-03-16 21:07:02Z pletzer $
+
+# this is to allow from pycf import *
+__all__ = ["libCFConfig"]
diff --git a/pycf/generateLibCFConfig.py b/pycf/generateLibCFConfig.py
new file mode 100644
index 0000000..76fdf6b
--- /dev/null
+++ b/pycf/generateLibCFConfig.py
@@ -0,0 +1,164 @@
+#!/usr/bin/env python
+
+"""
+Script to generate config information for python
+$Id: generateLibCFConfig.py 913 2012-01-06 00:59:04Z pletzer $
+"""
+
+import re
+import time
+import os.path
+
+UNSET_VALUE = '123456790'
+
+FMT = """try: %s = %s
+except: %s = None"""
+
+# data to extract from config.log file
+# syntax:
+# name: [strVal, regex]
+conf_constants = {
+    'CPPFLAGS': ['', re.compile(r"^CPPFLAGS\s*=\s*\'(.*)\'")],
+    'USE_NETCDF4': ['0', re.compile(r'^USE_NETCDF4\s+(\d)')],
+    'prefix' : ['', re.compile(r"^prefix\s*=\s*\'?([\w\/\-\_\\\:]+)\'?")],
+    }
+
+conf_header_constants = {
+    'USE_NETCDF4': ['0', re.compile(r'^USE_NETCDF4\s+(\d)')],
+    }
+
+
+from optparse import OptionParser
+import sys
+import re
+
+def parseHeader(filename):
+    nameValue = []
+    for oline in open(filename).readlines():
+        line = oline.rstrip()
+
+        # 	NC_INT =	4,	/* signed 4 byte integer */
+        m = re.match(r'^\s*(NC_\w+)\s*=\s*(\d+)\,?', line)
+        if m:
+            name, value = m.group(1), m.group(2)
+            nameValue.append([name, value])
+
+        if not re.search(r'#define', line): continue
+        # don't know what to do with
+        if re.search(r'size\_t', line): continue
+        # removing casting
+        line = re.sub(r'\(\s*char\s*\)', '', line)
+        line = re.sub(r'\(\s*signed\s+char\s*\)', '', line)
+        line = re.sub(r'\(\s*short\s*\)', '', line)
+        line = re.sub(r'\(\s*long\s+long\s*\)', '', line)
+        line = re.sub(r'\(\s*unsigned\s+long\s+long\s*\)', '', line)
+        # remove trailing comment 
+        line = re.sub(r'\s*\/\*.*\*?\/?', '', line)
+        # remove parentheses around numbers, as in #define NC_EMAXNAME    	(-53)
+        line = re.sub(r'\(([^\)]+)\)', '\\1', line)
+        # remove trailing f, as in #define NC_MAX_FLOAT 3.402823466e+38f
+        line = re.sub(r'e(\-?\+?\d+)f\s*$', 'e\\1', line)
+        # remove LL from #define NC_MAX_INT64  9223372036854775807LL
+        line = re.sub(r'\s+(\-?\d+)U?L?L?', ' \\1', line)
+        # Find the name and value pair
+        f1 = '^#define\s+([A-Z\_\d]+)\s+\(?(\"?[!@#$%^&*()|:%\\\/\-\w\d\+\., ]*\"?)\)?\s*' 
+        m = re.match(f1, line)
+        if m:
+           name, value = m.group(1), m.group(2)
+           nameValue.append([name, value])
+    return nameValue
+
+# parse command line arguments
+parser = OptionParser()
+parser.add_option("-b", "--buildir", dest="builddir",
+                 help="location of build directory",)
+parser.add_option("-s", "--srcdir", dest="srcdir",
+                 help="location of source directory",)
+parser.add_option("-c", "--config", dest="config",
+                 help="path to python config file",)
+options, args = parser.parse_args()
+
+# parse config.log file
+for line in open(options.builddir + '/config.log').readlines():
+    for c in conf_constants:
+        cvals = conf_constants[c]
+        m = re.match(cvals[1], line)
+        if m:
+            cvals[0] = m.group(1)            
+
+# parse cf_config.h file
+for line in open(options.builddir + '/cf_config.h').readlines():
+    for c in conf_header_constants:
+        cvals = conf_header_constants[c]
+        m = re.match(cvals[1], line)
+        if m:
+            cvals[0] = m.group(1)
+
+def findNetcdfHeader():
+    # assumes -I <path>
+    incdirs = re.sub(r'\-I\s*', ' ', conf_constants['CPPFLAGS'][0]).split()
+    for d in incdirs:
+        if os.path.exists(d + '/netcdf.h'):
+            return d + '/netcdf.h'
+    return ''
+
+
+# parse netcdf header
+netcdf_header = findNetcdfHeader()
+nc_constants = []
+if netcdf_header:
+    nc_constants += parseHeader(netcdf_header)
+
+# libcf headers
+libcf_headers = [options.srcdir + '/include/libcf_src.h',
+                 options.srcdir + '/include/nccf_constants.h',
+                 options.srcdir + '/include/nccf_errors.h',
+                 ]
+libcf_constants = []
+for header in libcf_headers:
+    libcf_constants += parseHeader(header)
+
+# generate configure information and save it
+# in file config.py
+cfg = open(options.config, 'w')
+cmd = sys.argv[0]
+for a in sys.argv[1:]:
+    cmd += ' ' + a
+print >> cfg, """
+# DO NOT EDIT THIS FILE!
+# This script was auto-generated by running the command:
+# %s on %s
+""" % (cmd, time.asctime())
+for consts in conf_constants, conf_header_constants:
+    for c in consts:
+        # write constant in config.py file
+        if consts[c][0] == UNSET_VALUE:
+            print 'Warning: value for ', c, ' was not found!'
+        else:
+            # put quotes around if value is a string
+            try:
+                 num = eval(consts[c][0])
+                 print >> cfg, '%s = %s' % (c, consts[c][0])
+            except:
+                 # failed to evaluate as a number
+                 consts[c][0] = '"' + consts[c][0] + '"'
+                 print >> cfg, FMT % (c, consts[c][0], c)
+
+print >> cfg, '# netcdf constants'
+for c in nc_constants:
+    try:
+        num = eval(c[1])
+        print >> cfg, '%s = %s' % (c[0], c[1])
+    except:
+        print >> cfg, FMT % (c[0], c[1], c[0])
+
+print >> cfg, '# libCF constants'
+for c in libcf_constants:
+    try:
+        num = eval(c[1])
+        print >> cfg, '%s = %s' % (c[0], c[1])
+    except:
+        print >> cfg, FMT % (c[0], c[1], c[0])
+
+
+cfg.close()
diff --git a/pycf/libCFConfig.py b/pycf/libCFConfig.py
new file mode 100644
index 0000000..568a7f4
--- /dev/null
+++ b/pycf/libCFConfig.py
@@ -0,0 +1,370 @@
+
+# DO NOT EDIT THIS FILE!
+# This script was auto-generated by running the command:
+# ../../pycf/generateLibCFConfig.py -b .. -s ../.. -c libCFConfig.py on Fri Mar 23 14:08:25 2012
+
+try: CPPFLAGS = "-I/home/pletzer/software/netcdf-4.1.1-ser/include"
+except: CPPFLAGS = None
+try: prefix = "/home/pletzer/software/libcf-debug"
+except: prefix = None
+USE_NETCDF4 = 0
+USE_NETCDF4 = 0
+# netcdf constants
+NC_NAT = 0
+NC_BYTE = 1
+NC_CHAR = 2
+NC_SHORT = 3
+NC_INT = 4
+NC_FLOAT = 5
+NC_DOUBLE = 6
+NC_FILL_BYTE = -127
+NC_FILL_CHAR = 0
+NC_FILL_SHORT = -32767
+NC_FILL_INT = -2147483647
+NC_FILL_FLOAT = 9.9692099683868690e+36
+NC_FILL_DOUBLE = 9.9692099683868690e+36
+NC_FILL = 0
+NC_NOFILL = 0x100
+NC_NOWRITE = 0
+NC_WRITE = 0x1
+NC_CLOBBER = 0
+NC_NOCLOBBER = 0x4
+NC_64BIT_OFFSET = 0x0200
+NC_SHARE = 0x0800
+NC_STRICT_NC3 = 0x8
+NC_LOCK = 0x0400
+NC_FORMAT_CLASSIC = 1
+NC_FORMAT_64BIT = 2
+NC_FORMAT_NETCDF4 = 3
+NC_FORMAT_NETCDF4_CLASSIC = 4
+NC_SIZEHINT_DEFAULT = 0
+NC_UNLIMITED = 0
+NC_GLOBAL = -1
+NC_MAX_DIMS = 1024
+NC_MAX_ATTRS = 8192
+NC_MAX_VARS = 8192
+NC_MAX_NAME = 256
+try: NC_MAX_VAR_DIMS = NC_MAX_DIMS
+except: NC_MAX_VAR_DIMS = None
+NC_NOERR = 0
+NC2_ERR = -1
+NC_EBADID = -33
+NC_ENFILE = -34
+NC_EEXIST = -35
+NC_EINVAL = -36
+NC_EPERM = -37
+NC_ENOTINDEFINE = -38
+NC_EINDEFINE = -39
+NC_EINVALCOORDS = -40
+NC_EMAXDIMS = -41
+NC_ENAMEINUSE = -42
+NC_ENOTATT = -43
+NC_EMAXATTS = -44
+NC_EBADTYPE = -45
+NC_EBADDIM = -46
+NC_EUNLIMPOS = -47
+NC_EMAXVARS = -48
+NC_ENOTVAR = -49
+NC_EGLOBAL = -50
+NC_ENOTNC = -51
+NC_ESTS = -52
+NC_EMAXNAME = -53
+NC_EUNLIMIT = -54
+NC_ENORECVARS = -55
+NC_ECHAR = -56
+NC_EEDGE = -57
+NC_ESTRIDE = -58
+NC_EBADNAME = -59
+NC_ERANGE = -60
+NC_ENOMEM = -61
+NC_EVARSIZE = -62
+NC_EDIMSIZE = -63
+NC_ETRUNC = -64
+NC_EAXISTYPE = -65
+NC_EDAP = -66
+NC_ECURL = -67
+NC_EIO = -68
+NC_ENODATA = -69
+NC_EDAPSVC = -70
+NC_EDAS = -71
+NC_EDDS = -72
+NC_EDATADDS = -73
+NC_EDAPURL = -74
+NC_EDAPCONSTRAINT = -75
+NC_TURN_OFF_LOGGING = -1
+try: FILL_BYTE = NC_FILL_BYTE
+except: FILL_BYTE = None
+try: FILL_CHAR = NC_FILL_CHAR
+except: FILL_CHAR = None
+try: FILL_SHORT = NC_FILL_SHORT
+except: FILL_SHORT = None
+try: FILL_LONG = NC_FILL_INT
+except: FILL_LONG = None
+try: FILL_FLOAT = NC_FILL_FLOAT
+except: FILL_FLOAT = None
+try: FILL_DOUBLE = NC_FILL_DOUBLE
+except: FILL_DOUBLE = None
+try: MAX_NC_DIMS = NC_MAX_DIMS
+except: MAX_NC_DIMS = None
+try: MAX_NC_ATTRS = NC_MAX_ATTRS
+except: MAX_NC_ATTRS = None
+try: MAX_NC_VARS = NC_MAX_VARS
+except: MAX_NC_VARS = None
+try: MAX_NC_NAME = NC_MAX_NAME
+except: MAX_NC_NAME = None
+try: MAX_VAR_DIMS = NC_MAX_VAR_DIMS
+except: MAX_VAR_DIMS = None
+try: NC_LONG = NC_INT
+except: NC_LONG = None
+try: NC_ENTOOL = NC_EMAXNAME
+except: NC_ENTOOL = None
+NC_EXDR = -32
+NC_SYSERR = -31
+NC_FATAL = 1
+NC_VERBOSE = 2
+# libCF constants
+COORDINATE_AXIS_TYPE = "_CoordinateAxisType"
+COORDINATE_AXES = "_CoordinateAxes"
+COORDINATE_Z_IS_POSITIVE = "_CoordinateZisPositive"
+Z_UP = "up"
+Z_DOWN = "down"
+COORDINATE_SYSTEMS = "_CoordinateSystems"
+TRANSFORM_NAME = "transform_name"
+TRANSFORM_TYPE = "_CoordinateTransformType"
+COORDINATE_TRANSFORMS = "_CoordinateTransforms"
+CF_LONGITUDE_NAME = "longitude"
+CF_LATITUDE_NAME = "latitude"
+CF_LONGITUDE_UNITS = "degrees_east"
+CF_LATITUDE_UNITS = "degrees_north"
+CF_LONGITUDE_AXIS = "X"
+CF_LATITUDE_AXIS = "Y"
+CF_LEVEL_AXIS = "Z"
+CF_TIME_AXIS = "T"
+CF_UNITS = "units"
+CF_FORMULA_TERMS = "formula_terms"
+CF_AXIS = "axis"
+CF_UP = "up"
+CF_DOWN = "down"
+CF_POSITIVE = "positive"
+CF_MAX_LEN = 40
+CF_MAX_GS_STRING = 255
+CF_MAX_FT_VARS = 7
+try: CF_MAX_FT_LEN = NC_MAX_NAME * CF_MAX_FT_VARS + 31
+except: CF_MAX_FT_LEN = None
+CF_MAX_COORDS = 10
+try: CF_MAX_COORD_LEN = NC_MAX_NAME * CF_MAX_COORDS
+except: CF_MAX_COORD_LEN = None
+NCCF_NOAXISTYPE = 0
+NCCF_LATITUDE = 1
+NCCF_LONGITUDE = 2
+NCCF_GEOX = 3
+NCCF_GEOY = 4
+NCCF_GEOZ = 5
+NCCF_HEIGHT_UP = 6
+NCCF_HEIGHT_DOWN = 7
+NCCF_PRESSURE = 8
+NCCF_TIME = 9
+NCCF_RADAZ = 10
+NCCF_RADEL = 11
+NCCF_RADDIST = 12
+try: CF_NOERR = NC_NOERR
+except: CF_NOERR = None
+try: CF_ENOMEM = NC_ENOMEM
+except: CF_ENOMEM = None
+try: CF_EBADTYPE = NC_EBADTYPE
+except: CF_EBADTYPE = None
+try: CF_EINVAL = NC_EINVAL
+except: CF_EINVAL = None
+CF_ENETCDF = -400
+CF_ETIME = -401
+CF_EMINMAX = -402
+CF_EUNKCOORD = -403
+CF_EEXISTS = -404
+CF_ENOTFOUND = -405
+CF_ENODIM = -406
+CF_EBADVALUE = -407
+CF_EMAXFT = -408
+CF_EBADFT = -409
+CF_EMAX_NAME = -410
+CF_EMAXCOORDS = -411
+CF_ERECTOOLARGE = -412
+CF_ENDIMS = -413
+CF_EBADRANGE = -414
+X_SCHAR_MAX = 127
+X_UCHAR_MAX = 255
+X_SHORT_MAX = 32767
+X_INT_MAX = 2147483647
+X_FLOAT_MAX = 3.402823466e+38
+try: X_FLOAT_MIN = -X_FLOAT_MAX
+except: X_FLOAT_MIN = None
+X_DOUBLE_MAX = 1.7976931348623157e+308
+try: X_DOUBLE_MIN = -X_DOUBLE_MAX
+except: X_DOUBLE_MIN = None
+CF_BYTE_MIN = -126
+try: CF_BYTE_MAX = X_SCHAR_MAX
+except: CF_BYTE_MAX = None
+CF_CHAR_MIN = 1
+try: CF_CHAR_MAX = X_UCHAR_MAX
+except: CF_CHAR_MAX = None
+CF_SHORT_MIN = -32766
+try: CF_SHORT_MAX = X_SHORT_MAX
+except: CF_SHORT_MAX = None
+CF_INT_MIN = -2147483646
+try: CF_INT_MAX = X_INT_MAX
+except: CF_INT_MAX = None
+try: CF_FLOAT_MIN = X_FLOAT_MIN
+except: CF_FLOAT_MIN = None
+try: CF_FLOAT_MAX = NC_FILL_FLOAT
+except: CF_FLOAT_MAX = None
+try: CF_DOUBLE_MIN = NC_FILL_DOUBLE
+except: CF_DOUBLE_MIN = None
+try: CF_DOUBLE_MAX = X_DOUBLE_MIN
+except: CF_DOUBLE_MAX = None
+CF_CONVENTIONS = "Conventions"
+CF_CONVENTION_STRING = "CF-1.0"
+CF_TITLE = "title"
+CF_HISTORY = "history"
+CF_INSTITUTION = "institution"
+CF_SOURCE = "source"
+CF_COMMENT = "comment"
+CF_REFERENCES = "references"
+CF_UNITS = "units"
+CF_LONG_NAME = "long_name"
+CF_STANDARD_NAME = "standard_name"
+CF_FILL_VALUE = "_FillValue"
+CF_VALID_MIN = "valid_min"
+CF_VALID_MAX = "valid_max"
+CF_COORDINATES = "coordinates"
+CF_VERT_ATM_LN = 0
+STD_ATM_LN = "atmosphere_ln_pressure_coordinate"
+FT_ATM_LN_FORMAT = "p0: %s lev: %s"
+FT_ATM_LN_TERMS = 2
+CF_VERT_SIGMA = 1
+STD_SIGMA = "atmosphere_sigma_coordinate"
+FT_SIGMA_FORMAT = "sigma: %s ps: %s ptop: %s"
+FT_SIGMA_TERMS = 3
+CF_VERT_HYBRID_SIGMA = 2
+STD_HYBRID_SIGMA = "atmosphere_hybrid_sigma_pressure_coordinate"
+FT_HYBRID_SIGMA_FORMAT = "a: %s b: %s ps: %s p0: %s"
+FT_HYBRID_SIGMA_TERMS = 4
+CF_VERT_HYBRID_HEIGHT = 3
+STD_HYBRID_HEIGHT = "atmosphere_hybrid_height_coordinate"
+FT_HYBRID_HEIGHT_FORMAT = "a: %s b: %s orog: %s"
+FT_HYBRID_HEIGHT_TERMS = 3
+CF_VERT_SLEVE = 4
+STD_SLEVE = "atmosphere_sleve_coordinate"
+FT_SLEVE_FORMAT = "a: %s b1: %s b2: %s ztop: %s zsurf1: %s zsurf2: %s"
+FT_SLEVE_TERMS = 6
+CF_VERT_OCEAN_SIGMA = 5
+STD_OCEAN_SIGMA = "ocean_sigma_coordinate"
+FT_OCEAN_SIGMA_FORMAT = "sigma: %s eta: %s depth: %s"
+FT_OCEAN_SIGMA_TERMS = 3
+CF_VERT_OCEAN_S = 6
+STD_OCEAN_S = "ocean_s_coordinate"
+FT_OCEAN_S_FORMAT = "s: %s eta: %s depth: %s a: %s b: %s depth_c: %s"
+FT_OCEAN_S_TERMS = 6
+CF_VERT_OCEAN_SIGMA_Z = 7
+STD_OCEAN_SIGMA_Z = "ocean_sigma_z_coordinate"
+FT_OCEAN_SIGMA_Z_FORMAT = "sigma: %s eta: %s depth: %s depth_c: %s nsigma: %s zlev: %s"
+FT_OCEAN_SIGMA_Z_TERMS = 6
+CF_VERT_OCEAN_DBL_SIGMA = 8
+STD_OCEAN_DBL_SIGMA = "ocean_double_sigma_coordinate"
+FT_OCEAN_DBL_SIGMA_FORMAT = "sigma: %s depth: %s z1: %s z2: %s a: %s href: %s k_c: %s"
+FT_OCEAN_DBL_SIGMA_TERMS = 7
+CF_NUM_VERT = 9
+FT_MAX_TERMS = 7
+CF_HUGE_INT = 2147483647
+CF_HUGE_FLOAT = 3.402823466e+38
+try: CF_HUGE_DOUBLE = HUGE_VAL
+except: CF_HUGE_DOUBLE = None
+CF_GS_HOST_MOSAIC_FILENAME = "gridspec_mosaic_filename"
+CF_GS_HOST_TILE_FILENAMES = "gridspec_tile_filenames"
+CF_GS_HOST_STATDATA_FILENAME = "gridspec_static_data_filenames"
+CF_GS_HOST_TIMEDATA_FILENAME = "gridspec_time_data_filenames"
+CF_GLATT_FILETYPE_HOST = "gridspec_host_file"
+CF_GS_MOSAIC_CONTACT_MAP = "gridspec_contact_map"
+CF_GS_MOSAIC_COORDINATE_NAME = "gridspec_coord_names"
+CF_GS_MOSAIC_TILE_NAMES = "gridspec_tile_names"
+CF_GS_MOSAIC_TILE_CONTACTS = "gridspec_tile_contacts"
+CF_GLATT_FILETYPE_MOSAIC = "gridspec_mosaic_file"
+CF_CONTACT_FORMAT = "gridspec_slice_format"
+CF_INDEX_SEPARATOR = " "
+CF_TILE_SEPARATOR = " | "
+CF_RANGE_SEPARATOR = ":"
+CF_GLATT_FILETYPE_GRID = "gridspec_tile_file"
+CF_GLATT_FILETYPE_STATIC_DATA = "gridspec_static_data_file"
+CF_GLATT_FILETYPE_TIME_DATA = "gridspec_time_data_file"
+CF_DIMNAME_STRING = "nstring"
+CF_DIMNAME_MOSAIC = "ncontact"
+CF_DIMNAME_NDIMS = "ndims"
+CF_DIMNAME_NTIMEDATA = "ntimedata"
+CF_DIMNAME_NSTATDATA = "nstatdata"
+CF_DIMNAME_NGRIDS = "ngrid"
+CF_DIMNAME_NCONTACTS = "ncontacts"
+CF_DIMNAME_NTARGETS = "ntargets"
+CF_DIMNAME_NNODES = "nnodes"
+CF_DIMNAME_NTIMES = "ntimes"
+CF_ATTNAME_CF_TYPE_NAME = "gridspec_type_name"
+CF_ATTNAME_STANDARD_NAME = "standard_name"
+CF_ATTNAME_LONG_NAME = "long_name"
+CF_ATTNAME_UNITS = "units"
+CF_ATTNAME_BOUNDS = "bounds"
+CF_ATTNAME_AXIS = "axis"
+CF_ATTNAME_POSITIVE = "positive"
+CF_GLOBAL = ""
+CF_NA = "N/A"
+CF_COORDINATES_ID = "gridspec_coordinates_id"
+CF_DATA_ID = "gridspec_data_id"
+CF_FILETYPE = "gridspec_file_type"
+CF_GRIDNAME = "gridspec_tile_name"
+CF_ORIGINALFILENAME = "originalfilename"
+CF_GLOBAL_TITLE = "Title"
+CF_GLOBAL_IDENTIFIER = "Identifier"
+CF_GLOBAL_INSTITUTION = "Institution"
+CF_GLOBAL_MODEL = "Model"
+CF_GLOBAL_RUN = "Run"
+CF_FILENAME_GRID = "_grid"
+CF_FILENAME_CONTACTS = "_contacts"
+CF_FILENAME_MOSAIC = "_mosaic"
+try: STRING_SIZE = NC_MAX_NAME
+except: STRING_SIZE = None
+NCCF_ENOAXISID = -1000
+NCCF_ENOCOORDID = -1001
+NCCF_ENOGRIDID = -1002
+NCCF_ENODATAID = -1003
+NCCF_ENOREGRIDID = -1004
+NCCF_ENOMOSAICID = -1005
+NCCF_ENOHOSTID = -1006
+NCCF_VAROBJCREATE = -1007
+NCCF_VAROBJCREATEFROMFILE = -1008
+NCCF_VAROBJDESTROY = -1009
+NCCF_VAROBJSETATTRIB = -1010
+NCCF_VAROBJGETATTRIBPTR = -1011
+NCCF_VAROBJSETDIMS = -1012
+NCCF_VAROBJGETDIMNAMEPTR = -1013
+NCCF_VAROBJSETDATAPTR = -1014
+NCCF_VAROBJSETDATA = -1015
+NCCF_VAROBJGETVARNAMEPTR = -1016
+NCCF_VAROBJGETDATATYPE = -1017
+NCCF_VAROBJGETDATAPTR = -1018
+NCCF_VAROBJGETNUMDIMS = -1019
+NCCF_VAROBJGETATTRIBLIST = -1020
+NCCF_VAROBJSETVARNAME = -1021
+NCCF_VAROBJWRITELISTOFVARS = -1022
+NCCF_EINDEXOUTOFRANGE = -1030
+NCCF_EPARSERANGES = -1031
+NCCF_ENOTHOSTFILE = -1040
+NCCF_EPUTCOORD = -1041
+NCCF_EPUTGRID = -1042
+NCCF_EPUTDATA = -1043
+NCCF_EPUTREGRID = -1044
+NCCF_EPUTMOSAIC = -1045
+NCCF_EPUTHOST = -1046
+NCCF_ENODATA = -1050
+NCCF_EVERTMISMATCH = -1051
+NCCF_ENGRIDMISMATCH = -1052
+NCCF_EATTEXISTS = -1053
+NCCF_EBADGRIDINDEX = -1054
+NCCF_EBADVAR = -1055
+NCCF_ENDIMS = -1056
+NCCF_LISTITEMEXISTS = -1060 
diff --git a/setup.py.in b/setup.py.in
new file mode 100644
index 0000000..aa24924
--- /dev/null
+++ b/setup.py.in
@@ -0,0 +1,142 @@
+#!/usr/bin/env python
+#
+# Python installation script
+# $Id: setup.py.in 916 2012-01-12 22:32:36Z pletzer $
+#
+# Python installation script. Will install the shared library 
+# and libCFConfig.py in the directory where python puts its 
+# modules (generally /usr/lib/python<VERSION>/site-packages. 
+# setup.py will be created upon configuring, with some autoconf
+# settings filled in when configuring.
+#
+
+from distutils.core import setup, Extension
+import types
+import re
+import glob
+import os.path
+
+
+# constants
+PAT_LIBDIR = re.compile(r'^-L')      # UNIX
+PAT_LIBRARY = re.compile(r'^-l')     # UNIX
+PAT_UNIT_TEST = re.compile(r'tst_')  # our way of distinguishing unit tests
+
+# list all the directories that contain source file to be compiled 
+# into a shared library
+EXTDIRS = ['@abs_srcdir@/src', 
+           '@abs_srcdir@/gridspec_api/global',
+           '@abs_srcdir@/gridspec_api/axis',
+           '@abs_srcdir@/gridspec_api/coord',
+           '@abs_srcdir@/gridspec_api/grid',
+           '@abs_srcdir@/gridspec_api/data',
+           '@abs_srcdir@/gridspec_api/regrid',
+           '@abs_srcdir@/gridspec_api/mosaic',
+           '@abs_srcdir@/gridspec_api/host',
+]
+
+LIBS = "@LIBS@"
+
+def findNetcdfIncludeDir():
+    # assumes -I <path>
+    incdirs = re.sub(r'\-I\s*', ' ', "@CPPFLAGS@").split()
+    for d in incdirs:
+        if os.path.exists(d + '/netcdf.h'):
+            return d
+    return ''
+
+netcdfinc = findNetcdfIncludeDir()
+if not netcdfinc:
+    print '*** error: could not find netcdf.h file in CPPFLAGS'
+    sys.exit(1)
+
+# list all the include directories
+incdirs = [netcdfinc,
+           '@abs_srcdir@/include', 
+           '@abs_srcdir@/src',
+           '@abs_srcdir@/gridspec_api/global',
+           '@abs_srcdir@/gridspec_api/axis',
+           '@abs_srcdir@/gridspec_api/coord',
+           '@abs_srcdir@/gridspec_api/grid',
+           '@abs_srcdir@/gridspec_api/data',
+           '@abs_srcdir@/gridspec_api/regrid',
+           '@abs_srcdir@/gridspec_api/mosaic',
+           '@abs_srcdir@/gridspec_api/host',
+           '@abs_builddir@',] # config.h
+
+def contractPath(path):
+    """
+    Remove ../ from the path
+    """
+    return re.sub(r'\/[^\/]+\/\.\.', '', path)
+
+def getLibraryDirs(libs):
+    """
+    Extract the library paths from string libs
+    """
+    res = []
+    for word in libs.split():
+        if re.match(PAT_LIBDIR, word):
+            res.append( re.sub(PAT_LIBDIR, '', word) )
+    return res
+
+def getLibraries(libs):
+    """
+    Extract the list of libraries to link against from string libs
+    """
+    res = []
+    for word in libs.split():
+        if re.match(PAT_LIBRARY, word):
+            res.append( re.sub(PAT_LIBRARY, '', word) )
+    return res
+
+def getAllLibFiles(dirs):
+    """
+    Given a list of directories, return all the source files,
+    excluding 'tst_' files
+    """
+    listOfFiles = []
+    for d in dirs:
+        allSrcFiles = glob.glob(d + '/*.c')
+        libFiles = []
+        for f in allSrcFiles:
+            if not re.search(PAT_UNIT_TEST, f):
+                f2 = contractPath(f)
+                libFiles.append(f2)
+        listOfFiles += libFiles
+    return listOfFiles
+
+#
+# Packages and extensions
+#
+source_files = getAllLibFiles(EXTDIRS)
+library_dirs = getLibraryDirs(LIBS)
+libraries = getLibraries(LIBS)
+if @HAVE_UUID@:
+    libraries.append('uuid')
+
+defs = {'HAVE_LAPACK_LIB': @HAVE_LAPACK_LIB@,
+        'HAVE_LAPACK_NO_UNDERSCORE': @HAVE_LAPACK_NO_UNDERSCORE@,
+        'HAVE_LAPACK_UNDERSCORE': @HAVE_LAPACK_UNDERSCORE@}
+define_macros = []
+if defs['HAVE_LAPACK_LIB'] == 1:
+    define_macros.append( ('HAVE_LAPACK_LIB', None) ) #define HAVE_LAPACK_LIB
+define_macros.append( ('HAVE_LAPACK_NO_UNDERSCORE', 
+                       str(defs['HAVE_LAPACK_NO_UNDERSCORE'])) )
+define_macros.append( ('HAVE_LAPACK_UNDERSCORE', 
+                       str(defs['HAVE_LAPACK_UNDERSCORE'])) )
+    
+
+setup(name = "@PACKAGE_NAME@",
+      version = "@VERSION@",
+      description = "A library that supports the creation of CF compliant NetCDF files",
+      author_email = "pletzer at txcorp.com",
+      maintainer_email = "support at unidata.ucar.edu",
+      url = "http://www.unidata.ucar.edu/software/libcf/",
+      packages = ["pycf",],
+      ext_modules=[Extension('pycf.pylibcf', source_files,
+                             include_dirs = incdirs,
+                             library_dirs = library_dirs,
+                             libraries = libraries,
+                             define_macros = define_macros),],
+)
diff --git a/src/Makefile.am b/src/Makefile.am
index 60ee4e5..1ac6e87 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,131 +1,96 @@
 ## This is an automake file, part of Unidata's NetCDF CF Library package.
-# Copyright 2006, see the COPYRIGHT file for more information.
+# Copyright 2006-2011, see the COPYRIGHT file for more information.
 
-# THis automake file is in charge of building the src directory.
-
-# $Id: Makefile.am,v 1.5 2009/11/11 12:59:24 ed Exp $
-
-# Tell automake that libcf.h is a header file we want to install.
-include_HEADERS = libcf.h
+# This automake file is in charge of building the src directory.
 
 # Test programs will need to link to this library (libcf) and also
 # netcdf.
 LDADD = ${lib_LTLIBRARIES}
+LDADD += -lnetcdf
 
 # Initalize these.
-AM_CPPFLAGS=
-AM_LDFLAGS=
+AM_CPPFLAGS = -I$(top_srcdir)/include
+AM_LDFLAGS =
+
+include_HEADERS =          \
+nccf_find_next_indices.h   \
+nccf_keyvalue.h            
 
 # This is our output, the NetCDF CF Library.
-lib_LTLIBRARIES = libcf.la
+lib_LTLIBRARIES = libcf_src.la
+
+# I think we always need this one
+LDADD += -lm
+
+# These linker flags specify libtool version info.
+libcf_src_la_LDFLAGS = -version-info 0:0:0
 
 check_PROGRAMS = tst_coords tst_files tst_vars tst_cvars tst_vert	\
-tst_subsets
+tst_subsets tst_princeton tst_listitem tst_nccf_get_flat_index		\
+tst_nccf_index2vector tst_nccf_varObj tst_solve tst_linear_interp	\
+tst_nccf_get_bipolar_cap tst_nccf_get_tripolar_grid			\
+tst_nccf_generate_id tst_nccf_get_tripolar_halfgrid			\
+tst_nccf_get_cubedsphere_grid tst_nccf_find_adjacent			\
+tst_nccf_linear_interp_mask tst_nccf_keyvalue \
+tst_nccf_get_flat_index tst_nccf_index2vector		\
+tst_nccf_varObj tst_solve tst_linear_interp tst_nccf_get_bipolar_cap	\
+tst_nccf_get_tripolar_grid tst_nccf_generate_id				\
+tst_nccf_get_tripolar_halfgrid tst_nccf_get_cubedsphere_grid		\
+tst_nccf_find_adjacent tst_nccf_linear_interp_mask tst_nccf_keyvalue
+
+#noinst_PROGRAMS = tst_nccf_get_flat_index tst_nccf_index2vector		
 
 if BUILD_F90
-lib_LTLIBRARIES += libcff.la
-libcff_la_DEPENDENCIES = libcf_api.f90
+lib_LTLIBRARIES += libcff_src.la
+libcff_src_la_DEPENDENCIES = libcf_api.f90
 EXTRA_DIST = libcf_api.f90
-libcff_la_SOURCES = cffcvars.f90
-if USE_NETCDF4
-check_PROGRAMS += tst_f03_file
-tst_f03_file_SOURCES = tst_f03_file.f90
-endif # USE_NETCDF4
-LDADD += libcf.la
-if USE_NETCDF_DIR
-AM_FCFLAGS = @MOD_FLAG@@NETCDFDIR@/include
-else
-AM_FCFLAGS = @MOD_FLAG at ../../f90
-endif
+libcff_src_la_SOURCES = cffcvars.f90
+# if USE_NETCDF4
+# check_PROGRAMS += tst_f03_file
+# tst_f03_file_SOURCES = tst_f03_file.f90
+# endif # USE_NETCDF4
+LDADD += libcf_src.la
 endif # BUILD_F90
 
-# Link to the netCDF-4, (optionally) HDF4, and the HDF5 libraries.
-if USE_NETCDF_DIR
-LDADD += -lnetcdf
-AM_CPPFLAGS += -I at NETCDFDIR@/include
-AM_LDFLAGS += -L at NETCDFDIR@/lib
-else
-if USE_NETCDF4
-LDADD += ../../libsrc4/libnetcdf.la 
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc4
-AM_LDFLAGS += -L../../libsrc4
-else 
-LDADD += ../../libsrc/libnetcdf.la
-AM_CPPFLAGS += -I$(top_srcdir)/../libsrc
-AM_LDFLAGS += -L../../libsrc
-endif # USE_NETCDF4
-endif # USE_NETCDF_DIR
-
-if USE_HDF4
-LDADD += -lmfhdf -ldf -ljpeg
-endif # USE_HDF4
-
-if USE_NETCDF4
-LDADD += -lhdf5_hl -lhdf5 -lz 
-endif
-
-# If the user specified a root for HDF5, use it.
-if USE_HDF5_DIR
-AM_CPPFLAGS += -I at HDF5DIR@/include
-AM_LDFLAGS += -L at HDF5DIR@/lib
-endif
-
-# If the user specified a prefix for the HDF4 library location, use it.
-if USE_HDF4_DIR
-AM_CPPFLAGS += -I at HDF4DIR@/include
-AM_LDFLAGS += -L at HDF4DIR@/lib
-endif
-
-# If the user specified a root location for ZLIB, use it.
-if USE_ZLIB_DIR
-AM_CPPFLAGS += -I at ZLIBDIR@/include
-AM_LDFLAGS += -L at ZLIBDIR@/lib
-endif
-
-# If the user specified a root location for SZLIB, use it.
-if USE_SZLIB_DIR
-AM_CPPFLAGS += -I at SZLIBDIR@/include
-AM_LDFLAGS += -L at SZLIBDIR@/lib
-endif
-
-# Add the gridspec functions.
-if BUILD_GRIDSPEC
-#libcf_la_LIBADD = ../gridspec/shared/mosaic/libshared.la 
-#libcf_la_LIBADD += ../gridspec/tools/shared/libtoolsshared.la 
-endif 
-
-# These linker flags specify libtool version info.
-libcf_la_LDFLAGS = -version-info 0:0:0
-
 # This is the coordinate systems stuff.
-libcf_la_SOURCES = nccoord.c libcf.h libcf_int.h cffiles.c cfvars.c	\
-cfcvars.c cfsubsets.c cferror.c cferror.h cdTimeConv.c cdmsint.h	\
-cdms.h cddrs.h drscdf.h cdunif.h
+libcf_src_la_SOURCES = nccoord.c libcf_int.h cffiles.c cfvars.c		\
+cfcvars.c cfsubsets.c cferror.c cdTimeConv.c cdmsint.h timeArith.c	\
+timeConv.c libcfAddOn.c cflistitem.c cdms.h cddrs.h drscdf.h cdunif.h
+
+# in memory variable, interpolation, indexing, ...
+libcf_src_la_SOURCES += nccf_varObj.c nccf_varSetData_generic.h		\
+nccf_strerror.c nccf_solve.h nccf_solve.c nccf_put_var_slice_text.c	\
+nccf_linesearch_indices.h nccf_linesearch_indices.c			\
+nccf_linear_interp.h nccf_linear_interp.c				\
+nccf_index_to_corner_vector.c nccf_index2vector.c nccf_handle_error.c	\
+nccf_get_tripolar_halfgrid.c nccf_get_tripolar_grid.c			\
+nccf_get_start_end_bound_indices.c nccf_get_position.h			\
+nccf_get_position.c nccf_get_multi_index.c nccf_get_linear_weights.h	\
+nccf_get_linear_weights.c nccf_get_flat_index.c				\
+nccf_get_cubedsphere_grid.c nccf_get_bipolar_cap.c nccf_generate_id.c	\
+nccf_find_next_indices.h nccf_find_next_indices.c			\
+nccf_find_next_adjcnt_index.c nccf_find_next_adjacent.c			\
+nccf_find_indices.h nccf_find_indices.c nccf_add_id_to_files.c		\
+nccf_keyvalue.h nccf_keyvalue.c                                         \
+nccf_get_distance_in_coord.c nccf_get_distance_in_coord.h               \
+nccf_linear_interp_mod.h nccf_linear_interp_mod.c			
 
 # These files are created by the tests.
-CLEANFILES = tst_coords_classic.nc tst_coords_64bit.nc			\
-tst_coords_netcdf4_classic.nc tst_coords_netcdf4.nc tst_vars.nc		\
-tst_files.nc tst_cvars.nc tst_vert_sigma.nc tst_vert_hybrid_sigma.nc	\
-tst_subsets_simple_sigma.nc tst_subsets_nw.nc tst_subsets_sw.nc		\
-tst_subsets_se.nc tst_subsets_ne.nc tst_f03_file.nc libcf.mod
-
-tst_coords_SOURCES = tst_coords.c nc_tests.h
-tst_files_SOURCES = tst_files.c nc_tests.h
-tst_vars_SOURCES = tst_vars.c nc_tests.h
-tst_cvars_SOURCES = tst_cvars.c nc_tests.h
-tst_vert_SOURCES = tst_vert.c nc_tests.h
-tst_subsets_SOURCES = tst_subsets.c nc_tests.h
+CLEANFILES = tst_*.nc libcf.mod
+
+# created by one of the unit tests
+clean-local:
+	-rm -rf tst_linear_interp_tripolar.py
 
 if EXTRA_DATA_TESTS
 check_PROGRAMS += tst_example_data
-tst_example_data_SOURCES = tst_example_data.c nc_tests.h
 endif # EXTRA_DATA_TESTS
 
 # Rule to build Fortran 2003 code.
 #cfcvars.o:cfcvsars.f90
 #	$(FC) -c $(AM_FCFLAGS) $(FCFLAGS) -c $? -o $@
 
-tst_f03_file.o:tst_f03_file.f90
+tst_f03_file.o: tst_f03_file.f90
 	$(FC) -c $(AM_FCFLAGS) $(FCFLAGS) -c $? -o $@
 
 TESTS = $(check_PROGRAMS)
diff --git a/src/Makefile.in b/src/Makefile.in
index afcdc0d..42cdbb3 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,11 +15,9 @@
 
 @SET_MAKE@
 
-# Copyright 2006, see the COPYRIGHT file for more information.
+# Copyright 2006-2011, see the COPYRIGHT file for more information.
 
-# THis automake file is in charge of building the src directory.
-
-# $Id: Makefile.am,v 1.5 2009/11/11 12:59:24 ed Exp $
+# This automake file is in charge of building the src directory.
 
 
 VPATH = @srcdir@
@@ -43,40 +41,37 @@ build_triplet = @build@
 host_triplet = @host@
 check_PROGRAMS = tst_coords$(EXEEXT) tst_files$(EXEEXT) \
 	tst_vars$(EXEEXT) tst_cvars$(EXEEXT) tst_vert$(EXEEXT) \
-	tst_subsets$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2)
- at BUILD_F90_TRUE@am__append_1 = libcff.la
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at am__append_2 = tst_f03_file
- at BUILD_F90_TRUE@am__append_3 = libcf.la
-
-# Link to the netCDF-4, (optionally) HDF4, and the HDF5 libraries.
- at USE_NETCDF_DIR_TRUE@am__append_4 = -lnetcdf
- at USE_NETCDF_DIR_TRUE@am__append_5 = -I at NETCDFDIR@/include
- at USE_NETCDF_DIR_TRUE@am__append_6 = -L at NETCDFDIR@/lib
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_7 = ../../libsrc4/libnetcdf.la 
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_8 = -I$(top_srcdir)/../libsrc4
- at USE_NETCDF4_TRUE@@USE_NETCDF_DIR_FALSE at am__append_9 = -L../../libsrc4
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_10 = ../../libsrc/libnetcdf.la
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_11 = -I$(top_srcdir)/../libsrc
- at USE_NETCDF4_FALSE@@USE_NETCDF_DIR_FALSE at am__append_12 = -L../../libsrc
- at USE_HDF4_TRUE@am__append_13 = -lmfhdf -ldf -ljpeg
- at USE_NETCDF4_TRUE@am__append_14 = -lhdf5_hl -lhdf5 -lz 
-
-# If the user specified a root for HDF5, use it.
- at USE_HDF5_DIR_TRUE@am__append_15 = -I at HDF5DIR@/include
- at USE_HDF5_DIR_TRUE@am__append_16 = -L at HDF5DIR@/lib
-
-# If the user specified a prefix for the HDF4 library location, use it.
- at USE_HDF4_DIR_TRUE@am__append_17 = -I at HDF4DIR@/include
- at USE_HDF4_DIR_TRUE@am__append_18 = -L at HDF4DIR@/lib
-
-# If the user specified a root location for ZLIB, use it.
- at USE_ZLIB_DIR_TRUE@am__append_19 = -I at ZLIBDIR@/include
- at USE_ZLIB_DIR_TRUE@am__append_20 = -L at ZLIBDIR@/lib
-
-# If the user specified a root location for SZLIB, use it.
- at USE_SZLIB_DIR_TRUE@am__append_21 = -I at SZLIBDIR@/include
- at USE_SZLIB_DIR_TRUE@am__append_22 = -L at SZLIBDIR@/lib
- at EXTRA_DATA_TESTS_TRUE@am__append_23 = tst_example_data
+	tst_subsets$(EXEEXT) tst_princeton$(EXEEXT) \
+	tst_listitem$(EXEEXT) tst_nccf_get_flat_index$(EXEEXT) \
+	tst_nccf_index2vector$(EXEEXT) tst_nccf_varObj$(EXEEXT) \
+	tst_solve$(EXEEXT) tst_linear_interp$(EXEEXT) \
+	tst_nccf_get_bipolar_cap$(EXEEXT) \
+	tst_nccf_get_tripolar_grid$(EXEEXT) \
+	tst_nccf_generate_id$(EXEEXT) \
+	tst_nccf_get_tripolar_halfgrid$(EXEEXT) \
+	tst_nccf_get_cubedsphere_grid$(EXEEXT) \
+	tst_nccf_find_adjacent$(EXEEXT) \
+	tst_nccf_linear_interp_mask$(EXEEXT) \
+	tst_nccf_keyvalue$(EXEEXT) tst_nccf_get_flat_index$(EXEEXT) \
+	tst_nccf_index2vector$(EXEEXT) tst_nccf_varObj$(EXEEXT) \
+	tst_solve$(EXEEXT) tst_linear_interp$(EXEEXT) \
+	tst_nccf_get_bipolar_cap$(EXEEXT) \
+	tst_nccf_get_tripolar_grid$(EXEEXT) \
+	tst_nccf_generate_id$(EXEEXT) \
+	tst_nccf_get_tripolar_halfgrid$(EXEEXT) \
+	tst_nccf_get_cubedsphere_grid$(EXEEXT) \
+	tst_nccf_find_adjacent$(EXEEXT) \
+	tst_nccf_linear_interp_mask$(EXEEXT) \
+	tst_nccf_keyvalue$(EXEEXT) $(am__EXEEXT_1)
+
+#noinst_PROGRAMS = tst_nccf_get_flat_index tst_nccf_index2vector		
+ at BUILD_F90_TRUE@am__append_1 = libcff_src.la
+# if USE_NETCDF4
+# check_PROGRAMS += tst_f03_file
+# tst_f03_file_SOURCES = tst_f03_file.f90
+# endif # USE_NETCDF4
+ at BUILD_F90_TRUE@am__append_2 = libcf_src.la
+ at EXTRA_DATA_TESTS_TRUE@am__append_3 = tst_example_data
 subdir = src
 DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
@@ -88,7 +83,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/nfconfig.inc
+CONFIG_HEADER = $(top_builddir)/cf_config.h \
+	$(top_builddir)/nfconfig.inc
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -114,74 +110,134 @@ am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
 am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
 LTLIBRARIES = $(lib_LTLIBRARIES)
-libcf_la_LIBADD =
-am_libcf_la_OBJECTS = nccoord.lo cffiles.lo cfvars.lo cfcvars.lo \
-	cfsubsets.lo cferror.lo cdTimeConv.lo
-libcf_la_OBJECTS = $(am_libcf_la_OBJECTS)
-libcf_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(libcf_la_LDFLAGS) \
-	$(LDFLAGS) -o $@
-libcff_la_LIBADD =
-am__libcff_la_SOURCES_DIST = cffcvars.f90
- at BUILD_F90_TRUE@am_libcff_la_OBJECTS = cffcvars.lo
-libcff_la_OBJECTS = $(am_libcff_la_OBJECTS)
- at BUILD_F90_TRUE@am_libcff_la_rpath = -rpath $(libdir)
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at am__EXEEXT_1 =  \
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE@	tst_f03_file$(EXEEXT)
- at EXTRA_DATA_TESTS_TRUE@am__EXEEXT_2 = tst_example_data$(EXEEXT)
-am_tst_coords_OBJECTS = tst_coords.$(OBJEXT)
-tst_coords_OBJECTS = $(am_tst_coords_OBJECTS)
+libcf_src_la_LIBADD =
+am_libcf_src_la_OBJECTS = nccoord.lo cffiles.lo cfvars.lo cfcvars.lo \
+	cfsubsets.lo cferror.lo cdTimeConv.lo timeArith.lo timeConv.lo \
+	libcfAddOn.lo cflistitem.lo nccf_varObj.lo nccf_strerror.lo \
+	nccf_solve.lo nccf_put_var_slice_text.lo \
+	nccf_linesearch_indices.lo nccf_linear_interp.lo \
+	nccf_index_to_corner_vector.lo nccf_index2vector.lo \
+	nccf_handle_error.lo nccf_get_tripolar_halfgrid.lo \
+	nccf_get_tripolar_grid.lo nccf_get_start_end_bound_indices.lo \
+	nccf_get_position.lo nccf_get_multi_index.lo \
+	nccf_get_linear_weights.lo nccf_get_flat_index.lo \
+	nccf_get_cubedsphere_grid.lo nccf_get_bipolar_cap.lo \
+	nccf_generate_id.lo nccf_find_next_indices.lo \
+	nccf_find_next_adjcnt_index.lo nccf_find_next_adjacent.lo \
+	nccf_find_indices.lo nccf_add_id_to_files.lo nccf_keyvalue.lo \
+	nccf_get_distance_in_coord.lo nccf_linear_interp_mod.lo
+libcf_src_la_OBJECTS = $(am_libcf_src_la_OBJECTS)
+libcf_src_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libcf_src_la_LDFLAGS) $(LDFLAGS) -o $@
+libcff_src_la_LIBADD =
+am__libcff_src_la_SOURCES_DIST = cffcvars.f90
+ at BUILD_F90_TRUE@am_libcff_src_la_OBJECTS = cffcvars.lo
+libcff_src_la_OBJECTS = $(am_libcff_src_la_OBJECTS)
+ at BUILD_F90_TRUE@am_libcff_src_la_rpath = -rpath $(libdir)
+ at EXTRA_DATA_TESTS_TRUE@am__EXEEXT_1 = tst_example_data$(EXEEXT)
+tst_coords_SOURCES = tst_coords.c
+tst_coords_OBJECTS = tst_coords.$(OBJEXT)
 tst_coords_LDADD = $(LDADD)
-am__DEPENDENCIES_1 =
-tst_coords_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_cvars_OBJECTS = tst_cvars.$(OBJEXT)
-tst_cvars_OBJECTS = $(am_tst_cvars_OBJECTS)
+tst_coords_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_2)
+tst_cvars_SOURCES = tst_cvars.c
+tst_cvars_OBJECTS = tst_cvars.$(OBJEXT)
 tst_cvars_LDADD = $(LDADD)
-tst_cvars_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am__tst_example_data_SOURCES_DIST = tst_example_data.c nc_tests.h
- at EXTRA_DATA_TESTS_TRUE@am_tst_example_data_OBJECTS =  \
- at EXTRA_DATA_TESTS_TRUE@	tst_example_data.$(OBJEXT)
-tst_example_data_OBJECTS = $(am_tst_example_data_OBJECTS)
+tst_cvars_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_2)
+tst_example_data_SOURCES = tst_example_data.c
+tst_example_data_OBJECTS = tst_example_data.$(OBJEXT)
 tst_example_data_LDADD = $(LDADD)
-tst_example_data_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am__tst_f03_file_SOURCES_DIST = tst_f03_file.f90
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at am_tst_f03_file_OBJECTS =  \
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE@	tst_f03_file.$(OBJEXT)
-tst_f03_file_OBJECTS = $(am_tst_f03_file_OBJECTS)
-tst_f03_file_LDADD = $(LDADD)
-tst_f03_file_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_files_OBJECTS = tst_files.$(OBJEXT)
-tst_files_OBJECTS = $(am_tst_files_OBJECTS)
+tst_example_data_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_2)
+tst_files_SOURCES = tst_files.c
+tst_files_OBJECTS = tst_files.$(OBJEXT)
 tst_files_LDADD = $(LDADD)
-tst_files_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_subsets_OBJECTS = tst_subsets.$(OBJEXT)
-tst_subsets_OBJECTS = $(am_tst_subsets_OBJECTS)
+tst_files_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_2)
+tst_linear_interp_SOURCES = tst_linear_interp.c
+tst_linear_interp_OBJECTS = tst_linear_interp.$(OBJEXT)
+tst_linear_interp_LDADD = $(LDADD)
+tst_linear_interp_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_2)
+tst_listitem_SOURCES = tst_listitem.c
+tst_listitem_OBJECTS = tst_listitem.$(OBJEXT)
+tst_listitem_LDADD = $(LDADD)
+tst_listitem_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_2)
+tst_nccf_find_adjacent_SOURCES = tst_nccf_find_adjacent.c
+tst_nccf_find_adjacent_OBJECTS = tst_nccf_find_adjacent.$(OBJEXT)
+tst_nccf_find_adjacent_LDADD = $(LDADD)
+tst_nccf_find_adjacent_DEPENDENCIES = $(lib_LTLIBRARIES) \
+	$(am__append_2)
+tst_nccf_generate_id_SOURCES = tst_nccf_generate_id.c
+tst_nccf_generate_id_OBJECTS = tst_nccf_generate_id.$(OBJEXT)
+tst_nccf_generate_id_LDADD = $(LDADD)
+tst_nccf_generate_id_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_2)
+tst_nccf_get_bipolar_cap_SOURCES = tst_nccf_get_bipolar_cap.c
+tst_nccf_get_bipolar_cap_OBJECTS = tst_nccf_get_bipolar_cap.$(OBJEXT)
+tst_nccf_get_bipolar_cap_LDADD = $(LDADD)
+tst_nccf_get_bipolar_cap_DEPENDENCIES = $(lib_LTLIBRARIES) \
+	$(am__append_2)
+tst_nccf_get_cubedsphere_grid_SOURCES =  \
+	tst_nccf_get_cubedsphere_grid.c
+tst_nccf_get_cubedsphere_grid_OBJECTS =  \
+	tst_nccf_get_cubedsphere_grid.$(OBJEXT)
+tst_nccf_get_cubedsphere_grid_LDADD = $(LDADD)
+tst_nccf_get_cubedsphere_grid_DEPENDENCIES = $(lib_LTLIBRARIES) \
+	$(am__append_2)
+tst_nccf_get_flat_index_SOURCES = tst_nccf_get_flat_index.c
+tst_nccf_get_flat_index_OBJECTS = tst_nccf_get_flat_index.$(OBJEXT)
+tst_nccf_get_flat_index_LDADD = $(LDADD)
+tst_nccf_get_flat_index_DEPENDENCIES = $(lib_LTLIBRARIES) \
+	$(am__append_2)
+tst_nccf_get_tripolar_grid_SOURCES = tst_nccf_get_tripolar_grid.c
+tst_nccf_get_tripolar_grid_OBJECTS =  \
+	tst_nccf_get_tripolar_grid.$(OBJEXT)
+tst_nccf_get_tripolar_grid_LDADD = $(LDADD)
+tst_nccf_get_tripolar_grid_DEPENDENCIES = $(lib_LTLIBRARIES) \
+	$(am__append_2)
+tst_nccf_get_tripolar_halfgrid_SOURCES =  \
+	tst_nccf_get_tripolar_halfgrid.c
+tst_nccf_get_tripolar_halfgrid_OBJECTS =  \
+	tst_nccf_get_tripolar_halfgrid.$(OBJEXT)
+tst_nccf_get_tripolar_halfgrid_LDADD = $(LDADD)
+tst_nccf_get_tripolar_halfgrid_DEPENDENCIES = $(lib_LTLIBRARIES) \
+	$(am__append_2)
+tst_nccf_index2vector_SOURCES = tst_nccf_index2vector.c
+tst_nccf_index2vector_OBJECTS = tst_nccf_index2vector.$(OBJEXT)
+tst_nccf_index2vector_LDADD = $(LDADD)
+tst_nccf_index2vector_DEPENDENCIES = $(lib_LTLIBRARIES) \
+	$(am__append_2)
+tst_nccf_keyvalue_SOURCES = tst_nccf_keyvalue.c
+tst_nccf_keyvalue_OBJECTS = tst_nccf_keyvalue.$(OBJEXT)
+tst_nccf_keyvalue_LDADD = $(LDADD)
+tst_nccf_keyvalue_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_2)
+tst_nccf_linear_interp_mask_SOURCES = tst_nccf_linear_interp_mask.c
+tst_nccf_linear_interp_mask_OBJECTS =  \
+	tst_nccf_linear_interp_mask.$(OBJEXT)
+tst_nccf_linear_interp_mask_LDADD = $(LDADD)
+tst_nccf_linear_interp_mask_DEPENDENCIES = $(lib_LTLIBRARIES) \
+	$(am__append_2)
+tst_nccf_varObj_SOURCES = tst_nccf_varObj.c
+tst_nccf_varObj_OBJECTS = tst_nccf_varObj.$(OBJEXT)
+tst_nccf_varObj_LDADD = $(LDADD)
+tst_nccf_varObj_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_2)
+tst_princeton_SOURCES = tst_princeton.c
+tst_princeton_OBJECTS = tst_princeton.$(OBJEXT)
+tst_princeton_LDADD = $(LDADD)
+tst_princeton_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_2)
+tst_solve_SOURCES = tst_solve.c
+tst_solve_OBJECTS = tst_solve.$(OBJEXT)
+tst_solve_LDADD = $(LDADD)
+tst_solve_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_2)
+tst_subsets_SOURCES = tst_subsets.c
+tst_subsets_OBJECTS = tst_subsets.$(OBJEXT)
 tst_subsets_LDADD = $(LDADD)
-tst_subsets_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_vars_OBJECTS = tst_vars.$(OBJEXT)
-tst_vars_OBJECTS = $(am_tst_vars_OBJECTS)
+tst_subsets_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_2)
+tst_vars_SOURCES = tst_vars.c
+tst_vars_OBJECTS = tst_vars.$(OBJEXT)
 tst_vars_LDADD = $(LDADD)
-tst_vars_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_tst_vert_OBJECTS = tst_vert.$(OBJEXT)
-tst_vert_OBJECTS = $(am_tst_vert_OBJECTS)
+tst_vars_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_2)
+tst_vert_SOURCES = tst_vert.c
+tst_vert_OBJECTS = tst_vert.$(OBJEXT)
 tst_vert_LDADD = $(LDADD)
-tst_vert_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_3) \
-	$(am__DEPENDENCIES_1) $(am__append_7) $(am__append_10) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+tst_vert_DEPENDENCIES = $(lib_LTLIBRARIES) $(am__append_2)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -202,16 +258,26 @@ FCLD = $(FC)
 FCLINK = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libcf_la_SOURCES) $(libcff_la_SOURCES) \
-	$(tst_coords_SOURCES) $(tst_cvars_SOURCES) \
-	$(tst_example_data_SOURCES) $(tst_f03_file_SOURCES) \
-	$(tst_files_SOURCES) $(tst_subsets_SOURCES) \
-	$(tst_vars_SOURCES) $(tst_vert_SOURCES)
-DIST_SOURCES = $(libcf_la_SOURCES) $(am__libcff_la_SOURCES_DIST) \
-	$(tst_coords_SOURCES) $(tst_cvars_SOURCES) \
-	$(am__tst_example_data_SOURCES_DIST) \
-	$(am__tst_f03_file_SOURCES_DIST) $(tst_files_SOURCES) \
-	$(tst_subsets_SOURCES) $(tst_vars_SOURCES) $(tst_vert_SOURCES)
+SOURCES = $(libcf_src_la_SOURCES) $(libcff_src_la_SOURCES) \
+	tst_coords.c tst_cvars.c tst_example_data.c tst_files.c \
+	tst_linear_interp.c tst_listitem.c tst_nccf_find_adjacent.c \
+	tst_nccf_generate_id.c tst_nccf_get_bipolar_cap.c \
+	tst_nccf_get_cubedsphere_grid.c tst_nccf_get_flat_index.c \
+	tst_nccf_get_tripolar_grid.c tst_nccf_get_tripolar_halfgrid.c \
+	tst_nccf_index2vector.c tst_nccf_keyvalue.c \
+	tst_nccf_linear_interp_mask.c tst_nccf_varObj.c \
+	tst_princeton.c tst_solve.c tst_subsets.c tst_vars.c \
+	tst_vert.c
+DIST_SOURCES = $(libcf_src_la_SOURCES) \
+	$(am__libcff_src_la_SOURCES_DIST) tst_coords.c tst_cvars.c \
+	tst_example_data.c tst_files.c tst_linear_interp.c \
+	tst_listitem.c tst_nccf_find_adjacent.c tst_nccf_generate_id.c \
+	tst_nccf_get_bipolar_cap.c tst_nccf_get_cubedsphere_grid.c \
+	tst_nccf_get_flat_index.c tst_nccf_get_tripolar_grid.c \
+	tst_nccf_get_tripolar_halfgrid.c tst_nccf_index2vector.c \
+	tst_nccf_keyvalue.c tst_nccf_linear_interp_mask.c \
+	tst_nccf_varObj.c tst_princeton.c tst_solve.c tst_subsets.c \
+	tst_vars.c tst_vert.c
 HEADERS = $(include_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -222,7 +288,6 @@ ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
 AR = @AR@
-AS = @AS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -243,15 +308,19 @@ ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-F77 = @F77@
 FC = @FC@
 FCFLAGS = @FCFLAGS@
 FCFLAGS_f90 = @FCFLAGS_f90@
-FFLAGS = @FFLAGS@
+FCLIBS = @FCLIBS@
 FGREP = @FGREP@
 GREP = @GREP@
-HDF4DIR = @HDF4DIR@
-HDF5DIR = @HDF5DIR@
+HAVE_DARWIN = @HAVE_DARWIN@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_LAPACK_LIB = @HAVE_LAPACK_LIB@
+HAVE_LAPACK_NO_UNDERSCORE = @HAVE_LAPACK_NO_UNDERSCORE@
+HAVE_LAPACK_UNDERSCORE = @HAVE_LAPACK_UNDERSCORE@
+HAVE_SHARED = @HAVE_SHARED@
+HAVE_UUID = @HAVE_UUID@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -266,8 +335,10 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 MOD_FLAG = @MOD_FLAG@
+NCDUMP = @NCDUMP@
 NCDUMPDIR = @NCDUMPDIR@
 NETCDFDIR = @NETCDFDIR@
 NM = @NM@
@@ -281,23 +352,23 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PYTHON = @PYTHON@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-SZLIBDIR = @SZLIBDIR@
 VERSION = @VERSION@
-ZLIBDIR = @ZLIBDIR@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_F77 = @ac_ct_F77@
 ac_ct_FC = @ac_ct_FC@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -329,7 +400,6 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -346,59 +416,56 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
-# Tell automake that libcf.h is a header file we want to install.
-include_HEADERS = libcf.h
-
 # Test programs will need to link to this library (libcf) and also
 # netcdf.
-LDADD = ${lib_LTLIBRARIES} $(am__append_3) $(am__append_4) \
-	$(am__append_7) $(am__append_10) $(am__append_13) \
-	$(am__append_14)
+
+# I think we always need this one
+LDADD = ${lib_LTLIBRARIES} -lnetcdf -lm $(am__append_2)
 
 # Initalize these.
-AM_CPPFLAGS = $(am__append_5) $(am__append_8) $(am__append_11) \
-	$(am__append_15) $(am__append_17) $(am__append_19) \
-	$(am__append_21)
-AM_LDFLAGS = $(am__append_6) $(am__append_9) $(am__append_12) \
-	$(am__append_16) $(am__append_18) $(am__append_20) \
-	$(am__append_22)
+AM_CPPFLAGS = -I$(top_srcdir)/include
+AM_LDFLAGS = 
+include_HEADERS = \
+nccf_find_next_indices.h   \
+nccf_keyvalue.h            
 
-# This is our output, the NetCDF CF Library.
-lib_LTLIBRARIES = libcf.la $(am__append_1)
- at BUILD_F90_TRUE@libcff_la_DEPENDENCIES = libcf_api.f90
- at BUILD_F90_TRUE@EXTRA_DIST = libcf_api.f90
- at BUILD_F90_TRUE@libcff_la_SOURCES = cffcvars.f90
- at BUILD_F90_TRUE@@USE_NETCDF4_TRUE at tst_f03_file_SOURCES = tst_f03_file.f90
- at BUILD_F90_TRUE@@USE_NETCDF_DIR_FALSE at AM_FCFLAGS = @MOD_FLAG at ../../f90
- at BUILD_F90_TRUE@@USE_NETCDF_DIR_TRUE at AM_FCFLAGS = @MOD_FLAG@@NETCDFDIR@/include
 
-# Add the gridspec functions.
-#libcf_la_LIBADD = ../gridspec/shared/mosaic/libshared.la 
-#libcf_la_LIBADD += ../gridspec/tools/shared/libtoolsshared.la 
+# This is our output, the NetCDF CF Library.
+lib_LTLIBRARIES = libcf_src.la $(am__append_1)
 
 # These linker flags specify libtool version info.
-libcf_la_LDFLAGS = -version-info 0:0:0
+libcf_src_la_LDFLAGS = -version-info 0:0:0
+ at BUILD_F90_TRUE@libcff_src_la_DEPENDENCIES = libcf_api.f90
+ at BUILD_F90_TRUE@EXTRA_DIST = libcf_api.f90
+ at BUILD_F90_TRUE@libcff_src_la_SOURCES = cffcvars.f90
 
 # This is the coordinate systems stuff.
-libcf_la_SOURCES = nccoord.c libcf.h libcf_int.h cffiles.c cfvars.c	\
-cfcvars.c cfsubsets.c cferror.c cferror.h cdTimeConv.c cdmsint.h	\
-cdms.h cddrs.h drscdf.h cdunif.h
 
+# in memory variable, interpolation, indexing, ...
+libcf_src_la_SOURCES = nccoord.c libcf_int.h cffiles.c cfvars.c \
+	cfcvars.c cfsubsets.c cferror.c cdTimeConv.c cdmsint.h \
+	timeArith.c timeConv.c libcfAddOn.c cflistitem.c cdms.h \
+	cddrs.h drscdf.h cdunif.h nccf_varObj.c \
+	nccf_varSetData_generic.h nccf_strerror.c nccf_solve.h \
+	nccf_solve.c nccf_put_var_slice_text.c \
+	nccf_linesearch_indices.h nccf_linesearch_indices.c \
+	nccf_linear_interp.h nccf_linear_interp.c \
+	nccf_index_to_corner_vector.c nccf_index2vector.c \
+	nccf_handle_error.c nccf_get_tripolar_halfgrid.c \
+	nccf_get_tripolar_grid.c nccf_get_start_end_bound_indices.c \
+	nccf_get_position.h nccf_get_position.c nccf_get_multi_index.c \
+	nccf_get_linear_weights.h nccf_get_linear_weights.c \
+	nccf_get_flat_index.c nccf_get_cubedsphere_grid.c \
+	nccf_get_bipolar_cap.c nccf_generate_id.c \
+	nccf_find_next_indices.h nccf_find_next_indices.c \
+	nccf_find_next_adjcnt_index.c nccf_find_next_adjacent.c \
+	nccf_find_indices.h nccf_find_indices.c nccf_add_id_to_files.c \
+	nccf_keyvalue.h nccf_keyvalue.c nccf_get_distance_in_coord.c \
+	nccf_get_distance_in_coord.h nccf_linear_interp_mod.h \
+	nccf_linear_interp_mod.c
 
 # These files are created by the tests.
-CLEANFILES = tst_coords_classic.nc tst_coords_64bit.nc			\
-tst_coords_netcdf4_classic.nc tst_coords_netcdf4.nc tst_vars.nc		\
-tst_files.nc tst_cvars.nc tst_vert_sigma.nc tst_vert_hybrid_sigma.nc	\
-tst_subsets_simple_sigma.nc tst_subsets_nw.nc tst_subsets_sw.nc		\
-tst_subsets_se.nc tst_subsets_ne.nc tst_f03_file.nc libcf.mod
-
-tst_coords_SOURCES = tst_coords.c nc_tests.h
-tst_files_SOURCES = tst_files.c nc_tests.h
-tst_vars_SOURCES = tst_vars.c nc_tests.h
-tst_cvars_SOURCES = tst_cvars.c nc_tests.h
-tst_vert_SOURCES = tst_vert.c nc_tests.h
-tst_subsets_SOURCES = tst_subsets.c nc_tests.h
- at EXTRA_DATA_TESTS_TRUE@tst_example_data_SOURCES = tst_example_data.c nc_tests.h
+CLEANFILES = tst_*.nc libcf.mod
 TESTS = $(check_PROGRAMS)
 all: all-am
 
@@ -465,10 +532,10 @@ clean-libLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libcf.la: $(libcf_la_OBJECTS) $(libcf_la_DEPENDENCIES) 
-	$(libcf_la_LINK) -rpath $(libdir) $(libcf_la_OBJECTS) $(libcf_la_LIBADD) $(LIBS)
-libcff.la: $(libcff_la_OBJECTS) $(libcff_la_DEPENDENCIES) 
-	$(FCLINK) $(am_libcff_la_rpath) $(libcff_la_OBJECTS) $(libcff_la_LIBADD) $(LIBS)
+libcf_src.la: $(libcf_src_la_OBJECTS) $(libcf_src_la_DEPENDENCIES) 
+	$(libcf_src_la_LINK) -rpath $(libdir) $(libcf_src_la_OBJECTS) $(libcf_src_la_LIBADD) $(LIBS)
+libcff_src.la: $(libcff_src_la_OBJECTS) $(libcff_src_la_DEPENDENCIES) 
+	$(FCLINK) $(am_libcff_src_la_rpath) $(libcff_src_la_OBJECTS) $(libcff_src_la_LIBADD) $(LIBS)
 
 clean-checkPROGRAMS:
 	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
@@ -487,12 +554,54 @@ tst_cvars$(EXEEXT): $(tst_cvars_OBJECTS) $(tst_cvars_DEPENDENCIES)
 tst_example_data$(EXEEXT): $(tst_example_data_OBJECTS) $(tst_example_data_DEPENDENCIES) 
 	@rm -f tst_example_data$(EXEEXT)
 	$(LINK) $(tst_example_data_OBJECTS) $(tst_example_data_LDADD) $(LIBS)
-tst_f03_file$(EXEEXT): $(tst_f03_file_OBJECTS) $(tst_f03_file_DEPENDENCIES) 
-	@rm -f tst_f03_file$(EXEEXT)
-	$(FCLINK) $(tst_f03_file_OBJECTS) $(tst_f03_file_LDADD) $(LIBS)
 tst_files$(EXEEXT): $(tst_files_OBJECTS) $(tst_files_DEPENDENCIES) 
 	@rm -f tst_files$(EXEEXT)
 	$(LINK) $(tst_files_OBJECTS) $(tst_files_LDADD) $(LIBS)
+tst_linear_interp$(EXEEXT): $(tst_linear_interp_OBJECTS) $(tst_linear_interp_DEPENDENCIES) 
+	@rm -f tst_linear_interp$(EXEEXT)
+	$(LINK) $(tst_linear_interp_OBJECTS) $(tst_linear_interp_LDADD) $(LIBS)
+tst_listitem$(EXEEXT): $(tst_listitem_OBJECTS) $(tst_listitem_DEPENDENCIES) 
+	@rm -f tst_listitem$(EXEEXT)
+	$(LINK) $(tst_listitem_OBJECTS) $(tst_listitem_LDADD) $(LIBS)
+tst_nccf_find_adjacent$(EXEEXT): $(tst_nccf_find_adjacent_OBJECTS) $(tst_nccf_find_adjacent_DEPENDENCIES) 
+	@rm -f tst_nccf_find_adjacent$(EXEEXT)
+	$(LINK) $(tst_nccf_find_adjacent_OBJECTS) $(tst_nccf_find_adjacent_LDADD) $(LIBS)
+tst_nccf_generate_id$(EXEEXT): $(tst_nccf_generate_id_OBJECTS) $(tst_nccf_generate_id_DEPENDENCIES) 
+	@rm -f tst_nccf_generate_id$(EXEEXT)
+	$(LINK) $(tst_nccf_generate_id_OBJECTS) $(tst_nccf_generate_id_LDADD) $(LIBS)
+tst_nccf_get_bipolar_cap$(EXEEXT): $(tst_nccf_get_bipolar_cap_OBJECTS) $(tst_nccf_get_bipolar_cap_DEPENDENCIES) 
+	@rm -f tst_nccf_get_bipolar_cap$(EXEEXT)
+	$(LINK) $(tst_nccf_get_bipolar_cap_OBJECTS) $(tst_nccf_get_bipolar_cap_LDADD) $(LIBS)
+tst_nccf_get_cubedsphere_grid$(EXEEXT): $(tst_nccf_get_cubedsphere_grid_OBJECTS) $(tst_nccf_get_cubedsphere_grid_DEPENDENCIES) 
+	@rm -f tst_nccf_get_cubedsphere_grid$(EXEEXT)
+	$(LINK) $(tst_nccf_get_cubedsphere_grid_OBJECTS) $(tst_nccf_get_cubedsphere_grid_LDADD) $(LIBS)
+tst_nccf_get_flat_index$(EXEEXT): $(tst_nccf_get_flat_index_OBJECTS) $(tst_nccf_get_flat_index_DEPENDENCIES) 
+	@rm -f tst_nccf_get_flat_index$(EXEEXT)
+	$(LINK) $(tst_nccf_get_flat_index_OBJECTS) $(tst_nccf_get_flat_index_LDADD) $(LIBS)
+tst_nccf_get_tripolar_grid$(EXEEXT): $(tst_nccf_get_tripolar_grid_OBJECTS) $(tst_nccf_get_tripolar_grid_DEPENDENCIES) 
+	@rm -f tst_nccf_get_tripolar_grid$(EXEEXT)
+	$(LINK) $(tst_nccf_get_tripolar_grid_OBJECTS) $(tst_nccf_get_tripolar_grid_LDADD) $(LIBS)
+tst_nccf_get_tripolar_halfgrid$(EXEEXT): $(tst_nccf_get_tripolar_halfgrid_OBJECTS) $(tst_nccf_get_tripolar_halfgrid_DEPENDENCIES) 
+	@rm -f tst_nccf_get_tripolar_halfgrid$(EXEEXT)
+	$(LINK) $(tst_nccf_get_tripolar_halfgrid_OBJECTS) $(tst_nccf_get_tripolar_halfgrid_LDADD) $(LIBS)
+tst_nccf_index2vector$(EXEEXT): $(tst_nccf_index2vector_OBJECTS) $(tst_nccf_index2vector_DEPENDENCIES) 
+	@rm -f tst_nccf_index2vector$(EXEEXT)
+	$(LINK) $(tst_nccf_index2vector_OBJECTS) $(tst_nccf_index2vector_LDADD) $(LIBS)
+tst_nccf_keyvalue$(EXEEXT): $(tst_nccf_keyvalue_OBJECTS) $(tst_nccf_keyvalue_DEPENDENCIES) 
+	@rm -f tst_nccf_keyvalue$(EXEEXT)
+	$(LINK) $(tst_nccf_keyvalue_OBJECTS) $(tst_nccf_keyvalue_LDADD) $(LIBS)
+tst_nccf_linear_interp_mask$(EXEEXT): $(tst_nccf_linear_interp_mask_OBJECTS) $(tst_nccf_linear_interp_mask_DEPENDENCIES) 
+	@rm -f tst_nccf_linear_interp_mask$(EXEEXT)
+	$(LINK) $(tst_nccf_linear_interp_mask_OBJECTS) $(tst_nccf_linear_interp_mask_LDADD) $(LIBS)
+tst_nccf_varObj$(EXEEXT): $(tst_nccf_varObj_OBJECTS) $(tst_nccf_varObj_DEPENDENCIES) 
+	@rm -f tst_nccf_varObj$(EXEEXT)
+	$(LINK) $(tst_nccf_varObj_OBJECTS) $(tst_nccf_varObj_LDADD) $(LIBS)
+tst_princeton$(EXEEXT): $(tst_princeton_OBJECTS) $(tst_princeton_DEPENDENCIES) 
+	@rm -f tst_princeton$(EXEEXT)
+	$(LINK) $(tst_princeton_OBJECTS) $(tst_princeton_LDADD) $(LIBS)
+tst_solve$(EXEEXT): $(tst_solve_OBJECTS) $(tst_solve_DEPENDENCIES) 
+	@rm -f tst_solve$(EXEEXT)
+	$(LINK) $(tst_solve_OBJECTS) $(tst_solve_LDADD) $(LIBS)
 tst_subsets$(EXEEXT): $(tst_subsets_OBJECTS) $(tst_subsets_DEPENDENCIES) 
 	@rm -f tst_subsets$(EXEEXT)
 	$(LINK) $(tst_subsets_OBJECTS) $(tst_subsets_LDADD) $(LIBS)
@@ -513,13 +622,59 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cfcvars.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cferror.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cffiles.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cflistitem.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cfsubsets.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cfvars.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libcfAddOn.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_add_id_to_files.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_find_indices.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_find_next_adjacent.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_find_next_adjcnt_index.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_find_next_indices.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_generate_id.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_get_bipolar_cap.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_get_cubedsphere_grid.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_get_distance_in_coord.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_get_flat_index.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_get_linear_weights.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_get_multi_index.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_get_position.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_get_start_end_bound_indices.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_get_tripolar_grid.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_get_tripolar_halfgrid.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_handle_error.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_index2vector.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_index_to_corner_vector.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_keyvalue.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_linear_interp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_linear_interp_mod.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_linesearch_indices.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_put_var_slice_text.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_solve.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_strerror.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccf_varObj.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nccoord.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/timeArith.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/timeConv.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_coords.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_cvars.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_example_data.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_files.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_linear_interp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_listitem.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_find_adjacent.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_generate_id.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_get_bipolar_cap.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_get_cubedsphere_grid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_get_flat_index.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_get_tripolar_grid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_get_tripolar_halfgrid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_index2vector.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_keyvalue.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_linear_interp_mask.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_nccf_varObj.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_princeton.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_solve.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_subsets.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vars.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_vert.Po at am__quote@
@@ -795,7 +950,7 @@ maintainer-clean-generic:
 clean: clean-am
 
 clean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
-	clean-libtool mostlyclean-am
+	clean-libtool clean-local mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -867,7 +1022,7 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
 
 .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
 	clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
-	clean-libtool ctags distclean distclean-compile \
+	clean-libtool clean-local ctags 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 \
@@ -882,11 +1037,15 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
 	uninstall-libLTLIBRARIES
 
 
+# created by one of the unit tests
+clean-local:
+	-rm -rf tst_linear_interp_tripolar.py
+
 # Rule to build Fortran 2003 code.
 #cfcvars.o:cfcvsars.f90
 #	$(FC) -c $(AM_FCFLAGS) $(FCFLAGS) -c $? -o $@
 
-tst_f03_file.o:tst_f03_file.f90
+tst_f03_file.o: tst_f03_file.f90
 	$(FC) -c $(AM_FCFLAGS) $(FCFLAGS) -c $? -o $@
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/src/cdTimeConv.c b/src/cdTimeConv.c
index 375df85..b575c3e 100644
--- a/src/cdTimeConv.c
+++ b/src/cdTimeConv.c
@@ -8,7 +8,7 @@
  * Author:      Bob Drach, Lawrence Livermore National Laboratory
  *              drach at llnl.gov
  *
- * Version:     $Id: cdTimeConv.c,v 1.2 2009/09/08 17:14:52 ed Exp $
+ * Version:     $Id: cdTimeConv.c 30 2010-09-15 14:24:51Z edhartnett $
  *
  * Revision History:
  *
diff --git a/src/cddrs.h b/src/cddrs.h
index 07d07a5..6ac38dd 100644
--- a/src/cddrs.h
+++ b/src/cddrs.h
@@ -8,7 +8,7 @@
  * Author:      Bob Drach, Lawrence Livermore National Laboratory
  *              drach at llnl.gov
  *
- * Version:     $Id: cddrs.h,v 1.2 2009/09/08 17:14:53 ed Exp $
+ * Version:     $Id: cddrs.h 30 2010-09-15 14:24:51Z edhartnett $
  *
  * Revision History:
  *
diff --git a/src/cdms.h b/src/cdms.h
index 07c6d23..411f48b 100644
--- a/src/cdms.h
+++ b/src/cdms.h
@@ -8,7 +8,7 @@
  * Author:      Bob Drach, Lawrence Livermore National Laboratory
  *              drach at llnl.gov
  *
- * Version:     $Id: cdms.h,v 1.2 2009/09/08 17:14:53 ed Exp $
+ * Version:     $Id: cdms.h 30 2010-09-15 14:24:51Z edhartnett $
  *
  * Revision History:
  *
diff --git a/src/cdmsint.h b/src/cdmsint.h
index a988846..a22cada 100644
--- a/src/cdmsint.h
+++ b/src/cdmsint.h
@@ -8,7 +8,7 @@
  * Author:      Bob Drach, Lawrence Livermore National Laboratory
  *              drach at llnl.gov
  *
- * Version:     $Id: cdmsint.h,v 1.2 2009/09/08 17:14:53 ed Exp $
+ * Version:     $Id: cdmsint.h 30 2010-09-15 14:24:51Z edhartnett $
  *
  * Revision History:
  *
diff --git a/src/cdunif.h b/src/cdunif.h
index a35d366..daf7d4b 100644
--- a/src/cdunif.h
+++ b/src/cdunif.h
@@ -8,7 +8,7 @@
  * Author:      Bob Drach, Lawrence Livermore National Laboratory
  *              drach at llnl.gov
  *
- * Version:     $Id: cdunif.h,v 1.2 2009/09/08 17:14:53 ed Exp $
+ * Version:     $Id: cdunif.h 30 2010-09-15 14:24:51Z edhartnett $
  *
  * Revision History:
  *
diff --git a/src/cfcvars.c b/src/cfcvars.c
index f3d6631..e1bf677 100644
--- a/src/cfcvars.c
+++ b/src/cfcvars.c
@@ -7,12 +7,11 @@
   This file handles the libcf file stuff.
 
   Ed Hartnett, 9/1/06
-
-  $Id: cfcvars.c,v 1.2 2009/09/08 17:14:53 ed Exp $
+  $Id: cfcvars.c 828 2011-09-14 20:05:08Z pletzer $
 */
 
-#include <config.h>
-#include <libcf.h>
+#include <cf_config.h>
+#include <libcf_src.h>
 #include <libcf_int.h>
 #include <netcdf.h>
 #include <stdlib.h>
@@ -28,26 +27,32 @@
 
 #define CF_PTOP "PTOP"
 
+/*! \defgroup coord_grp Coordinates axes
+
+  These functions can be used to define and read coordinate axis
+  variables and dimensions.
+
+  In netCDF, a coordinate axis variable is one with the same name as a
+  dimension. This indicates that the data values in the coordinate
+  variable represent the actual values along the dimension. This
+  convention becomes a little more complex when the coordinate
+  variable has more than one dimension.
+
+  @{*/
+
 static char *vert_std_name[] = {
    STD_ATM_LN, STD_SIGMA, STD_HYBRID_SIGMA, STD_HYBRID_HEIGHT, STD_SLEVE, 
    STD_OCEAN_SIGMA, STD_OCEAN_S, STD_OCEAN_SIGMA_Z, STD_OCEAN_DBL_SIGMA
 };
 
-/* The Common Data Model defines these axis types. */
+/*! The Common Data Model defines these axis types. */
 static char* axis_type_name[] = {"", "Lat", "Lon", "GeoX", "GeoY", "GeoZ", 
 				 "Height", "Height", "Pressure", "Time", 
 				 "RadialAzimuth", "RadialElevation", 
 				 "RadialDistance"};
 
-int
-cf_test1(int i)
-{
-   printf("i = %d", i);
-   return 0;
-}
-
 /* Define a coordinate dimension and variable with all the CF
- * recomended attribute accessories. */
+   recomended attribute accessories. */
 static int 
 def_coord_var(int ncid, const char *name, size_t len, nc_type xtype, 
 	      const char *units, const char *axis, int positive_up, 
@@ -379,8 +384,35 @@ inq_coord_var(int ncid, int nvalid, const char valid_units[][CF_MAX_LEN + 1],
    return CF_NOERR;
 }
 
-/* Define a latitude dimension and variable with all the CF
- * recomended attribute accessories.*/
+/*! \defgroup coord_horizontal_grp Horizontal Coordinates 
+
+  These functions help with the definition and reading of latitude and
+  longitude coordinate variables and dimensions.
+
+  @{*/
+
+/*! Define a latitude dimension and variable with all the CF
+  recomended attribute accessories.
+
+  \param ncid
+  The ncid of the file.
+
+  \param len
+  The length of this coordinate dimension.
+
+  \param xtype
+  The type of this coordinate variable.
+
+  \param lat_dimidp
+  If non-NULL, nccf_def_latitude will write the dimension ID of the
+  netCDF dimension for the latitude here.
+
+  \param lat_varidp
+  If non-NULL, nccf_def_latitude will write the variable ID of the
+  netCDF coordinate variable for the latitude here.
+
+  \return 0 for success, error code otherwise.  
+*/
 int 
 nccf_def_latitude(int ncid, size_t len, nc_type xtype, 
 		  int *lat_dimidp, int *lat_varidp)
@@ -391,8 +423,28 @@ nccf_def_latitude(int ncid, size_t len, nc_type xtype,
 			NCCF_LATITUDE, lat_dimidp, lat_varidp);
 }
 
-/* Inquire about a latitude dimension and variable with all the CF
- * recomended attribute accessories.*/
+/*! Inquire about a latitude dimension and variable with all the CF
+  recomended attribute accessories.
+
+  \param ncid
+  The ncid of the file.
+
+  \param lenp
+  If non-NULL, the length of the latitude dimension will be written
+  here by nccf_inq_latitude.
+
+  \param xtypep
+  If non-NULL, the type of the coordinate variable will be written here.
+
+  \param lat_dimidp
+  If non-NULL, the dimid of the latitude dimension will be written here.
+
+  \param lat_varidp
+  If non-NULL, the varid of the latitude coordinate variable will be
+  written here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_inq_latitude(int ncid, size_t *lenp, nc_type *xtypep, 
 		  int *lat_dimidp, int *lat_varidp)
@@ -404,8 +456,28 @@ nccf_inq_latitude(int ncid, size_t *lenp, nc_type *xtypep,
 			NULL, NULL, NULL, lat_dimidp, lat_varidp);
 }
 
-/* Define a longitude dimension and variable with all the CF
- * recomended attribute accessories.*/
+/*! Define a longitude dimension and variable with all the CF
+  recomended attribute accessories.
+
+  \param ncid
+  The ncid of the file.
+
+  \param len
+  The length of this coordinate dimension.
+
+  \param xtype
+  The type of this coordinate variable.
+
+  \param lon_dimidp
+  If non-NULL, nccf_def_longitude will write the dimension ID of the
+  netCDF dimension for the longitude here.
+
+  \param lon_varidp
+  If non-NULL, nccf_def_longitude will write the variable ID of the
+  netCDF coordinate variable for the longitude here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_def_longitude(int ncid, size_t len, nc_type xtype, 
 		   int *lon_dimidp, int *lon_varidp)
@@ -416,8 +488,28 @@ nccf_def_longitude(int ncid, size_t len, nc_type xtype,
 			NCCF_LONGITUDE, lon_dimidp, lon_varidp);
 }
 
-/* Inquire about a longitude dimension and variable with all the CF
- * recomended attribute accessories.*/
+/*! Inquire about a longitude dimension and variable with all the CF
+  recomended attribute accessories.
+
+  \param ncid
+  The ncid of the file.
+
+  \param lenp
+  If non-NULL, the length of the longitude dimension will be written
+  here by nccf_inq_longitude.
+
+  \param xtypep
+  If non-NULL, the type of the coordinate variable will be written here.
+
+  \param lon_dimidp
+  If non-NULL, the dimid of the longitude dimension will be written here.
+
+  \param lon_varidp
+  If non-NULL, the varid of the longitude coordinate variable will be
+  written here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_inq_longitude(int ncid, size_t *lenp, nc_type *xtypep, 
 		   int *lon_dimidp, int *lon_varidp)
@@ -429,8 +521,59 @@ nccf_inq_longitude(int ncid, size_t *lenp, nc_type *xtypep,
    return inq_coord_var(ncid, NLON_UNITS, val, NULL, NULL, lenp, xtypep, 
 			NULL, NULL, NULL, lon_dimidp, lon_varidp);
 }
+/*!@}*/
+
+/*! \defgroup coord_vertical_grp Vertical Coordinates 
+
+  These functions help with the definition and reading of latitude and
+  longitude coordinate variables and dimensions.
+
+  @{*/
+
+/*! Define a coordinate variable and dimension with all the CF
+  recommended attribute accessories for a vertical level.
+
+  \param ncid
+  The ncid of the file.
+
+  \param name
+  The name of the coordinate dimension and variable.
+
+  \param len
+  The length of this coordinate dimension and variable.
+
+  \param xtype
+  The type of this coordinate variable.
+
+  \param units
+  If non-NULL, a string which will be written as the ``units''
+  attribute on the coordinate variable.
+
+  \param positive_up
+  Set to 0 and the attribute ``positive'' to ``down''. Set to any other
+  value to get ``up''.
+
+  \param standard_name
+  If non-NULL, a string which will be written as the ``standard_name''
+  attribute on the coordinate variable.
+
+  \param formula_terms
+  If non-NULL, a string which will be written as the ``formula_terms''
+  attribute on the coordinate variable.
+
+  \param cdm_axis_type
+  CDM axis type.
+
+  \param lvl_dimidp
+  If non-NULL, nccf_def_lvl will write the dimension ID of the
+  netCDF dimension for the level here.
 
-/* Define a verticle level coordinate variable and dimension. */
+  \param lvl_varidp
+  If non-NULL, nccf_def_lvl will write the variable ID of the
+  netCDF coordinate variable for the level here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_def_lvl(int ncid, const char *name, size_t len, nc_type xtype, 
 	     const char *units, int positive_up, 
@@ -442,11 +585,47 @@ nccf_def_lvl(int ncid, const char *name, size_t len, nc_type xtype,
 			cdm_axis_type, lvl_dimidp, lvl_varidp);
 }
 
-/* Inquire about a vertical dimension and coordinate variable. */
+/*! Inquire about a vertical dimension and coordinate variable. 
+
+  \param ncid
+  The ncid of the file.
+
+  \param name
+  If non-NULL, the name of this vertical level dimension (and variable)
+  will be written here.
+
+  \param lenp
+  If non-NULL, the length of the level dimension will be written
+  here by nccf_inq_lvl.
+
+  \param xtypep
+  If non-NULL, the type of the coordinate variable will be written here.
+
+  \param ft_lenp
+  If non-NULL, the length of the value of the ``formula_terms''
+  attribute will be written here by ft_lenp. If there is no
+  ``formula_terms'' attribute, zero will be written.
+
+  \param formula_terms If non-NULL, the value of the formula terms
+  attribute will be copied here.
+
+  \param positive_upp If non-NULL, a one will be written here if the
+  ``positive'' attribute of this coordinate variable is ``up'', a zero
+  will be written if it is ``down''.
+
+  \param lvl_dimidp
+  If non-NULL, the dimid of the level dimension will be written here.
+
+  \param lvl_varidp
+  If non-NULL, the varid of the level coordinate variable will be
+  written here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_inq_lvl(int ncid, char *name, size_t *lenp, nc_type *xtypep, 
 	     size_t *ft_lenp, char *formula_terms, int *positive_upp, 
-	     int *lon_dimidp, int *lon_varidp)
+	     int *lvl_dimidp, int *lvl_varidp)
 {
    const char val[NLEVEL_UNITS][CF_MAX_LEN + 1] = 
       {"bar", "standard_atmosphere", "technical_atmosphere", 
@@ -460,42 +639,40 @@ nccf_inq_lvl(int ncid, char *name, size_t *lenp, nc_type *xtypep,
 
    /* Find a coordinate var and dim with one of the units above. */
    return inq_coord_var(ncid, NLEVEL_UNITS, val, NULL, name, lenp, xtypep, 
-			ft_lenp, formula_terms, positive_upp, lon_dimidp, 
-			lon_varidp);
+			ft_lenp, formula_terms, positive_upp, lvl_dimidp, 
+			lvl_varidp);
 }
 
-/* Define a time coordinate variable and dimension. */
-int 
-nccf_def_time(int ncid, const char *name, size_t len, nc_type xtype, 
-	      const char *units, const char *standard_name, 
-	      int *time_dimidp, int *time_varidp)
-{
-   return def_coord_var(ncid, name, len, xtype, units, CF_TIME_AXIS, 0, 
-			standard_name, NULL, NCCF_TIME, time_dimidp, 
-			time_varidp);
-}
+/*! Define one of the unitless vertical coordinate variables from
+  appendix D of the CF document. 
 
-/* Inquire about a vertical dimension and coordinate variable. */
-int 
-nccf_inq_time(int ncid, char *name, size_t *lenp, nc_type *xtypep, 
-	      int *time_dimidp, int *time_varidp)
-{
-   const char val[NTIME_UNITS][CF_MAX_LEN + 1] = {
-      "second", "day", "hour", "minute", "s", 
-      "sec", "shake", "sidereal_day", "sidereal_hour", 
-      "sidereal_minute", "sidereal_second", 
-      "sidereal_year", "tropical_year", "lunar_month", 
-      "common_year", "leap_year", "Julian_year", 
-      "Gregorian_year", "sidereal_month", "tropical_month", 
-      "d", "min", "hr", "h", "fortnight", "week", "jiffy", 
-      "jiffies", "year", "yr", "a", "eon", "month"};
+  \param ncid
+  The ncid of the file.
 
-   return inq_coord_var(ncid, NTIME_UNITS, val, NULL, NULL, lenp, xtypep, NULL, 
-			NULL, NULL, time_dimidp, time_varidp);
-}
+  \param name the name of the dimension and variable.
 
-/* Define one of the unitless vertical coordinate variables from
- * appendix D of the CF document. */
+  \param xtype
+  The type of this coordinate variable.
+
+  \param len
+  The length of this coordinate dimension.
+
+  \param nterms number of terms in term_id array
+
+  \param term_id the IDs of the terms
+
+  \param ft_format the formula terms format
+
+  \param lvl_dimidp
+  If non-NULL, nccf_def_longitude will write the dimension ID of the
+  netCDF dimension for the longitude here.
+
+  \param lvl_varidp
+  If non-NULL, nccf_def_longitude will write the variable ID of the
+  netCDF coordinate variable for the longitude here.
+
+  \return 0 for success, error code otherwise.
+*/
 static int
 def_vert_var(int ncid, const char *name, nc_type xtype, size_t len, 
 	     int nterms, int *term_id, const char *ft_format, 
@@ -696,10 +873,11 @@ inq_vert_var(int ncid, const char *standard_name, int nterms,
    return CF_NOERR;
 }
 
-/*
+/*! Define a vertical coordinate for atmosphere natural log pressure.
+
   Atmosphere natural log pressure coordinate
 
-  standard_name = "atmosphere_ln_pressure_coordinate"
+  standard_name = 'atmosphere_ln_pressure_coordinate'
 
   Definition:
 
@@ -711,7 +889,28 @@ inq_vert_var(int ncid, const char *standard_name, int nterms,
 
   The format for the formula_terms attribute is
 
-  formula_terms = "p0: var1 lev: var2"
+  formula_terms = 'p0: var1 lev: var2'
+
+  \param ncid
+  The ncid of the file.
+
+  \param name the name of the dimension and variable.
+
+  \param xtype
+  The type of this coordinate variable.
+
+  \param len
+  The length of this coordinate dimension.
+
+  \param lvl_dimidp
+  If non-NULL, nccf_def_longitude will write the dimension ID of the
+  netCDF dimension for the longitude here.
+
+  \param lvl_varidp
+  If non-NULL, nccf_def_longitude will write the variable ID of the
+  netCDF coordinate variable for the longitude here.
+
+  \return 0 for success, error code otherwise.
 */
 int 
 nccf_def_lvl_atm_ln(int ncid, const char *name, nc_type xtype, size_t len, 
@@ -722,6 +921,18 @@ nccf_def_lvl_atm_ln(int ncid, const char *name, nc_type xtype, size_t len,
 			lvl_varidp);
 }
 
+/*! Define formula terms for atmosphere natural log pressure.
+
+  \param ncid
+  The ncid of the file.
+
+  \param varid 
+  The ID of the variable.
+
+  \param pref_varid
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_def_ft_atm_ln(int ncid, int varid, int pref_varid)
 {
@@ -732,7 +943,32 @@ nccf_def_ft_atm_ln(int ncid, int varid, int pref_varid)
    return nccf_set_ft(ncid, varid, FT_ATM_LN_TERMS, ft_varids, FT_ATM_LN_FORMAT);
 }
 
-/* Atmosphere natural log pressure coordinate. */
+/*! Inquire about atmosphere natural log pressure coordinate. 
+
+  \param ncid The ncid of the file.
+
+  \param name If non-NULL the name of the time dimension and variable
+  will be copied here.
+
+  \param xtypep
+  If non-NULL, the type of the coordinate variable will be copied here.
+
+  \param lenp
+  If non-NULL, the length of the time dimension will be copied
+  here by nccf_inq_time.
+
+  \param pref_varidp
+  If non-NULL, the varid of the pref variable will be copied here.
+
+  \param lvl_dimidp
+  If non-NULL, the dimid of the vertical dimension will be copied here.
+
+  \param lvl_varidp
+  If non-NULL, the varid of the vertical coordinate variable will be
+  copied here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_inq_lvl_atm_ln(int ncid, char *name, nc_type *xtypep, size_t *lenp, 
 		    int *pref_varidp, int *lvl_dimidp, int *lvl_varidp)
@@ -752,8 +988,35 @@ nccf_inq_lvl_atm_ln(int ncid, char *name, nc_type *xtypep, size_t *lenp,
    return CF_NOERR;
 }
 
-/* Create a unitless vertical dimension/variable from appendix D of
- * the CF standard. */
+/*! Create a unitless vertical dimension/variable from appendix D of
+  the CF standard. 
+
+  \param ncid The ncid of the file.
+
+  \param lvl_type
+  One of: CF_VERT_ATM_LN, CF_VERT_SIGMA, CF_VERT_HYBRID_SIGMA,
+  CF_VERT_HYBRID_HEIGHT, CF_VERT_SLEVE, CF_VERT_OCEAN_SIGMA,
+  CF_VERT_OCEAN_S, CF_VERT_OCEAN_SIGMA_Z, CF_VERT_OCEAN_DBL_SIGMA.
+
+  \param name
+  The name of the coordinate dimension and variable.
+
+  \param xtype
+  The type of this coordinate variable.
+
+  \param len
+  The length of this coordinate dimension and variable.
+
+  \param lvl_dimidp
+  If non-NULL, the function will write the dimension ID of the
+  netCDF dimension for the level here.
+
+  \param lvl_varidp
+  If non-NULL, the function will write the variable ID of the
+  netCDF coordinate variable for the level here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_def_lvl_vert(int ncid, int lvl_type, const char *name, nc_type xtype, 
 		  size_t len, int *lvl_dimidp, int *lvl_varidp)
@@ -768,15 +1031,35 @@ nccf_def_lvl_vert(int ncid, int lvl_type, const char *name, nc_type xtype,
 			lvl_varidp);
 }
 
-/* Define a vertical sigma coordinate dimension. 
+/*! Define a vertical sigma coordinate dimension. 
+
    From the CF doc:
 
    Atmosphere sigma coordinate:  
    float lev(lev) ;
-   lev:long_name = "sigma at layer midpoints" ;
-   lev:positive = "down" ;
-   lev:standard_name = "atmosphere_sigma_coordinate" ;
-   lev:formula_terms = "sigma: lev ps: PS ptop: PTOP" ;
+   lev:long_name = 'sigma at layer midpoints' ;
+   lev:positive = 'down' ;
+   lev:standard_name = 'atmosphere_sigma_coordinate' ;
+   lev:formula_terms = 'sigma: lev ps: PS ptop: PTOP' ;
+
+  \param ncid The ncid of the file.
+
+  \param name If non-NULL, the name of this vertical level dimension
+  (and variable) will be written here.
+
+  \param xtype If non-NULL, the type of the coordinate variable will
+  be written here.
+
+  \param len If non-NULL, the length of the level dimension will be
+  written here by nccf_inq_lvl.
+
+  \param lvl_dimidp If non-NULL, the dimid of the level dimension will
+  be written here.
+
+  \param lvl_varidp If non-NULL, the varid of the level coordinate
+  variable will be written here.
+
+   \return 0 for success, error code otherwise.
 */
 int 
 nccf_def_lvl_sigma(int ncid, const char *name, nc_type xtype, size_t len, 
@@ -787,18 +1070,56 @@ nccf_def_lvl_sigma(int ncid, const char *name, nc_type xtype, size_t len,
 			lvl_varidp);
 }
 
-/* Set the formula_terms to contain information about this level. */
+/*! Define formula terms attribute for atmosphere sigma coordinate variable.
+
+  \param ncid The ncid of the file.
+
+  \param lvl_varid The variable ID of the level.
+
+  \param ps_varid The variable ID of the ps variable.
+
+  \param p0_varid The variable ID of the p0 variable.
+
+  \return 0 for success, error code otherwise.
+*/
 int
-nccf_def_ft_sigma(int ncid, int lvl_vid, int ps_vid, int p0_vid)
+nccf_def_ft_sigma(int ncid, int lvl_varid, int ps_varid, int p0_varid)
 {
    int ft_varids[FT_MAX_TERMS];
    
-   ft_varids[0] = lvl_vid;
-   ft_varids[1] = ps_vid;
-   ft_varids[2] = p0_vid;
-   return nccf_set_ft(ncid, lvl_vid, FT_SIGMA_TERMS, ft_varids, FT_SIGMA_FORMAT);
+   ft_varids[0] = lvl_varid;
+   ft_varids[1] = ps_varid;
+   ft_varids[2] = p0_varid;
+   return nccf_set_ft(ncid, lvl_varid, FT_SIGMA_TERMS, ft_varids, FT_SIGMA_FORMAT);
 }
 
+/*! Inquire about a level dimension and coordinate variable.
+
+  \param ncid The ncid of the file.
+
+  \param name If non-NULL, the name of this vertical level dimension
+  (and variable) will be written here.
+
+  \param xtypep If non-NULL, the type of the coordinate variable will
+  be written here.
+
+  \param lenp If non-NULL, the length of the level dimension will be
+  written here.
+
+  \param lvl_typep If non-NULL, the type of vertical dimension will be
+  written here, one of CF_VERT_ATM_LN, CF_VERT_SIGMA,
+  CF_VERT_HYBRID_SIGMA, CF_VERT_HYBRID_HEIGHT, CF_VERT_SLEVE,
+  CF_VERT_OCEAN_SIGMA, CF_VERT_OCEAN_S, CF_VERT_OCEAN_SIGMA_Z,
+  CF_VERT_OCEAN_DBL_SIGMA.
+
+  \param lvl_dimidp If non-NULL, the dimid of the level dimension will
+  be written here.
+
+  \param lvl_varidp If non-NULL, the varid of the level coordinate
+  variable will be written here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_inq_lvl_vert(int ncid, char *name, nc_type *xtypep, size_t *lenp, 
 		  int *lvl_typep, int *lvl_dimidp, int *lvl_varidp)
@@ -888,7 +1209,33 @@ nccf_inq_lvl_vert(int ncid, char *name, nc_type *xtypep, size_t *lenp,
    return CF_NOERR;
 }
 
-/* Inquire about atmosphere sigma coordinate. */
+/*! Inquire about atmospheric sigma coordinate. 
+
+  \param ncid The ncid of the file.
+
+  \param name If non-NULL, this pointer gets the name of the
+  coordinate variable and dimension.
+
+  \param xtypep If non-NULL, the type of the coordinate variable will
+  be written here.
+
+  \param lenp If non-NULL, the length of the coordinate dimension will
+  be written here.
+
+  \param ps_varidp If non-NULL, the variable ID of the ps variable
+  will be written here.
+
+  \param ptop_varidp If non-NULL, the variable ID of the ptop variable
+  will be written here.
+
+  \param lvl_dimidp If non-NULL, the dimid of the coordinate dimension
+  will be written here.
+
+  \param lvl_varidp If non-NULL, the varid of the coordinate variable
+  will be written here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_inq_lvl_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp, 
 		   int *ps_varidp, int *ptop_varidp, int *lvl_dimidp, 
@@ -911,10 +1258,9 @@ nccf_inq_lvl_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp,
    return CF_NOERR;
 }
 
-/*
-  Atmosphere hybrid sigma pressure coordinate
+/*! Define hybrid sigma pressure coordinate.
 
-  standard_name = "atmosphere_hybrid_sigma_pressure_coordinate"
+  standard_name = 'atmosphere_hybrid_sigma_pressure_coordinate'
 
   Definition:
 
@@ -934,13 +1280,31 @@ nccf_inq_lvl_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp,
 
   The format for the formula_terms attribute is
 
-  formula_terms = "a: var1 b: var2 ps: var3 p0: var4"
+  formula_terms = 'a: var1 b: var2 ps: var3 p0: var4'
 
   where a is replaced by ap if appropriate.
 
   The hybrid sigma-pressure coordinate for level k is defined as
   a(k)+b(k) or ap(k)/p0+b(k), as appropriate.
 
+  \param ncid The ncid of the file.
+
+  \param name If non-NULL, the name of this vertical level dimension
+  (and variable) will be written here.
+
+  \param xtype If non-NULL, the type of the coordinate variable will
+  be written here.
+
+  \param len If non-NULL, the length of the level dimension will be
+  written here by nccf_inq_lvl.
+
+  \param lvl_dimidp If non-NULL, the dimid of the level dimension will
+  be written here.
+
+  \param lvl_varidp If non-NULL, the varid of the level coordinate
+  variable will be written here.
+
+  \return 0 for success, error code otherwise.
 */
 int 
 nccf_def_lvl_hybrid_sigma(int ncid, const char *name, nc_type xtype, size_t len, 
@@ -953,18 +1317,34 @@ nccf_def_lvl_hybrid_sigma(int ncid, const char *name, nc_type xtype, size_t len,
 			lvl_varidp);
 }
 
-/* Set the formula_terms atribute to contain all this information. */
+/*! Define formula terms attribute for atmosphere hybrid sigma
+  coordinate variable.
+
+  \param ncid The ncid of the file.
+
+  \param lvl_varid The varid of the vertical coordinate variable.
+
+  \param a_varid The variable ID of the a variable.
+
+  \param b_varid The variable ID of the b variable.
+
+  \param ps_varid The variable ID of the ps variable.
+
+  \param p0_varid The variable ID of the ptop variable.
+
+  \return 0 for success, error code otherwise.
+*/
 int
-nccf_def_ft_hybrid_sigma(int ncid, int lvl_vid, int a_vid, int b_vid, int ps_vid, 
-			 int p0_vid)
+nccf_def_ft_hybrid_sigma(int ncid, int lvl_varid, int a_varid, int b_varid, int ps_varid, 
+			 int p0_varid)
 {
    int ft_varids[FT_MAX_TERMS];
    
-   ft_varids[0] = a_vid;
-   ft_varids[1] = b_vid;
-   ft_varids[2] = ps_vid;
-   ft_varids[3] = p0_vid;
-   return nccf_set_ft(ncid, lvl_vid, FT_HYBRID_SIGMA_TERMS, ft_varids, 
+   ft_varids[0] = a_varid;
+   ft_varids[1] = b_varid;
+   ft_varids[2] = ps_varid;
+   ft_varids[3] = p0_varid;
+   return nccf_set_ft(ncid, lvl_varid, FT_HYBRID_SIGMA_TERMS, ft_varids, 
 		      FT_HYBRID_SIGMA_FORMAT);
 }
 
@@ -1053,7 +1433,39 @@ nccf_def_ft_hybrid_sigma(int ncid, int lvl_vid, int a_vid, int b_vid, int ps_vid
    
 /* } */
 
-/* Inquire about atmosphere hybrid_sigma coordinate. */
+/*! Inquire about hybrid sigma coordinate. 
+
+  \param ncid The ncid of the file.
+
+  \param name If non-NULL, this pointer gets the name of the
+  coordinate variable and dimension.
+
+  \param xtypep If non-NULL, the type of the coordinate variable will
+  be written here.
+
+  \param lenp If non-NULL, the length of the coordinate dimension will
+  be written here.
+
+  \param a_varidp If non-NULL, the variable ID of the a variable will
+  be written here.
+
+  \param b_varidp If non-NULL, the variable ID of the b variable will
+  be written here.
+
+  \param ps_varidp If non-NULL, the variable ID of the ps variable
+  will be written here.
+
+  \param p0_varidp If non-NULL, the variable ID of the ptop variable
+  will be written here.
+
+  \param lvl_dimidp If non-NULL, the dimid of the coordinate dimension
+  will be written here.
+
+  \param lvl_varidp If non-NULL, the varid of the coordinate variable
+  will be written here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_inq_lvl_hybrid_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp, 
 			  int *a_varidp, int *b_varidp, int *ps_varidp, 
@@ -1081,25 +1493,41 @@ nccf_inq_lvl_hybrid_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp,
    return CF_NOERR;
 }
 
-/* Atmosphere hybrid height coordinate
+/*! Atmosphere hybrid height coordinate
+
+  standard_name = 'atmosphere_hybrid_height_coordinate'
+
+  Definition:
+  z(n,k,j,i) = a(k) + b(k)*orog(n,j,i)
+
+  where z(n,k,j,i) is the height above the geoid (approximately mean
+  sea level) at gridpoint (k,j,i) and time (n), orog(n,j,i) is the
+  height of the surface above the geoid at (j,i) and time (n), and
+  a(k) and b(k) are the coordinates which define hybrid height level
+  k. a(k) has the dimensions of height and b(k) is dimensionless.
+
+  The format for the formula_terms attribute is
+  formula_terms = 'a: var1 b: var2 orog: var3'
+
+  There is no dimensionless hybrid height coordinate. The hybrid
+  height is best approximated as a(k) if a level-dependent constant
+  is needed.
+
+  \param ncid The ncid of the file.
+
+  \param name The name of the coordinate dimension and variable.
 
-   standard_name = "atmosphere_hybrid_height_coordinate"
+  \param xtype The type of this coordinate variable.
 
-   Definition:
-   z(n,k,j,i) = a(k) + b(k)*orog(n,j,i)
+  \param len The length of this coordinate dimension and variable.
 
-   where z(n,k,j,i) is the height above the geoid (approximately mean
-   sea level) at gridpoint (k,j,i) and time (n), orog(n,j,i) is the
-   height of the surface above the geoid at (j,i) and time (n), and
-   a(k) and b(k) are the coordinates which define hybrid height level
-   k. a(k) has the dimensions of height and b(k) is dimensionless.
+  \param lvl_dimidp If non-NULL, the function will write the dimension
+  ID of the netCDF dimension for the level here.
 
-   The format for the formula_terms attribute is
-   formula_terms = "a: var1 b: var2 orog: var3"
+  \param lvl_varidp If non-NULL, the function will write the variable
+  ID of the netCDF coordinate variable for the level here.
 
-   There is no dimensionless hybrid height coordinate. The hybrid
-   height is best approximated as a(k) if a level-dependent constant
-   is needed.
+  \return 0 for success, error code otherwise.
 */
 int 
 nccf_def_lvl_hybrid_height(int ncid, const char *name, nc_type xtype, size_t len, 
@@ -1112,6 +1540,21 @@ nccf_def_lvl_hybrid_height(int ncid, const char *name, nc_type xtype, size_t len
 			lvl_varidp);
 }
 
+/*! Define formula terms attribute for atmosphere hybrid height
+  coordinate variable.
+
+  \param ncid The ncid of the file.
+
+  \param varid The varid of the vertical coordinate variable.
+
+  \param a_varid The variable ID of the a variable.
+
+  \param b_varid The variable ID of the b variable.
+
+  \param orog_varid The variable ID of the orog variable.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_def_ft_hybrid_height(int ncid, int varid, int a_varid, int b_varid, 
 			  int orog_varid)
@@ -1125,7 +1568,36 @@ nccf_def_ft_hybrid_height(int ncid, int varid, int a_varid, int b_varid,
 		      FT_HYBRID_HEIGHT_FORMAT);
 }
 
-/* Inquire about atmosphere hybrid_height coordinate. */
+/*! Inquire about atmosphere hybrid_height coordinate. 
+
+  \param ncid The ncid of the file.
+
+  \param name If non-NULL, this pointer gets the name of the
+  coordinate variable and dimension.
+
+  \param xtypep If non-NULL, the type of the coordinate variable will
+  be written here.
+
+  \param lenp If non-NULL, the length of the coordinate dimension will
+  be written here.
+
+  \param a_varidp If non-NULL, the variable ID of the a variable will
+  be written here.
+
+  \param b_varidp If non-NULL, the variable ID of the b variable will
+  be written here.
+
+  \param orog_varidp If non-NULL, the variable ID of the orog variable
+  will be written here.
+
+  \param lvl_dimidp If non-NULL, the dimid of the coordinate dimension
+  will be written here.
+
+  \param lvl_varidp If non-NULL, the varid of the coordinate variable
+  will be written here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_inq_lvl_hybrid_height(int ncid, char *name, nc_type *xtypep, size_t *lenp, 
 			   int *a_varidp, int *b_varidp, int *orog_varidp, 
@@ -1151,27 +1623,43 @@ nccf_inq_lvl_hybrid_height(int ncid, char *name, nc_type *xtypep, size_t *lenp,
    return CF_NOERR;
 }
 
-/* Atmosphere smooth level vertical (SLEVE) coordinate
+/*! Atmosphere smooth level vertical (SLEVE) coordinate
 
-   standard_name = "atmosphere_sleve_coordinate"
+  standard_name = 'atmosphere_sleve_coordinate'
+
+  Definition:
+  z(n,k,j,i) = a(k)*ztop + b1(k)*zsurf1(n,j,i) + b2(k)*zsurf2(n,j,i)
+
+  where z(n,k,j,i) is the height above the geoid (approximately mean
+  sea level) at gridpoint (k,j,i) and time (n), ztop is the height of
+  the top of the model, and a(k), b1(k) and b2(k) are the
+  dimensionless coordinates which define hybrid height level
+  k. zsurf1(n,j,i) and zsurf2(n,j,i) are respectively the large and
+  small scale parts of the topography. See Schaer et al [SCH02] for
+  details.
+
+  The format for the formula_terms attribute is
 
-   Definition:
-   z(n,k,j,i) = a(k)*ztop + b1(k)*zsurf1(n,j,i) + b2(k)*zsurf2(n,j,i)
+  formula_terms = 'a: var1 b1: var2 b2: var3 ztop: var4 zsurf1: var5
+  zsurf2: var6'
 
-   where z(n,k,j,i) is the height above the geoid (approximately mean
-   sea level) at gridpoint (k,j,i) and time (n), ztop is the height of
-   the top of the model, and a(k), b1(k) and b2(k) are the
-   dimensionless coordinates which define hybrid height level
-   k. zsurf1(n,j,i) and zsurf2(n,j,i) are respectively the large and
-   small scale parts of the topography. See Schaer et al [SCH02] for
-   details.
+  The hybrid height coordinate for level k is defined as a(k)*ztop.
 
-   The format for the formula_terms attribute is
+  \param ncid The ncid of the file.
 
-   formula_terms = "a: var1 b1: var2 b2: var3 ztop: var4 zsurf1: var5
-   zsurf2: var6"
+  \param name The name of the coordinate dimension and variable.
 
-   The hybrid height coordinate for level k is defined as a(k)*ztop.
+  \param xtype The type of this coordinate variable.
+
+  \param len The length of this coordinate dimension and variable.
+
+  \param lvl_dimidp If non-NULL, the function will write the dimension
+  ID of the netCDF dimension for the level here.
+
+  \param lvl_varidp If non-NULL, the function will write the variable
+  ID of the netCDF coordinate variable for the level here.
+
+  \return 0 for success, error code otherwise.
 */
 int 
 nccf_def_lvl_sleve(int ncid, const char *name, nc_type xtype, size_t len, 
@@ -1184,6 +1672,27 @@ nccf_def_lvl_sleve(int ncid, const char *name, nc_type xtype, size_t len,
 			lvl_varidp);
 }
 
+/*! Define formula terms attribute for the atmosphere sleve coordinate
+  variable.
+
+  \param ncid The ncid of the file.
+
+  \param varid The varid of the vertical coordinate variable.
+
+  \param a_varid The variable ID of the a variable.
+
+  \param b1_varid The variable ID of the b1 variable.
+
+  \param b2_varid The variable ID of the b2 variable.
+
+  \param ztop_varid The variable ID of the ztop variable.
+
+  \param zsurf1_varid The variable ID of the zsurf1 variable.
+
+  \param zsurf2_varid The variable ID of the zsurf2 variable.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_def_ft_sleve(int ncid, int varid, int a_varid, int b1_varid, int b2_varid, 
 		  int ztop_varid, int zsurf1_varid, int zsurf2_varid)
@@ -1199,7 +1708,45 @@ nccf_def_ft_sleve(int ncid, int varid, int a_varid, int b1_varid, int b2_varid,
    return nccf_set_ft(ncid, varid, FT_SLEVE_TERMS, ft_varids, FT_SLEVE_FORMAT);
 }
 
-/* Inquire about atmosphere sleve coordinate. */
+/*! Inquire about atmosphere sleve coordinate. 
+
+  \param ncid The ncid of the file.
+
+  \param name If non-NULL, this pointer gets the name of the
+  coordinate variable and dimension.
+
+  \param xtypep If non-NULL, the type of the coordinate variable will
+  be written here.
+
+  \param lenp If non-NULL, the length of the coordinate dimension will
+  be written here.
+
+  \param a_varidp If non-NULL, the variable ID of the a variable will
+  be written here.
+
+  \param b1_varidp If non-NULL, the variable ID of the b1 variable
+  will be written here.
+
+  \param b2_varidp If non-NULL, the variable ID of the b2 variable
+  will be written here.
+
+  \param ztop_varidp If non-NULL, the variable ID of the ztop variable
+  will be written here.
+
+  \param zsurf1_varidp If non-NULL, the variable ID of the zsurf1
+  variable will be written here.
+
+  \param zsurf2_varidp If non-NULL, the variable ID of the zsurf2
+  variable will be written here.
+
+  \param lvl_dimidp If non-NULL, the dimid of the coordinate dimension
+  will be written here.
+
+  \param lvl_varidp If non-NULL, the varid of the coordinate variable
+  will be written here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_inq_lvl_sleve(int ncid, char *name, nc_type *xtypep, size_t *lenp, 
 		   int *a_varidp, int *b1_varidp, int *b2_varidp, int *ztop_varidp, 
@@ -1231,23 +1778,40 @@ nccf_inq_lvl_sleve(int ncid, char *name, nc_type *xtypep, size_t *lenp,
    return CF_NOERR;
 }
 
-/* Ocean sigma coordinate
+/*! Define an ocean sigma coordinate.
+
+  standard_name = 'ocean_sigma_coordinate'
+
+  Definition:
+  z(n,k,j,i) = eta(n,j,i) + sigma(k) * (depth(j,i)+eta(n,j,i))
+
+  where z(n,k,j,i) is height, positive upwards, relative to ocean
+  datum (e.g. mean sea level) at gridpoint (n,k,j,i), eta(n,j,i) is
+  the height of the ocean surface, positive upwards, relative to
+  ocean datum at gridpoint (n,j,i), sigma(k) is the dimensionless
+  coordinate at vertical gridpoint (k), and depth(j,i) is the
+  distance from ocean datum to sea floor (positive value) at
+  horizontal gridpoint (j,i).
+
+  The format for the formula_terms attribute is
+  formula_terms = 'sigma: var1 eta: var2 depth: var3'
 
-   standard_name = "ocean_sigma_coordinate"
 
-   Definition:
-   z(n,k,j,i) = eta(n,j,i) + sigma(k) * (depth(j,i)+eta(n,j,i))
+  \param ncid The ncid of the file.
 
-   where z(n,k,j,i) is height, positive upwards, relative to ocean
-   datum (e.g. mean sea level) at gridpoint (n,k,j,i), eta(n,j,i) is
-   the height of the ocean surface, positive upwards, relative to
-   ocean datum at gridpoint (n,j,i), sigma(k) is the dimensionless
-   coordinate at vertical gridpoint (k), and depth(j,i) is the
-   distance from ocean datum to sea floor (positive value) at
-   horizontal gridpoint (j,i).
+  \param name The name of the coordinate dimension and variable.
 
-   The format for the formula_terms attribute is
-   formula_terms = "sigma: var1 eta: var2 depth: var3"
+  \param xtype The type of this coordinate variable.
+
+  \param len The length of this coordinate dimension and variable.
+
+  \param lvl_dimidp If non-NULL, the function will write the dimension
+  ID of the netCDF dimension for the level here.
+
+  \param lvl_varidp If non-NULL, the function will write the variable
+  ID of the netCDF coordinate variable for the level here.
+
+  \return 0 for success, error code otherwise.
 */
 int 
 nccf_def_lvl_ocean_sigma(int ncid, const char *name, nc_type xtype, size_t len, 
@@ -1260,6 +1824,19 @@ nccf_def_lvl_ocean_sigma(int ncid, const char *name, nc_type xtype, size_t len,
 			lvl_varidp);
 }
 
+/*! Define the formula terms attribute for the ocean sigma coordinate
+ *  variable.
+
+ \param ncid The ncid of the file.
+
+ \param varid The varid of the vertical coordinate variable.
+
+ \param eta_varid The variable ID of the eta variable.
+
+ \param depth_varid The variable ID of the depth variable.
+
+ \return 0 for success, error code otherwise.
+*/
 int 
 nccf_def_ft_ocean_sigma(int ncid, int varid, int eta_varid, int depth_varid)
 {
@@ -1272,7 +1849,33 @@ nccf_def_ft_ocean_sigma(int ncid, int varid, int eta_varid, int depth_varid)
 		      FT_OCEAN_SIGMA_FORMAT);
 }
 
-/* Inquire about atmosphere ocean_sigma coordinate. */
+/*! Inquire about ocean sigma coordinate. 
+
+  \param ncid The ncid of the file.
+
+  \param name If non-NULL, this pointer gets the name of the
+  coordinate variable and dimension.
+
+  \param xtypep If non-NULL, the type of the coordinate variable will
+  be written here.
+
+  \param lenp If non-NULL, the length of the coordinate dimension will
+  be written here.
+
+  \param eta_varidp If non-NULL, the variable ID of the eta variable
+  will be written here.
+
+  \param depth_varidp If non-NULL, the variable ID of the depth
+  variable will be written here.
+
+  \param lvl_dimidp If non-NULL, the dimid of the coordinate dimension
+  will be written here.
+
+  \param lvl_varidp If non-NULL, the varid of the coordinate variable
+  will be written here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_inq_lvl_ocean_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp, 
 			 int *eta_varidp, int *depth_varidp, int *lvl_dimidp, 
@@ -1295,29 +1898,45 @@ nccf_inq_lvl_ocean_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp,
    return CF_NOERR;
 }
 
-/* Ocean s-coordinate
+/*! Define ocean s-coordinate.
 
-   standard_name = "ocean_s_coordinate"
+  standard_name = 'ocean_s_coordinate'
 
-   z(n,k,j,i) = eta(n,j,i)*(1+s(k)) + depth_c*s(k) +
-   (depth(j,i)-depth_c)*C(k)
+  z(n,k,j,i) = eta(n,j,i)*(1+s(k)) + depth_c*s(k) +
+  (depth(j,i)-depth_c)*C(k)
 
-   C(k) = (1-b)*sinh(a*s(k))/sinh(a) + 
-   b*[tanh(a*(s(k)+0.5))/(2*tanh(0.5*a)) - 0.5]
+  C(k) = (1-b)*sinh(a*s(k))/sinh(a) + 
+  b*[tanh(a*(s(k)+0.5))/(2*tanh(0.5*a)) - 0.5]
 
-   where z(n,k,j,i) is height, positive upwards, relative to ocean
-   datum (e.g. mean sea level) at gridpoint (n,k,j,i), eta(n,j,i) is
-   the height of the ocean surface, positive upwards, relative to
-   ocean datum at gridpoint (n,j,i), s(k) is the dimensionless
-   coordinate at vertical gridpoint (k), and depth(j,i) is the
-   distance from ocean datum to sea floor (positive value) at
-   horizontal gridpoint (j,i). The constants a, b, and depth_c control
-   the stretching.
+  where z(n,k,j,i) is height, positive upwards, relative to ocean
+  datum (e.g. mean sea level) at gridpoint (n,k,j,i), eta(n,j,i) is
+  the height of the ocean surface, positive upwards, relative to
+  ocean datum at gridpoint (n,j,i), s(k) is the dimensionless
+  coordinate at vertical gridpoint (k), and depth(j,i) is the
+  distance from ocean datum to sea floor (positive value) at
+  horizontal gridpoint (j,i). The constants a, b, and depth_c control
+  the stretching.
 
-   The format for the formula_terms attribute is
+  The format for the formula_terms attribute is
+
+  formula_terms = 's: var1 eta: var2 depth: var3 a: var4 b: var5
+  depth_c: var6'
+
+  \param ncid The ncid of the file.
+
+  \param name The name of the coordinate dimension and variable.
+
+  \param xtype The type of this coordinate variable.
+
+  \param len The length of this coordinate dimension and variable.
+
+  \param lvl_dimidp If non-NULL, the function will write the dimension
+  ID of the netCDF dimension for the level here.
 
-   formula_terms = "s: var1 eta: var2 depth: var3 a: var4 b: var5
-   depth_c: var6"
+  \param lvl_varidp If non-NULL, the function will write the variable
+  ID of the netCDF coordinate variable for the level here.
+
+  \return 0 for success, error code otherwise.
 */
 int 
 nccf_def_lvl_ocean_s(int ncid, const char *name, nc_type xtype, size_t len, 
@@ -1330,6 +1949,25 @@ nccf_def_lvl_ocean_s(int ncid, const char *name, nc_type xtype, size_t len,
 			lvl_varidp);
 }
 
+/*! Define the formula terms attribute for the ocean sigma coordinate
+  variable.
+
+  \param ncid The ncid of the file.
+
+  \param varid The varid of the vertical coordinate variable.
+
+  \param eta_varid The variable ID of the eta variable.
+
+  \param depth_varid The variable ID of the depth variable.
+
+  \param a_varid The variable ID of the a variable.
+
+  \param b_varid The variable ID of the b variable.
+
+  \param depth_c_varid The variable ID of the depth_c variable.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_def_ft_ocean_s(int ncid, int varid, int eta_varid, int depth_varid, 
 		    int a_varid, int b_varid, int depth_c_varid)
@@ -1346,7 +1984,42 @@ nccf_def_ft_ocean_s(int ncid, int varid, int eta_varid, int depth_varid,
 		      FT_OCEAN_S_FORMAT);
 }
 
-/* Inquire about atmosphere ocean_s coordinate. */
+/*! Inquire about ocean_s coordinate. 
+
+  \param ncid The ncid of the file.
+
+  \param name If non-NULL, this pointer gets the name of the
+  coordinate variable and dimension.
+
+  \param xtypep If non-NULL, the type of the coordinate variable will
+  be written here.
+
+  \param lenp If non-NULL, the length of the coordinate dimension will
+  be written here.
+
+  \param eta_varidp If non-NULL, the variable ID of the eta variable
+  will be written here.
+
+  \param depth_varidp If non-NULL, the variable ID of the depth
+  variable will be written here.
+
+  \param a_varidp If non-NULL, the variable ID of the a variable will
+  be written here.
+
+  \param b_varidp If non-NULL, the variable ID of the b variable will
+  be written here.
+
+  \param depth_c_varidp If non-NULL, the variable ID of the depth_c
+  variable will be written here.
+
+  \param lvl_dimidp If non-NULL, the dimid of the coordinate dimension
+  will be written here.
+
+  \param lvl_varidp If non-NULL, the varid of the coordinate variable
+  will be written here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_inq_lvl_ocean_s(int ncid, char *name, nc_type *xtypep, size_t *lenp, 
 		     int *eta_varidp, int *depth_varidp, int *a_varidp, int *b_varidp, 
@@ -1375,29 +2048,45 @@ nccf_inq_lvl_ocean_s(int ncid, char *name, nc_type *xtypep, size_t *lenp,
    return CF_NOERR;
 }
 
-/* Ocean sigma over z coordinate
+/*! Define ocean sigma over z coordinate.
 
-   standard_name = "ocean_sigma_z_coordinate"
+  standard_name = 'ocean_sigma_z_coordinate'
 
-   for k <= nsigma:
-   z(n,k,j,i) = eta(n,j,i) + sigma(k)*(min(depth_c,depth(j,i))+eta(n,j,i))
+  for k <= nsigma:
+  z(n,k,j,i) = eta(n,j,i) + sigma(k)*(min(depth_c,depth(j,i))+eta(n,j,i))
  
-   for k > nsigma:
-   z(n,k,j,i) = zlev(k)
-
-   where z(n,k,j,i) is height, positive upwards, relative to ocean
-   datum (e.g. mean sea level) at gridpoint (n,k,j,i), eta(n,j,i) is
-   the height of the ocean surface, positive upwards, relative to
-   ocean datum at gridpoint (n,j,i), sigma(k) is the dimensionless
-   coordinate at vertical gridpoint (k) for k <= nsigma, and
-   depth(j,i) is the distance from ocean datum to sea floor (positive
-   value) at horizontal gridpoint (j,i). Above depth depth_c there are
-   nsigma layers.
-
-   The format for the formula_terms attribute is
-
-   formula_terms = "sigma: var1 eta: var2 depth: var3 depth_c: var4
-   nsigma: var5 zlev: var6"
+  for k > nsigma:
+  z(n,k,j,i) = zlev(k)
+
+  where z(n,k,j,i) is height, positive upwards, relative to ocean
+  datum (e.g. mean sea level) at gridpoint (n,k,j,i), eta(n,j,i) is
+  the height of the ocean surface, positive upwards, relative to
+  ocean datum at gridpoint (n,j,i), sigma(k) is the dimensionless
+  coordinate at vertical gridpoint (k) for k <= nsigma, and
+  depth(j,i) is the distance from ocean datum to sea floor (positive
+  value) at horizontal gridpoint (j,i). Above depth depth_c there are
+  nsigma layers.
+
+  The format for the formula_terms attribute is
+
+  formula_terms = 'sigma: var1 eta: var2 depth: var3 depth_c: var4
+  nsigma: var5 zlev: var6'
+
+  \param ncid The ncid of the file.
+
+  \param name The name of the coordinate dimension and variable.
+
+  \param xtype The type of this coordinate variable.
+
+  \param len The length of this coordinate dimension and variable.
+
+  \param lvl_dimidp If non-NULL, the function will write the dimension
+  ID of the netCDF dimension for the level here.
+
+  \param lvl_varidp If non-NULL, the function will write the variable
+  ID of the netCDF coordinate variable for the level here.
+
+  \return 0 for success, error code otherwise.
 */
 int 
 nccf_def_lvl_ocean_sigma_z(int ncid, const char *name, nc_type xtype, size_t len, 
@@ -1411,6 +2100,24 @@ nccf_def_lvl_ocean_sigma_z(int ncid, const char *name, nc_type xtype, size_t len
 
 }
 
+/*! Define formula terms for the ocean sigma z coordinate.
+
+  \param ncid The ncid of the file.
+
+  \param varid The varid of the vertical coordinate variable.
+
+  \param eta_varid The variable ID of the eta variable.
+
+  \param depth_varid The variable ID of the depth variable.
+
+  \param depth_c_varid The variable ID of the depth_c variable.
+
+  \param nsigma_varid The variable ID of the nsigma variable.
+
+  \param zlev_varid The variable ID of the zlev variable.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_def_ft_ocean_sigma_z(int ncid, int varid, int eta_varid, int depth_varid, 
 			  int depth_c_varid, int nsigma_varid, int zlev_varid)
@@ -1427,7 +2134,42 @@ nccf_def_ft_ocean_sigma_z(int ncid, int varid, int eta_varid, int depth_varid,
 		      FT_OCEAN_SIGMA_Z_FORMAT);
 }
 
-/* Inquire about atmosphere ocean_sigma_z coordinate. */
+/*! Inquire about atmosphere ocean_sigma_z coordinate. 
+
+  \param ncid The ncid of the file.
+
+  \param name If non-NULL, this pointer gets the name of the
+  coordinate variable and dimension.
+
+  \param xtypep If non-NULL, the type of the coordinate variable will
+  be written here.
+
+  \param lenp If non-NULL, the length of the coordinate dimension will
+  be written here.
+
+  \param eta_varidp If non-NULL, the variable ID of the eta variable
+  will be written here.
+
+  \param depth_varidp If non-NULL, the variable ID of the depth
+  variable will be written here.
+
+  \param depth_c_varidp If non-NULL, the variable ID of the depth_c
+  variable will be written here.
+
+  \param nsigma_varidp If non-NULL, the variable ID of the nsigma
+  variable will be written here.
+
+  \param zlev_varidp If non-NULL, the variable ID of the zlev variable
+  will be written here.
+
+  \param lvl_dimidp If non-NULL, the dimid of the coordinate dimension
+  will be written here.
+
+  \param lvl_varidp If non-NULL, the varid of the coordinate variable
+  will be written here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_inq_lvl_ocean_sigma_z(int ncid, char *name, nc_type *xtypep, size_t *lenp, 
 			   int *eta_varidp, int *depth_varidp, int *depth_c_varidp, 
@@ -1458,10 +2200,9 @@ nccf_inq_lvl_ocean_sigma_z(int ncid, char *name, nc_type *xtypep, size_t *lenp,
    return CF_NOERR;
 }
 
-/*
-  Ocean double sigma coordinate
+/*! Define ocean double sigma coordinate.
 
-  standard_name = "ocean_double_sigma_coordinate"
+  standard_name = 'ocean_double_sigma_coordinate'
 
   Definition:
 
@@ -1484,10 +2225,25 @@ nccf_inq_lvl_ocean_sigma_z(int ncid, char *name, nc_type *xtypep, size_t *lenp,
 
   The format for the formula_terms attribute is:
 
-  formula_terms = "sigma: var1 depth: var2 z1: var3 z2: var4 a: var5 
-  href: var6 k_c: var7"
-*/
+  formula_terms = 'sigma: var1 depth: var2 z1: var3 z2: var4 a: var5 
+  href: var6 k_c: var7'
+
+  \param ncid The ncid of the file.
 
+  \param name The name of the coordinate dimension and variable.
+
+  \param xtype The type of this coordinate variable.
+
+  \param len The length of this coordinate dimension and variable.
+
+  \param lvl_dimidp If non-NULL, the function will write the dimension
+  ID of the netCDF dimension for the level here.
+
+  \param lvl_varidp If non-NULL, the function will write the variable
+  ID of the netCDF coordinate variable for the level here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_def_lvl_ocean_dbl_sigma(int ncid, const char *name, nc_type xtype, size_t len, 
 			     int *lvl_dimidp, int *lvl_varidp)
@@ -1499,6 +2255,26 @@ nccf_def_lvl_ocean_dbl_sigma(int ncid, const char *name, nc_type xtype, size_t l
 			lvl_varidp);
 }
 
+/*! Define formula terms for ocean double sigma coordinate. 
+
+  \param ncid The ncid of the file.
+
+  \param varid The varid of the vertical coordinate variable.
+
+  \param depth_varid The variable ID of the depth variable.
+
+  \param z1_varid The variable ID of the z1 variable.
+
+  \param z2_varid The variable ID of the z2 variable.
+
+  \param a_varid The variable ID of the a variable.
+
+  \param href_varid The variable ID of the href variable.
+
+  \param k_c_varid The variable ID of the k_c variable.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_def_ft_ocean_dbl_sigma(int ncid, int varid, int depth_varid, int z1_varid, 
 			    int z2_varid, int a_varid, int href_varid, int k_c_varid)
@@ -1516,7 +2292,45 @@ nccf_def_ft_ocean_dbl_sigma(int ncid, int varid, int depth_varid, int z1_varid,
 		      FT_OCEAN_DBL_SIGMA_FORMAT);
 }
 
-/* Inquire about atmosphere ocean_dbl_sigma coordinate. */
+/*! Inquire about the ocean double sigma coordinate.
+
+  \param ncid The ncid of the file.
+
+  \param name If non-NULL, this pointer gets the name of the
+  coordinate variable and dimension.
+
+  \param xtypep If non-NULL, the type of the coordinate variable will
+  be copied here.
+
+  \param lenp If non-NULL, the length of the coordinate dimension will
+  be copied here.
+
+  \param depth_varidp If non-NULL, the variable ID of the depth
+  variable will be copied here.
+
+  \param z1_varidp If non-NULL, the variable ID of the z1 variable
+  will be copied here.
+
+  \param z2_varidp If non-NULL, the variable ID of the z2 variable
+  will be copied here.
+
+  \param a_varidp If non-NULL, the variable ID of the a variable will
+  be copied here.
+
+  \param href_varidp If non-NULL, the variable ID of the href variable
+  will be copied here.
+
+  \param k_c_varidp If non-NULL, the variable ID of the k_c variable
+  will be copied here.
+
+  \param lvl_dimidp If non-NULL, the dimid of the coordinate dimension
+  will be copied here.
+
+  \param lvl_varidp If non-NULL, the varid of the coordinate variable
+  will be copied here.
+
+  \return 0 for success, error code otherwise.
+*/
 int 
 nccf_inq_lvl_ocean_dbl_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp, 
 			     int *depth_varidp, int *z1_varidp, int *z2_varidp, 
@@ -1549,4 +2363,98 @@ nccf_inq_lvl_ocean_dbl_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp
 
    return CF_NOERR;
 }
+/*!@}*/
+
+/*! \defgroup coord_time_grp Time Coordinates 
+
+  These functions help with the definition and reading of time
+  coordinate variables and dimensions.
+
+  @{*/
+
+/*! Define a coordinate variable and dimension with all the CF
+  recommended attribute accessories for time.
+
+  \param ncid
+  The ncid of the file.
+
+  \param name the name of the dimension and variable.
+
+  \param len
+  The length of this coordinate dimension.
+
+  \param xtype
+  The type of this coordinate variable.
+
+  \param standard_name
+  If non-NULL, a string which will be written as the ``standard_name''
+  attribute on the coordinate variable.
+
+  \param units
+  If non-NULL, a string which will be written as the ``units''
+  attribute on the coordinate variable.
+
+  \param time_dimidp
+  If non-NULL, nccf_def_time will write the dimension ID of the
+  netCDF dimension for the time here.
+
+  \param time_varidp
+  If non-NULL, nccf_def_time will write the variable ID of the
+  netCDF coordinate variable for the time here.
+
+  \return 0 for success, error code otherwise.
+*/
+int 
+nccf_def_time(int ncid, const char *name, size_t len, nc_type xtype, 
+	      const char *units, const char *standard_name, 
+	      int *time_dimidp, int *time_varidp)
+{
+   return def_coord_var(ncid, name, len, xtype, units, CF_TIME_AXIS, 0, 
+			standard_name, NULL, NCCF_TIME, time_dimidp, 
+			time_varidp);
+}
+
+/*! Inquire about a time dimension and coordinate variable. 
+
+  \param ncid
+  The ncid of the file.
+
+  \param name If non-NULL the name of the time dimension and variable
+  will be copied here.
+
+  \param lenp
+  If non-NULL, the length of the time dimension will be copied
+  here by nccf_inq_time.
+
+  \param xtypep
+  If non-NULL, the type of the coordinate variable will be copied here.
+
+  \param time_dimidp
+  If non-NULL, the dimid of the time dimension will be copied here.
+
+  \param time_varidp
+  If non-NULL, the varid of the time coordinate variable will be
+  copied here.
+
+  \return 0 for success, error code otherwise.
+*/
+int 
+nccf_inq_time(int ncid, char *name, size_t *lenp, nc_type *xtypep, 
+	      int *time_dimidp, int *time_varidp)
+{
+   const char val[NTIME_UNITS][CF_MAX_LEN + 1] = {
+      "second", "day", "hour", "minute", "s", 
+      "sec", "shake", "sidereal_day", "sidereal_hour", 
+      "sidereal_minute", "sidereal_second", 
+      "sidereal_year", "tropical_year", "lunar_month", 
+      "common_year", "leap_year", "Julian_year", 
+      "Gregorian_year", "sidereal_month", "tropical_month", 
+      "d", "min", "hr", "h", "fortnight", "week", "jiffy", 
+      "jiffies", "year", "yr", "a", "eon", "month"};
+
+   return inq_coord_var(ncid, NTIME_UNITS, val, NULL, NULL, lenp, xtypep, NULL, 
+			NULL, NULL, time_dimidp, time_varidp);
+}
 
+/*!@}*/
+/*!@}*/
diff --git a/src/cferror.c b/src/cferror.c
index 557dce2..3e41eb3 100644
--- a/src/cferror.c
+++ b/src/cferror.c
@@ -8,24 +8,36 @@
 
   Ed Hartnett, 5/22/07
 
-  $Id: cferror.c,v 1.2 2009/09/08 17:14:53 ed Exp $
+  $Id: cferror.c 828 2011-09-14 20:05:08Z pletzer $
 */
 
-#include <config.h>
+#include <cf_config.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <cferror.h>
 #include <assert.h>
 
-/* This contents of this file get skipped if LOGGING is not defined
- * during compile. */
-#ifdef LOGGING
-
 /* This is the severity level of messages which will be logged. Use
    severity 0 for errors, 1 for important log messages, 2 for less
    important, etc. */
+#ifdef LOGGING
 int cf_log_level = -1;
+#endif /* LOGGING */
+
+/* Use this to set the global log level. Set it to CF_TURN_OFF_LOGGING
+   (-1) to turn off all logging. Set it to 0 to show only errors, and
+   to higher numbers to show more and more logging details. */
+int 
+nccf_set_log_level(int new_level)
+{
+#ifdef LOGGING
+   /* Now remember the new level. */
+   cf_log_level = new_level;
+   LOG((4, "log_level changed to %d", cf_log_level));
+#endif /* LOGGING */
+   return 0;
+} 
 
 /* This function prints out a message, if the severity of the message
    is lower than the global cf_log_level. To use it, do something like
@@ -38,6 +50,7 @@ int cf_log_level = -1;
 
    This function is heavily based on the function in section 15.5 of
    the C FAQ. */
+#ifdef LOGGING
 void cf_log(int severity, const char *fmt, ...)
 {
    va_list argp;
@@ -64,17 +77,5 @@ void cf_log(int severity, const char *fmt, ...)
    fprintf(stdout, "\n");
    fflush(stdout);
 }
-
-/* Use this to set the global log level. Set it to CF_TURN_OFF_LOGGING
-   (-1) to turn off all logging. Set it to 0 to show only errors, and
-   to higher numbers to show more and more logging details. */
-int 
-cf_set_log_level(int new_level)
-{
-   /* Now remember the new level. */
-   cf_log_level = new_level;
-   LOG((4, "log_level changed to %d", cf_log_level));
-   return 0;
-} 
-
 #endif /* LOGGING */
+
diff --git a/src/cffiles.c b/src/cffiles.c
index 43836a6..9a3c99d 100644
--- a/src/cffiles.c
+++ b/src/cffiles.c
@@ -1,27 +1,168 @@
-/*
-Copyright 2006, University Corporation for Atmospheric Research. See
-COPYRIGHT file for copying and redistribution conditions.
+/*!
+  \file
 
-This file is part of the NetCDF CF Library. 
+  This file handles the libcf file stuff.
 
-This file handles the libcf file stuff.
+  \author Ed Hartnett, Unidata
+  \date 9/1/06
 
-Ed Hartnett, 9/1/06
-
-$Id: cffiles.c,v 1.3 2009/09/28 14:52:22 ed Exp $
 */
 
-#include <config.h>
-#include <libcf.h>
+#include <cf_config.h>
+#include <libcf_src.h>
 #include <libcf_int.h>
 #include <netcdf.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <time.h>
+/*! 
+\page overview_page Overview
+
+The LibCF library access data files in accordance with the <a
+href="http://cf-pcmdi.llnl.gov/">CF Conventions</a>.
+
+The functions of the CF library are intended to be interspersed with
+netCDF library calls. That is, the programmer will open or create a
+netCDF file with the netCDF API, and then add or read metadata with
+libcf library functions, then continue to working with the netCDF API
+to read and write data.
+
+By using libcf, a data producer can produce files that conform to the
+CF standards, without having to write netCDF code to create and decode
+all the attributes that the CF convention uses to store meta-data. A
+data consumer can use libcf to read any file which conforms to the CF
+conventions; the file does not need to be created with libcf to be
+read by libcf.
+
+\page install_page Installation Information
+
+You must have either netCDF-3 or netCDF-4 installed.
+
+Get the latest version of the libcf tarball at the libcf ftp site:
+ftp://ftp.unidata.ucar.edu/pub/libcf/libcf-daily.tar.gz
+
+Unpack the tarball, and run:
+
+./configure --with-netcdf=/my/netcdf --prefix=/my/libcf && make check install > output.txt
+
+Where /my/netcdf is the root install directory of the netCDF library
+you want to use, and /my/libcf is the root directory where you want
+libcf installed. (They may be the same directory.) If unspecified, the
+prefix defaults to /usr/local.
+
+If you wish to use netCDF-4, you must also have HDF5 and libz, the
+compression library, installed. In this case, configure libcf like
+this:
+
+./configure --with-netcdf=/s/n4_new1/install --enable-netcdf-4 --with-hdf5=/home/ed/local/s && make check install > output.txt
+
+If the build does not work for you, please email libcf support:
+support-libcf\@unidata.ucar.edu. Please send the complete output of
+the configure and build output, in ASCII (the output.txt file produced
+by the above build commands), and the file config.log, which is
+generated by the configure script.
+
+\page credit_page Credit
+
+The LibCF library is a community-supported effort. We thank the
+following contributors:
+
+V. Balaji and Zhi Liang, GFDL
+A. Pletzer, D. Kindig, and A. Sobol, Tech-X Corp.
+
+The GRIDSPEC work has been partially funded by the <a
+href="http://gip.noaa.gov/">Global Interoperability Program</a> under
+an Interagency Agreement (IA) from NOAA through NSF as a grant on our
+core award, M0833450.
+
+The implementation of the GRIDSPEC API was partially funded by SBIR grant 
+DOE-FG02-08ER85153.
+
+\page history_page History
+
+The LibCF library was developed at <a
+href="http://www.unidata.ucar.edu/">Unidata</a> starting in 2007. The
+intent was to provide a home for geo-science specific functionality,
+which does not fit into the more general netCDF library.
+
+In 2008/2009 the first set of GRIDSPEC functions were added at
+Unidata, based on the code of Zhi Liang at GFDL.
+
+In 2010 the second set of GRIDSPEC functions, with the Princeton API,
+were added by Dave Kindig, Alex Pletzer, and Andrey Sobol.
+
+*/
+
+/*!
+   \mainpage Documentation for LibCF
+   \image html libcf1.png 
+
+The CF conventions for climate and forecast metadata are designed to
+promote the processing and sharing of files created with the netCDF
+API. This library makes it easier to create and work with CF data
+files.
+
+\ref overview_page
+
+\ref install_page
+
+\ref file_grp 
+
+\ref var_grp
+
+\ref subset_grp
+
+\ref coord_grp
+
+\ref gridspec_grp
+
+\ref credit_page
+
+\ref history_page
+
+ */
+
+/*! \defgroup gridspec_grp GRIDSPEC
+
+  GRIDSPEC is a CF Convention for describing multi-tile and multi-time
+  slice data, including on the cubed-sphere grid.
+
+\ref gs_axis_grp
+
+\ref gs_coord_grp
+
+\ref gs_grid_grp
+
+\ref gs_data_grp
+
+\ref gs_regrid_grp
+
+\ref gs_mosaic_grp
+
+\ref gs_host_grp
+
+
+*/
+/*! \defgroup file_grp File-Level Functions 
+
+  File level functions assist with reading and writing the global
+  attributes recommended by the CF conventions. 
+
+@{*/
+
+/*!
+  Get the version string for the CF Library (max length: 
+  NC_MAX_NAME + 1). 
+  
+  \param version_string if non-NULL, the library version char array
+  will be written here. It will be NULL-terminated and less that
+  NC_MAX_NAME chars.
 
-/* Get the version string for the CF Library (max length: 
-   NC_MAX_NAME + 1). */
+  \return 0 for success.
+
+  \author Ed Hartnett, Unidata
+*/
 int
 nccf_inq_libvers(char *version_string)
 {
@@ -95,19 +236,43 @@ nccf_append_att(int ncid, const char *name, const char *string)
    return ret;
 }
 
-/* From the CF 1.0 conventions:
+/*!
+   Annotate a file to indicate that it conforms to CF conventions.
 
-"We recommend that the NUG defined attribute Conventions be given the
-string value "CF-1.0" to identify datasets that conform to these
-conventions. */
+   From the CF 1.0 conventions: We recommend that the NUG defined
+   attribute Conventions be given the string value 'CF-1.0' to
+   identify datasets that conform to these conventions.
 
-/*  Mark a file with the CF-1.0 string in a Conventions attribute. */
+   This function will mark a file with the CF-1.0 string in a
+   Conventions attribute. This functions is called automatically by
+   nccf_def_file, so need not be called by the user if nccf_def_file
+   is being called.
+
+   \param ncid the ncid of the file to be annotated
+   \return 0 for success, error code otherwise
+*/
 int 
 nccf_def_convention(int ncid)
 {
    return nccf_append_att(ncid, CF_CONVENTIONS, CF_CONVENTION_STRING);
 }
 
+/*!
+   Determine if a file claims to conform to cf conventions.
+
+   This function will determine if the file claims to follow CF-1.0
+   conventions. This function only checks the global ``Conventions''
+   attribute. It does not look at file metadata to ensure that this is
+   a well-formed CF file. It only tells whether the file claims to be
+   a CF file.
+
+   \param ncid the ncid of the file
+
+   \param cf_convention a 1 is written here if this file claims to
+   follow CF 1.0 conventions, a 0 otherwise.
+
+   \return 0 for success, error code otherwise
+ */
 int 
 nccf_inq_convention(int ncid, int *cf_convention)
 {
@@ -157,13 +322,30 @@ nccf_inq_convention(int ncid, int *cf_convention)
 }
 
 
-/* From the CF 1.0 conventions:
+/*!
+   Add CF recommended global attributes to the file.
+
+   From the CF 1.0 conventions:
+
+   'The general description of a file's contents should be contained
+   in the following attributes: title, history, institution, source,
+   comment and references (2.6.2). For backwards compatibility with
+   COARDS none of these attributes is required, but their use is
+   recommended to provide human readable documentation of the file
+   contents.'
+
+   This function will add some or all of the CF recommended text
+   attributes to a file. Any parameters which are set to NULL will be
+   ignored.
+
+   \param ncid the ncid of the file to be annotated
+   
+   \param title the title string
+   
+   \param history the history string
+
+   \return 0 on success, error code otherwise
 
-"The general description of a file's contents should be contained in
-the following attributes: title, history, institution, source, comment
-and references (2.6.2). For backwards compatibility with COARDS none
-of these attributes is required, but their use is recommended to
-provide human readable documentation of the file contents."
 */
 
 /* Add CF_recomended attributes to a file. Any NULLs will cause the
@@ -192,10 +374,20 @@ nccf_def_file(int ncid, const char *title, const char *history)
    return ret;
 }
 
-
-/* Append to the global "history" attribute, with a timestamp. Create
- * the attribute if it does not exist. */
+/*! Maximum length of a timestamp string in a history attribute. */
 #define NCCF_MAX_TIMESTAMP_LEN 35
+
+/*! This function appends a time-stamped history string to the history
+  attribute, creating the attribute if it doesn't already exist.
+
+  \param ncid
+  The ncid of the file.
+
+  \param history
+  The string to append to the history attribute. 
+
+  \return 0 for success, error code otherwise
+*/
 int 
 nccf_add_history(int ncid, const char *history)
 {
@@ -232,16 +424,38 @@ nccf_add_history(int ncid, const char *history)
    return ret;
 }
 
-/* Read the CF annotations. Recall that in C, strlens do not include
- * the null terminator. To get the lengths before the strings (in
- * order to allocatate) pass NULL for any or all strngs and the
- * lengths will be returned. Then call the funtion again after
- * allocating memory. 
+/*! Read the CF annotations. Recall that in C, strlens do not include
+  the null terminator. To get the lengths before the strings (in order
+  to allocatate) pass NULL for any or all strngs and the lengths will
+  be returned. Then call the funtion again after allocating memory.
+
+  The CF version is guaranteed to be less than NC_MAX_NAME.
+
+  Any of the pointer args may be NULL, in which case it will be
+  ignored.
+
+  \param ncid
+  The ncid of the file.
+
+  \param title_lenp
+  Pointer to size_t which, if not NULL, will get the length of the title
+  attribute.
+
+  \param title
+  Pointer to char array which, if not NULL, will get the title
+  string. Memory must be allocated before this function is called. Call
+  this function with a NULL for this parameter to get the size first.
 
- * The CF version is guarenteed to be less than NC_MAX_NAME.
+  \param history_lenp
+  Pointer to size_t which, if not NULL, will get the length of the history
+  attribute.
 
- * Any of these pointer args may be NULL, in which case it will be
- * ignored.
+  \param history
+  Pointer to char array which, if not NULL, will get the history
+  string. Memory must be allocated before this function is called. Call
+  this function with a NULL for this parameter to get the size first.
+
+  \return 0 for success, error code otherwise
 */
 int
 nccf_inq_file(int ncid, size_t *title_lenp, char *title, 
@@ -272,7 +486,37 @@ nccf_inq_file(int ncid, size_t *title_lenp, char *title,
    return NC_NOERR;
 
 }
-/* Add any or all of these four attributes to a file or variable. */
+
+/*! This functions writes up to four text attributes for either a
+  variable, or an entire file: ``institution,'' ``source,''
+  ``comment,'' and ``references.''
+
+
+  \param ncid
+  The ncid of the file.
+
+  \param varid
+  The varid of the netCDF variable being described. Use NC_GLOBAL if you
+  wish these attributes to apply to the entire file.
+
+  \param institution
+  If non-NULL, this text string will be written as the CF-recommended
+  ``institution'' attribute.
+
+  \param source
+  If non-NULL, this text string will be written as the CF-recommended
+  ``source'' attribute.
+
+  \param comment
+  If non-NULL, this text string will be written as the CF-recommended
+  ``comment'' attribute.
+
+  \param references
+  If non-NULL, this text string will be written as the CF-recommended
+  ``references'' attribute.
+
+  \return 0 for success, error code otherwise
+*/
 int 
 nccf_def_notes(int ncid, int varid, const char *institution, 
 	       const char *source, const char *comment, 
@@ -303,8 +547,52 @@ nccf_def_notes(int ncid, int varid, const char *institution,
    return CF_NOERR;
 }
 
-/* Read any or all of these four attributes of a file or
- * variable. */
+/*! Read any existing CF recommended text attributes from a variable. 
+
+  \param ncid
+  The ncid of the file.
+
+  \param varid
+  The varid of the netCDF variable.
+
+  \param institution_lenp
+  Pointer to size_t which, if not NULL, will get the length of the institution
+  attribute.
+
+  \param institution
+  Pointer to char array which, if not NULL, will get the institution
+  string. Memory must be allocated before this function is called. Call
+  this function with a NULL for this parameter to get the size first.
+
+  \param source_lenp
+  Pointer to size_t which, if not NULL, will get the length of the source
+  attribute.
+
+  \param source
+  Pointer to char array which, if not NULL, will get the source
+  string. Memory must be allocated before this function is called. Call
+  this function with a NULL for this parameter to get the size first.
+
+  \param comment_lenp
+  Pointer to size_t which, if not NULL, will get the length of the comment
+  attribute.
+
+  \param comment
+  Pointer to char array which, if not NULL, will get the comment
+  string. Memory must be allocated before this function is called. Call
+  this function with a NULL for this parameter to get the size first.
+
+  \param references_lenp
+  Pointer to size_t which, if not NULL, will get the length of the references
+  attribute.
+
+  \param references
+  Pointer to char array which, if not NULL, will get the references
+  string. Memory must be allocated before this function is called. Call
+  this function with a NULL for this parameter to get the size first.
+
+  \return 0 for success, error code otherwise
+ */
 int nccf_inq_notes(int ncid, int varid, size_t *institution_lenp, 
 		   char *institution, size_t *source_lenp, char *source, 
 		   size_t *comment_lenp, char *comment, 
@@ -386,4 +674,8 @@ int nccf_inq_notes(int ncid, int varid, size_t *institution_lenp,
    
    return NC_NOERR;
 }
+/*!@}*/
+
+
+
 
diff --git a/src/cflistitem.c b/src/cflistitem.c
new file mode 100644
index 0000000..82252f8
--- /dev/null
+++ b/src/cflistitem.c
@@ -0,0 +1,228 @@
+/**
+ * API for adding/removing and extracting elements from a linked list
+ * $Id: cflistitem.c 924 2012-03-23 16:47:05Z pletzer $
+ */
+
+/* std includes */
+#include <stdlib.h>
+
+#include "cflistitem.h"
+#include "nccf_errors.h"
+
+/* Private method, only called internally to create a new item 
+   in an existing list  */
+void 
+nccf_li_newitem(struct CFLISTITEM **lst, int id) {
+  *lst = (struct CFLISTITEM *) malloc(sizeof(struct CFLISTITEM));
+  (*lst)->first = *lst; // will be reset by the user
+  (*lst)->next = NULL;
+  (*lst)->data = NULL;
+  (*lst)->id = id;
+}
+
+void 
+nccf_li_new(struct CFLISTITEM **lst) {
+  nccf_li_newitem(lst, CF_LIST_ITEM_HEAD_ID);
+  // create head
+  // data stores the number of items (in head)
+  (*lst)->data = (int *) malloc( sizeof( int ) );
+  int *nelemp;
+  nelemp = (int *) (*lst)->data; // cast into int pointer
+  *nelemp = 0;
+}
+
+void
+nccf_li_del(struct CFLISTITEM **lst) {
+  if (*lst) {
+    free((*lst)->data);
+    free(*lst);
+  }
+  *lst = NULL;
+}
+
+void 
+nccf_li_begin(struct CFLISTITEM **lst){
+  *lst = (*lst)->first;
+}
+
+int 
+nccf_li_next(struct CFLISTITEM **lst) {
+  if (!(*lst)) return 0;
+  if ((*lst)->next) {
+    *lst = (*lst)->next;
+    return 1;
+  }
+  return 0;
+}
+
+int 
+nccf_li_get_id(struct CFLISTITEM **lst) {
+  return (*lst)->id;
+}
+
+int
+nccf_li_add(struct CFLISTITEM **lst, const _DATATYPE *data){
+  struct CFLISTITEM *newItem;
+  struct CFLISTITEM *fstItem;
+  int maxid;
+
+  /* advance to the last item */
+  while ((*lst)->next) {
+    *lst = (*lst)->next;
+  }
+  maxid = nccf_li_get_nelem( lst );
+
+  /* create new entry */
+  nccf_li_newitem(&newItem, maxid);
+  newItem->first = (*lst)->first;
+  newItem->data = (void *) data;
+
+  /* Update the number of elements */
+  int *nelemp;
+  fstItem = (*lst)->first;
+  nelemp = (int*)fstItem->data;
+  ( *nelemp )++;
+  
+  /* set item to new entry */
+  (*lst)->next = newItem;
+  (*lst) = newItem;
+  return newItem->id;
+}
+
+int
+nccf_li_get_nelem( struct CFLISTITEM **lst ){
+  int *nelemp;
+  struct CFLISTITEM *fstItem;
+
+  fstItem = (*lst)->first;
+  nelemp = (int*)fstItem->data;
+  return *nelemp;
+}
+
+int 
+nccf_li_insert_after( struct CFLISTITEM **lst, const _DATATYPE *data, 
+                int id){
+
+  /* The list to be inserted ( new )*/
+  struct CFLISTITEM *insertItem;
+  struct CFLISTITEM *fstItem;
+  int maxId;
+
+  /* Find the id after which the new element is to be inserted */
+  maxId = nccf_li_get_nelem( lst );
+  nccf_li_begin(lst);
+  if( id != CF_LIST_ITEM_HEAD_ID ){
+    while(nccf_li_next(lst)){
+      if ((*lst)->id == id) break;
+    }
+  }
+
+  nccf_li_newitem( &insertItem, maxId );
+
+  /* Populate the inserted list item */
+  insertItem->first = (*lst)->first;
+  insertItem->data = (void*)data;
+  insertItem->id = maxId;
+
+  /* Switch where the next item of the current item points */
+  insertItem->next = (*lst)->next;
+  (*lst)->next = insertItem;
+
+  /* Update the number of elements */
+  int *nelemp;
+  fstItem = (*lst)->first;
+  nelemp = (int*)fstItem->data;
+  ( *nelemp )++;
+  
+  /* Output the inserted items ID */
+  return insertItem->id;
+}
+
+int 
+nccf_li_insert( struct CFLISTITEM **lst, 
+                const _DATATYPE *data,
+                int (*comparison)(const _DATATYPE *data1, const _DATATYPE *data2), 
+                int ifresult0 ){
+
+  /* The list to be inserted ( new )*/
+  _DATATYPE *curData;
+  int useId = CF_LIST_ITEM_HEAD_ID;
+  int curId = CF_LIST_ITEM_HEAD_ID;
+  int id = NCCF_LISTITEMEXISTS, result = 0;
+
+
+  /* advance to the last item */
+  nccf_li_begin(lst);
+  while( nccf_li_next(lst)){
+    curId = nccf_li_get_id( lst );
+    curData = (_DATATYPE *)nccf_li_find( lst, curId );
+    result = comparison( data, curData );
+
+    /* data < curData */
+    if( result < 0 ) break;
+    /* data > curData */ 
+    if( result > 0) useId = curId;
+    if( result == 0 && ifresult0 != 0 ) useId = curId;
+  }
+  if( ifresult0 || result != 0 ) id = nccf_li_insert_after( lst, data, useId );
+
+  return id;
+}
+
+_DATATYPE *
+nccf_li_remove(struct CFLISTITEM **lst, int id){
+  _DATATYPE *data = NULL;
+  if (id == CF_LIST_ITEM_HEAD_ID) {
+    /* this call will not remove the head, use 
+       nccf_li_delete to remove head */
+    return NULL;
+  }
+  nccf_li_begin(lst);
+  struct CFLISTITEM *prevItem = *lst;
+  struct CFLISTITEM *firstItem;
+  while (nccf_li_next(lst)) {
+    if ((*lst)->id == id) {
+
+      /* Decrement the number of elements */
+      int *nelemp;
+      firstItem = (*lst)->first;
+      nelemp = (int *) firstItem->data; // cast into int pointer
+      --(*nelemp);
+      
+      /* Change where next is pointing */
+      prevItem->next = (*lst)->next;
+      data = (*lst)->data;
+
+      free(*lst); 
+      *lst = NULL;
+      break;
+    }
+    prevItem = *lst;
+  }
+  *lst = prevItem;
+  return data;
+}
+
+_DATATYPE *
+nccf_li_find(struct CFLISTITEM **lst, int id){
+
+  /* may already be pointing to the searched element */
+  if ((*lst)->id == id) {
+    return (*lst)->data;
+  }
+
+  /* reset only if searched id is smaller than pointed id */
+  if ( (*lst)->id > id ) {
+    nccf_li_begin(lst);
+  }
+
+  /* locate id and return element */
+  while (nccf_li_next(lst)) {
+    if ((*lst)->id == id) {
+      return (*lst)->data;
+    }
+  }
+
+  /* no element found */
+  return NULL;
+}
diff --git a/src/cfsubsets.c b/src/cfsubsets.c
index a6f35d0..6476e0a 100644
--- a/src/cfsubsets.c
+++ b/src/cfsubsets.c
@@ -1,19 +1,8 @@
-/*
-  Copyright 2006, University Corporation for Atmospheric Research. See
-  COPYRIGHT file for copying and redistribution conditions.
+/* This file handles the libcf subsetting. */
 
-  This file is part of the NetCDF CF Library. 
-
-  This file handles the libcf subsetting.
-
-  Ed Hartnett, 5/1/7
-
-  $Id: cfsubsets.c,v 1.2 2009/09/08 17:14:53 ed Exp $
-*/
-
-#include <config.h>
+#include <cf_config.h>
 #include <cferror.h>
-#include <libcf.h>
+#include <libcf_src.h>
 #include <libcf_int.h>
 #include <netcdf.h>
 #include <stdlib.h>
@@ -136,6 +125,48 @@ find_coord_idx(int ncid, int vid, size_t len, float *range, int *nidxp,
    return CF_NOERR;
 }
 
+/*! \defgroup subset_grp Subsetting Functions
+@{*/
+
+/*! Get a geographic subset of the data.
+
+  \param ncid
+  The ncid of the file.
+
+  \param varid
+  The varid of the data variable from which the subset will be taken.
+
+  \param lat_range
+  A length two array, this holds the latitude start and stop values for
+  the range of interest.
+
+  \param nlat
+  A pointer to an integer which will get the number of latitude values
+  which fall within the range.
+
+  \param lon_range
+  A length two array, this holds the longitude start and stop values for
+  the range of interest. (Wrapping around the dateline is not allowed!)
+
+  \param nlon
+  A pointer to an integer which will get the number of longitude values
+  which fall within the range.
+
+  \param lvl_index
+  A zero-based index number for the verticle level of interest to the
+  subsetter. (Ignored if data has no vertical axis).
+
+  \param timestep
+  A zero-based index number for the timestep of interest to the
+  subsetter. (Ignored if data has no time axis).
+
+  \param data
+  A pointer to which the data subset will be written. Memory must be
+  allocated (and deallocated) by the user.
+
+
+  \return 0 for success, error code otherwise
+ */
 int 
 nccf_get_vara(int ncid, int varid, float *lat_range, int *nlat, float *lon_range, 
 	      int *nlon, int lvl_index, int timestep, void *data)
@@ -263,3 +294,5 @@ nccf_get_vara(int ncid, int varid, float *lat_range, int *nlat, float *lon_range
 
    return CF_NOERR;
 }
+/*!@}*/
+
diff --git a/src/cfvars.c b/src/cfvars.c
index 7de3d85..92b41d0 100644
--- a/src/cfvars.c
+++ b/src/cfvars.c
@@ -1,18 +1,7 @@
-/*
-Copyright 2006, University Corporation for Atmospheric Research. See
-COPYRIGHT file for copying and redistribution conditions.
+/* This file handles the libcf variable functions. */
 
-This file is part of the NetCDF CF Library. 
-
-This file handles the libcf file stuff.
-
-Ed Hartnett, 10/1/06
-
-$Id: cfvars.c,v 1.3 2009/09/28 14:52:23 ed Exp $
-*/
-
-#include <config.h>
-#include <libcf.h>
+#include <cf_config.h>
+#include <libcf_src.h>
 #include <libcf_int.h>
 #include <netcdf.h>
 #include <stdlib.h>
@@ -21,37 +10,68 @@ $Id: cfvars.c,v 1.3 2009/09/28 14:52:23 ed Exp $
 
 int nccf_parse_coords(int ncid, int varid, char *att_name, int *naxes, 
 		      int *axis_varids);
+int
+nccf_def_var1(int ncid, int varid, const char *units, 
+	     const char *long_name, const char *standard_name, 
+	     int ncoord_vars, int *coord_varids)
+{
+   return nccf_def_var(ncid, varid, units, long_name, standard_name, 0, NULL);
+}
 
-/* From the CF conventions, 1.0:
+/*! \defgroup var_grp Variable-Level Functions
+@{*/
 
-"Each variable in a netCDF file has an associated description which is
-provided by the attributes units, long_name, and standard_name. The
-units, and long_name attributes are defined in the NUG and the
-standard_name attribute is defined in this document."
+/*! Define the recomended attributes for a data variable.
 
-also
+  From the CF conventions, 1.0:
 
-"We wish to allow ... institution, source, references, and comment, to
-be either global or assigned to individual variables. When an
-attribute appears both globally and as a variable attribute, the
-variable's version has precedence."
+  'Each variable in a netCDF file has an associated description which is
+  provided by the attributes units, long_name, and standard_name. The
+  units, and long_name attributes are defined in the NUG and the
+  standard_name attribute is defined in this document.'
 
-also
+  also
 
-"The value of the coordinates attribute is a blank separated list of
-the names of auxiliary coordinate variables."
+  'We wish to allow ... institution, source, references, and comment, to
+  be either global or assigned to individual variables. When an
+  attribute appears both globally and as a variable attribute, the
+  variable's version has precedence.'
 
-This function makes all of these optional.
+  also
 
-*/
+  'The value of the coordinates attribute is a blank separated list of
+  the names of auxiliary coordinate variables.'
 
-int
-nccf_def_var1(int ncid, int varid, const char *units, 
-	     const char *long_name, const char *standard_name, 
-	     int ncoord_vars, int *coord_varids)
-{
-   return nccf_def_var(ncid, varid, units, long_name, standard_name, 0, NULL);
-}
+  This function makes all of these optional.
+
+  \param ncid
+  The ncid of the file.
+
+  \param varid
+  The varid of the netCDF variable being described.
+
+  \param units
+  If non-NULL, this text string will be written as the CF-recommended
+  ``units'' attribute.
+
+  \param long_name
+  If non-NULL, this text string will be written as the CF-recommended
+  ``long_name'' attribute.
+
+  \param standard_name
+  If non-NULL, this text string will be written as the CF-recommended
+  ``standard_name'' attribute.
+
+  \param ncoord_vars
+  Number of coordinate variables for this variable.
+
+  \param coord_varids
+  The variable IDs of the coordinate variables for this variable.
+
+  \return 0 on success, error code otherwise
+
+  \author Ed Hartnett, Unidata
+*/
 int
 nccf_def_var(int ncid, int varid, const char *units, 
 	     const char *long_name, const char *standard_name, 
@@ -104,13 +124,43 @@ nccf_def_var(int ncid, int varid, const char *units,
    return NC_NOERR;
 }
 
-/* Read the CF annotations. Recall that in C, strlens do not include
- * the null terminator. To get the lengths before the strings (in
- * order to allocatate) pass NULL for any or all strngs and the
- * lengths will be returned. Then call the funtion again after
- * allocating memory. 
- * Any of these pointer args may be NULL, in which case it will be
- * ignored.
+/*! Read the CF annotations of a variable. 
+
+    Recall that in C, strlens do not include the null terminator. To
+    get the lengths before the strings (in order to allocatate) pass
+    NULL for any or all strngs and the lengths will be returned. Then
+    call the funtion again after allocating memory.  Any of these
+    pointer args may be NULL, in which case it will be ignored.
+
+    \param ncid the ncid of the file
+
+    \param varid the varid of the variable
+
+    \param units_lenp if non-NULL, length of units string will be
+    copied here.
+
+    \param units if non-NULL, units string will be copied here
+
+    \param long_name_lenp if non-NULL, length of long_name string will be
+    copied here.
+
+    \param long_name if non-NULL, long_name string will be copied here
+
+    \param standard_name_lenp if non-NULL, length of standard_name string will be
+    copied here.
+
+    \param standard_name if non-NULL, standard_name string will be copied here
+
+    \param ncoord_vars if non-NULL, the number of coordinate variables will be
+    copied here.
+
+    \param coord_varids if non-NULL, the varids of the coordinate
+    variables will be copied here
+
+   \return 0 on success, error code otherwise
+
+   \author Ed Hartnett, Unidata
+
 */
 int
 nccf_inq_var(int ncid, int varid,
@@ -188,7 +238,32 @@ nccf_inq_var(int ncid, int varid,
    return NC_NOERR;
 }
 
-/* Set attributes to define missing data information. */
+/*! Define missing data information for a variable.
+
+   This function sets the ``fill_value'', ``valid_min'', and
+   ``valid_max'' attributes.
+
+   \param ncid The ncid of the netCDF file.
+
+   \param varid The varid of the netCDF variable being described.
+
+   \param fill_value If non-NULL, this will point to a value of the
+   same type as this varid, which will be used as the fill_value for
+   the data.
+
+   \param valid_min If non-NULL, this will point to a value of the
+   same type as this varid, which will be written as the ``valid_min''
+   attribute. If this parameter is non-NULL, valid_max must also be
+   provided.
+
+   \param valid_max If non-NULL, this will point to a value of the same type as this
+   varid, which will be written as the ``valid_max'' attribute. If this
+   parameter is non-NULL, valid_min must also be provided.
+
+   \return 0 on success, error code otherwise
+
+   \author Ed Hartnett, Unidata
+*/
 int 
 nccf_def_var_missing(int ncid, int varid, const void *fill_value, 
 		     const void *valid_min, const void *valid_max)
@@ -196,7 +271,7 @@ nccf_def_var_missing(int ncid, int varid, const void *fill_value,
    nc_type xtype;
    int ret;
 
-   /* User must provide either both or neither of valid_min and
+   /* User must provide either both or neither of valid_minp and
     * valid_max. */
    if ((valid_min && !valid_max) || 
        (!valid_min && valid_max))
@@ -290,9 +365,33 @@ nccf_get_default_missing(nc_type xtype, void *fill_value,
    return NC_NOERR;
 }
 
-/* Get attributes which define missing data information. If the
- * attributes are not there, then provide the valid data anyway, based
- * on netCDF defaults. */
+/*! Get attributes which define missing data information. If the
+   attributes are not there, then provide the valid data anyway, based
+   on netCDF defaults.
+
+   \param ncid The ncid of the file.
+
+   \param varid The varid of the netCDF variable.
+
+   \param fill_value If this is not NULL, the fill value of the
+   variable will be written at this address by
+   nccf_inq_var_missing. If the fill value was not defined for the
+   variable, the netCDF default value will be used.
+
+   \param valid_min If this is not NULL, the valid_min value of the
+   variable will be written at this address by
+   nccf_inq_var_missing. If the valid_min was not defined for the
+   variable, the netCDF default value will be used.
+
+   \param valid_max If this is not NULL, the valid_max value of the
+   variable will be written at this address by
+   nccf_inq_var_missing. If the valid_max value was not defined for
+   the variable, the netCDF default value will be used.
+
+   \return 0 on success, error code otherwise
+
+   \author Ed Hartnett, Unidata
+*/
 int 
 nccf_inq_var_missing(int ncid, int varid, void *fill_value, 
 		     void *valid_min, void *valid_max)
@@ -354,3 +453,4 @@ nccf_inq_var_missing(int ncid, int varid, void *fill_value,
    return NC_NOERR;
 }
 
+/*!@}*/
diff --git a/src/drscdf.h b/src/drscdf.h
index bb4cfcd..81776db 100644
--- a/src/drscdf.h
+++ b/src/drscdf.h
@@ -1,5 +1,5 @@
 /*
-     $Id: drscdf.h,v 1.2 2009/09/08 17:14:53 ed Exp $
+     $Id: drscdf.h 30 2010-09-15 14:24:51Z edhartnett $
      $Log: drscdf.h,v $
      Revision 1.2  2009/09/08 17:14:53  ed
      many changes
diff --git a/src/libcfAddOn.c b/src/libcfAddOn.c
new file mode 100644
index 0000000..db84fa0
--- /dev/null
+++ b/src/libcfAddOn.c
@@ -0,0 +1,18 @@
+/**
+ * Following are some symbols that need to be resolved in order
+ * for make check to work when configure'ing --enable-shared
+ * This is a temporary solution!
+ * $Id: libcfAddOn.c 30 2010-09-15 14:24:51Z edhartnett $
+ */
+
+#include <stdio.h>
+#include "cdms.h"
+
+// global symbols
+
+int cuErrorOccurred;
+int cuErrOpts;
+
+void cdError(char *fmt, ...) {
+  printf("in cdError...ERROR\n");
+}
diff --git a/src/libcf_api.f90 b/src/libcf_api.f90
deleted file mode 100644
index a15772d..0000000
--- a/src/libcf_api.f90
+++ /dev/null
@@ -1,788 +0,0 @@
-     interface
-!     int nccf_inq_libvers(char *version_string)
-     function nccf_inq_libvers(version_string) bind(c)
-       use, intrinsic :: iso_c_binding
-       character(c_char), intent(out) :: version_string
-       integer(c_int) :: nccf_inq_libvers
-     end function nccf_inq_libvers
-
-!     int nccf_def_convention(int ncid)
-     function nccf_def_convention(ncid) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int) :: nccf_def_convention
-     end function nccf_def_convention
-
-!     int nccf_inq_convention(int ncid, int *cf_convention)
-     function nccf_inq_convention(ncid, cf_convention) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), intent(out) :: cf_convention
-       integer(c_int) :: nccf_inq_convention
-     end function nccf_inq_convention
-
-!     int nccf_def_file(int ncid, const char *title, const char *history)
-     function nccf_def_file(ncid, title, history) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(in) :: title
-       character(c_char), intent(in) :: history
-       integer(c_int) :: nccf_def_file
-     end function nccf_def_file
-
-!      int nccf_inq_file(int ncid, size_t *title_lenp, char *title, size_t *history_le
-!     np, char *history)
-     function nccf_inq_file(ncid, title_lenp, title, history_lenp, history) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_size_t), intent(out) :: title_lenp
-       character(c_char), intent(out) :: title
-       integer(c_size_t), intent(out) :: history_lenp
-       character(c_char), intent(out) :: history
-       integer(c_int) :: nccf_inq_file
-     end function nccf_inq_file
-
-!     int nccf_add_history(int ncid, const char *history)
-     function nccf_add_history(ncid, history) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(in) :: history
-       integer(c_int) :: nccf_add_history
-     end function nccf_add_history
-
-!      int nccf_def_var(int ncid, int varid, const char *units, const char *long_name,
-!      const char *standard_name, int ncoord_vars, int *coord_varids)
-     function nccf_def_var(ncid, varid, units, long_name, standard_name, &
-       ncoord_vars, coord_varids) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       character(c_char), intent(in) :: units
-       character(c_char), intent(in) :: long_name
-       character(c_char), intent(in) :: standard_name
-       integer(c_int), value, intent(in) :: ncoord_vars
-       integer(c_int), dimension(*), intent(in) :: coord_varids
-       integer(c_int) :: nccf_def_var
-     end function nccf_def_var
-
-!      int nccf_inq_var(int ncid, int varid, size_t *units_lenp, char *units, size_t *
-!     long_name_lenp, char *long_name, size_t *standard_name_lenp, char *standard_name
-!     , int *ncoord_vars, int *coord_varids)
-     function nccf_inq_var(ncid, varid, units_lenp, units, long_name_lenp, &
-       long_name, standard_name_lenp, standard_name, ncoord_vars, &
-       coord_varids) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       integer(c_size_t), intent(out) :: units_lenp
-       character(c_char), intent(out) :: units
-       integer(c_size_t), intent(out) :: long_name_lenp
-       character(c_char), intent(out) :: long_name
-       integer(c_size_t), intent(out) :: standard_name_lenp
-       character(c_char), intent(out) :: standard_name
-       integer(c_int), intent(out) :: ncoord_vars
-       integer(c_int), dimension(*), intent(in) :: coord_varids
-       integer(c_int) :: nccf_inq_var
-     end function nccf_inq_var
-
-!      int nccf_def_var_missing(int ncid, int varid, const void *fill_value, const voi
-!     d *valid_min, const void *valid_max)
-     function nccf_def_var_missing(ncid, varid, fill_value, valid_min, valid_max) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       type(c_ptr), intent(in) :: fill_value
-       type(c_ptr), intent(in) :: valid_min
-       type(c_ptr), intent(in) :: valid_max
-       integer(c_int) :: nccf_def_var_missing
-     end function nccf_def_var_missing
-
-!      int nccf_inq_var_missing(int ncid, int varid, void *fill_value, void *valid_min
-!     , void *valid_max)
-     function nccf_inq_var_missing(ncid, varid, fill_value, valid_min, valid_max) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       type(c_ptr), intent(out) :: fill_value
-       type(c_ptr), intent(out) :: valid_min
-       type(c_ptr), intent(out) :: valid_max
-       integer(c_int) :: nccf_inq_var_missing
-     end function nccf_inq_var_missing
-
-!      int nccf_def_notes(int ncid, int varid, const char *institution, const char *so
-!     urce, const char *comment, const char *references)
-     function nccf_def_notes(ncid, varid, institution, source, comment, references) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       character(c_char), intent(in) :: institution
-       character(c_char), intent(in) :: source
-       character(c_char), intent(in) :: comment
-       character(c_char), intent(in) :: references
-       integer(c_int) :: nccf_def_notes
-     end function nccf_def_notes
-
-!      int nccf_inq_notes(int ncid, int varid, size_t *institution_lenp, char *institu
-!     tion, size_t *source_lenp, char *source, size_t *comment_lenp, char *comment, si
-!     ze_t *references_lenp, char *references)
-     function nccf_inq_notes(ncid, varid, institution_lenp, institution, &
-       source_lenp, source, comment_lenp, comment, references_lenp, &
-       references) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       integer(c_size_t), intent(out) :: institution_lenp
-       character(c_char), intent(out) :: institution
-       integer(c_size_t), intent(out) :: source_lenp
-       character(c_char), intent(out) :: source
-       integer(c_size_t), intent(out) :: comment_lenp
-       character(c_char), intent(out) :: comment
-       integer(c_size_t), intent(out) :: references_lenp
-       character(c_char), intent(out) :: references
-       integer(c_int) :: nccf_inq_notes
-     end function nccf_inq_notes
-
-!      int nccf_def_latitude(int ncid, size_t len, nc_type xtype, int *lat_dimidp, int
-!      *lat_varidp)
-     function nccf_def_latitude(ncid, len, xtype, lat_dimidp, lat_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_size_t), intent(in) :: len
-       integer(c_int), intent(in) :: xtype
-       integer(c_int), intent(out) :: lat_dimidp
-       integer(c_int), intent(out) :: lat_varidp
-       integer(c_int) :: nccf_def_latitude
-     end function nccf_def_latitude
-
-!      int nccf_inq_latitude(int ncid, size_t *lenp, nc_type *xtypep, int *lat_dimidp,
-!      int *lat_varidp)
-     function nccf_inq_latitude(ncid, lenp, xtypep, lat_dimidp, lat_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_size_t), intent(out) :: lenp
-       integer(c_int), intent(out) :: xtypep
-       integer(c_int), intent(out) :: lat_dimidp
-       integer(c_int), intent(out) :: lat_varidp
-       integer(c_int) :: nccf_inq_latitude
-     end function nccf_inq_latitude
-
-!      int nccf_def_longitude(int ncid, size_t len, nc_type xtype, int *lon_dimidp, in
-!     t *lon_varidp)
-     function nccf_def_longitude(ncid, len, xtype, lon_dimidp, lon_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_size_t), intent(in) :: len
-       integer(c_int), intent(in) :: xtype
-       integer(c_int), intent(out) :: lon_dimidp
-       integer(c_int), intent(out) :: lon_varidp
-       integer(c_int) :: nccf_def_longitude
-     end function nccf_def_longitude
-
-!      int nccf_inq_longitude(int ncid, size_t *lenp, nc_type *xtypep, int *lon_dimidp
-!     , int *lon_varidp)
-     function nccf_inq_longitude(ncid, lenp, xtypep, lon_dimidp, lon_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_size_t), intent(out) :: lenp
-       integer(c_int), intent(out) :: xtypep
-       integer(c_int), intent(out) :: lon_dimidp
-       integer(c_int), intent(out) :: lon_varidp
-       integer(c_int) :: nccf_inq_longitude
-     end function nccf_inq_longitude
-
-!      int nccf_def_lvl(int ncid, const char *name, size_t len, nc_type xtype, const c
-!     har *units, int positive_up, const char *standard_name, const char *formula_term
-!     s, int cdm_axis_type, int *lvl_dimidp, int *lvl_varidp)
-     function nccf_def_lvl(ncid, name, len, xtype, units, positive_up, &
-       standard_name, formula_terms, cdm_axis_type, lvl_dimidp, &
-       lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(in) :: name
-       integer(c_size_t), intent(in) :: len
-       integer(c_int), intent(in) :: xtype
-       character(c_char), intent(in) :: units
-       integer(c_int), value, intent(in) :: positive_up
-       character(c_char), intent(in) :: standard_name
-       character(c_char), intent(in) :: formula_terms
-       integer(c_int), value, intent(in) :: cdm_axis_type
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_def_lvl
-     end function nccf_def_lvl
-
-!      int nccf_inq_lvl(int ncid, char *name, size_t *lenp, nc_type *xtypep, size_t *f
-!     t_lenp, char *formula_terms, int *positive_upp, int *lvl_dimidp, int *lvl_varidp
-!     )
-     function nccf_inq_lvl(ncid, name, lenp, xtypep, ft_lenp, formula_terms, &
-       positive_upp, lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(out) :: name
-       integer(c_size_t), intent(out) :: lenp
-       integer(c_int), intent(out) :: xtypep
-       integer(c_size_t), intent(out) :: ft_lenp
-       character(c_char), intent(out) :: formula_terms
-       integer(c_int), intent(out) :: positive_upp
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_inq_lvl
-     end function nccf_inq_lvl
-
-!      int nccf_def_time(int ncid, const char *name, size_t len, nc_type xtype, const 
-!     char *units, const char *standard_name, int *time_dimidp, int *time_varidp)
-     function nccf_def_time(ncid, name, len, xtype, units, standard_name, &
-       time_dimidp, time_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(in) :: name
-       integer(c_size_t), intent(in) :: len
-       integer(c_int), intent(in) :: xtype
-       character(c_char), intent(in) :: units
-       character(c_char), intent(in) :: standard_name
-       integer(c_int), intent(out) :: time_dimidp
-       integer(c_int), intent(out) :: time_varidp
-       integer(c_int) :: nccf_def_time
-     end function nccf_def_time
-
-!      int nccf_inq_time(int ncid, char *name, size_t *lenp, nc_type *xtypep, int *tim
-!     e_dimidp, int *time_varidp)
-     function nccf_inq_time(ncid, name, lenp, xtypep, time_dimidp, time_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(out) :: name
-       integer(c_size_t), intent(out) :: lenp
-       integer(c_int), intent(out) :: xtypep
-       integer(c_int), intent(out) :: time_dimidp
-       integer(c_int), intent(out) :: time_varidp
-       integer(c_int) :: nccf_inq_time
-     end function nccf_inq_time
-
-!      int nccf_def_lvl_vert(int ncid, int lvl_type, const char *name, nc_type xtype, 
-!     size_t len, int *lvl_dimidp, int *lvl_varidp)
-     function nccf_def_lvl_vert(ncid, lvl_type, name, xtype, len, lvl_dimidp, &
-       lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: lvl_type
-       character(c_char), intent(in) :: name
-       integer(c_int), intent(in) :: xtype
-       integer(c_size_t), intent(in) :: len
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_def_lvl_vert
-     end function nccf_def_lvl_vert
-
-!      int nccf_inq_lvl_vert(int ncid, char *name, nc_type *xtypep, size_t *lenp, int 
-!     *lvl_typep, int *lvl_dimidp, int *lvl_varidp)
-     function nccf_inq_lvl_vert(ncid, name, xtypep, lenp, lvl_typep, lvl_dimidp, &
-       lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(out) :: name
-       integer(c_int), intent(out) :: xtypep
-       integer(c_size_t), intent(out) :: lenp
-       integer(c_int), intent(out) :: lvl_typep
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_inq_lvl_vert
-     end function nccf_inq_lvl_vert
-
-!      int nccf_def_lvl_sigma(int ncid, const char *name, nc_type xtype, size_t len, i
-!     nt *lvl_dimidp, int *lvl_varidp)
-     function nccf_def_lvl_sigma(ncid, name, xtype, len, lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(in) :: name
-       integer(c_int), intent(in) :: xtype
-       integer(c_size_t), intent(in) :: len
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_def_lvl_sigma
-     end function nccf_def_lvl_sigma
-
-!     int nccf_def_ft_sigma(int ncid, int lvl_vid, int ps_vid, int p0_vid)
-     function nccf_def_ft_sigma(ncid, lvl_vid, ps_vid, p0_vid) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: lvl_vid
-       integer(c_int), value, intent(in) :: ps_vid
-       integer(c_int), value, intent(in) :: p0_vid
-       integer(c_int) :: nccf_def_ft_sigma
-     end function nccf_def_ft_sigma
-
-!      int nccf_inq_lvl_sigma(int ncid, char *name, nc_type *xtypep, size_t *lenp, int
-!      *ps_varidp, int *ptop_varidp, int *lvl_dimidp, int *lvl_varidp)
-     function nccf_inq_lvl_sigma(ncid, name, xtypep, lenp, ps_varidp, ptop_varidp, &
-       lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(out) :: name
-       integer(c_int), intent(out) :: xtypep
-       integer(c_size_t), intent(out) :: lenp
-       integer(c_int), intent(out) :: ps_varidp
-       integer(c_int), intent(out) :: ptop_varidp
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_inq_lvl_sigma
-     end function nccf_inq_lvl_sigma
-
-!      int nccf_def_lvl_hybrid_sigma(int ncid, const char *name, nc_type xtype, size_t
-!      len, int *lvl_dimidp, int *lvl_varidp)
-     function nccf_def_lvl_hybrid_sigma(ncid, name, xtype, len, lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(in) :: name
-       integer(c_int), intent(in) :: xtype
-       integer(c_size_t), intent(in) :: len
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_def_lvl_hybrid_sigma
-     end function nccf_def_lvl_hybrid_sigma
-
-!      int nccf_def_ft_hybrid_sigma(int ncid, int lvl_vid, int a_vid, int b_vid, int p
-!     s_vid, int p0_vid)
-     function nccf_def_ft_hybrid_sigma(ncid, lvl_vid, a_vid, b_vid, ps_vid, p0_vid) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: lvl_vid
-       integer(c_int), value, intent(in) :: a_vid
-       integer(c_int), value, intent(in) :: b_vid
-       integer(c_int), value, intent(in) :: ps_vid
-       integer(c_int), value, intent(in) :: p0_vid
-       integer(c_int) :: nccf_def_ft_hybrid_sigma
-     end function nccf_def_ft_hybrid_sigma
-
-!      int nccf_inq_lvl_hybrid_sigma(int ncid, char *name, nc_type *xtypep, size_t *le
-!     np, int *a_varidp, int *b_varidp, int *ps_varidp, int *p0_varidp, int *lvl_dimid
-!     p, int *lvl_varidp)
-     function nccf_inq_lvl_hybrid_sigma(ncid, name, xtypep, lenp, a_varidp, b_varidp, &
-       ps_varidp, p0_varidp, lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(out) :: name
-       integer(c_int), intent(out) :: xtypep
-       integer(c_size_t), intent(out) :: lenp
-       integer(c_int), intent(out) :: a_varidp
-       integer(c_int), intent(out) :: b_varidp
-       integer(c_int), intent(out) :: ps_varidp
-       integer(c_int), intent(out) :: p0_varidp
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_inq_lvl_hybrid_sigma
-     end function nccf_inq_lvl_hybrid_sigma
-
-!      int nccf_def_lvl_hybrid_sigma_full(int ncid, const char *name, nc_type xtype, s
-!     ize_t len, int *lvl_dimidp, int *lvl_varidp)
-     function nccf_def_lvl_hybrid_sigma_full(ncid, name, xtype, len, lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(in) :: name
-       integer(c_int), intent(in) :: xtype
-       integer(c_size_t), intent(in) :: len
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_def_lvl_hybrid_sigma_full
-     end function nccf_def_lvl_hybrid_sigma_full
-
-!      int nccf_def_ft_hybrid_sigma_full(int ncid, int varid, int a_varid, int b_varid
-!     , int ps_varid, int p0_varid)
-     function nccf_def_ft_hybrid_sigma_full(ncid, varid, a_varid, b_varid, ps_varid, p0_varid) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       integer(c_int), value, intent(in) :: a_varid
-       integer(c_int), value, intent(in) :: b_varid
-       integer(c_int), value, intent(in) :: ps_varid
-       integer(c_int), value, intent(in) :: p0_varid
-       integer(c_int) :: nccf_def_ft_hybrid_sigma_full
-     end function nccf_def_ft_hybrid_sigma_full
-
-!      int nccf_def_lvl_hybrid_height(int ncid, const char *name, nc_type xtype, size_
-!     t len, int *lvl_dimidp, int *lvl_varidp)
-     function nccf_def_lvl_hybrid_height(ncid, name, xtype, len, lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(in) :: name
-       integer(c_int), intent(in) :: xtype
-       integer(c_size_t), intent(in) :: len
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_def_lvl_hybrid_height
-     end function nccf_def_lvl_hybrid_height
-
-!      int nccf_def_ft_hybrid_height(int ncid, int varid, int a_varid, int b_varid, in
-!     t orog_varid)
-     function nccf_def_ft_hybrid_height(ncid, varid, a_varid, b_varid, orog_varid) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       integer(c_int), value, intent(in) :: a_varid
-       integer(c_int), value, intent(in) :: b_varid
-       integer(c_int), value, intent(in) :: orog_varid
-       integer(c_int) :: nccf_def_ft_hybrid_height
-     end function nccf_def_ft_hybrid_height
-
-!      int nccf_inq_lvl_hybrid_height(int ncid, char *name, nc_type *xtypep, size_t *l
-!     enp, int *a_varidp, int *b_varidp, int *orog_varidp, int *lvl_dimidp, int *lvl_v
-!     aridp)
-     function nccf_inq_lvl_hybrid_height(ncid, name, xtypep, lenp, a_varidp, b_varidp, &
-       orog_varidp, lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(out) :: name
-       integer(c_int), intent(out) :: xtypep
-       integer(c_size_t), intent(out) :: lenp
-       integer(c_int), intent(out) :: a_varidp
-       integer(c_int), intent(out) :: b_varidp
-       integer(c_int), intent(out) :: orog_varidp
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_inq_lvl_hybrid_height
-     end function nccf_inq_lvl_hybrid_height
-
-!      int nccf_def_lvl_sleve(int ncid, const char *name, nc_type xtype, size_t len, i
-!     nt *lvl_dimidp, int *lvl_varidp)
-     function nccf_def_lvl_sleve(ncid, name, xtype, len, lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(in) :: name
-       integer(c_int), intent(in) :: xtype
-       integer(c_size_t), intent(in) :: len
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_def_lvl_sleve
-     end function nccf_def_lvl_sleve
-
-!      int nccf_def_ft_sleve(int ncid, int varid, int a_varid, int b1_varid, int b2_va
-!     rid, int ztop_varid, int zsurf1_varid, int zsurf2_varid)
-     function nccf_def_ft_sleve(ncid, varid, a_varid, b1_varid, b2_varid, ztop_varid, &
-       zsurf1_varid, zsurf2_varid) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       integer(c_int), value, intent(in) :: a_varid
-       integer(c_int), value, intent(in) :: b1_varid
-       integer(c_int), value, intent(in) :: b2_varid
-       integer(c_int), value, intent(in) :: ztop_varid
-       integer(c_int), value, intent(in) :: zsurf1_varid
-       integer(c_int), value, intent(in) :: zsurf2_varid
-       integer(c_int) :: nccf_def_ft_sleve
-     end function nccf_def_ft_sleve
-
-!      int nccf_inq_lvl_sleve(int ncid, char *name, nc_type *xtypep, size_t *lenp, int
-!      *a_varidp, int *b1_varidp, int *b2_varidp, int *ztop_varidp, int *zsurf1_varidp
-!     , int *zsurf2_varidp, int *lvl_dimidp, int *lvl_varidp)
-     function nccf_inq_lvl_sleve(ncid, name, xtypep, lenp, a_varidp, b1_varidp, &
-       b2_varidp, ztop_varidp, zsurf1_varidp, zsurf2_varidp, &
-       lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(out) :: name
-       integer(c_int), intent(out) :: xtypep
-       integer(c_size_t), intent(out) :: lenp
-       integer(c_int), intent(out) :: a_varidp
-       integer(c_int), intent(out) :: b1_varidp
-       integer(c_int), intent(out) :: b2_varidp
-       integer(c_int), intent(out) :: ztop_varidp
-       integer(c_int), intent(out) :: zsurf1_varidp
-       integer(c_int), intent(out) :: zsurf2_varidp
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_inq_lvl_sleve
-     end function nccf_inq_lvl_sleve
-
-!      int nccf_def_lvl_ocean_sigma(int ncid, const char *name, nc_type xtype, size_t 
-!     len, int *lvl_dimidp, int *lvl_varidp)
-     function nccf_def_lvl_ocean_sigma(ncid, name, xtype, len, lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(in) :: name
-       integer(c_int), intent(in) :: xtype
-       integer(c_size_t), intent(in) :: len
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_def_lvl_ocean_sigma
-     end function nccf_def_lvl_ocean_sigma
-
-!      int nccf_def_ft_ocean_sigma(int ncid, int varid, int eta_varid, int depth_varid
-!     )
-     function nccf_def_ft_ocean_sigma(ncid, varid, eta_varid, depth_varid) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       integer(c_int), value, intent(in) :: eta_varid
-       integer(c_int), value, intent(in) :: depth_varid
-       integer(c_int) :: nccf_def_ft_ocean_sigma
-     end function nccf_def_ft_ocean_sigma
-
-!      int nccf_inq_lvl_ocean_sigma(int ncid, char *name, nc_type *xtypep, size_t *len
-!     p, int *eta_varidp, int *depth_varidp, int *lvl_dimidp, int *lvl_varidp)
-     function nccf_inq_lvl_ocean_sigma(ncid, name, xtypep, lenp, eta_varidp, depth_varidp, &
-       lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(out) :: name
-       integer(c_int), intent(out) :: xtypep
-       integer(c_size_t), intent(out) :: lenp
-       integer(c_int), intent(out) :: eta_varidp
-       integer(c_int), intent(out) :: depth_varidp
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_inq_lvl_ocean_sigma
-     end function nccf_inq_lvl_ocean_sigma
-
-!      int nccf_def_lvl_ocean_s(int ncid, const char *name, nc_type xtype, size_t len,
-!      int *lvl_dimidp, int *lvl_varidp)
-     function nccf_def_lvl_ocean_s(ncid, name, xtype, len, lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(in) :: name
-       integer(c_int), intent(in) :: xtype
-       integer(c_size_t), intent(in) :: len
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_def_lvl_ocean_s
-     end function nccf_def_lvl_ocean_s
-
-!      int nccf_def_ft_ocean_s(int ncid, int varid, int eta_varid, int depth_varid, in
-!     t a_varid, int b_varid, int depth_c_varid)
-     function nccf_def_ft_ocean_s(ncid, varid, eta_varid, depth_varid, a_varid, b_varid, &
-       depth_c_varid) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       integer(c_int), value, intent(in) :: eta_varid
-       integer(c_int), value, intent(in) :: depth_varid
-       integer(c_int), value, intent(in) :: a_varid
-       integer(c_int), value, intent(in) :: b_varid
-       integer(c_int), value, intent(in) :: depth_c_varid
-       integer(c_int) :: nccf_def_ft_ocean_s
-     end function nccf_def_ft_ocean_s
-
-!      int nccf_inq_lvl_ocean_s(int ncid, char *name, nc_type *xtypep, size_t *lenp, i
-!     nt *eta_varidp, int *depth_varidp, int *a_varidp, int *b_varidp, int *depth_c_va
-!     ridp, int *lvl_dimidp, int *lvl_varidp)
-     function nccf_inq_lvl_ocean_s(ncid, name, xtypep, lenp, eta_varidp, depth_varidp, &
-       a_varidp, b_varidp, depth_c_varidp, lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(out) :: name
-       integer(c_int), intent(out) :: xtypep
-       integer(c_size_t), intent(out) :: lenp
-       integer(c_int), intent(out) :: eta_varidp
-       integer(c_int), intent(out) :: depth_varidp
-       integer(c_int), intent(out) :: a_varidp
-       integer(c_int), intent(out) :: b_varidp
-       integer(c_int), intent(out) :: depth_c_varidp
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_inq_lvl_ocean_s
-     end function nccf_inq_lvl_ocean_s
-
-!      int nccf_def_lvl_ocean_sigma_z(int ncid, const char *name, nc_type xtype, size_
-!     t len, int *lvl_dimidp, int *lvl_varidp)
-     function nccf_def_lvl_ocean_sigma_z(ncid, name, xtype, len, lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(in) :: name
-       integer(c_int), intent(in) :: xtype
-       integer(c_size_t), intent(in) :: len
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_def_lvl_ocean_sigma_z
-     end function nccf_def_lvl_ocean_sigma_z
-
-!      int nccf_def_ft_ocean_sigma_z(int ncid, int varid, int eta_varid, int depth_var
-!     id, int depth_c_varid, int nsigma_varid, int zlev_varid)
-     function nccf_def_ft_ocean_sigma_z(ncid, varid, eta_varid, depth_varid, depth_c_varid, &
-       nsigma_varid, zlev_varid) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       integer(c_int), value, intent(in) :: eta_varid
-       integer(c_int), value, intent(in) :: depth_varid
-       integer(c_int), value, intent(in) :: depth_c_varid
-       integer(c_int), value, intent(in) :: nsigma_varid
-       integer(c_int), value, intent(in) :: zlev_varid
-       integer(c_int) :: nccf_def_ft_ocean_sigma_z
-     end function nccf_def_ft_ocean_sigma_z
-
-!      int nccf_inq_lvl_ocean_sigma_z(int ncid, char *name, nc_type *xtypep, size_t *l
-!     enp, int *eta_varidp, int *depth_varidp, int *depth_c_varidp, int *nsigma_varidp
-!     , int *zlev_varidp, int *lvl_dimidp, int *lvl_varidp)
-     function nccf_inq_lvl_ocean_sigma_z(ncid, name, xtypep, lenp, eta_varidp, depth_varidp, &
-       depth_c_varidp, nsigma_varidp, zlev_varidp, lvl_dimidp, &
-       lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(out) :: name
-       integer(c_int), intent(out) :: xtypep
-       integer(c_size_t), intent(out) :: lenp
-       integer(c_int), intent(out) :: eta_varidp
-       integer(c_int), intent(out) :: depth_varidp
-       integer(c_int), intent(out) :: depth_c_varidp
-       integer(c_int), intent(out) :: nsigma_varidp
-       integer(c_int), intent(out) :: zlev_varidp
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_inq_lvl_ocean_sigma_z
-     end function nccf_inq_lvl_ocean_sigma_z
-
-!      int nccf_def_lvl_ocean_dbl_sigma(int ncid, const char *name, nc_type xtype, siz
-!     e_t len, int *lvl_dimidp, int *lvl_varidp)
-     function nccf_def_lvl_ocean_dbl_sigma(ncid, name, xtype, len, lvl_dimidp, lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(in) :: name
-       integer(c_int), intent(in) :: xtype
-       integer(c_size_t), intent(in) :: len
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_def_lvl_ocean_dbl_sigma
-     end function nccf_def_lvl_ocean_dbl_sigma
-
-!      int nccf_def_ft_ocean_dbl_sigma(int ncid, int varid, int depth_varid, int z1_va
-!     rid, int z2_varid, int a_varid, int href_varid, int k_c_varid)
-     function nccf_def_ft_ocean_dbl_sigma(ncid, varid, depth_varid, z1_varid, z2_varid, a_varid, &
-       href_varid, k_c_varid) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       integer(c_int), value, intent(in) :: depth_varid
-       integer(c_int), value, intent(in) :: z1_varid
-       integer(c_int), value, intent(in) :: z2_varid
-       integer(c_int), value, intent(in) :: a_varid
-       integer(c_int), value, intent(in) :: href_varid
-       integer(c_int), value, intent(in) :: k_c_varid
-       integer(c_int) :: nccf_def_ft_ocean_dbl_sigma
-     end function nccf_def_ft_ocean_dbl_sigma
-
-!      int nccf_inq_lvl_ocean_dbl_sigma(int ncid, char *name, nc_type *xtypep, size_t 
-!     *lenp, int *depth_varidp, int *z1_varidp, int *z2_varidp, int *a_varidp, int *hr
-!     ef_varidp, int *k_c_varidp, int *lvl_dimidp, int *lvl_varidp)
-     function nccf_inq_lvl_ocean_dbl_sigma(ncid, name, xtypep, lenp, depth_varidp, z1_varidp, &
-       z2_varidp, a_varidp, href_varidp, k_c_varidp, lvl_dimidp, &
-       lvl_varidp) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(out) :: name
-       integer(c_int), intent(out) :: xtypep
-       integer(c_size_t), intent(out) :: lenp
-       integer(c_int), intent(out) :: depth_varidp
-       integer(c_int), intent(out) :: z1_varidp
-       integer(c_int), intent(out) :: z2_varidp
-       integer(c_int), intent(out) :: a_varidp
-       integer(c_int), intent(out) :: href_varidp
-       integer(c_int), intent(out) :: k_c_varidp
-       integer(c_int), intent(out) :: lvl_dimidp
-       integer(c_int), intent(out) :: lvl_varidp
-       integer(c_int) :: nccf_inq_lvl_ocean_dbl_sigma
-     end function nccf_inq_lvl_ocean_dbl_sigma
-
-!     int nccf_def_axis_type(int ncid, int varid, int axis_type)
-     function nccf_def_axis_type(ncid, varid, axis_type) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       integer(c_int), value, intent(in) :: axis_type
-       integer(c_int) :: nccf_def_axis_type
-     end function nccf_def_axis_type
-
-!     int nccf_inq_axis_type(int ncid, int varid, int *axis_type)
-     function nccf_inq_axis_type(ncid, varid, axis_type) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       integer(c_int), intent(out) :: axis_type
-       integer(c_int) :: nccf_inq_axis_type
-     end function nccf_inq_axis_type
-
-!      int nccf_def_coord_system(int ncid, const char *name, int naxes, int *axis_vari
-!     ds, int *system_varid)
-     function nccf_def_coord_system(ncid, name, naxes, axis_varids, system_varid) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(in) :: name
-       integer(c_int), value, intent(in) :: naxes
-       integer(c_int), dimension(*), intent(in) :: axis_varids
-       integer(c_int), intent(out) :: system_varid
-       integer(c_int) :: nccf_def_coord_system
-     end function nccf_def_coord_system
-
-!      int nccf_inq_coord_system(int ncid, int system_varid, char *name, int *naxes, i
-!     nt *axis_varids)
-     function nccf_inq_coord_system(ncid, system_varid, name, naxes, axis_varids) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: system_varid
-       character(c_char), intent(out) :: name
-       integer(c_int), intent(out) :: naxes
-       integer(c_int), dimension(*), intent(in) :: axis_varids
-       integer(c_int) :: nccf_inq_coord_system
-     end function nccf_inq_coord_system
-
-!     int nccf_assign_coord_system(int ncid, int varid, int system_varid)
-     function nccf_assign_coord_system(ncid, varid, system_varid) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       integer(c_int), value, intent(in) :: system_varid
-       integer(c_int) :: nccf_assign_coord_system
-     end function nccf_assign_coord_system
-
-!      int nccf_def_transform(int ncid, const char *name, const char *transform_type, 
-!     const char *transform_name, int *transform_varid)
-     function nccf_def_transform(ncid, name, transform_type, transform_name, &
-       transform_varid) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       character(c_char), intent(in) :: name
-       character(c_char), intent(in) :: transform_type
-       character(c_char), intent(in) :: transform_name
-       integer(c_int), intent(out) :: transform_varid
-       integer(c_int) :: nccf_def_transform
-     end function nccf_def_transform
-
-!      int nccf_inq_transform(int ncid, int transform_varid, char *name, size_t *type_
-!     len, char *transform_type, size_t *name_len, char *transform_name)
-     function nccf_inq_transform(ncid, transform_varid, name, type_len, transform_type, &
-       name_len, transform_name) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: transform_varid
-       character(c_char), intent(out) :: name
-       integer(c_size_t), intent(out) :: type_len
-       character(c_char), intent(out) :: transform_type
-       integer(c_size_t), intent(out) :: name_len
-       character(c_char), intent(out) :: transform_name
-       integer(c_int) :: nccf_inq_transform
-     end function nccf_inq_transform
-
-!     int nccf_assign_transform(int ncid, int system_varid, int transform_varid)
-     function nccf_assign_transform(ncid, system_varid, transform_varid) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: system_varid
-       integer(c_int), value, intent(in) :: transform_varid
-       integer(c_int) :: nccf_assign_transform
-     end function nccf_assign_transform
-
-!      int nccf_get_vara(int ncid, int varid, float *lat_range, int *nlat, float *lon_
-!     range, int *nlon, int lvl_index, int timestep, void *data)
-     function nccf_get_vara(ncid, varid, lat_range, nlat, lon_range, nlon, &
-       lvl_index, timestep, data) bind(c)
-       use, intrinsic :: iso_c_binding
-       integer(c_int), value, intent(in) :: ncid
-       integer(c_int), value, intent(in) :: varid
-       real(c_float), intent(out) :: lat_range
-       integer(c_int), intent(out) :: nlat
-       real(c_float), intent(out) :: lon_range
-       integer(c_int), intent(out) :: nlon
-       integer(c_int), value, intent(in) :: lvl_index
-       integer(c_int), value, intent(in) :: timestep
-       type(c_ptr), intent(out) :: data
-       integer(c_int) :: nccf_get_vara
-     end function nccf_get_vara
-
-     end interface
diff --git a/src/libcf_int.h b/src/libcf_int.h
index 6e77bee..5f22d06 100644
--- a/src/libcf_int.h
+++ b/src/libcf_int.h
@@ -3,11 +3,11 @@ This is part of the libcf package from Unidata. Copyright UCAR
 2006.
 
 This is an internal header file for library-wide stuff that I don't
-want in the libcf.h file.
+want in the libcf_src.h file.
 
 Ed Hartnett, 10/1/06
 
-$Id: libcf_int.h,v 1.2 2009/09/08 17:14:53 ed Exp $
+$Id: libcf_int.h 376 2011-01-14 21:09:50Z pletzer $
 */
 
 #ifndef _LIBCF_INT_
diff --git a/src/nccf_add_id_to_files.c b/src/nccf_add_id_to_files.c
new file mode 100644
index 0000000..907327b
--- /dev/null
+++ b/src/nccf_add_id_to_files.c
@@ -0,0 +1,62 @@
+/**
+ * After generating a pseudo-random id. Add the id to the grid files, data files
+ * and mosaic file as an attribute in the XXXX variable.
+ *
+ * I have to think how this will work. 
+ *    a. Do we gen the id before creating the files? We can then put the id in
+ *       the struct
+ *    b. Gen the id after creating the files. Then we need a list of the files
+ *       before running this routine.
+ *
+ * Once the attribute is populated, then we can create a host file to keep it 
+ * sorted out.
+ * 
+ * $Id: nccf_add_id_to_files.c 513 2011-02-14 22:48:17Z dkindig $
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netcdf.h>
+#include <nccf_utility_functions.h>
+#include <nccf_constants.h>
+
+int nccf_add_id_to_files(const char *id, int nfiles, const char **tile_names, 
+                         const char **file_types, const char **list_o_files){
+  
+  char *filename, *sig;
+  filename = ( char* )calloc( STRING_SIZE, sizeof( char ));
+  sig      = ( char* )calloc( STRING_SIZE, sizeof( char ));
+  int status = NC_NOERR, ncid, i;
+  int toterr = 0;
+
+  for( i = 0; i < nfiles; i++ ){
+
+    sprintf( filename, "%s", list_o_files[i] );
+
+    status = nc_open( filename, NC_WRITE, &ncid );
+    if( status ) return status;
+    status = nc_redef( ncid );
+    toterr += abs(status);
+
+    status = nc_put_att_text( ncid, NC_GLOBAL, CF_COORDINATES_ID, 
+			      strlen( id ), id );
+    toterr += abs(status);
+    status = nc_put_att_text( ncid, NC_GLOBAL, CF_GRIDNAME, 
+			      strlen( tile_names[i] ), tile_names[i] );
+    toterr += abs(status);
+    status = nc_put_att_text( ncid, NC_GLOBAL, CF_FILETYPE, 
+			      strlen( file_types[i] ), file_types[i] );
+    toterr += abs(status);
+    
+    status = nc_enddef( ncid );
+    toterr += abs(status);
+    status = nc_close( ncid );
+    toterr += status;
+  }
+
+  free(sig);
+  free(filename);
+
+  return(toterr);
+}
diff --git a/src/nccf_find_indices.c b/src/nccf_find_indices.c
new file mode 100644
index 0000000..48ad828
--- /dev/null
+++ b/src/nccf_find_indices.c
@@ -0,0 +1,44 @@
+/**
+ * $Id: nccf_find_indices.c 905 2011-12-29 04:56:48Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <nccf_utility_functions.h>
+
+#include <cf_config.h>
+
+#define nccf_find_indices_TYPE nccf_find_indices_double
+#define nccf_get_distance_in_coord_TYPE nccf_get_distance_in_coord_double
+#define nccf_get_distance_in_coord_TYPE nccf_get_distance_in_coord_double
+#define nccf_find_next_indices_TYPE nccf_find_next_indices_double
+#define nccf_linesearch_indices_TYPE nccf_linesearch_indices_double
+#define _TYPE double
+#include <nccf_find_indices.h>
+#undef _TYPE
+#undef nccf_linesearch_indices_TYPE
+#undef nccf_find_next_indices_TYPE
+#undef nccf_get_distance_in_coord_TYPE
+#undef nccf_get_distance_in_coord_TYPE
+#undef nccf_find_indices_TYPE
+
+#define nccf_find_indices_TYPE nccf_find_indices_float
+#define nccf_get_distance_in_coord_TYPE nccf_get_distance_in_coord_float
+#define nccf_get_distance_in_coord_TYPE nccf_get_distance_in_coord_float
+#define nccf_find_next_indices_TYPE nccf_find_next_indices_float
+#define nccf_linesearch_indices_TYPE nccf_linesearch_indices_float
+#define _TYPE float
+#include <nccf_find_indices.h>
+#undef _TYPE
+#undef nccf_linesearch_indices_TYPE
+#undef nccf_find_next_indices_TYPE
+#undef nccf_get_distance_in_coord_TYPE
+#undef nccf_get_distance_in_coord_TYPE
+#undef nccf_find_indices_TYPE
+
+
+
+
diff --git a/src/nccf_find_indices.h b/src/nccf_find_indices.h
new file mode 100644
index 0000000..e24c510
--- /dev/null
+++ b/src/nccf_find_indices.h
@@ -0,0 +1,208 @@
+/**
+ * $Id: nccf_find_indices.h 898 2011-12-22 23:42:03Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+int
+nccf_find_indices_TYPE(int ndims, const int dims[], 
+		       const _TYPE **coordData, 
+                       const _TYPE coord_periodicity[],
+		       const _TYPE targetPos[],
+		       int *niter, _TYPE *tolpos, 
+		       void (*adjustFunc)(int, const int[], _TYPE []),
+		       _TYPE dindices[], int hit_bounds[]) {
+
+  int status, i, iter;
+  int totError = 0;
+  int iterError = 0;
+  int boundError = 0;
+  int numUpperBoundErrors = 0;
+  int numLowerBoundErrors = 0;
+
+  // fix input, if need be
+  int nIterMax = abs(*niter);
+  _TYPE tolPos = fabs(*tolpos);
+
+  _TYPE dindices_new[ndims];
+  _TYPE xPos[ndims];
+  _TYPE xNormErr, xNormErrNew;
+  _TYPE dIndicesBest[ndims];
+  _TYPE xNormErrBest = HUGE_VAL;
+  _TYPE alpha = 1.0;
+
+  /* no tolerance should be smaller than this */
+  const _TYPE eps = 0.1 * tolPos;
+  const _TYPE indexTol = 0.1; // for linesearch
+
+  
+  for (i = 0; i < ndims; ++i) {
+    dIndicesBest[i] = dindices[i];
+  }
+
+#ifdef LOGGING
+  printf("-----------\ntargetPos = ");
+  for (i = 0; i < ndims; ++i) printf("%f, ", targetPos[i]);
+  printf("\n");
+  printf("iteration alpha   xNormErr   position/indices/displ \n");
+#endif
+
+  iter = -1;
+  const int nIterMax2 = (nIterMax/2 > 2? nIterMax/2: 2);
+  while (iter < nIterMax && 
+         numUpperBoundErrors < nIterMax2 &&
+         numLowerBoundErrors < nIterMax2) {
+
+    iter++;
+
+    status = nccf_get_distance_in_coord_TYPE(ndims, dims, 
+                                             coordData,
+                                             coord_periodicity,
+                                             targetPos, 
+                                             dindices, 
+                                             &xNormErr);
+    totError += abs(status);
+
+    // check if done
+    if (xNormErr < tolPos) break;
+
+    // compute the increment
+    status = nccf_find_next_indices_TYPE(ndims, dims, coordData, 
+                                         coord_periodicity,
+                                         targetPos,
+                                         dindices, dindices_new, xPos);
+    totError += abs(status);
+
+#ifdef LOGGING
+    printf("%4d      %5.3f  %10.3g ", iter, alpha, xNormErr);
+    for (i = 0; i < ndims; ++i) {
+      printf("%10.6f, ", xPos[i]);
+    }
+    for (i = 0; i < ndims; ++i) {
+      printf("%10.4f, ", dindices[i]);
+    }
+    for (i = 0; i < ndims; ++i) {
+      printf("%10.4f, ", dindices_new[i] - dindices[i]);
+    }
+    printf("\n");
+#endif
+
+    // adjust indices if these fall outside the domain
+    if (adjustFunc) {
+      adjustFunc(ndims, dims, dindices);
+    }
+
+    // error handling
+    boundError = 0;
+    for (i = 0; i < ndims; ++i) {
+
+      if (dindices_new[i] < -eps) {
+        /* a negative value means we went beyond the left boundary */
+        hit_bounds[i] = -1;
+        numUpperBoundErrors++;
+        boundError++;
+      }
+      else if (dindices_new[i] > dims[i] - 1 + eps) {
+        /* a positive value means we went beyond the right boundary */
+        hit_bounds[i] = 1;
+        numLowerBoundErrors++;
+        boundError++;
+      }
+      else {
+        hit_bounds[i] = 0;
+      }
+    }
+
+    // correct if overshooting
+    for (i = 0; i < ndims; ++i) {
+      dindices_new[i] = (dindices_new[i] < 0? 0: dindices_new[i]);
+      dindices_new[i] = (dindices_new[i] > dims[i] - 1? dims[i] - 1: dindices_new[i]);
+    }
+
+    status = nccf_get_distance_in_coord_TYPE(ndims, dims, 
+                                             coordData,
+                                             coord_periodicity,
+                                             targetPos, 
+                                             dindices_new,
+                                             &xNormErrNew);
+    totError += abs(status);
+
+    // do a linesearch
+    if (xNormErrNew > 0.99 * xNormErr) {
+      status = nccf_linesearch_indices_TYPE(ndims, dims, coordData,
+                                            coord_periodicity,
+                                            targetPos, indexTol,
+                                            dindices, dindices_new);
+      totError += abs(status);
+    }
+    
+    /* if (bad) { */
+    /*   // generally means we left the domain */
+    /*   break; */
+    /* } */
+
+    // update
+    for (i = 0; i < ndims; ++i) {
+      dindices[i] += alpha*(dindices_new[i] - dindices[i]);
+    }
+
+    // are we improving?
+    status = nccf_get_distance_in_coord_TYPE(ndims, dims, 
+                                             coordData,
+                                             coord_periodicity,
+                                             targetPos, 
+                                             dindices,
+                                             &xNormErrNew);
+    totError += abs(status);
+
+    // store the best result so far
+    if (xNormErrNew < xNormErrBest) {
+      for (i = 0; i < ndims; ++i) {
+        dIndicesBest[i] = dindices[i];
+      }
+      xNormErrBest = xNormErrNew;
+    }
+    
+    /*     if (xNormErrNew > 0.99 * xNormErr) { */
+    /*       // add some relaxation */
+    /*       alpha *= 0.9; */
+    /* /\*       for (i = 0; i < ndims; ++i) { *\/ */
+    /* /\* 	dindices[i] += eps * (_TYPE)random()/ (_TYPE)RAND_MAX; *\/ */
+    /* /\*       } *\/ */
+    /*     } */
+    /*     else if (xNormErrNew < 0.7 * xNormErr) { */
+    /*       alpha = 1.0; */
+    /*     } */
+  }
+    
+  // set the error code
+  if (iter >= nIterMax || boundError) {
+    iterError = 1;
+  }
+
+  // make sure we return our best guess so far...
+  for (i = 0; i < ndims; ++i) {
+    dindices[i] = dIndicesBest[i];
+  }
+
+  *niter = iter;
+  *tolpos = xNormErrBest;
+  
+#ifdef LOGGING
+  if (iterError || totError || boundError) {
+    printf("*** Failure in nccf_find_indices_TYPE: totError=%d iterError=%d ", 
+           totError, iterError);
+    for (i = 0; i < ndims; ++i) {
+      if (hit_bounds[i] > 0) {
+        printf(" hit high bound %d", i);
+      }
+      else if (hit_bounds[i] < 0) {
+        printf(" hit low bound %d", i);
+      }
+    }
+    printf("\n");
+  }
+#endif
+  return iterError;
+}
+
diff --git a/src/nccf_find_next_adjacent.c b/src/nccf_find_next_adjacent.c
new file mode 100644
index 0000000..dd2636c
--- /dev/null
+++ b/src/nccf_find_next_adjacent.c
@@ -0,0 +1,34 @@
+/*
+ * Find the next cell adjacent to the current cell in using k, j, i order
+ *
+ * $Id: nccf_find_next_adjacent.c 373 2011-01-14 19:53:49Z pletzer $
+ */
+
+int nccf_find_next_adjacent( int ndims, const int dims[], int kji[] ){
+
+  int z, inside_domain = 1, mult = 1;
+
+  /* Calculate the Direction vector */
+  int directionVector[ndims], tmpkji;
+  directionVector[0] = 1;
+  for( z = 0; z < ndims-1; z++ ){
+    mult *= (1 - 2 * ( kji[z] % 2 ));
+    directionVector[z+1] = mult;
+  }
+
+  /* Start at the fastest varying dimension */
+  for( z = ndims-1; z >= 0; z-- ){
+    tmpkji = kji[z] + directionVector[z]; 
+    if( tmpkji >= 0 ){
+      if( tmpkji <= dims[z]-1 ){
+        kji[z] = kji[z] + directionVector[z];
+        return inside_domain;
+      }
+    }
+  }
+
+  inside_domain = 0;
+  return inside_domain;
+
+}
+
diff --git a/src/nccf_find_next_adjcnt_index.c b/src/nccf_find_next_adjcnt_index.c
new file mode 100644
index 0000000..e7cc324
--- /dev/null
+++ b/src/nccf_find_next_adjcnt_index.c
@@ -0,0 +1,140 @@
+/*
+ * Find next index adjacent to current index without repetition. 
+ * This routine assumes the fastest varying index is the last index
+ *
+ * \author Dave Kindig, Tech-X Corp.
+ *
+ * $Id: nccf_find_next_adjcnt_index.c 881 2011-12-17 21:53:14Z pletzer $
+ */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <nccf_utility_functions.h>
+
+#include <cf_config.h>
+
+int 
+nccf_find_next_adjcnt_index( int ndims, const int dims[], 
+			     int kji[] ){
+
+  int m, n, index, mult = 1;
+  int *tmp_dims, *tmp_locs, kjiFI, currFI, di1 = 0, di2 = 0;
+
+  int flatIndices[ndims];
+  int directionVectors[ndims][ndims];
+  int dir[ndims];
+
+  /* Returns */
+  int inside_domain = 1; 
+  int isCorner  =  0;
+
+  /* Set up the directionVectors */
+  directionVectors[0][0] = 1;
+  for( m = 0; m < ndims-1; m++ ){
+    mult *= (1 - 2 * ( kji[m] % 2 ));
+    directionVectors[m+1][m+1] = mult;
+  }
+
+  /* Calculate the flat index of the location */
+  int fi;
+  for( m = ndims-1; m >= 0 ; m-- ){
+    tmp_dims = (int *)malloc((m+1) * sizeof(int));
+    tmp_locs = (int *)malloc((m+1) * sizeof(int));
+    for( n = 0; n < m+1; n++ ) tmp_dims[n] = dims[n];
+    for( n = 0; n < m+1; n++ ) tmp_locs[n] = dims[n]-1;
+    fi = nccf_get_flat_index( m+1, tmp_dims, tmp_locs );
+    index = (ndims-m)-1;
+    flatIndices[index] = fi;
+    free( tmp_dims );
+    free( tmp_locs );
+  }
+
+  /* Determine if location vector is inside the domain by finding the adjacent
+   * location vector location vector is updated as well */
+
+  /* For higher dimensions, corners are special in some cases */
+  if( ndims > 1 ){
+    if( kji[ndims-2] == 0 && kji[ndims-1] == 0 ){
+      if (directionVectors[ndims-1][ndims-1] == -1) isCorner = 1;
+    }
+    if( kji[ndims-2] == dims[ndims-2]-1 && kji[ndims-1] == 0 ){
+      if (directionVectors[ndims-1][ndims-1] == -1) isCorner = 1;
+    }
+    /* Even top row */
+    if( (kji[ndims-2] % 2) == 1 ){
+      if( kji[ndims-2] == 0 && kji[ndims-1] == dims[ndims-1]-1 ){
+        if (directionVectors[ndims-1][ndims-1] == +1) isCorner = 1;
+      }
+    }
+    /* Odd  top row */
+    if( (kji[ndims-2] % 2) == 0 ){
+      if( kji[ndims-2] == dims[ndims-2]-1 && kji[ndims-1] == dims[ndims-1]-1 ){
+        if (directionVectors[ndims-1][ndims-1] == +1) isCorner = 1;
+      }
+    }
+
+    /* Found a corner */
+    if( isCorner == 1 && ndims == 2 ){
+      inside_domain = 0;
+      kji[0] = kji[0] + directionVectors[0][0];
+      return inside_domain;
+    }
+    else if( isCorner && ndims > 1 ){
+      for( m = 0; m < ndims-2; m++ ){
+        /* If the dimension of i is max'd out then the location is outside of
+         * the domain otherwise just increment the index by 1 */
+        if( kji[m] != dims[m]-1 ){
+          kji[m] = kji[m] + 1;
+          return inside_domain;
+        }
+        else{
+          inside_domain = 0;
+          kji[m] = kji[m] + 1;
+          return inside_domain;
+        }
+      }
+    }
+  }
+
+  /* Deal with non corners */
+  for( m = 0; m < ndims; m++ ) dir[m] = directionVectors[m][m];
+
+  kjiFI = nccf_get_flat_index( ndims, dims, kji );
+
+  /* Ignore the i-dimension */
+  for( m = ndims-1; m >= 1; m-- ){
+    currFI = flatIndices[m];
+    if( dir[m-1] > 0) di1 = 1;
+    if( dir[m-1] < 0) di2 = 1;
+    if( isCorner == 0 ){
+      if( kjiFI % (currFI+1) == 0 && (kji[m-1] % 2) == 1 && di1 == 1 ){
+        kji[m-1] = kji[m-1] + dir[m-1];
+        if( kji[m-1] > dims[m-1]-1 ) return 0;
+        return inside_domain;
+      }
+      if( kjiFI % (currFI+1) == 0 && (kji[m-1] % 2 == 0) && di2 == 1 ){
+        kji[m-1] = kji[m-1] + dir[m-1];
+        if( kji[m-1] > dims[m-1]-1 ) return 0;
+        return inside_domain;
+      }
+      if( kjiFI % (currFI+1) == currFI && (kji[m-1] % 2) == 0 && di1 == 1 ){
+        kji[m-1] = kji[m-1] + dir[m-1];
+        if( kji[m-1] > dims[m-1]-1 ) return 0;
+        return inside_domain;
+      }
+      if( kjiFI % (currFI+1) == currFI && (kji[m-1] % 2) == 1 && di2 == 1 ){
+        kji[m-1] = kji[m-1] + dir[m-1];
+        if( kji[m-1] > dims[m-1]-1 ) return 0;
+        return inside_domain;
+      }
+    }
+  }
+
+  kji[ndims-1] = kji[ndims-1] + dir[ndims-1];
+  
+  /* Clean up */
+
+  return inside_domain;
+
+}
diff --git a/src/nccf_find_next_indices.c b/src/nccf_find_next_indices.c
new file mode 100644
index 0000000..50938ea
--- /dev/null
+++ b/src/nccf_find_next_indices.c
@@ -0,0 +1,40 @@
+/**
+ * $Id: nccf_find_next_indices.c 903 2011-12-28 21:46:08Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <nccf_utility_functions.h>
+#include <nccf_constants.h>
+
+#include <cf_config.h>
+
+#define nccf_find_next_indices_TYPE nccf_find_next_indices_double
+#define _TYPE double
+#define nccf_get_position_TYPE nccf_get_position_double
+#define nccf_solve_TYPE nccf_solve_double
+#define _HUGE_TYPE CF_HUGE_DOUBLE
+#include <nccf_find_next_indices.h>
+#undef _HUGE_TYPE
+#undef nccf_solve_TYPE
+#undef nccf_get_position_TYPE
+#undef _TYPE
+#undef nccf_find_next_indices_TYPE
+
+#define nccf_find_next_indices_TYPE nccf_find_next_indices_float
+#define _TYPE float
+#define nccf_get_position_TYPE nccf_get_position_float
+#define nccf_solve_TYPE nccf_solve_float
+#define _HUGE_TYPE CF_HUGE_FLOAT
+#include <nccf_find_next_indices.h>
+#undef _HUGE_TYPE
+#undef nccf_solve_TYPE
+#undef nccf_get_position_TYPE
+#undef _TYPE
+#undef nccf_find_next_indices_TYPE
+
+
+
diff --git a/src/nccf_find_next_indices.h b/src/nccf_find_next_indices.h
new file mode 100644
index 0000000..a0b1db6
--- /dev/null
+++ b/src/nccf_find_next_indices.h
@@ -0,0 +1,86 @@
+/**
+ * $Id: nccf_find_next_indices.h 905 2011-12-29 04:56:48Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+int
+nccf_find_next_indices_TYPE(int ndims, const int dims[], 
+			    const _TYPE **coordData,
+                            const _TYPE coord_periodicity[],
+                            const _TYPE targetPos[],
+                            const _TYPE dIndices_in[],
+                            _TYPE dIndices_out[], 
+                            _TYPE position_out[]) {
+
+  int status, i, j, k;
+  int totError = 0;
+
+  _TYPE jac[ndims * ndims];
+  int loCornerIndx[ndims];
+  int bigIndex0;
+  int indx[ndims];
+  _TYPE idxDispl[ndims];
+  _TYPE posDispl[ndims];
+
+  status = nccf_get_position_TYPE(ndims, dims, coordData, 
+                                  coord_periodicity, targetPos,
+                                  dIndices_in, position_out);
+  totError += abs(status);
+
+  /* compute the position */
+  for (i = 0; i < ndims; ++i) {
+
+    posDispl[i] = targetPos[i] - position_out[i];
+    if (coord_periodicity[i] < _HUGE_TYPE) {
+      if (fabs((double)(posDispl[i] - coord_periodicity[i])) < 
+          fabs((double)posDispl[i])) {
+        posDispl[i] -= coord_periodicity[i];
+      }
+      if (fabs((double)(posDispl[i] + coord_periodicity[i])) < 
+          fabs((double)posDispl[i])) {
+        posDispl[i] += coord_periodicity[i];
+      }
+    }
+
+    loCornerIndx[i] = (int) floor(dIndices_in[i]);
+    loCornerIndx[i] = (loCornerIndx[i] >= dims[i] - 1? dims[i] - 2: loCornerIndx[i]);
+    loCornerIndx[i] = (loCornerIndx[i] < 0? 0: loCornerIndx[i]);
+
+    indx[i] = loCornerIndx[i];
+  }
+  bigIndex0 = nccf_get_flat_index(ndims, dims, loCornerIndx);
+
+  /* Jacobian */
+  int bigIndexPlus;
+  for (i = 0; i < ndims; ++i) {
+    for (j = 0; j < ndims; ++j) {
+      indx[j] += 1;
+      bigIndexPlus = nccf_get_flat_index(ndims, dims, indx);
+      k = j + ndims*i;
+      jac[k] = (coordData[i][bigIndexPlus] - coordData[i][bigIndex0]);
+      if (coord_periodicity[i] < _HUGE_TYPE) {
+        if (fabs((double)(jac[k] - coord_periodicity[i])) < 
+            fabs((double)jac[k])) {
+          jac[k] -= coord_periodicity[i];
+        }
+        if (fabs((double)(jac[k] + coord_periodicity[i])) < 
+            fabs((double)jac[k])) {
+          jac[k] += coord_periodicity[i];
+        }
+      }
+      indx[j] -= 1;
+    }
+  }
+
+  /* compute the increment */
+  status = nccf_solve_TYPE(ndims, jac, posDispl, idxDispl);
+  totError += abs(status);
+
+  /* compute the new index position */
+  for (i = 0; i < ndims; ++i) {
+    dIndices_out[i] = dIndices_in[i] + idxDispl[i];
+  }
+  
+  return totError;
+}
diff --git a/src/nccf_generate_id.c b/src/nccf_generate_id.c
new file mode 100644
index 0000000..c0f175b
--- /dev/null
+++ b/src/nccf_generate_id.c
@@ -0,0 +1,84 @@
+/*
+ * Create pseudo-random 32 digit alpha-numeric id.
+ *
+ * "$Id: nccf_generate_id.c 828 2011-09-14 20:05:08Z pletzer $"
+ * */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <netcdf.h>
+#include <cf_config.h>
+#ifdef HAVE_UUID_H
+#include <uuid/uuid.h>
+#endif
+
+#include <nccf_constants.h>
+#include <nccf_utility_functions.h>
+
+time_t get_string( int ulim, char *ostr, time_t beg ){
+
+  int i, dig;
+  double sec = 0;
+  int casetest;
+
+/* Loop over the number of digits in the signature */
+  for( i = 0; i < ulim; i++ ){
+    sec = beg + i;
+    srand48( sec );
+    dig = lrand48() % 36;
+    casetest = (i != 0);
+    switch( casetest ){
+      case 0:
+        if( dig <= 9 ) sprintf( ostr, "%c", dig + 48 );
+        if( dig >  9 ) sprintf( ostr, "%c", dig + 87 );
+        break;
+      case 1:
+        if( dig <= 9 ) sprintf( ostr, "%s%c", ostr, dig + 48 );
+        if( dig >  9 ) sprintf( ostr, "%s%c", ostr, dig + 87 );
+        break;
+    }
+  }
+
+  beg = sec;
+
+  return( sec );
+
+}
+
+int nccf_generate_id(int seed_adj, char *sigid){
+
+#ifdef HAVE_UUID_H
+  char s1[37]; // 36 characters + '\0'
+  uuid_t sgid;
+  uuid_generate( sgid );
+  uuid_unparse( sgid, s1 );
+  sprintf( sigid, "%s", s1 );
+#else
+  time_t t1;
+  char *ostr;
+  ostr = ( char* )calloc( STRING_SIZE, sizeof( char ));
+
+  ( void )time( &t1 );
+  t1 = t1 / ( float )seed_adj;
+  t1 = get_string( 8, ostr, t1 );
+  sprintf( sigid, "%s", ostr);
+  t1++;
+  t1 = get_string( 4, ostr, t1 );
+  sprintf( sigid, "%s-%s", sigid, ostr);
+  t1++;
+  t1 = get_string( 4, ostr, t1 );
+  sprintf( sigid, "%s-%s", sigid, ostr);
+  t1++;
+  t1 = get_string( 4, ostr, t1 );
+  sprintf( sigid, "%s-%s", sigid, ostr);
+  t1++;
+  t1 = get_string( 12, ostr, t1 );
+  sprintf( sigid, "%s-%s", sigid, ostr);
+
+  free( ostr );
+#endif
+
+  return NC_NOERR;
+
+}
diff --git a/src/nccf_get_bipolar_cap.c b/src/nccf_get_bipolar_cap.c
new file mode 100644
index 0000000..f1a8f7a
--- /dev/null
+++ b/src/nccf_get_bipolar_cap.c
@@ -0,0 +1,60 @@
+/**
+ * $Id: nccf_get_bipolar_cap.c 373 2011-01-14 19:53:49Z pletzer $
+ */
+
+#include <math.h>
+#include <netcdf.h>
+
+int nccf_get_bipolar_cap(const int dims[], 
+			 double latPerim, double lonSing,
+			 double lon[], double lat[]) {
+  int i,j;
+  latPerim = 90. - latPerim;
+  double Lc, Pc;
+  double L0 = 0.0; // lonSing * M_PI / 180.0;
+  double di = M_PI / (dims[0]-1);
+  double dj = M_PI / (dims[1]-1);
+  double Pc0 = -(M_PI/2.);
+  double Lc0 = -(M_PI/2.);
+  double lo, la;
+  for (j=0; j<dims[1]; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+      Pc = Pc0 + j*dj;
+      Lc = Lc0 + i*di;
+      lo = -L0 + atan2(sin(Lc), tan(Pc));
+      la = 0.5*M_PI  - 2*atan(tan(M_PI*latPerim/360.)*
+			      tan(0.5*acos((cos(Lc)*cos(Pc)))));
+      lon[i+j*dims[0]] = lo * 180./M_PI;
+      lat[i+j*dims[0]] = la * 180./M_PI;
+    }
+  }
+  return NC_NOERR;
+}
+
+int nccf_get_bipolar_cap2(const int dims[], 
+			 double latPerim, double lonSing,
+			 double lon[], double lat[]) {
+  int i,j;
+  latPerim = 90. - latPerim;
+  double Lc, Pc;
+  double L0 = 0.0; // lonSing * M_PI / 180.0;
+  double di = M_PI / (dims[0]-1);
+  double dj = M_PI / (dims[1]-1);
+  double Pc0 = -(M_PI/2.);
+  double Lc0 = -(M_PI/2.);
+  double lo, la;
+  for (j=0; j<dims[1]; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+      Pc = Pc0 + j*dj;
+      Lc = Lc0 + i*di;
+      lo = -L0 + atan2(sin(Lc), tan(Pc));
+      la = 0.5*M_PI  - 2*atan(tan(M_PI*latPerim/360.)*
+			      tan(0.5*acos((cos(Lc)*cos(Pc)))));
+      lon[i+j*dims[0]] = lo * 180./M_PI;
+      lat[i+j*dims[0]] = la * 180./M_PI;
+    }
+  }
+  return NC_NOERR;
+}
+
+
diff --git a/src/nccf_get_cubedsphere_grid.c b/src/nccf_get_cubedsphere_grid.c
new file mode 100644
index 0000000..a59d795
--- /dev/null
+++ b/src/nccf_get_cubedsphere_grid.c
@@ -0,0 +1,56 @@
+/**
+ * $Id: nccf_get_cubedsphere_grid.c 373 2011-01-14 19:53:49Z pletzer $
+ */
+
+#include <math.h>
+#include <netcdf.h>
+
+double nccf_norm(double v[]) {
+  return sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
+}
+
+void nccf_cross_product(double v[], const double w[], double res[]) {
+  res[0] = v[1]*w[2] - v[2]*w[1];
+  res[1] = v[2]*w[0] - v[0]*w[2];
+  res[2] = v[0]*w[1] - v[1]*w[0];
+}
+
+int nccf_get_cubedsphere_grid(const int dims[], const int faceVect[], 
+			      double lon[], double lat[]) {
+
+  int i,j,n;
+	double iUnit[3];
+	double jUnit[3];
+	double tempVec[3];
+
+	for (n=0; n<3; ++n)
+		tempVec[n] = (double) faceVect[n];
+
+	iUnit[0] = (double) faceVect[2];
+	iUnit[1] = (double) faceVect[0];
+	iUnit[2] = (double) faceVect[1];
+
+	nccf_cross_product(tempVec, iUnit, jUnit);
+
+	for (n=0; n<3; ++n) {
+		// start position in corner
+		tempVec[n] -= (iUnit[n] + jUnit[n]);
+		// shrink unit vectors down to gridspacing-size
+		iUnit[n] *= 2./(dims[0]-1);
+		jUnit[n] *= 2./(dims[1]-1);
+	}
+
+	double x,y,z;
+	for (j=0; j<dims[1]; ++j) {
+		for (i=0; i<dims[0]; ++i) {
+			x = tempVec[0] + i*iUnit[0] + j*jUnit[0];
+			y = tempVec[1] + i*iUnit[1] + j*jUnit[1];
+			z = tempVec[2] + i*iUnit[2] + j*jUnit[2];
+			lon[i + j*dims[0]] = atan2(y,x) * (180./M_PI);
+			lat[i + j*dims[0]] = atan2(z, sqrt(pow(x,2) + 
+					pow(y,2))) * (180./M_PI);
+		}
+	}
+
+  return NC_NOERR;
+}
diff --git a/src/nccf_get_distance_in_coord.c b/src/nccf_get_distance_in_coord.c
new file mode 100644
index 0000000..a7fea1a
--- /dev/null
+++ b/src/nccf_get_distance_in_coord.c
@@ -0,0 +1,27 @@
+/* $Id: nccf_get_distance_in_coord.c 903 2011-12-28 21:46:08Z pletzer $ 
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+#include <math.h>
+#include <nccf_constants.h>
+#include <nccf_utility_functions.h>
+
+#define _TYPE double 
+#define nccf_get_distance_in_coord_TYPE nccf_get_distance_in_coord_double
+#define nccf_get_position_TYPE nccf_get_position_double
+#define _HUGE_TYPE CF_HUGE_DOUBLE
+#include "nccf_get_distance_in_coord.h"
+#undef _HUGE_TYPE
+#undef nccf_get_position_TYPE
+#undef nccf_get_distance_in_coord_TYPE
+#undef _TYPE
+
+#define _TYPE float
+#define nccf_get_distance_in_coord_TYPE nccf_get_distance_in_coord_float
+#define nccf_get_position_TYPE nccf_get_position_float
+#define _HUGE_TYPE CF_HUGE_FLOAT
+#include "nccf_get_distance_in_coord.h"
+#undef _HUGE_TYPE
+#undef nccf_get_position_TYPE
+#undef nccf_get_distance_in_coord_TYPE
+#undef _TYPE
diff --git a/src/nccf_get_distance_in_coord.h b/src/nccf_get_distance_in_coord.h
new file mode 100644
index 0000000..8758781
--- /dev/null
+++ b/src/nccf_get_distance_in_coord.h
@@ -0,0 +1,25 @@
+/* $Id: nccf_get_distance_in_coord.h 905 2011-12-29 04:56:48Z pletzer $ 
+ *  \author Alexander Pletzer, Tech-X Corp.
+ */
+
+int
+nccf_get_distance_in_coord_TYPE(int ndims, const int dims[], 
+				const _TYPE **coordData,
+                                const _TYPE coord_periodicity[],
+				const _TYPE targetPos[],
+				const _TYPE dindices[],
+                                _TYPE *distance) {
+  int i;
+  _TYPE xPos[ndims];
+  nccf_get_position_TYPE(ndims, dims, coordData, 
+                         coord_periodicity, targetPos, 
+                         dindices, xPos);
+  *distance = 0;
+  _TYPE diff;
+  for (i = 0; i < ndims; ++i) {
+    diff = targetPos[i] - xPos[i];
+    *distance += diff * diff;
+  }
+  *distance = sqrt(*distance);
+  return 0;
+}
diff --git a/src/nccf_get_flat_index.c b/src/nccf_get_flat_index.c
new file mode 100644
index 0000000..b779d2c
--- /dev/null
+++ b/src/nccf_get_flat_index.c
@@ -0,0 +1,14 @@
+/**
+ * $Id: nccf_get_flat_index.c 373 2011-01-14 19:53:49Z pletzer $
+ */
+
+int nccf_get_flat_index(int ndims, const int dims[], const int inx[]) {
+  int res = 0;
+  int nProd = 1;
+  int i;
+  for (i = ndims - 1; i >= 0; --i) {
+    res += nProd * inx[i];
+    nProd *= dims[i];
+  }
+  return res;
+}
diff --git a/src/nccf_get_linear_weights.c b/src/nccf_get_linear_weights.c
new file mode 100644
index 0000000..54069f7
--- /dev/null
+++ b/src/nccf_get_linear_weights.c
@@ -0,0 +1,32 @@
+/**
+ * $Id: nccf_get_linear_weights.c 651 2011-03-30 22:24:46Z pletzer $
+ */
+
+#include <float.h>
+#include <math.h>
+#include <stdio.h>
+#include <netcdf.h>
+#include <nccf_utility_functions.h>
+
+#include <assert.h> // DEBUG
+
+#define nccf_get_linear_weights_TYPE nccf_get_linear_weights_double
+#define _TYPE double
+#define _EPS (10*DBL_EPSILON)
+#define nccf_solve_TYPE nccf_solve_double
+#include <nccf_get_linear_weights.h>
+#undef nccf_solve_TYPE
+#undef _EPS
+#undef _TYPE
+#undef nccf_get_linear_weights_TYPE
+
+#define nccf_get_linear_weights_TYPE nccf_get_linear_weights_float
+#define _TYPE float
+#define _EPS (10*FLT_EPSILON)
+#define nccf_solve_TYPE nccf_solve_float
+#include <nccf_get_linear_weights.h>
+#undef nccf_solve_TYPE
+#undef _EPS
+#undef _TYPE
+#undef nccf_get_linear_weights_TYPE
+
diff --git a/src/nccf_get_linear_weights.h b/src/nccf_get_linear_weights.h
new file mode 100644
index 0000000..099c2f6
--- /dev/null
+++ b/src/nccf_get_linear_weights.h
@@ -0,0 +1,163 @@
+/**
+ * $Id: nccf_get_linear_weights.h 891 2011-12-21 17:22:02Z pletzer $
+ */
+
+int nccf_get_linear_weights_TYPE(int ndims, const int dims[], 
+                                 const _TYPE dindices[],
+                                 const int imask[],
+                                 _TYPE weights[]) {
+  int i, j, k;
+  int num_invalid;
+  int all_weights_zero = 1;
+  int bi, neigh_bi;
+  int ier;
+  int num_invalid_corners;
+
+  // find the lower corner set of indices,
+  // the number of nodes in the cell, and the
+  // total number of nodes
+  int loCornerIndx[ndims];
+  int nNodes = 1;
+  int ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    loCornerIndx[i] = (int) floor(dindices[i]);
+    nNodes *= 2;
+    ntot *= dims[i];
+  }
+  
+  // iterate over all nodes with the cell
+  int displ[ndims]; // intra cell displacements from loCornerIndx
+  int indx[ndims];  // index set
+  int indxBar; // 1 - indx
+  int neigh_jindx[ndims];  // the node index 0...2^ndims of the neighbor node
+  int neigh_indx[ndims][ndims]; // the neighbor index sets
+  int valid_nodes[nNodes]; // list of valid nodes in cell
+  int offset[ndims]; // offsets from reference node, aka (1, 0, 0)
+
+  _TYPE xis[ndims]; // triangular parametrization
+  _TYPE rhs[ndims]; // target position - reference node position
+  _TYPE mat[ndims*ndims]; // matrix of (neigh position - ref node position)
+  _TYPE sum_xi;
+
+  int prodDims[ndims];
+  prodDims[ndims - 1] = 1; 
+  for (i = ndims - 2; i >= 0; --i) {
+    prodDims[i] = prodDims[i + 1] * 2;
+  }
+
+  num_invalid = 0;
+  for (j = 0; j < nNodes; ++j) {
+
+    valid_nodes[j] = 1;
+
+    // compute the index set of the node, the index set opposite to 
+    // the node, and the quad interp weights
+    weights[j] = 1.0;
+    for (i = 0; i < ndims; ++i) {
+      displ[i] = j / prodDims[i] % 2; // vector of 0s and 1s
+      indx[i] = loCornerIndx[i] + displ[i];
+      indxBar = loCornerIndx[i] + 1 - displ[i];
+      weights[j] *= fabs(dindices[i] - (_TYPE)indxBar);
+    }
+
+    if (imask != NULL) {
+      bi = nccf_get_flat_index(ndims, dims, indx);
+      bi = (bi > ntot - 1? ntot - 1: bi);
+      bi = (bi < 0? 0: bi);
+      if (imask[bi] == 0) {
+	num_invalid++;
+	valid_nodes[j] = 0;
+      }
+    }
+  } // end of cell node iteration
+
+  if (imask != NULL && num_invalid !=0) {
+    
+    for (j = 0; j < nNodes; ++j) {
+      // default is no interpolation
+      weights[j] = 0;
+    } 
+
+    if (nNodes - num_invalid >= ndims + 1) {
+      // try tri interpolation 
+      for (j = 0; j < nNodes; ++j) {
+	if (valid_nodes[j] == 1) {
+	  // there is hope that tri interpolation will work. However,
+	  // will need to have all the closest neighbors to be also 
+	  // valid
+	  for (i = 0; i < ndims; ++i) {
+	    displ[i] = j / prodDims[i] % 2;
+	    indx[i] = loCornerIndx[i] + displ[i];
+	  }
+	  bi = nccf_get_flat_index(ndims, dims, indx);
+	  bi = (bi > ntot - 1? ntot - 1: bi);
+	  bi = (bi < 0? 0: bi);
+	  num_invalid_corners = 0;
+	  for (k = 0; k < ndims; ++k) {
+	    // iterate over directions
+	    for (i = 0; i < ndims; ++i) {
+	      offset[i] = 0;
+	      neigh_indx[k][i] = indx[i];
+	    }
+	    // if displ[k] == 0 then offset[k] = 1
+	    // if displ[k] == 1 then offset[k] = -1
+	    offset[k] = 1 - 2*displ[k];
+	    neigh_jindx[k] = 0;
+	    for (i = 0; i < ndims; ++i) {
+	      neigh_indx[k][i] += offset[i];
+	      neigh_jindx[k] += (displ[i] + offset[i])*prodDims[i];
+	    }
+	    neigh_bi = nccf_get_flat_index(ndims, dims, neigh_indx[k]);
+	    neigh_bi = (neigh_bi > ntot - 1? ntot - 1: neigh_bi);
+	    neigh_bi = (neigh_bi < 0? 0: neigh_bi);
+	    if (imask[neigh_bi] == 0) {
+	      num_invalid_corners++;
+	      // no good, cannot interpolate, must have ndims valid neighbors
+	      break; // k loop
+	    }
+	  } // end of k loop
+	  if (num_invalid_corners == 0) {
+	    // if we reached this point then we may be able to
+	    // apply tri interpolation. solve for the xi cell parametrization.
+	    // The xis must be within [0, 1] and sum xi <=1.
+	    for (i = 0; i < ndims; ++i) {
+	      rhs[i] = dindices[i] - indx[i];
+	      for (k = 0; k < ndims; ++k) {
+		mat[i*ndims + k] = neigh_indx[k][i] - indx[i];
+	      }
+	    }
+	    ier = nccf_solve_TYPE(ndims, mat, rhs, xis);
+	    int test_interp = 1;
+	    // sum of all xis <= 1 for the target point to be in the triangle
+	    sum_xi = 0;
+	    for (i = 0; i < ndims; ++i) {
+	      sum_xi += xis[i];
+	      if (xis[i] < 0 - _EPS || xis[i] > 1 + _EPS) {
+		test_interp = 0;
+	      }
+	    }
+	    if (test_interp == 1 && sum_xi < 1 + _EPS) {
+	      // now set the weights
+	      weights[j] =  1 - sum_xi;
+	      for (k = 0; k < ndims; ++k) {
+		weights[neigh_jindx[k]] = xis[k];
+	      }
+	      all_weights_zero = 0; // success
+	      break; // finish j loop
+	    }
+	  }   // num_invalid_corners test
+	} // valid_nodes test
+      } // j loop
+    } // number of invalid nodes test
+  } // mask test
+
+  if (num_invalid != 0 && all_weights_zero != 0) {
+    // no interpolation was possible (too many invalid data in
+    //                                in this cell)
+    return -num_invalid; 
+  }
+  else {
+    // 0=all data are valid, >0 triangular interpolation was successful
+    return num_invalid;
+  }
+}
diff --git a/src/nccf_get_multi_index.c b/src/nccf_get_multi_index.c
new file mode 100644
index 0000000..2c55ccf
--- /dev/null
+++ b/src/nccf_get_multi_index.c
@@ -0,0 +1,16 @@
+/**
+ * $Id: nccf_get_multi_index.c 373 2011-01-14 19:53:49Z pletzer $
+ */
+
+void nccf_get_multi_index(int ndims, const int dims[], int index, int inx[]) {
+  int i;
+  /* prodDims would be (n1*n2, n2, 1) for dims == (n0, n1, n2) */
+  int prodDims[ndims];
+  prodDims[ndims - 1] = 1;
+  for (i = ndims - 2; i >= 0; --i) {
+    prodDims[i] = prodDims[i + 1] * dims[i + 1];
+  }
+  for (i = 0; i < ndims; ++i) {
+    inx[i] = index / prodDims[i] % dims[i];
+  }
+}
diff --git a/src/nccf_get_position.c b/src/nccf_get_position.c
new file mode 100644
index 0000000..2ffc783
--- /dev/null
+++ b/src/nccf_get_position.c
@@ -0,0 +1,44 @@
+/**
+ * $Id: nccf_get_position.c 905 2011-12-29 04:56:48Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+#include <stdlib.h>
+#include <math.h>
+#include <netcdf.h> // for NC_FILL_DOUBLE, ...
+#include <nccf_utility_functions.h>
+#include <nccf_constants.h>
+
+#define nccf_get_position_TYPE nccf_get_position_double
+#define _TYPE double
+#define _FILL_VALUE NC_FILL_DOUBLE
+#define nccf_linear_interp_TYPE nccf_linear_interp_double
+#define nccf_linear_interp_mod_TYPE nccf_linear_interp_mod_double
+#define nccf_get_linear_weights_TYPE nccf_get_linear_weights_double
+#define _HUGE_TYPE CF_HUGE_DOUBLE
+#include <nccf_get_position.h>
+#undef _HUGE_TYPE
+#undef nccf_get_linear_weights_TYPE
+#undef nccf_linear_interp_mod_TYPE
+#undef nccf_linear_interp_TYPE
+#undef _FILL_VALUE
+#undef _TYPE
+#undef nccf_get_position_TYPE
+
+#define nccf_get_position_TYPE nccf_get_position_float
+#define _TYPE float
+#define _FILL_VALUE NC_FILL_FLOAT
+#define nccf_linear_interp_TYPE nccf_linear_interp_float
+#define nccf_linear_interp_mod_TYPE nccf_linear_interp_mod_float
+#define nccf_get_linear_weights_TYPE nccf_get_linear_weights_float
+#define _HUGE_TYPE CF_HUGE_FLOAT
+#include <nccf_get_position.h>
+#undef _HUGE_TYPE
+#undef nccf_get_linear_weights_TYPE
+#undef nccf_linear_interp_mod_TYPE
+#undef nccf_linear_interp_TYPE
+#undef _FILL_VALUE
+#undef _TYPE
+#undef nccf_get_position_TYPE
+
diff --git a/src/nccf_get_position.h b/src/nccf_get_position.h
new file mode 100644
index 0000000..2d73436
--- /dev/null
+++ b/src/nccf_get_position.h
@@ -0,0 +1,48 @@
+/**
+ * $Id: nccf_get_position.h 905 2011-12-29 04:56:48Z pletzer $
+ *
+ * \author Alexander Pletzer, Tech-X Corp.
+ */
+
+int
+nccf_get_position_TYPE(int ndims, const int dims[],
+                       const _TYPE **coordData,
+                       const _TYPE coord_periodicity[],
+                       const _TYPE pos_ref[],
+                       const _TYPE dindices[],
+                       _TYPE position[]) {
+
+  int status, i;
+  int totError = 0;
+  _TYPE *weights = (_TYPE *) malloc( pow(2, ndims) * sizeof(_TYPE) );
+
+  status = nccf_get_linear_weights_TYPE(ndims, dims, 
+					dindices,
+					NULL,
+					weights);
+  totError += abs(status);
+
+  for (i = 0; i < ndims; ++i) {
+    if (pos_ref && coord_periodicity[i] < _HUGE_TYPE) {
+      status = nccf_linear_interp_mod_TYPE(ndims, dims, 
+                                           coordData[i],
+                                           pos_ref[i],
+                                           coord_periodicity[i], 
+                                           dindices, weights, 
+                                           _FILL_VALUE, 
+                                           &position[i]);
+    }
+    else {
+      status = nccf_linear_interp_TYPE(ndims, dims, 
+                                       coordData[i], 
+                                       dindices, weights, 
+                                       _FILL_VALUE, 
+                                       &position[i]);      
+    }
+    totError += abs(status);
+  }
+
+  free(weights);
+
+  return totError;
+}
diff --git a/src/nccf_get_start_end_bound_indices.c b/src/nccf_get_start_end_bound_indices.c
new file mode 100644
index 0000000..9076eb1
--- /dev/null
+++ b/src/nccf_get_start_end_bound_indices.c
@@ -0,0 +1,24 @@
+/**
+ * $Id: nccf_get_start_end_bound_indices.c 409 2011-01-19 18:06:34Z pletzer $
+ */
+
+void nccf_get_start_end_bound_indices(int ndims, const int dims[], 
+					 const int normalVect[],
+					 int exclusive,
+					 int startIndices[],
+					 int endIndices[]) {
+  int i;
+  for (i = 0; i < ndims; ++i) {
+    /* by default, cover the entire domain */
+    startIndices[i] = 0;
+    endIndices[i] = dims[i] - 1 + exclusive;
+    if (normalVect[i] > 0) {
+      /* north, east, front, ... */
+      startIndices[i] = dims[i] - 1;
+    }
+    else if (normalVect[i] < 0) {
+      /* south, west, back, ... */
+      endIndices[i] = 0 + exclusive;
+    }
+  }
+}
diff --git a/src/nccf_get_tripolar_grid.c b/src/nccf_get_tripolar_grid.c
new file mode 100644
index 0000000..a371e7b
--- /dev/null
+++ b/src/nccf_get_tripolar_grid.c
@@ -0,0 +1,64 @@
+/**
+ * $Id: nccf_get_tripolar_grid.c 373 2011-01-14 19:53:49Z pletzer $
+ */
+
+#include <math.h>
+#include <netcdf.h>
+
+int nccf_get_tripolar_grid(const int dims[], int capIndx,
+    double lon[], double lat[]) {
+  int i,j;
+  double L, P, Lc, Pc, Pc0, Lc0, latPerim;
+  double L0 = 0.;
+  double di = 2*M_PI / (dims[0]-1);
+  double dj = M_PI / (dims[1]-1);
+
+  Pc0 = -0.5*M_PI;
+  Lc0 = -M_PI;
+
+  for (j=0; j < capIndx; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+      P = Pc0 + j*dj;
+      L = Lc0 + i*di;
+      lon[i+j*dims[0]] = L;
+      lat[i+j*dims[0]] = P;
+
+      lon[i+j*dims[0]] *= 180./M_PI;
+      lat[i+j*dims[0]] *= 180./M_PI;
+    }
+  }
+
+  latPerim = M_PI - capIndx*dj;
+  //di = M_PI / (dims[0]-1);
+  dj = (0.5*M_PI) / (dims[1]-capIndx-1);
+  Pc0 = -(M_PI/2.);
+  Lc0 = (M_PI/2.);
+  for (j=capIndx; j<dims[1]; ++j) {
+    for (i=0; i<dims[0]/2; ++i) {
+      Pc = Pc0 + i*di;
+      Lc = Lc0 - (j-capIndx)*dj;
+      lon[i+j*dims[0]] = L0 - atan2(sin(Lc), tan(Pc));
+      lat[i+j*dims[0]] = 0.5*M_PI  - 2.*atan(tan(latPerim/2.)*
+          tan(0.5*acos((cos(Lc)*cos(Pc)))));
+
+      lon[i+j*dims[0]] *= 180./M_PI;
+      lat[i+j*dims[0]] *= 180./M_PI;
+    }
+  }
+
+  Pc0 = -(M_PI/2.);
+  Lc0 = -(M_PI/2.);
+  for (j=capIndx; j<dims[1]; ++j) {
+    for (i=dims[0]/2; i<dims[0]; ++i) {
+      Pc = Pc0 + (dims[0]-i-1)*di;
+      Lc = Lc0 + (1-1.e-10)*(j-capIndx)*dj;
+      lon[i+j*dims[0]] = L0 - atan2(sin(Lc), tan(Pc));
+      lat[i+j*dims[0]] = 0.5*M_PI  - 2.*atan(tan(latPerim/2.)*
+          tan(0.5*acos((cos(Lc)*cos(Pc)))));
+
+      lon[i+j*dims[0]] *= 180./M_PI;
+      lat[i+j*dims[0]] *= 180./M_PI;
+    }
+  }
+  return NC_NOERR;
+}
diff --git a/src/nccf_get_tripolar_halfgrid.c b/src/nccf_get_tripolar_halfgrid.c
new file mode 100644
index 0000000..8d92092
--- /dev/null
+++ b/src/nccf_get_tripolar_halfgrid.c
@@ -0,0 +1,72 @@
+/**
+ * $Id: nccf_get_tripolar_halfgrid.c 373 2011-01-14 19:53:49Z pletzer $
+ */
+
+#include <math.h>
+#include <netcdf.h>
+
+int nccf_get_tripolar_halfgrid(const int dims[], int wchHalf, int capIndx,
+    double lon[], double lat[]) {
+  int i,j;
+  double L, P, L0, P0, Lc, Pc, Pc0, Lc0, latPerim;
+  double Lshift = 0.;
+  double di = M_PI / (dims[0]-1);
+  double dj = M_PI / (dims[1]-1);
+
+  P0 = -0.5*M_PI;
+  if (wchHalf)
+    L0 = 0.;
+  else
+    L0 = -M_PI;
+
+  for (j=0; j < capIndx; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+      P = P0 + j*dj;
+      L = L0 + i*di;
+      lon[i+j*dims[0]] = L;
+      lat[i+j*dims[0]] = P;
+
+      lon[i+j*dims[0]] *= 180./M_PI;
+      lat[i+j*dims[0]] *= 180./M_PI;
+    }
+  }
+
+  latPerim = M_PI - capIndx*dj;
+  //di = M_PI / (dims[0]-1);
+  dj = (0.5*M_PI) / (dims[1]-capIndx-1);
+
+  if (wchHalf) {
+    Pc0 = -(M_PI/2.);
+    Lc0 = -(M_PI/2.);
+    for (j=capIndx; j<dims[1]; ++j) {
+      for (i=0; i<dims[0]; ++i) {
+        Pc = Pc0 + (dims[0]-i-1)*di;
+        Lc = Lc0 + (1-1.e-10)*(j-capIndx)*dj;
+        lon[i+j*dims[0]] = Lshift - atan2(sin(Lc), tan(Pc));
+        lat[i+j*dims[0]] = 0.5*M_PI  - 2.*atan(tan(latPerim/2.)*
+            tan(0.5*acos((cos(Lc)*cos(Pc)))));
+
+        lon[i+j*dims[0]] *= 180./M_PI;
+        lat[i+j*dims[0]] *= 180./M_PI;
+      }
+    }
+  }
+  else {
+    Pc0 = -(M_PI/2.);
+    Lc0 = (M_PI/2.);
+    for (j=capIndx; j<dims[1]; ++j) {
+      for (i=0; i<dims[0]; ++i) {
+        Pc = Pc0 + i*di;
+        Lc = Lc0 - (j-capIndx)*dj;
+        lon[i+j*dims[0]] = Lshift - atan2(sin(Lc), tan(Pc));
+        lat[i+j*dims[0]] = 0.5*M_PI  - 2.*atan(tan(latPerim/2.)*
+            tan(0.5*acos((cos(Lc)*cos(Pc)))));
+
+        lon[i+j*dims[0]] *= 180./M_PI;
+        lat[i+j*dims[0]] *= 180./M_PI;
+      }
+    }
+  }
+
+  return NC_NOERR;
+}
diff --git a/src/nccf_handle_error.c b/src/nccf_handle_error.c
new file mode 100644
index 0000000..115f124
--- /dev/null
+++ b/src/nccf_handle_error.c
@@ -0,0 +1,41 @@
+/*
+ * Global nchandle error
+ *
+ * "$Id: nccf_handle_error.c 606 2011-03-25 04:11:05Z pletzer $"
+ * */
+#include <stdio.h>
+#include <assert.h>
+#include <nccf_errors.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+const char *nccf_strerror(int err);
+
+void nccf_handle_error( const char *filename, int linenumber, int status ){
+
+  if (status) {
+    printf("In %s at line: %d, ERR = %d (netcdf: %s) (libcf: %s)\n",  
+	   filename, linenumber, status, 
+	   nc_strerror(status), nccf_strerror(status));
+    assert(0 == 1); /* crash */
+  }
+}
+
+void ncgs_handle_error( const char *filename, int linenumber, int status, 
+                        const char *errmsg ){
+
+  if (status) {
+    printf( "In %s at line: %d,  %s )\n", filename, 
+                                          linenumber, 
+                                          errmsg );
+    assert(0 == 1); /* crash */
+  }
+}
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
diff --git a/src/nccf_index2vector.c b/src/nccf_index2vector.c
new file mode 100644
index 0000000..cdaffbc
--- /dev/null
+++ b/src/nccf_index2vector.c
@@ -0,0 +1,37 @@
+/**
+ * PURPOSE: Convert an index into a vector of -1, 0, and 1
+ * \author Dave Kindig, Tech-X Corp.
+ * "$Id: nccf_index2vector.c 467 2011-01-27 07:17:59Z dkindig $"
+ */
+
+#include <stdio.h>
+#include <math.h>
+
+int nccf_index2vector(int index, int ndims, int vector[]){
+
+    int mod, div, sign;
+    int i;
+
+/* Normal vector +/- */
+    div = index / 2;   
+    mod = index % 2;
+
+    switch (mod) {
+      case 0: 
+        sign = -1;
+        break;
+      default:
+      /* mod is 1 */
+      sign =  1;
+    }
+
+    /* Zero out the vector*/
+    for( i = 0; i < ndims; i++ ){
+      vector[i] = 0;
+    }
+
+    /* Populate the vector */
+    vector[div] = 1 * sign;
+
+    return 0;
+}
diff --git a/src/nccf_index_to_corner_vector.c b/src/nccf_index_to_corner_vector.c
new file mode 100644
index 0000000..04f94de
--- /dev/null
+++ b/src/nccf_index_to_corner_vector.c
@@ -0,0 +1,24 @@
+/**
+ * $Id: nccf_index_to_corner_vector.c 373 2011-01-14 19:53:49Z pletzer $
+ */
+
+#include <netcdf.h>
+
+int nccf_index_to_corner_vector(int index, int ndims, int vector[]) {
+  /*
+    Given an index in the range 3^ndims, return a unique 
+    vector whose elements are -1, 0, or 1
+  */
+
+  int i, j;
+  int powersOfThree;
+  for (i = 0; i < ndims; ++i) {
+    powersOfThree = 1;
+    for (j = 0; j < i; ++j) {
+      powersOfThree *= 3;
+    }
+    vector[i] = (index / powersOfThree % 3) - 1;
+  }
+
+  return NC_NOERR;
+}
diff --git a/src/nccf_keyvalue.c b/src/nccf_keyvalue.c
new file mode 100644
index 0000000..1f2c35f
--- /dev/null
+++ b/src/nccf_keyvalue.c
@@ -0,0 +1,131 @@
+/**
+ * $Id: nccf_keyvalue.c 671 2011-04-04 20:00:43Z pletzer $
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <nccf_keyvalue.h>
+
+void nccf_kv_new(struct CFLISTITEM **lst) {
+  nccf_li_new(lst);
+}
+
+void nccf_kv_del(struct CFLISTITEM **lst) {
+  nccf_li_begin(lst);
+  while (nccf_li_next(lst)) {
+    int id = nccf_li_get_id(lst);
+    struct nccf_kv *kv = nccf_li_remove(lst, id);
+    free(kv->key);
+    free(kv->val);
+    free(kv);
+  }
+  nccf_li_del(lst);  
+}
+
+void nccf_kv_get_value(struct CFLISTITEM **lst, const char *key, 
+		       nc_type *type, int *nelem,  const void **val) {
+  nccf_li_begin(lst);
+  while (nccf_li_next(lst)) {
+    struct nccf_kv *kv = (*lst)->data;
+    if ( strcmp(kv->key, key) == 0 ) {
+      *type = kv->type;
+      *nelem = kv->nelem;
+      *val = kv->val;
+      return;
+    }
+  }
+  *type = NC_NAT;
+  *nelem = 0;
+  *val = NULL;
+}
+
+void nccf_kv_add(struct CFLISTITEM **lst, const char *key, 
+		 nc_type type, int nelem, const void *val) {
+  int i;
+  void *values;
+  // make a copy of the data
+  if (type == NC_CHAR) {
+    char *vc = strdup(val);
+    nelem = strlen(vc) + 1; // should we add '\0' to the length?
+    values = vc;
+  } 
+  else if (type == NC_DOUBLE) {
+    double *vd = malloc(nelem * sizeof(double));
+    double *v = (double *) val;
+    for (i = 0; i < nelem; ++i) {
+      vd[i] = v[i];
+    }
+    values = vd;
+  }
+  else if (type == NC_FLOAT) {
+    float *vf = malloc(nelem * sizeof(float));
+    float *v = (float *) val;
+    for (i = 0; i < nelem; ++i) {
+      vf[i] = v[i];
+    }
+    values = vf;
+  }
+  else if (type == NC_INT) {
+    int *vi = malloc(nelem * sizeof(int));
+    int *v = (int *) val;
+    for (i = 0; i < nelem; ++i) {
+      vi[i] = v[i];
+    }
+    values = vi;
+  }
+  else if (type == NC_SHORT) {
+    short *vi = malloc(nelem * sizeof(int));
+    short *v = (short *) val;
+    for (i = 0; i < nelem; ++i) {
+      vi[i] = v[i];
+    }
+    values = vi;
+  }
+  else {
+    // should catch this error!!
+  }
+
+  // find whether there already is an entry
+  struct nccf_kv *kv2 = NULL;
+  int has_key = 0;
+  nccf_li_begin(lst);
+  while (nccf_li_next(lst)) {
+    kv2 = (*lst)->data;
+    if (strcmp(kv2->key, key) == 0) {
+      has_key = 1;
+      break;
+    }
+  }
+  if (has_key) {
+    // replace (swap pointers)
+    void *val3 = kv2->val;
+    kv2->val = values;
+    kv2->type = type;
+    kv2->nelem = nelem;
+    free(val3);
+  }
+  else {
+    // new entry
+    struct nccf_kv *kv = malloc(sizeof(struct nccf_kv));
+    kv->key = strdup(key);
+    kv->type = type;
+    kv->nelem = nelem;
+    kv->val = values;
+    nccf_li_add(lst, kv);    
+  }
+}
+
+void nccf_kv_begin(struct  CFLISTITEM **lst) {
+  nccf_li_begin(lst);
+}
+
+int nccf_kv_next(struct  CFLISTITEM **lst) {
+   return nccf_li_next(lst);
+}
+
+void nccf_kv_get_key(struct  CFLISTITEM **lst, const char **key) {
+  if (*lst) {
+    struct nccf_kv *kv = (*lst)->data;
+    *key = kv->key;
+  }
+}
diff --git a/src/nccf_keyvalue.h b/src/nccf_keyvalue.h
new file mode 100644
index 0000000..76a3b56
--- /dev/null
+++ b/src/nccf_keyvalue.h
@@ -0,0 +1,91 @@
+/**
+ * C object behaving like an associative array
+ * 
+ * $Id: nccf_keyvalue.h 833 2011-09-14 20:50:14Z pletzer $
+ */
+
+#ifndef NCCF_KEYVALUE
+#define NCCF_KEYVALUE
+
+#include <netcdf.h>
+#include "cflistitem.h"
+
+struct nccf_kv {
+  char *key;      // key used to access elements
+  nc_type type;   // type of the element
+  int nelem;      // number of element stored
+  void *val;      // value attached to each element
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Constructor
+ * \param lst handle to the object
+ */
+void nccf_kv_new(struct CFLISTITEM **lst);
+
+/**
+ * Destructor
+ * \param lst handle to the object
+ */
+void nccf_kv_del(struct CFLISTITEM **lst);
+
+/**
+ * Access element by key
+ * \param lst handle to the object
+ * \param key key 
+ * \param nc_type type of the element (output)
+ * \param nelem number of elements (output)
+ * \param val pointer to the value(s) (output)
+ * 
+ * \note NULL will be returned for val if the key is not found.
+ * The caller does NOT own the pointer. 
+ */
+void nccf_kv_get_value(struct CFLISTITEM **lst, const char *key, 
+		       nc_type *type, int *nelem, const void **val);
+
+/**
+ * Add an element, replacing the one already stored if need be.
+ * \param lst handle to the object
+ * \param key key 
+ * \param nc_type type of the element
+ * \param nelem number of elements
+ * \param val pointer to the value(s)
+ * 
+ * \note the val values will be copied so caller is responsible 
+ * deallocating the memory associated with keys and values. For 
+ * char * strings, nelem will not be used. Use nelem = 1 for 
+ * scalars. 
+ */
+void nccf_kv_add(struct CFLISTITEM **lst, const char *key, 
+		 nc_type type, int nelem, const void *val);
+/**
+ * Set iterator to begin.
+ * \param lst handle to the object
+ */
+void nccf_kv_begin(struct  CFLISTITEM **lst);
+
+/**
+ * Move the iterator by one step
+ * \param lst handle to the object
+ * \return 1 if the iterator is valid, 0 otherwise
+ */
+int nccf_kv_next(struct  CFLISTITEM **lst);
+
+/**
+ * Get the current key
+ * \param lst handle to the object
+ * \param key pointer to the key 
+ * 
+ * \note caller does NOT own the key.
+ */
+void nccf_kv_get_key(struct  CFLISTITEM **lst, const char **key);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // NCCF_KEYVALUE
diff --git a/src/nccf_linear_interp.c b/src/nccf_linear_interp.c
new file mode 100644
index 0000000..9562315
--- /dev/null
+++ b/src/nccf_linear_interp.c
@@ -0,0 +1,19 @@
+/**
+ * $Id: nccf_linear_interp.c 628 2011-03-28 16:52:19Z pletzer $
+ */
+
+#include <netcdf.h>
+#include <math.h>
+#include <nccf_utility_functions.h>
+
+#define nccf_linear_interp_TYPE nccf_linear_interp_double
+#define _TYPE double
+#include <nccf_linear_interp.h>
+#undef _TYPE
+#undef nccf_linear_interp_TYPE
+
+#define nccf_linear_interp_TYPE nccf_linear_interp_float
+#define _TYPE float
+#include <nccf_linear_interp.h>
+#undef _TYPE
+#undef nccf_linear_interp_TYPE
diff --git a/src/nccf_linear_interp.h b/src/nccf_linear_interp.h
new file mode 100644
index 0000000..cc85f79
--- /dev/null
+++ b/src/nccf_linear_interp.h
@@ -0,0 +1,63 @@
+/**
+ * $Id: nccf_linear_interp.h 915 2012-01-09 16:58:08Z pletzer $
+ */
+
+int nccf_linear_interp_TYPE(int ndims, const int dims[],
+                            const _TYPE f_nodes[],
+                            const _TYPE dindices[], 
+                            const _TYPE weights[],
+                            _TYPE fill_value,
+                            _TYPE *f_interp) {
+  int i, j;
+
+  // find the lower corner set of indices
+  // and the number of nodes in the cell
+  int loCornerIndx[ndims];
+  int nNodes = 1;
+  int ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    loCornerIndx[i] = (int) floor(dindices[i]);
+    nNodes *= 2;
+    ntot *= dims[i];
+  }
+  
+  // set the interpolation value to fill_value if all the 
+  // weights are zero. This can happen if there are invalid
+  // function values.
+  _TYPE sum_weights = 0;
+  for (j = 0; j < nNodes; ++j) {
+    sum_weights += weights[j];
+  }
+  if (sum_weights == 0) {
+    *f_interp = fill_value;
+    return NC_NOERR;
+  }
+  
+  // iterate over all nodes of the cell
+  int bigIndex;
+  int indx[ndims];
+
+  int prodDims[ndims];
+  prodDims[ndims - 1] = 1; 
+  for (i = ndims - 2; i >= 0; --i) {
+    prodDims[i] = prodDims[i + 1] * 2;
+  }
+
+  *f_interp = 0.0;
+  for (j = 0; j < nNodes; ++j) {
+
+    // compute the index set of the node
+    for (i = 0; i < ndims; ++i) {
+      indx[i] = loCornerIndx[i] + (j / prodDims[i] % 2);
+    }
+
+    bigIndex = nccf_get_flat_index(ndims, dims, indx);
+    bigIndex = (bigIndex > ntot - 1? ntot - 1: bigIndex);
+    bigIndex = (bigIndex < 0? 0: bigIndex);
+
+    // add the contribution of each partial volume
+    *f_interp += weights[j] * f_nodes[bigIndex];
+  }
+  
+  return NC_NOERR;
+}
diff --git a/src/nccf_linear_interp_mod.c b/src/nccf_linear_interp_mod.c
new file mode 100644
index 0000000..ccc6ff5
--- /dev/null
+++ b/src/nccf_linear_interp_mod.c
@@ -0,0 +1,20 @@
+/**
+ * $Id: nccf_linear_interp_mod.c 915 2012-01-09 16:58:08Z pletzer $
+ */
+
+#include <netcdf.h>
+#include <math.h>
+#include <nccf_utility_functions.h>
+#include <nccf_constants.h>
+
+#define nccf_linear_interp_mod_TYPE nccf_linear_interp_mod_double
+#define _TYPE double
+#include <nccf_linear_interp_mod.h>
+#undef _TYPE
+#undef nccf_linear_interp_mod_TYPE
+
+#define nccf_linear_interp_mod_TYPE nccf_linear_interp_mod_float
+#define _TYPE float
+#include <nccf_linear_interp_mod.h>
+#undef _TYPE
+#undef nccf_linear_interp_mod_TYPE
diff --git a/src/nccf_linear_interp_mod.h b/src/nccf_linear_interp_mod.h
new file mode 100644
index 0000000..a0de66e
--- /dev/null
+++ b/src/nccf_linear_interp_mod.h
@@ -0,0 +1,81 @@
+/**
+ * $Id: nccf_linear_interp_mod.h 915 2012-01-09 16:58:08Z pletzer $
+ */
+
+int nccf_linear_interp_mod_TYPE(int ndims, const int dims[],
+                                const _TYPE f_nodes[],
+                                _TYPE f_ref, 
+                                _TYPE f_periodicity, 
+                                const _TYPE dindices[], 
+                                const _TYPE weights[],
+                                _TYPE fill_value,
+                                _TYPE *f_interp) {
+  int i, j;
+
+  // find the lower corner set of indices
+  // and the number of nodes in the cell
+  int loCornerIndx[ndims];
+  int nNodes = 1;
+  int ntot = 1;
+  for (i = 0; i < ndims; ++i) {
+    loCornerIndx[i] = (int) floor(dindices[i]);
+    nNodes *= 2;
+    ntot *= dims[i];
+  }
+  
+  // set the interpolation value to fill_value if all the 
+  // weights are zero. This can happen if there are invalid
+  // function values.
+  _TYPE sum_weights = 0;
+  for (j = 0; j < nNodes; ++j) {
+    sum_weights += weights[j];
+  }
+  if (sum_weights == 0) {
+    *f_interp = fill_value;
+    return NC_NOERR;
+  }
+  
+  // iterate over all nodes of the cell
+  _TYPE f_store[nNodes];
+  int bigIndex;
+  int indx[ndims];
+  int prodDims[ndims];
+  prodDims[ndims - 1] = 1; 
+  for (i = ndims - 2; i >= 0; --i) {
+    prodDims[i] = prodDims[i + 1] * 2;
+  }
+
+  *f_interp = 0.0;
+  for (j = 0; j < nNodes; ++j) {
+
+    // compute the index set of the node
+    for (i = 0; i < ndims; ++i) {
+      indx[i] = loCornerIndx[i] + (j / prodDims[i] % 2);
+    }
+
+    bigIndex = nccf_get_flat_index(ndims, dims, indx);
+    bigIndex = (bigIndex > ntot - 1? ntot - 1: bigIndex);
+    bigIndex = (bigIndex < 0? 0: bigIndex);
+
+    // modulo operation, adjust periodicity so as to 
+    // minimize the distance from f_ref (typically the
+    // target coordinate value)
+    f_store[j] = f_nodes[bigIndex];
+    if (fabs((double)(f_store[j] + f_periodicity - f_ref)) < 
+        fabs((double)(f_store[j] - f_ref))) {
+      f_store[j] += f_periodicity;
+    }
+    if (fabs((double)(f_store[j] - f_periodicity - f_ref)) < 
+        fabs((double)(f_store[j] - f_ref))) {
+      f_store[j] -= f_periodicity;
+    }
+    
+  }
+
+  for (j = 0; j < nNodes; ++j) {
+    // add the contribution of each partial volume
+    *f_interp += weights[j] * f_store[j];
+  }
+  
+  return NC_NOERR;
+}
diff --git a/src/nccf_linesearch_indices.c b/src/nccf_linesearch_indices.c
new file mode 100644
index 0000000..8055134
--- /dev/null
+++ b/src/nccf_linesearch_indices.c
@@ -0,0 +1,27 @@
+/**
+ * Perform line search in index space
+ * $Id: nccf_linesearch_indices.c 905 2011-12-29 04:56:48Z pletzer $
+ *
+ * \author Alexander Pletzer
+ */
+
+#include <stdlib.h>
+#include <math.h>
+#include <nccf_utility_functions.h>
+
+#define nccf_linesearch_indices_TYPE nccf_linesearch_indices_double
+#define _TYPE double
+#define nccf_get_distance_in_coord_TYPE nccf_get_distance_in_coord_double
+#include <nccf_linesearch_indices.h>
+#undef nccf_get_distance_in_coord_TYPE
+#undef _TYPE
+#undef nccf_linesearch_indices_TYPE
+
+#define nccf_linesearch_indices_TYPE nccf_linesearch_indices_float
+#define _TYPE float
+#define nccf_get_distance_in_coord_TYPE nccf_get_distance_in_coord_float
+#include <nccf_linesearch_indices.h>
+#undef nccf_get_distance_in_coord_TYPE
+#undef _TYPE
+#undef nccf_linesearch_indices_TYPE
+
diff --git a/src/nccf_linesearch_indices.h b/src/nccf_linesearch_indices.h
new file mode 100644
index 0000000..89a14ba
--- /dev/null
+++ b/src/nccf_linesearch_indices.h
@@ -0,0 +1,100 @@
+/**
+ * Perform line search minimization in index space
+ * $Id: nccf_linesearch_indices.h 891 2011-12-21 17:22:02Z pletzer $
+ *
+ * \author Alexander Pletzer
+ */
+
+int 
+nccf_linesearch_indices_TYPE(int ndims, const int dims[], 
+			const _TYPE **coordData,
+                        const _TYPE coord_periodicity[],
+			const _TYPE targetPos[],
+			_TYPE indexTol, 
+			const _TYPE dindices[], 
+			_TYPE dindices_new[]) {
+
+  int status, i;
+  int totErr = 0;
+
+  _TYPE leftIndices[ndims];
+  _TYPE righIndices[ndims];
+  _TYPE middIndices[ndims];
+  _TYPE leftErr, middErr, righErr, indexErr;
+
+  for (i = 0; i < ndims; ++i) {
+    leftIndices[i] = dindices[i];
+    righIndices[i] = dindices_new[i];
+    middIndices[i] = 0.5 * (leftIndices[i] + righIndices[i]);
+  }
+
+  status = nccf_get_distance_in_coord_TYPE(ndims, dims, coordData,
+                                           coord_periodicity,
+                                           targetPos, leftIndices, 
+                                           &leftErr);
+  totErr += abs(status);
+  status = nccf_get_distance_in_coord_TYPE(ndims, dims, coordData,
+                                           coord_periodicity,
+                                           targetPos, righIndices, 
+                                           &righErr);
+  totErr += abs(status);
+  status = nccf_get_distance_in_coord_TYPE(ndims, dims, coordData,
+                                           coord_periodicity,
+                                           targetPos, middIndices, 
+                                           &middErr);
+  totErr += abs(status);
+  
+  indexErr = 0.0;
+  for (i = 0; i < ndims; ++i) {
+    indexErr += (righIndices[i] - leftIndices[i]) * 
+      (righIndices[i] - leftIndices[i]);
+  }
+  indexErr = sqrt(indexErr);
+
+  while (indexErr > indexTol) {
+
+    if (leftErr < righErr) {
+      for (i = 0; i < ndims; ++i) {
+	righIndices[i] = middIndices[i];
+      }
+    }
+    else {
+      for (i = 0; i < ndims; ++i) {
+	leftIndices[i] = middIndices[i];
+      }
+    }
+
+    for (i = 0; i < ndims; ++i) {
+      middIndices[i] = 0.5 * (leftIndices[i] + righIndices[i]);
+    }
+    
+    status = nccf_get_distance_in_coord_TYPE(ndims, dims, coordData,
+                                             coord_periodicity,
+                                             targetPos, leftIndices, 
+                                             &leftErr);
+    totErr += abs(status);
+    status = nccf_get_distance_in_coord_TYPE(ndims, dims, coordData,
+                                             coord_periodicity,
+                                             targetPos, righIndices, 
+                                             &righErr);
+    totErr += abs(status);
+    status = nccf_get_distance_in_coord_TYPE(ndims, dims, coordData,
+                                             coord_periodicity,
+                                             targetPos, middIndices, 
+                                             &middErr);
+    totErr += abs(status);
+  
+    indexErr = 0.0;
+    for (i = 0; i < ndims; ++i) {
+      indexErr += (righIndices[i] - leftIndices[i]) * 
+        (righIndices[i] - leftIndices[i]);
+    }
+    indexErr = sqrt(indexErr);
+  }
+
+  for (i = 0; i < ndims; ++i) {
+    dindices_new[i] = middIndices[i];
+  }
+
+  return totErr;
+}
diff --git a/src/nccf_put_var_slice_text.c b/src/nccf_put_var_slice_text.c
new file mode 100644
index 0000000..969e0f4
--- /dev/null
+++ b/src/nccf_put_var_slice_text.c
@@ -0,0 +1,45 @@
+/*
+ * Write slices of text using a flat array index 
+ * $Id: nccf_put_var_slice_text.c 513 2011-02-14 22:48:17Z dkindig $
+ */
+
+#include <stdlib.h>
+#include <netcdf.h>
+#include "nccf_utility_functions.h"
+
+int 
+nccf_put_var_slice_text(int ncid, int varId, int ndims, const int *dims, 
+			const char *string) {
+
+  int status = NC_NOERR;
+  int blockSize = dims[ndims - 1]; 
+  int i, j;
+  int startIndices[ndims];
+  size_t startIndicesS_t[ndims];
+  int start;
+  size_t counts[ndims];
+
+  /* number of blocks to write for each dimension, {1, ...1, blockSize} */
+  counts[ndims - 1] = (size_t) blockSize;
+
+  /* number of records */
+  int numberOfWrites = 1;
+  for (i = 0; i < ndims - 1; ++i) {
+    numberOfWrites *= dims[i];
+    counts[i] = 1;
+  }
+	  
+  /* write the data, slice by slice */
+  for (i = 0; i < numberOfWrites; ++i) {
+    start = i * blockSize;
+    /* convert the flat index (start) into a tuple of indices (startIndices) */
+    nccf_get_multi_index(ndims, dims, start, startIndices);
+    for (j = 0; j < ndims; ++j) {
+      startIndicesS_t[i] = (size_t) startIndices[i];
+    }
+    /* write the slice */
+    status += nc_put_vara_text(ncid, varId, startIndicesS_t, counts, string);
+  }
+
+  return status;
+}
diff --git a/src/nccf_solve.c b/src/nccf_solve.c
new file mode 100644
index 0000000..645f02c
--- /dev/null
+++ b/src/nccf_solve.c
@@ -0,0 +1,52 @@
+/**
+ * $Id: nccf_solve.c 848 2011-10-13 18:53:20Z pletzer $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <cf_config.h>
+#endif
+#if (HAVE_LAPACK_NO_UNDERSCORE == 1) 
+#define dGetrf dgetrf
+#define dGetrs dgetrs
+#define fGetrf sgetrf
+#define fGetrs sgetrs
+#endif
+#if (HAVE_LAPACK_UNDERSCORE == 1)
+#define dGetrf dgetrf_
+#define dGetrs dgetrs_
+#define fGetrf sgetrf_
+#define fGetrs sgetrs_
+#endif
+
+#if (HAVE_LAPACK_NO_UNDERSCORE == 1 || HAVE_LAPACK_UNDERSCORE == 1)
+
+// Lapack routines
+
+// double
+void dGetrf(int *, int *, double *, int *,  int *, int *); 
+void dGetrs(char *, int *, int *, double *, int *,  int *, double *, int *, int *);
+// float
+void fGetrf(int *, int *, float *, int *,  int *, int *); 
+void fGetrs(char *, int *, int *, float *, int *,  int *, float *, int *, int *);
+
+#define _TYPE double
+#define nccf_solve_TYPE nccf_solve_double
+#define _GETRF dGetrf
+#define  _GETRS dGetrs
+#include <nccf_solve.h>
+#undef _GETRS
+#undef _GETRF
+#undef nccf_solve_TYPE
+#undef _TYPE
+
+#define _TYPE float
+#define nccf_solve_TYPE nccf_solve_float
+#define _GETRF fGetrf
+#define  _GETRS fGetrs
+#include <nccf_solve.h>
+#undef _GETRS
+#undef _GETRF
+#undef nccf_solve_TYPE
+#undef _TYPE
+
+#endif // (HAVE_LAPACK == 1 || HAVE_LAPACK_UNDERSCORE == 1)
diff --git a/src/nccf_solve.h b/src/nccf_solve.h
new file mode 100644
index 0000000..66d2e33
--- /dev/null
+++ b/src/nccf_solve.h
@@ -0,0 +1,30 @@
+/**
+ * $Id: nccf_solve.h 846 2011-10-06 03:59:42Z pletzer $
+ */
+
+int 
+nccf_solve_TYPE(int ndims, _TYPE mat[], const _TYPE rhs[], _TYPE sol[]) {
+  int info = 1;
+  
+#ifdef HAVE_LAPACK_LIB
+  int lda = ndims;
+  int ldb = ndims;
+  int ipv[ndims];
+  int i;
+  _GETRF(&ndims, &ndims, &mat[0], &lda,  &ipv[0], &info); 
+  if (info == 0) {
+    char meth = 'T'; // transpose
+    int nrhs = 1;
+    for (i = 0; i < ndims; ++i) {
+      sol[i] = rhs[i];
+    }
+    _GETRS(&meth, &ndims, &nrhs, &mat[0], &lda,  &ipv[0], 
+	   &sol[0], &ldb, &info);
+  }
+#else
+  // no LAPACK
+  info = 12345;
+#endif
+
+  return info;
+}
diff --git a/src/nccf_strerror.c b/src/nccf_strerror.c
new file mode 100644
index 0000000..432f2d6
--- /dev/null
+++ b/src/nccf_strerror.c
@@ -0,0 +1,115 @@
+
+/**
+ * Error handling. Code auto-generated by 
+ * nccf_generate_strerror.py
+ * on Thu Mar 24 21:15:31 2011
+ */
+const char *
+nccf_strerror(int err) {
+
+   switch(err) {
+
+   case(-1001):
+      return " Not a valid coord id ";
+
+   case(-1002):
+      return " Not a valid grid iad ";
+
+   case(-1003):
+      return " Not a valid data id ";
+
+   case(-1004):
+      return " Not a valid regrid id ";
+
+   case(-1005):
+      return " Not a valid mosaic id ";
+
+   case(-1006):
+      return " Not a valid host id ";
+
+   case(-1007):
+      return " Error when creating a var obj ";
+
+   case(-1008):
+      return " Error when creating a var obj from file ";
+
+   case(-1009):
+      return " Error when destroying var obj ";
+
+   case(-1010):
+      return " Error when setting an attribute in var obj ";
+
+   case(-1011):
+      return " Error when getting an attribute from var obj ";
+
+   case(-1012):
+      return " Error when setting dims in var obj ";
+
+   case(-1013):
+      return " Error when getting dims name pointer in var obj ";
+
+   case(-1014):
+      return " Error when setting data pointer in var obj ";
+
+   case(-1015):
+      return " Error when setting data in var obj ";
+
+   case(-1016):
+      return " Error when getting var name pointer in var obj ";
+
+   case(-1017):
+      return " Error when getting data type in var obj ";
+
+   case(-1018):
+      return " Error when getting data pointer in var obj ";
+
+   case(-1019):
+      return " Error when getting num dims in var obj ";
+
+   case(-1020):
+      return " Error when getting attrib list in var obj ";
+
+   case(-1021):
+      return " Error when setting var name in var obj ";
+
+   case(-1022):
+      return " Error occurred when writing var objs ";
+
+   case(-1030):
+      return " Error index out of range ";
+
+   case(-1040):
+      return " Error the file given is not a host file ";
+
+   case(-1041):
+      return " Error occurred when writing coordinate object to file ";
+
+   case(-1042):
+      return " Error occurred when writing grid object to file ";
+
+   case(-1043):
+      return " Error occurred when writing data object to file ";
+
+   case(-1044):
+      return " Error occurred when writing regrid object to file ";
+
+   case(-1045):
+      return " Error occurred when writing mosaic object to file ";
+
+   case(-1046):
+      return " Error occurred when writing host object to file ";
+
+   case(-1050):
+      return " Error no data were set in data object ";
+
+   case(-1051):
+      return " Vertices mismatch in polytope viewer ";
+
+   case(-1053):
+      return " Attribute exists ";
+
+   default:
+      return "Unknown error!";
+   }
+}
+
diff --git a/src/nccf_varObj.c b/src/nccf_varObj.c
new file mode 100644
index 0000000..f4d6dfd
--- /dev/null
+++ b/src/nccf_varObj.c
@@ -0,0 +1,867 @@
+/**
+ * $Id: nccf_varObj.c 919 2012-02-07 22:21:33Z pletzer $
+ *
+ * Methods to populate a netcdf-like variable in memory
+ */
+
+#include <netcdf.h>
+#include <nccf_handle_error.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include "nccf_varObj.h"
+#include "cflistitem.h"
+#include "nccf_constants.h"
+#include "nccf_errors.h"
+
+int nccf_varCreate(struct nccf_var_obj **v, const char* name) {
+  int status = NC_NOERR;
+  // more stuff here
+  *v = malloc(sizeof(struct nccf_var_obj));
+  nccf_kv_new(&(**v).attr);
+  (**v).name = NULL;
+  nccf_varSetVarName(v, name);
+  (**v).ndims = 0;
+  (**v).data_type = NC_NAT;
+  (**v).dims = NULL;
+  (**v).dimnames = NULL;
+  (**v).data = NULL;
+  (**v).save = 0;
+  (**v).numWrittenRecords = 0;
+  (**v).time_dimension = -1;
+  return status;
+}
+
+int nccf_varCreateFromFile(struct nccf_var_obj **v, const char* name, 
+			   int ncid, int readData, int castToDouble) {
+
+  // initial settings are for global attributes (name is "")
+  int varid = NC_GLOBAL;
+  nc_type dataType = NC_NAT;
+  int ndims = 0;
+  int natts = 0;
+
+  int *dimids = NULL;
+  int *dims = NULL;
+  char **dimnames = NULL;
+
+  size_t sz;
+  int status;
+  int i;
+  int ntot;
+  char *unlimdimname = calloc(NC_MAX_NAME+1, sizeof(char));
+
+  int totError = NC_NOERR;
+  nccf_varCreate(v, name);
+
+  // determine the id of the unlimited dimension
+  int unlimid; 
+  status = nc_inq_unlimdim(ncid, &unlimid);
+  totError += abs(status);
+  if (unlimid >= 0) {
+    // get the name of this dimension
+    status = nc_inq_dimname(ncid, unlimid, unlimdimname);
+    totError += abs(status);
+  }
+
+  // variable
+  if (strcmp(name, "") != 0 && 
+      nc_inq_varid(ncid, name, &varid) == NC_NOERR) {
+
+    // only for non-global attributes
+
+    status = nc_inq_vartype(ncid, varid, &dataType);
+    (**v).data_type = dataType;
+    totError += abs(status);
+    status = nc_inq_varndims(ncid, varid, &ndims);
+    totError += abs(status);
+
+    // dimensions
+    dimids = (int *) malloc(ndims * sizeof(int));
+    dims = (int *) malloc(ndims * sizeof(int));
+    dimnames = (char **) malloc(ndims * sizeof(char *));
+
+    status = nc_inq_vardimid(ncid, varid, dimids);
+    totError += abs(status);
+    for (i = 0; i < ndims; ++i) {
+      dimnames[i] = (char *) calloc(NC_MAX_NAME+1, sizeof(char));
+      status = nc_inq_dimlen(ncid, dimids[i], &sz);
+      totError += abs(status);
+      status = nc_inq_dimname(ncid, dimids[i], dimnames[i]);
+      totError += abs(status);
+      if (strcmp(dimnames[i], unlimdimname) == 0) {
+        (**v).time_dimension = i;
+      }
+      dims[i] = (int) sz;
+    }
+    status = nccf_varSetDims(v, ndims, dims, 
+                             (const char **) dimnames);
+    totError += abs(status);
+    status = nccf_varGetNumValsPerTime(v, &ntot);
+    totError += abs(status);    
+
+    // read the first data record
+    if (readData) {
+      status = nccf_varReadData(v, ncid, 0, castToDouble);
+      totError += abs(status);
+    }
+  }
+
+  // attributes (applies to variables and global attributes)
+  char attName[NC_MAX_NAME+1];
+  size_t len;
+  nc_type xtype;
+  status = nc_inq_varnatts(ncid, varid, &natts);
+  totError += abs(status);
+  for (i = 0; i < natts; ++i) {
+    // nc_inq_attname returns a pointer to the attr name
+    // no need to allocate
+    status = nc_inq_attname(ncid, varid, i, attName);
+    totError += abs(status);
+    status = nc_inq_att(ncid, varid, attName, &xtype, &len);
+    totError += abs(status);
+    if (xtype == NC_CHAR) {
+      // len returned by nc_inq_attlen does no include termination
+      // character
+      char *attValue = (char *) calloc(len + 1, sizeof(char));
+      status = nc_get_att_text(ncid, varid, attName, attValue);
+      totError += abs(status);
+      nccf_varSetAttribText(v, attName, attValue);
+      free(attValue);
+      attValue = NULL;
+    }
+    else if (xtype == NC_DOUBLE) {
+      double attValue[len]; 
+      status = nc_get_att_double(ncid, varid, attName,
+				 attValue);
+      totError += abs(status);
+      nccf_varSetAttribDoubleArray(v, attName, len, attValue);
+    }
+    else if (xtype == NC_FLOAT) {
+      float attValue[len]; 
+      status = nc_get_att_float(ncid, varid, attName,
+				attValue);
+      totError += abs(status);
+      nccf_varSetAttribFloatArray(v, attName, len, attValue);
+    }
+    else if (xtype == NC_INT) {
+      int attValue[len]; 
+      status = nc_get_att_int(ncid, varid, attName,
+			      attValue);
+      totError += abs(status);
+      nccf_varSetAttribIntArray(v, attName, len, attValue);
+    }
+    else if (xtype == NC_SHORT) {
+      short attValue[len]; 
+      status = nc_get_att_short(ncid, varid, attName,
+				attValue);
+      totError += abs(status);
+      nccf_varSetAttribShortArray(v, attName, len, attValue);
+    }
+    else {
+      // unsupported attribute type
+      totError++;
+    }
+  }
+
+  // clean up
+  for (i = 0; i < ndims; ++i) {
+    if (dimnames[i]) {
+      free(dimnames[i]);
+      dimnames[i] = NULL;
+    }
+  }
+  if (dimnames) {
+    free(dimnames);
+    dimnames = NULL;
+  }
+  if (dims) {
+    free(dims);
+    dims = NULL;
+  }
+  if (dimids) {
+    free(dimids);
+    dimids = NULL;
+  }
+  if (unlimdimname) {
+    free(unlimdimname);
+    unlimdimname = NULL;
+  }
+
+  if (totError != NC_NOERR) {
+    totError = NCCF_VAROBJCREATEFROMFILE;
+  }
+  return totError;
+}
+
+int nccf_varDestroy(struct nccf_var_obj **v) {
+  int status = NC_NOERR;
+  int i;
+  for( i = 0; i < (**v).ndims; i++ ){
+    free( (**v).dimnames[i] );
+  }
+  free((**v).dimnames);
+  free((**v).dims);
+  nccf_kv_del(&(**v).attr);
+  if ( (**v).save ) {
+    free( (**v).data );
+    (**v).data = NULL;
+  }
+  free((**v).name);
+  free(*v);
+  *v = NULL;
+  return status;
+}
+
+int nccf_varSetAttribText(struct nccf_var_obj **v, 
+			  const char *name, 
+			  const char *value) {
+  int status = NC_NOERR;
+  nccf_kv_add(&(**v).attr, name, NC_CHAR, 0, value);
+  return status;
+}
+
+int nccf_varSetAttribDouble(struct nccf_var_obj **v, 
+			    const char *name, 
+			    double value) {
+  int status = NC_NOERR;
+  nccf_kv_add(&(**v).attr, name, NC_DOUBLE, 1, &value);
+  return status;
+}
+
+int nccf_varSetAttribFloat(struct nccf_var_obj **v, 
+			   const char *name, 
+			   float value) {
+  int status = NC_NOERR;
+  nccf_kv_add(&(**v).attr, name, NC_FLOAT, 1, &value);
+  return status;
+}
+
+int nccf_varSetAttribInt(struct nccf_var_obj **v, 
+			 const char *name, 
+			 int value) {
+  int status = NC_NOERR;
+  nccf_kv_add(&(**v).attr, name, NC_INT, 1, &value);
+  return status;
+}
+
+int nccf_varSetAttribShort(struct nccf_var_obj **v, 
+			   const char *name, 
+			   short value) {
+  int status = NC_NOERR;
+  nccf_kv_add(&(**v).attr, name, NC_SHORT, 1, &value);
+  return status;
+}
+
+int nccf_varSetAttribDoubleArray(struct nccf_var_obj **v, 
+                                 const char *name, int n, 
+                                 const double values[]) {
+  int status = NC_NOERR;
+  nccf_kv_add(&(**v).attr, name, NC_DOUBLE, n, values);
+  return status;
+}
+
+int nccf_varSetAttribFloatArray(struct nccf_var_obj **v, 
+                                const char *name, int n, 
+                                const float values[]) {
+  int status = NC_NOERR;
+  nccf_kv_add(&(**v).attr, name, NC_FLOAT, n, values);
+  return status;
+}
+
+int nccf_varSetAttribIntArray(struct nccf_var_obj **v, 
+                              const char *name, int n, 
+                              const int values[]) {
+  int status = NC_NOERR;
+  nccf_kv_add(&(**v).attr, name, NC_INT, n, values);
+  return status;
+}
+
+int nccf_varSetAttribShortArray(struct nccf_var_obj **v, 
+                                const char *name, int n, 
+                                const short values[]) {
+  int status = NC_NOERR;
+  nccf_kv_add(&(**v).attr, name, NC_SHORT, n, values);
+  return status;
+}
+
+int nccf_varInqAttrib(struct nccf_var_obj **v,
+		      const char *name, nc_type *xtypep, int *lenp) {
+  int status = NC_NOERR;
+  const void *value;
+  nccf_kv_get_value(&(**v).attr, name, xtypep, lenp, &value);
+  return status;
+}
+
+int nccf_varGetAttribPtr(struct nccf_var_obj **v, 
+			 const char *name, const void **value) {
+  int status = NC_NOERR;
+  int nelem;
+  nc_type type;
+  nccf_kv_get_value(&(**v).attr, name, &type, &nelem, value);
+  return status;
+}
+
+int nccf_varSetDims(struct nccf_var_obj **v, 
+		    int numDims, const int dims[], 
+		    const char **dimnames) {
+  int status = NC_NOERR;
+  int i;
+  if ((**v).dimnames) {
+    for(i = 0; i < (**v).ndims; i++){
+      free((**v).dimnames[i]); 
+    }
+  }
+  (**v).ndims = numDims;
+  (**v).dims = realloc((**v).dims, numDims*sizeof(int)); 
+  (**v).dimnames = realloc((**v).dimnames, numDims*sizeof(char*)); 
+  for(i = 0; i < numDims; i++){
+    (**v).dims[i] = dims[i];
+    (**v).dimnames[i] = strdup(dimnames[i]);
+    if (dims[i] == NC_UNLIMITED) {
+      (**v).time_dimension = i;
+    }
+  }
+  return status;
+}
+
+int nccf_varGetDimNamePtr(struct nccf_var_obj **v, 
+			  int index, 
+			  const char **dimname ){
+  int status = NC_NOERR;
+  *dimname = (**v).dimnames[index];
+  return status;
+}
+
+int nccf_varGetDimsPtr(struct nccf_var_obj **v, int **dims) {
+  int status = NC_NOERR;
+  *dims = (**v).dims;
+  return status;
+}
+
+int nccf_varReadData(struct nccf_var_obj **v, int ncid, 
+                     int time_index, int castToDouble) {
+  int status = NC_NOERR;
+  int totError = 0;
+  int i;
+
+  // get varid
+  int varid = NC_GLOBAL;
+  status = nc_inq_varid(ncid, (**v).name, &varid);
+
+  // get data type
+  nc_type dataType = NC_NAT;
+  if (castToDouble) {
+    // will cast into doubles
+    dataType = NC_DOUBLE;
+  }
+  else {
+    // get the data type from the file
+    status = nc_inq_vartype(ncid, varid, &dataType);
+    totError += abs(status);
+  }
+
+  void *data = NULL;
+  int ndims;
+  int *dims;
+  status = nccf_varGetNumDims(v, &ndims);
+  totError += abs(status);
+  status = nccf_varGetDimsPtr(v, &dims);
+  totError += abs(status);
+
+  size_t start[ndims];
+  size_t counts[ndims];
+  for (i = 0; i < ndims; ++i) {
+    start[i] = 0;
+    counts[i] = dims[i];
+    if (i == (**v).time_dimension) {
+      start[i] = time_index;
+      counts[i] = 1;
+    }
+  }
+  
+  int ntot;
+  status = nccf_varGetNumValsPerTime(v, &ntot);
+  totError += abs(status);
+
+  // free any old data
+  void *dataold = NULL;
+  status = nccf_varGetDataPtr(v, &dataold);
+  totError += abs(status);
+  if (dataold) {
+    free(dataold);
+    dataold = NULL;
+  }
+
+  switch (dataType) {
+  case NC_DOUBLE:
+    data = malloc(sizeof(double) * ntot);
+    status = nc_get_vara_double(ncid, varid, start, counts, data);
+    nccf_varSetDataDouble(v, (const double *) data);
+    free(data);
+    data = NULL;
+    break;
+  case NC_FLOAT:
+    data = malloc(sizeof(float) * ntot);
+    status = nc_get_vara_float(ncid, varid, start, counts, data);    
+    nccf_varSetDataFloat(v, (const float *) data);
+    free(data);
+    data = NULL;
+    break;
+  case NC_INT:
+    data = malloc(sizeof(int) * ntot);
+    status = nc_get_vara_int(ncid, varid, start, counts, data);    
+    nccf_varSetDataInt(v, (const int *) data);
+    free(data);
+    data = NULL;
+    break;
+  case NC_SHORT:
+    data = malloc(sizeof(short) * ntot);
+    status = nc_get_vara_short(ncid, varid, start, counts, data);    
+    nccf_varSetDataShort(v, (const short *) data);
+    free(data);
+    data = NULL;
+    break;
+  case NC_CHAR:
+    data = calloc(ntot, sizeof(char));
+    status = nc_get_vara_text(ncid, varid, start, counts, data);    
+    nccf_varSetDataChar(v, (const char *) data);
+    free(data);
+    data = NULL;
+    break;
+  case NC_BYTE:
+    // not implemented
+    totError += 1;
+    break;
+  case NC_NAT:
+    // not implemented
+    totError += 1;
+  }
+  totError += abs(status);
+  
+  return totError;
+}
+
+
+int nccf_varSetDataPtr(struct nccf_var_obj **v, 
+		       nc_type data_type, 
+		       void *val) {
+  int status = NC_NOERR;
+  (**v).data_type = data_type;
+  (**v).data = val;
+  (**v).save = 0;
+  return status;
+}
+
+#define _TYPE_ double
+#define nccf_varSetData_TYPE_ nccf_varSetDataDouble
+#define _NC_TYPE_  NC_DOUBLE
+#include "nccf_varSetData_generic.h"
+#undef _NC_TYPE_
+#undef nccf_varSetData_TYPE_
+#undef _TYPE_ 
+
+#define _TYPE_ float
+#define nccf_varSetData_TYPE_ nccf_varSetDataFloat
+#define _NC_TYPE_  NC_FLOAT
+#include "nccf_varSetData_generic.h"
+#undef _NC_TYPE_
+#undef nccf_varSetData_TYPE_
+#undef _TYPE_ 
+
+#define _TYPE_ int
+#define nccf_varSetData_TYPE_ nccf_varSetDataInt
+#define _NC_TYPE_  NC_INT
+#include "nccf_varSetData_generic.h"
+#undef _NC_TYPE_
+#undef nccf_varSetData_TYPE_
+#undef _TYPE_ 
+
+#define _TYPE_ short
+#define nccf_varSetData_TYPE_ nccf_varSetDataShort
+#define _NC_TYPE_  NC_SHORT
+#include "nccf_varSetData_generic.h"
+#undef _NC_TYPE_
+#undef nccf_varSetData_TYPE_
+#undef _TYPE_ 
+
+#define _TYPE_ char
+#define nccf_varSetData_TYPE_ nccf_varSetDataChar
+#define _NC_TYPE_  NC_CHAR
+#include "nccf_varSetData_generic.h"
+#undef _NC_TYPE_
+#undef nccf_varSetData_TYPE_
+#undef _TYPE_ 
+
+int nccf_varGetVarNamePtr(struct nccf_var_obj **v, const char **varname) {
+  int status = NC_NOERR;
+  *varname=(**v).name;
+  return status;
+}
+
+int nccf_varGetDataType(struct nccf_var_obj **v, nc_type *dataType) {
+  int status = NC_NOERR;
+  *dataType = (**v).data_type;
+  return status;
+}
+
+int nccf_varGetDataPtr(struct nccf_var_obj **v, void **val) {
+  int status = NC_NOERR;
+  *val = (**v).data;
+  return status;
+}
+
+int nccf_varGetNumValsPerTime(struct nccf_var_obj **v, int *ntot){
+  int status = NC_NOERR;
+  int i;
+  *ntot = 1;
+  for (i = 0; i < (**v).ndims; ++i) {
+    if (i != (**v).time_dimension) {
+      *ntot *= (**v).dims[i];
+    }
+  }
+  return status;
+}
+
+int nccf_varGetNumDims(struct nccf_var_obj **v, int *numDims){
+  int status = NC_NOERR;
+  *numDims = (**v).ndims;
+  return status;
+}
+
+int nccf_varSetVarName(struct nccf_var_obj **v, const char *varname) {
+  int status = NC_NOERR;
+  free((**v).name);
+  (**v).name = strdup(varname);
+  return status;
+}
+
+int nccf_varAttribIterBegin(struct nccf_var_obj **v) {
+  int status = NC_NOERR;
+  nccf_kv_begin(&(**v).attr);
+  return status;
+}
+
+int nccf_varAttribIterNext(struct nccf_var_obj **v) {
+  // return value is 1 = valid next, 0 = invalid 
+  return nccf_kv_next(&(**v).attr);
+}
+
+int nccf_varInqAttribNamePtr(struct nccf_var_obj **v, 
+			     const char **name) {
+  int status = NC_NOERR;
+  nccf_kv_get_key(&(**v).attr, name);
+  return status;
+}
+
+int nccf_writeListOfVars(int ncid, int numVars, ...) {
+  va_list handles;
+  va_start(handles, numVars);
+
+  struct CFLISTITEM *dimNames;
+  struct CFLISTITEM *dimIds;
+  struct CFLISTITEM *varids, *vars;
+
+  int status, idim, dimid;
+  int varid = NC_GLOBAL;
+  nc_type dataType = NC_NAT;
+  int iHandle;
+  int totErr = 0;
+  int catchError = NC_NOERR;
+
+  status = nc_redef(ncid);
+  if (status != NC_NOERR && status != NC_EINDEFINE) {
+    return status;
+  }
+
+  nccf_li_new(&vars);
+  nccf_li_new(&varids); 
+  nccf_li_new(&dimNames); 
+  nccf_li_new(&dimIds); 
+
+  for ( iHandle = 0; iHandle < numVars; ++iHandle) {
+    struct nccf_var_obj *var = va_arg(handles, struct nccf_var_obj *);
+    nccf_li_add(&vars, var);
+  
+    // get name and dimensions
+    const char *name;
+    nccf_varGetVarNamePtr(&var, &name);
+    int *dims, ndims;
+    nccf_varGetNumDims(&var, &ndims);
+    nccf_varGetDimsPtr(&var, &dims);
+
+    // build table of dimensions names and values and define the dimensions
+    // in the netcdf file.
+    int *ids = malloc(sizeof(int)*ndims);
+    for (idim = 0; idim < ndims; ++idim) {
+      const char *cdim;
+      int dimVal = dims[idim];
+      nccf_varGetDimNamePtr(&var,idim,&cdim);
+      // If the value of the find is past the end of the list add a new 
+      // element. This works even if the dimensions are not equal.
+
+      int found = 0;
+      nccf_li_begin(&dimNames);
+      nccf_li_begin(&dimIds);
+      while(nccf_li_next(&dimNames)){
+        nccf_li_next(&dimIds);
+        if (strcmp(dimNames->data,cdim) == 0){
+           found = 1;
+           ids[idim] = *(int *)dimIds->data;
+           break;
+        }
+      } 
+      if(( status = nc_inq_dimid( ncid, cdim, &dimid )) == 0 ){
+        found = 1;
+        ids[idim] = dimid;
+      }
+
+      if (!found) {
+        // a new dimension using the dimname as the map key.
+        nccf_li_add(&dimNames, strdup(cdim));
+        int *id = malloc(sizeof(int));
+        size_t len = (size_t) dimVal;
+	nc_redef(ncid);
+        status = nc_def_dim(ncid, cdim, len, id);
+        totErr += abs(status);
+        nccf_li_add(&dimIds, id);
+        ids[idim] = *id;
+     } 
+    }
+
+    // create variable
+    if (strcmp(name, "") != 0) { 
+      // empty string means a global attribute, with 
+      // no attached data
+      nccf_varGetDataType(&var, &dataType);
+      if (dataType == NC_NAT) {
+	catchError = NCCF_ENODATA;
+      }
+      nc_redef(ncid);
+      status = nc_def_var(ncid, name, dataType, ndims, ids, &varid);
+      totErr += abs(status);
+    } else {
+      varid = NC_GLOBAL;
+    }
+
+    int *id = malloc(sizeof(int));
+    *id = varid;
+    nccf_li_add(&varids, id);
+
+    free(ids);
+    ids = NULL;
+
+    // attributes
+    nccf_kv_begin(&(var->attr));
+    while ( nccf_kv_next(&(var->attr)) ) {
+      const char *attrName;
+      int nelem;
+      nc_type type;
+      const void *attrVal;
+      nccf_kv_get_key(&(var->attr), &attrName);
+      nccf_kv_get_value(&(var->attr), attrName, &type, &nelem, 
+			(const void **) &attrVal);
+      size_t attrlen;
+      status = nc_inq_attlen(ncid, varid, attrName, &attrlen);
+      if (status == NC_NOERR && type == NC_CHAR) {
+	// some other variable had the same attribute, so append...
+	// note: + 1 because of the " " separator
+	// note: + 1 because strlen does not count '\0'
+	int len = attrlen + strlen( (char *) attrVal) + 1 + 1;
+	char *attrValBig = (char *) calloc(len, sizeof(char));
+	// attrlen may or may not include '\0'
+	char *attrValOld = (char *) calloc(attrlen + 1, sizeof(char));
+	status = nc_get_att_text(ncid, varid, attrName, attrValOld);
+	totErr += abs(status);
+	// only append if word is not in the attribute
+	// use blank as word boundary
+	char *blankAttrValOldBlank = (char *) calloc(strlen(attrValOld)+3, 
+						  sizeof(char));
+	char *blankAttrVal = (char *) calloc(strlen( (char *) attrVal)+2, sizeof(char));
+	char *attrValBlank = (char *) calloc(strlen( (char *) attrVal)+2, sizeof(char));
+	sprintf(blankAttrValOldBlank, " %s ", attrValOld);
+	sprintf(blankAttrVal, " %s", (char *) attrVal);
+	sprintf(attrValBlank, "%s ", (char *) attrVal);
+	if (!strstr(blankAttrValOldBlank, blankAttrVal) &&
+	    !strstr(blankAttrValOldBlank, attrValBlank)) {
+	  // append
+	  sprintf(attrValBig, "%s %s", attrValOld, (char *) attrVal);
+	  status = nc_put_att_text(ncid, varid, attrName, 
+			       strlen(attrValBig), attrValBig);
+	  totErr += abs(status);
+	}
+	free(blankAttrValOldBlank);
+	free(blankAttrVal);
+	free(attrValBlank);
+	free(attrValOld);
+	free(attrValBig);
+      }
+      else {
+	// new attribute
+	switch (type) {
+	case NC_CHAR:
+	  status = nc_put_att_text(ncid, varid, attrName, 
+				   strlen( (char *) attrVal), 
+				   (char *) attrVal);
+	  totErr += abs(status);
+	  break;
+	case NC_DOUBLE:
+	  status = nc_put_att_double(ncid, varid, attrName, NC_DOUBLE, 
+				     (size_t) nelem, (double *) attrVal);
+	  totErr += abs(status);
+	  break;
+	case NC_FLOAT:
+	  status = nc_put_att_float(ncid, varid, attrName, NC_FLOAT,
+				    (size_t) nelem, (float *) attrVal);
+	  totErr += abs(status);
+	  break;
+	case NC_INT:
+	  status = nc_put_att_int(ncid, varid, attrName, NC_INT,  
+				  (size_t) nelem, (int *) attrVal);
+	  totErr += abs(status);
+	  break;
+	case NC_SHORT:
+	  status = nc_put_att_short(ncid, varid, attrName, NC_SHORT,  
+				    (size_t) nelem, (short *) attrVal);
+	  totErr += abs(status);
+	  break;
+	default:
+	  /* unsupported attribute type */
+	  totErr++;
+	}
+      }
+    }
+  }
+
+  // leave define mode
+  status = nc_enddef(ncid);
+  totErr += abs(status);
+
+  // write data
+  va_start(handles, numVars);
+  for (iHandle = 0; iHandle < numVars; ++iHandle) {
+    struct nccf_var_obj *var = va_arg(handles, struct nccf_var_obj *);
+    const char *name;
+    nccf_varGetVarNamePtr(&var, &name);
+    if (strcmp(name, "") != 0) {
+      /* only write if not global */
+      nccf_writeListOfVarData(ncid, 1, var);
+    }
+  }
+
+  /* clean up */
+  int id;
+
+  nccf_li_begin(&vars);
+  while(nccf_li_next(&vars)){
+    id = nccf_li_get_id(&vars);
+    /* NO FREE HERE */
+    nccf_li_remove(&vars, id);
+  }
+  nccf_li_del(&vars);
+
+  nccf_li_begin(&varids);
+  while(nccf_li_next(&varids)){
+    id = nccf_li_get_id(&varids);
+    free(nccf_li_remove(&varids, id));
+  }
+  nccf_li_del(&varids);
+
+  nccf_li_begin(&dimNames);
+  while(nccf_li_next(&dimNames)){
+    id = nccf_li_get_id(&dimNames);
+    free(nccf_li_remove(&dimNames, id));
+  }
+  nccf_li_del(&dimNames);
+
+  nccf_li_begin(&dimIds);
+  while( nccf_li_next(&dimIds)){
+    id = nccf_li_get_id(&dimIds);
+    free(nccf_li_remove(&dimIds, id));
+  }
+  nccf_li_del(&dimIds);
+
+  va_end(handles);
+
+  if (catchError != NC_NOERR) {
+    // specific error
+    return catchError;
+  }
+  else if (totErr != NC_NOERR) {
+    // generic error
+    return NCCF_VAROBJWRITELISTOFVARS;
+  }
+  // no error
+  return NC_NOERR;
+}
+
+int nccf_writeListOfVarData(int ncid, int numVars, ...) {
+  va_list handles;
+  va_start(handles, numVars);
+
+  int status;
+  int varid;
+  nc_type dataType;
+  int iHandle;
+  int totErr = 0;
+
+  for (iHandle = 0; iHandle < numVars; ++iHandle) {
+    struct nccf_var_obj *var = va_arg(handles, struct nccf_var_obj *);
+  
+    // get name and dimensions
+    const char *name;
+    nccf_varGetVarNamePtr(&var, &name);
+    int *dims, ndims;
+    nccf_varGetNumDims(&var, &ndims);
+    nccf_varGetDimsPtr(&var, &dims);
+
+    status = nc_inq_varid (ncid, name, &varid);
+    totErr += abs(status);
+
+    nccf_varGetDataType(&var, &dataType);
+    size_t start[ndims];
+    size_t counts[ndims];
+    int i;
+    for (i = 0; i < ndims; ++i) {
+      start[i] = 0;
+      counts[i] = dims[i];
+      if (dims[i] == NC_UNLIMITED) {
+	start[i] = var->numWrittenRecords;
+	counts[i] = 1;
+      }
+    }
+
+    void *data;
+    nccf_varGetDataPtr(&var,&data);
+    switch (dataType) {
+    case NC_DOUBLE:
+      status = nc_put_vara_double(ncid, varid, start, counts, 
+				  (const double *) data);
+      break;
+    case NC_FLOAT:
+      status = nc_put_vara_float(ncid, varid, start, counts, 
+				 (const float *) data);
+      break;
+    case NC_INT:
+      status = nc_put_vara_int(ncid, varid, start, counts, 
+			       (const int *) data);
+      break;
+    case NC_SHORT:
+      status = nc_put_vara_short(ncid, varid, start, counts, 
+				 (const short *) data);
+      break;
+    case NC_CHAR:
+      status = nc_put_vara_text(ncid, varid, start, counts, 
+				(const char *)data);
+      break;
+    default:
+      status = NC_FATAL;
+    }
+    totErr += abs(status);
+    ++var->numWrittenRecords;
+  }
+  va_end(handles);
+
+  return totErr;
+}
diff --git a/src/nccf_varSetData_generic.h b/src/nccf_varSetData_generic.h
new file mode 100644
index 0000000..02e4cfd
--- /dev/null
+++ b/src/nccf_varSetData_generic.h
@@ -0,0 +1,18 @@
+/* $Id: nccf_varSetData_generic.h 840 2011-09-23 03:25:52Z pletzer $ */
+
+int nccf_varSetData_TYPE_(struct nccf_var_obj **v, 
+			  const _TYPE_ val[]) {
+  int status = NC_NOERR;
+  int i, ntot;
+  _TYPE_ *d;
+  (**v).data_type = _NC_TYPE_;
+  status = nccf_varGetNumValsPerTime(v, &ntot);
+  d = (_TYPE_ *) malloc(sizeof(_TYPE_) * ntot);
+  for (i = 0; i < ntot; ++i) {
+    d[i] = val[i];
+  }
+  // set pointer
+  (**v).data = (void *) d;
+  (**v).save = 1;
+  return status;
+}
diff --git a/src/nccoord.c b/src/nccoord.c
index 7f88302..246e8b6 100644
--- a/src/nccoord.c
+++ b/src/nccoord.c
@@ -1,18 +1,11 @@
 /*
-Copyright 2006, University Corporation for Atmospheric Research. See
-COPYRIGHT file for copying and redistribution conditions.
+  \file
 
-This file is part of the CF Library. 
-
-This file handles the nc4 coordinate systems.
-
-Ed Hartnett, 10/1/05
-
-$Id: nccoord.c,v 1.2 2009/09/08 17:14:53 ed Exp $
+  This file handles the nc4 coordinate systems.
 */
 
-#include <config.h>
-#include <libcf.h>
+#include <cf_config.h>
+#include <libcf_src.h>
 #include <libcf_int.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/src/timeArith.c b/src/timeArith.c
new file mode 100644
index 0000000..90c1c02
--- /dev/null
+++ b/src/timeArith.c
@@ -0,0 +1,182 @@
+/*
+ * Module:      Time arithmetic routines: CdAddDelTime, CdDivDeltime
+ *
+ * Copyright:	1994, Regents of the University of California
+ *		This software may not be distributed to others without
+ *		permission of the author.
+ *
+ * Author:      Bob Drach, Lawrence Livermore National Laboratory
+ *              drach at llnl.gov
+ *
+ * Version:     $Id: timeArith.c 30 2010-09-15 14:24:51Z edhartnett $
+ *
+ * Revision History:
+ *
+ * $Log: timeArith.c,v $
+ * Revision 1.1  2010/01/19 22:38:38  pletzer
+ * adding a new directory for python tests
+ *
+ * Revision 1.1.1.1  1997/12/09 18:57:40  drach
+ * Copied from cirrus
+ *
+ * Revision 1.2  1996/02/21  23:56:49  drach
+ * - Overlayed cdtime routines in cdTimeConv.c:
+ * - Added seconds, julian calendar, changed include to cdmsint.h for old
+ *   time routines in timeArith.c and timeConv.c
+ *
+ * Revision 1.1  1994/07/19  23:54:13  drach
+ * Initial version
+ *
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <cdmsint.h>
+
+/* Add 'nDel' times 'delTime' to epochal time 'begEtm',
+ * return the result in epochal time 'endEtm'.
+ */
+void
+CdAddDelTime(double begEtm, long nDel, CdDeltaTime delTime, CdTimeType timeType,
+	     long baseYear, double *endEtm)
+{
+	double delHours;
+	long delMonths, delYears;
+	CdTime bhtime, ehtime;
+
+	extern void Cde2h(double etime, CdTimeType timeType, long baseYear, CdTime *htime);
+	extern void Cdh2e(CdTime *htime, double *etime);
+
+	switch(delTime.units){
+	  case CdYear:
+		delMonths = 12;
+		break;
+	  case CdSeason:
+		delMonths = 3;
+		break;
+	  case CdMonth:
+		delMonths = 1;
+		break;
+	  case CdWeek:
+		delHours = 168.0;
+		break;
+	  case CdDay:
+		delHours = 24.0;
+		break;
+	  case CdHour:
+		delHours = 1.0;
+		break;
+	  case CdMinute:
+		delHours = 1./60.;
+		break;
+	  case CdSecond:
+		delHours = 1./3600.;
+		break;
+	  default:
+		cdError("Invalid delta time units: %d\n",delTime.units);
+		return;
+	}
+
+	switch(delTime.units){
+	  case CdYear: case CdSeason: case CdMonth:
+		Cde2h(begEtm,timeType,baseYear,&bhtime);
+		delMonths = delMonths * nDel * delTime.count + bhtime.month - 1;
+		delYears = (delMonths >= 0 ? (delMonths/12) : (delMonths+1)/12 - 1);
+		ehtime.year = bhtime.year + delYears;
+		ehtime.month = delMonths - (12 * delYears) + 1;
+		ehtime.day = 1;
+		ehtime.hour = 0.0;
+		ehtime.timeType = timeType;
+		ehtime.baseYear = !(timeType & CdChronCal) ? 0 :
+			(timeType & CdBase1970) ? 1970 : baseYear; /* base year is 0 for Clim, */
+								   /* 1970 for Chron, */
+								   /* or input base year for Rel */
+		Cdh2e(&ehtime,endEtm);
+		break;
+	  case CdWeek: case CdDay: case CdHour: case CdMinute: case CdSecond:
+		delHours *= (nDel * delTime.count);
+		*endEtm = begEtm + delHours;
+		break;
+	}
+	return;
+}
+
+/* Divide ('endEtm' - 'begEtm') by 'delTime',
+ * return the integer portion of the result in 'nDel'.
+ */
+void
+CdDivDelTime(double begEtm, double endEtm, CdDeltaTime delTime, CdTimeType timeType,
+	     long baseYear, long *nDel)
+{
+	double delHours, frange;
+	long delMonths, range;
+	CdTime bhtime, ehtime;
+	int hoursInYear;
+	
+	extern void Cde2h(double etime, CdTimeType timeType, long baseYear, CdTime *htime);
+
+	switch(delTime.units){
+	  case CdYear:
+		delMonths = 12;
+		break;
+	  case CdSeason:
+		delMonths = 3;
+		break;
+	  case CdMonth:
+		delMonths = 1;
+		break;
+	  case CdWeek:
+		delHours = 168.0;
+		break;
+	  case CdDay:
+		delHours = 24.0;
+		break;
+	  case CdHour:
+		delHours = 1.0;
+		break;
+	  case CdMinute:
+		delHours = 1./60.;
+		break;
+	  case CdSecond:
+		delHours = 1./3600.;
+		break;
+	  default:
+		cdError("Invalid delta time units: %d\n",delTime.units);
+		return;
+	}
+
+	switch(delTime.units){
+	  case CdYear: case CdSeason: case CdMonth:
+		delMonths *= delTime.count;
+		Cde2h(begEtm,timeType,baseYear,&bhtime);
+		Cde2h(endEtm,timeType,baseYear,&ehtime);
+		if(timeType & CdChronCal){   /* Chron and Rel time */
+			range = 12*(ehtime.year - bhtime.year)
+				+ (ehtime.month - bhtime.month);
+		}
+		else{			     /* Clim time, ignore year */
+			range = (ehtime.month - bhtime.month);
+			if(range < 0) range += 12;
+		}
+		*nDel = abs(range)/delMonths;
+		break;
+	  case CdWeek: case CdDay: case CdHour: case CdMinute: case CdSecond:
+		delHours *= (double)delTime.count;
+		if(timeType & CdChronCal){   /* Chron and Rel time */
+			frange = fabs(endEtm - begEtm);
+		}
+		else{			     /* Clim time, ignore year, but */
+					     /* wraparound relative to hours-in-year*/
+			frange = endEtm - begEtm;
+			hoursInYear = (timeType & Cd365) ? 8760. : 8640.;
+					     /* Normalize frange to interval [0,hoursInYear) */
+			if(frange < 0.0 || frange >= hoursInYear)
+				frange -= hoursInYear * floor(frange/hoursInYear);
+		}
+		*nDel = (frange + 1.e-10*delHours)/delHours;
+		break;
+	}
+	return;
+}
diff --git a/src/timeConv.c b/src/timeConv.c
new file mode 100644
index 0000000..aceaef7
--- /dev/null
+++ b/src/timeConv.c
@@ -0,0 +1,399 @@
+/*
+ * Module:      Basic time format conversion routines:
+ *              Cdc2e, Cdc2h, Cde2c, Cde2h, Cdh2c, Cdh2e
+ *
+ * Copyright:	1994, Regents of the University of California
+ *		This software may not be distributed to others without
+ *		permission of the author.
+ *
+ * Author:      Bob Drach, Lawrence Livermore National Laboratory
+ *              drach at llnl.gov
+ *
+ * Version:     $Id: timeConv.c 30 2010-09-15 14:24:51Z edhartnett $
+ *
+ * Revision History:
+ *
+ * $Log: timeConv.c,v $
+ * Revision 1.1  2010/01/19 22:38:38  pletzer
+ * adding a new directory for python tests
+ *
+ * Revision 1.2  1998/02/20 00:24:49  drach
+ * - Added multi-variable file spanning in QL
+ * - Accounted for goofy floor function on J90, in timeConv.c
+ *
+ * Revision 1.1.1.1  1997/12/09 18:57:40  drach
+ * Copied from cirrus
+ *
+ * Revision 1.4  1996/02/21  23:56:50  drach
+ * - Overlayed cdtime routines in cdTimeConv.c:
+ * - Added seconds, julian calendar, changed include to cdmsint.h for old
+ *   time routines in timeArith.c and timeConv.c
+ *
+ * Revision 1.3  1994/08/12  19:03:30  drach
+ * Added CdDaysInMonth function so that CdSetTime can handle last-day-of-month flag.
+ *
+ * Revision 1.2  1994/07/20  00:01:17  drach
+ * - Changed unsigned struct values to signed
+ * - Added baseYear argument to Cdc2e
+ *
+ * Revision 1.1  1994/07/13  18:29:44  drach
+ * Initial version
+ *
+ *
+ */
+
+#include <math.h>
+#include <stdio.h>
+#include <cdmsint.h>
+
+#define ISLEAP(year,timeType)	(((timeType) & CdHasLeap) && (!((year) % 4) && (((timeType) & CdJulianType) || (((year) % 100) || !((year) % 400)))))
+
+static int mon_day_cnt[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
+static int days_sum[12] = {0,31,59,90,120,151,181,212,243,273,304,334};
+
+/* Compute month and day from year and day-of-year.
+ *
+ *	Input:
+ *		doy	     (int)  (day-of-year)
+ *		date->year   (long)  (year since 0 BC)
+ *              date->timeType (CdTimetype) (time type)
+ *              date->baseYear   base year for relative times
+ *	Output: 
+ *		date->month  (short)  (month in year) 
+ *		date->day    (short)  (day in month)
+ *
+ * 
+ * Derived from NRL NEONS V3.6.
+ */
+
+void
+CdMonthDay(int *doy, CdTime *date)
+{
+	int i;				/* month counter */
+	int idoy;			/* day of year counter */
+	long year;
+
+	if ((idoy = *doy) < 1) {
+		date->month = 0;
+		date->day   = 0;
+		return;
+	}
+
+	if(!(date->timeType & CdChronCal))   /* Ignore year for Clim calendar */
+		year = 0;
+	else if(!(date->timeType & CdBase1970))	/* year is offset from base for relative time */
+		year = date->baseYear + date->year;
+	else
+		year = date->year;
+
+	if (ISLEAP(year,date->timeType)) {
+		mon_day_cnt[1] = 29;
+	} else {
+		mon_day_cnt[1] = 28;
+	}
+	date->month	= 0;
+	for (i = 0; i < 12; i++) {
+		(date->month)++;
+		date->day	= idoy;
+		if ((idoy -= ((date->timeType & Cd365) ? (mon_day_cnt[date->month-1]) : 30)) <= 0) {
+			return;
+		}
+	}
+	return;
+}
+
+
+/* Compute number of days in a month
+ *
+ *	Input:
+ *		date->year       (long)  (year since 0 BC)
+ *		date->month      (short)  (month in year) 
+ *              date->timeType   (CdTimetype) (time type)
+ *              date->baseYear   base year for relative times
+ * 
+ *	Output: 
+ *		days    (short)  (number of days in month)
+ *
+ */
+
+void
+CdDaysInMonth(CdTime *date, int *days)
+{
+	long year;
+
+	if(!(date->timeType & CdChronCal))   /* Ignore year for Clim calendar */
+		year = 0;
+	else if(!(date->timeType & CdBase1970))	/* year is offset from base for relative time */
+		year = date->baseYear + date->year;
+	else
+		year = date->year;
+
+	if (ISLEAP(year,date->timeType)) {
+		mon_day_cnt[1] = 29;
+	} else {
+		mon_day_cnt[1] = 28;
+	}
+
+	*days = (date->timeType & Cd365) ? (mon_day_cnt[date->month-1]) : 30;
+
+	return;
+}
+
+/* Compute day-of-year from year, month and day
+ * 
+ *	Input:
+ *		date->year  (long)  (year since 0 BC)
+ *		date->month (short)  (month in year)
+ *		date->day   (short)  (day in month)
+ *              date->baseYear   base year for relative times
+ *	Output: doy         (int)  (day-of-year)
+ * 
+ * Derived from NRL NEONS V3.6
+ */
+
+void
+CdDayOfYear(CdTime *date, int *doy)
+{
+	int leap_add = 0;		/* add 1 day if leap year */
+	int month;			/* month */
+	long year;
+
+   	month	= date->month;
+	if (month < 1 || month > 12) {
+		cdError( "Day-of-year error; month: %d\n", month);
+		month = 1;	
+	}
+
+	if(!(date->timeType & CdChronCal))   /* Ignore year for Clim calendar */
+		year = 0;
+	else if(!(date->timeType & CdBase1970))	/* year is offset from base for relative time */
+		year = date->baseYear + date->year;
+	else
+		year = date->year;
+
+	if (ISLEAP(year,date->timeType) && month > 2) leap_add = 1;
+	*doy 	 = ((date->timeType & Cd365) ? (days_sum[month-1]) : 30*(month-1)) + date->day + leap_add;
+	return;
+}
+/* Convert human time to epochal time (hours since 00 jan 1, 1970)
+ * 
+ * Input: htime = human time representation
+ * 
+ * Output: etime = epochal time representation
+ * 
+ * Derived from NRL Neons V3.6
+ */
+void
+Cdh2e(CdTime *htime, double *etime)
+{
+	long 	ytemp, year;			/* temporary year holder */
+	int	day_cnt;		/* count of days */
+	int 	doy;			/* day of year */
+	long    baseYear;		     /* base year for epochal time */
+	int     daysInLeapYear;		     /* number of days in a leap year */
+	int     daysInYear;		     /* days in non-leap year */
+	extern void CdDayOfYear(CdTime *date, int *doy);
+
+	CdDayOfYear(htime,&doy);
+	
+	day_cnt	= 0;
+
+	baseYear = ((htime->timeType) & CdBase1970) ? 1970 : htime->baseYear;
+	year = ((htime->timeType) & CdBase1970) ? htime->year : (htime->year + htime->baseYear);
+	if(!((htime->timeType) & CdChronCal)) baseYear = year = 0;	/* set year and baseYear to 0 for Clim */
+	daysInLeapYear = ((htime->timeType) & Cd365) ? 366 : 360;
+	daysInYear = ((htime->timeType) & Cd365) ? 365 : 360;
+	
+	if (year > baseYear) {
+		for (ytemp = year - 1; ytemp >= baseYear; ytemp--) {
+			day_cnt += ISLEAP(ytemp,htime->timeType) ? daysInLeapYear : daysInYear;
+		}
+	} else if (year < baseYear) {
+		for (ytemp = year; ytemp < baseYear; ytemp++) {
+			day_cnt -= ISLEAP(ytemp,htime->timeType) ? daysInLeapYear : daysInYear;
+		}
+	}	
+	*etime	= (double) (day_cnt + doy - 1) * 24. + htime->hour;
+        return;
+}
+/* Convert epochal time (hours since 00 jan 1, 1970)
+ *   to human time (structured)
+ * 
+ * Input: 
+ *   etime = epochal time representation
+ *   timeType = time type (e.g., CdChron, CdClim, etc.) as defined in cdms.h
+ *   baseYear = base real, used for relative time types only
+ * 
+ * Output: htime = human (structured) time representation
+ * 
+ * Derived from NRL Neons V3.6
+ */
+void
+Cde2h(double etime, CdTimeType timeType, long baseYear, CdTime *htime)
+{
+	long 	ytemp;			/* temporary year holder */
+	int 	yr_day_cnt;		/* count of days in year */
+	int 	doy;			/* day of year */
+	int     daysInLeapYear;		     /* number of days in a leap year */
+	int     daysInYear;		     /* days in non-leap year */
+	extern void CdMonthDay(int *doy, CdTime *date);
+
+	doy	= (long) floor(etime / 24.) + 1;
+	htime->hour	= etime - (double) (doy - 1) * 24.;
+
+					     /* Correct for goofy floor func on J90 */
+	if(htime->hour >= 24.){
+		doy += 1;
+		htime->hour -= 24.;
+	}
+
+	htime->baseYear = (timeType & CdBase1970) ? 1970 : baseYear;
+	if(!(timeType & CdChronCal)) htime->baseYear = 0; /* Set base year to 0 for Clim */
+	daysInLeapYear = (timeType & Cd365) ? 366 : 360;
+	daysInYear = (timeType & Cd365) ? 365 : 360;
+
+	if (doy > 0) {
+		for (ytemp = htime->baseYear; ; ytemp++) {
+			yr_day_cnt = ISLEAP(ytemp,timeType) ? daysInLeapYear : daysInYear;
+			if (doy <= yr_day_cnt) break;
+			doy -= yr_day_cnt;
+		}
+	} else {
+		for (ytemp = htime->baseYear-1; ; ytemp--) {
+			yr_day_cnt = ISLEAP(ytemp,timeType) ? daysInLeapYear : daysInYear;
+			doy += yr_day_cnt;
+			if (doy > 0) break;
+		}
+	}
+        htime->year = (timeType & CdBase1970) ? ytemp : (ytemp - htime->baseYear);
+	if(!(timeType & CdChronCal)) htime->year = 0; /* Set year to 0 for Clim */
+	htime->timeType = timeType;
+	CdMonthDay(&doy,htime);
+
+        return;
+}
+/* Convert character time to human time
+ * 
+ * Input:
+ *   ctime    = character time
+ *   timeType = time type (e.g. CdChron) as defined in cdms.h
+ *   
+ * Output:
+ *   htime    = human (structured) time
+ */
+void
+Cdc2h(char *ctime, CdTimeType timeType, CdTime *htime)
+{
+/* 	int iyear, imon, iday, ihour, imin; */
+	int ihour, imin;
+	double dsec;
+/* 	long baseYear; */
+
+	switch(timeType){
+	  case CdChron: case CdChronNoLeap: case CdChron360:
+		sscanf(ctime,"%ld/%hd/%hd %d:%d:%lf",&htime->year,&htime->month,
+		       &htime->day,&ihour,&imin,&dsec);
+		htime->hour = (double)ihour + (double)imin/60. + dsec/3600;
+		htime->baseYear = 1970;
+		htime->timeType = timeType;
+		break;
+	  case CdRel: case CdRelNoLeap:
+		sscanf(ctime,"%ld+%ld/%hd/%hd %d:%d:%lf",&htime->baseYear,
+		       &htime->year,&htime->month,&htime->day,&ihour,&imin,&dsec);
+		htime->hour = (double)ihour + (double)imin/60. + dsec/3600;
+		htime->timeType = timeType;
+		break;
+	  case CdClim:
+		sscanf(ctime,"%hd/%hd %d:%d:%lf",&htime->month,&htime->day,
+		       &ihour,&imin,&dsec);
+		htime->hour = (double)ihour + (double)imin/60. + dsec/3600;
+		htime->year = 0;
+		htime->baseYear = 0;
+		htime->timeType = timeType;
+		break;
+	  default:
+		cdError("Invalid time type: %d\n",timeType);
+	}
+	return;
+}
+/* Convert human (structured) time to character time.
+ * 
+ * Input:
+ *   htime = human time
+ * 
+ * Output:
+ *   ctime = character time
+ */
+void
+Cdh2c(CdTime *htime, char *ctime)
+{
+
+	int ihour, imin;
+	double dmin, dsec;
+
+	ihour = (int) htime->hour;
+	dmin = (htime->hour - (double)ihour) * 60.0;
+	imin = (int) dmin;
+	dsec = (dmin - (double)imin) * 60.0;
+		
+	switch(htime->timeType){
+	  case CdChron: case CdChronNoLeap: case CdChron360:
+		sprintf(ctime,"%ld/%hd/%hd %d:%d:%.1f",htime->year,htime->month,
+		       htime->day,ihour,imin,dsec);
+		break;
+	  case CdRel: case CdRelNoLeap:
+		sprintf(ctime,"%ld+%ld/%hd/%hd %d:%d:%.1f",htime->baseYear,
+		       htime->year,htime->month,htime->day,ihour,imin,dsec);
+		break;
+	  case CdClim:
+		sprintf(ctime,"%hd/%hd %d:%d:%.1f",htime->month,htime->day,
+		       ihour,imin,dsec);
+		break;
+	  default:
+		cdError("Invalid time type: %d\n",htime->timeType);
+
+	}
+	return;
+}
+/* Convert character time to epochal time (hours since 00 jan 1, 1970)
+ * 
+ * Input:
+ *   ctime    = character time
+ *   timeType = time type (e.g. CdChron) as defined in cdms.h
+ * 
+ * Output:
+ *   etime    = epochal time 
+ */
+void
+Cdc2e(char *ctime, CdTimeType timeType, double *etime, long *baseYear)
+{
+	CdTime htime;
+	extern void Cdc2h(char *ctime, CdTimeType timeType, CdTime *htime);
+	extern void Cdh2e(CdTime *htime, double *etime);
+
+	Cdc2h(ctime,timeType,&htime);
+	Cdh2e(&htime,etime);
+	*baseYear = htime.baseYear;
+	return;
+}
+/* Convert epochal time (hours since 00 jan 1, 1970) to character time
+ * 
+ * Input:
+ *   etime    = epochal time
+ *   timeType = time type, (e.g., CdChron) as defined in cdms.h
+ *   baseYear = base year, used for relative time only
+ * 
+ * Output:
+ *   ctime    = character time
+ */
+void
+Cde2c(double etime, CdTimeType timeType, long baseYear, char *ctime)
+{
+	CdTime htime;
+	extern void Cde2h(double etime, CdTimeType timeType, long baseYear, CdTime *htime);
+	extern void Cdh2c(CdTime *htime, char *ctime);
+
+	Cde2h(etime,timeType,baseYear,&htime);
+	Cdh2c(&htime,ctime);
+	return;
+}
diff --git a/src/tst_coords.c b/src/tst_coords.c
index fd1d4da..edcea28 100644
--- a/src/tst_coords.c
+++ b/src/tst_coords.c
@@ -1,19 +1,16 @@
-/* 
-Copyright 2005 University Corporation for Atmospheric Research/Unidata
-See COPYRIGHT file for conditions of use. See www.unidata.ucar.edu for
-more info.
+/*!
+\file
 
-This file is part of the libcf package; it tests libcf coordinate
-systems.
+This is a test of libcf coordinate systems.
 
-Ed Hartnett 10/1/05
+\author Ed Hartnett, Unidata
+\date 10/1/05
 
-$Id: tst_coords.c,v 1.2 2009/09/08 17:14:53 ed Exp $
 */
 
 #include <nc_tests.h>
 #include <netcdf.h>
-#include <libcf.h>
+#include <libcf_src.h>
 
 #define DIM_LEN 4
 #define DIM1_NAME "lat"
@@ -203,7 +200,7 @@ test_system_assign(const char *testfile)
    if (nc_inq_var(ncid, system_varid, name_in, &type_in, &ndims_in, 
 		  dimids_in, &natts_in)) ERR;
    if (strcmp(name_in, LAT_LON_COORDINATE_SYSTEM) || type_in != NC_CHAR || 
-       ndims_in != 0 || natts_in != 1);
+       ndims_in != 0 || natts_in != 1) ERR;
    if (nc_inq_att(ncid, system_varid, COORDINATE_AXES, &type_in, &len_in)) ERR;
    if (type_in != NC_CHAR) ERR;
    if (nccf_inq_coord_system(ncid, system_varid, name_in, &naxes_in, axis_varids_in)) ERR;
diff --git a/src/tst_cvars.c b/src/tst_cvars.c
index 4b74b5c..491024a 100644
--- a/src/tst_cvars.c
+++ b/src/tst_cvars.c
@@ -6,11 +6,11 @@
 
    Ed Hartnett, 10/1/06
 
-   $Id: tst_cvars.c,v 1.2 2009/09/08 17:14:53 ed Exp $
+   $Id: tst_cvars.c 828 2011-09-14 20:05:08Z pletzer $
 */
 
-#include <config.h>
-#include <libcf.h>
+#include <cf_config.h>
+#include <libcf_src.h>
 #include <netcdf.h>
 #include <nc_tests.h>
 
diff --git a/src/tst_example_data.c b/src/tst_example_data.c
index 5ae0844..84eb23e 100644
--- a/src/tst_example_data.c
+++ b/src/tst_example_data.c
@@ -6,11 +6,11 @@
 
    Ed Hartnett, 10/1/06
 
-   $Id: tst_example_data.c,v 1.2 2009/09/08 17:14:53 ed Exp $
+   $Id: tst_example_data.c 828 2011-09-14 20:05:08Z pletzer $
 */
 
-#include <config.h>
-#include <libcf.h>
+#include <cf_config.h>
+#include <libcf_src.h>
 #include <netcdf.h>
 #include <nc_tests.h>
 
diff --git a/src/tst_f03_file.f90 b/src/tst_f03_file.f90
deleted file mode 100644
index b92887f..0000000
--- a/src/tst_f03_file.f90
+++ /dev/null
@@ -1,139 +0,0 @@
-program tst_f03_file
-  use libcf
-  use typeSizes
-  use netcdf
-  implicit none
-  integer:: ncid, varid
-  integer, parameter :: MAX_LEN = 256
-  character (len = *), parameter :: FILE_NAME = "tst_f03_file.nc"
-  character (len = *), parameter :: TITLE = 'Viscount of Lafayette'
-  character (len = *), parameter :: HISTORY = 'It all started one dark and stormy night...'
-  character (len = *), parameter :: INSTITUTION = 'Happy Home for Histronic Hacks'
-  character (len = *), parameter :: COMMENT = 'I like beans'
-  character (len = *), parameter :: SOURCE = 'Fevered imagination'
-  character (len = *), parameter :: REFERENCES = 'works of Emily Dickenson, Edgar Allen Poe'
-  character (len = *), parameter :: VAR_NAME = 'height'
-  character (len = *), parameter :: STANDARD_NAME = 'Constance'
-  character (len = *), parameter :: TITLE2 = 'Duke of Denver'
-  character (len = *), parameter :: HISTORY2 = 'In the beginning, there was the void......'
-  character (len = *), parameter :: INSTITUTION2 = 'St. Brutus Home for Hopeless Cases'
-  character (len = *), parameter :: COMMENT2 = 'soup is good when Muggles make it'
-  character (len = *), parameter :: SOURCE2 = 'Too much coffee waiting for BritRail'
-  character (len = *), parameter :: REFERENCES2 = 'Tales of Beadle the Bard'
-  character (len = *), parameter :: VAR_NAME2 = 'age'
-  character (len = *), parameter :: STANDARD_NAME2 = 'Harry'
-  character (len = MAX_LEN) :: title_in, history_in, institution_in, comment_in, &
-       source_in, references_in, standard_name_in
-  integer :: ncoord_vars_in
-  integer, dimension(CF_MAX_COORDS) :: coord_varids_in
-  integer, parameter :: FILL_VALUE = 42
-
-  print *
-  print *,'*** Testing f90 file API. All hail the ', TITLE, '!'
-  call check(nf90_create(FILE_NAME, NF90_NETCDF4, ncid))
-
-  ! Write some of the CF file attributes, and check them.
-  print *,'*** testing cf_def_file with partial args... '
-  call check(cf_def_file(ncid, convention = '1.0', title = TITLE, history = HISTORY, &
-       institution = INSTITUTION))
-  call check(cf_inq_file(ncid, title = title_in, history = history_in, institution = institution_in, &
-       comment = comment_in, source = source_in, references = references_in))
-  if (title_in .ne. TITLE) stop 3
-  if (institution_in .ne. INSTITUTION) stop 4
-  if (source_in .ne. ' ') stop 5
-  if (references_in .ne. ' ') stop 6
-
-  print *,'*** testing cf_def_file with different partial args... '
-  call check(cf_def_file(ncid, convention = '1.0', title = TITLE2, &
-       institution = INSTITUTION2))
-  call check(cf_inq_file(ncid, title = title_in, history = history_in, institution = institution_in, &
-       comment = comment_in, source = source_in, references = references_in))
-  if (title_in .ne. TITLE2) stop 23
-  if (institution_in .ne. INSTITUTION2) stop 24
-  if (source_in .ne. ' ') stop 25
-  if (references_in .ne. ' ') stop 26
-  
-  ! Write all of the CF file attributes.
-  print *,'*** testing cf_def_file with all args... '
-  call check(cf_def_file(ncid, convention = '1.0', title = TITLE, history = HISTORY, &
-       institution = INSTITUTION, comment = COMMENT, source = SOURCE, references = REFERENCES))
-  call check(cf_add_history(ncid, 'by the pale and sickly light of a bloated, over-described, harvest moon.'))
-  call check(cf_inq_file(ncid, title = title_in, history = history_in, institution = institution_in, &
-       comment = comment_in, source = source_in, references = references_in))
-  if (title_in .ne. TITLE) stop 33
-  if (institution_in .ne. INSTITUTION) stop 34
-  if (comment_in .ne. COMMENT) stop 35
-  if (source_in .ne. SOURCE) stop 36
-  if (references_in .ne. REFERENCES) stop 37
-
-  ! Write the variable CF attributes.
-  print *,'*** testing cf_def_var with some args... '
-  call check(nf90_def_var(ncid, VAR_NAME, NF90_INT, varid))
-  call check(cf_def_var(ncid, varid, institution = INSTITUTION, standard_name = STANDARD_NAME))
-  call check(cf_inq_var(ncid, varid, standard_name = standard_name_in, &
-       institution = institution_in, source = source_in))
-  if (standard_name_in .ne. STANDARD_NAME) stop 46
-  if (institution_in .ne. INSTITUTION) stop 47
-  if (source_in .ne. ' ') stop 48
-
-  print *,'*** testing cf_def_var with some other args... '
-  call check(cf_def_var(ncid, varid, institution = INSTITUTION2, comment = COMMENT2, &
-       source = SOURCE2, references = REFERENCES2))
-  call check(cf_inq_var(ncid, varid, comment = comment_in, &
-       institution = institution_in, source = source_in, references = references_in))
-  if (institution_in .ne. INSTITUTION2) stop 51
-  if (comment_in .ne. COMMENT2) stop 52
-  if (source_in .ne. SOURCE2) stop 53
-  if (references_in .ne. REFERENCES2) stop 54
-
-  print *,'*** testing cf_def_var with coord_varids... '
-  call check(cf_def_var(ncid, varid, ncoord_vars = 1, coord_varids = (/1/)))
-  call check(cf_inq_var(ncid, varid, ncoord_vars = ncoord_vars_in, coord_varids = coord_varids_in))
-  if (ncoord_vars_in .ne. 1) stop 60
-  if (coord_varids_in(1) .ne. 1) stop 61
-
-  print *,'*** testing cf_def_var with missing values... '
-!  call check(cf_def_var(ncid, varid, fill_value = FILL_VALUE))
-  call check(cf_inq_var(ncid, varid, ncoord_vars = ncoord_vars_in, coord_varids = coord_varids_in))
-  if (ncoord_vars_in .ne. 1) stop 60
-  if (coord_varids_in(1) .ne. 1) stop 61
-
-  ! Close the file.
-  call check(nf90_close(ncid))
-
-  ! Reopen and check.
-  print *,'*** testing after file reopen... '
-  call check(nf90_open(FILE_NAME, NF90_NOWRITE, ncid))
-  call check(cf_inq_file(ncid, title = title_in, &
-       history = history_in, institution = institution_in, &
-       comment = comment_in, source = source_in, references = references_in))
-  if (title_in .ne. TITLE) stop 13
-  if (institution_in .ne. INSTITUTION) stop 14
-  if (comment_in .ne. COMMENT) stop 15
-  if (source_in .ne. SOURCE) stop 16
-  if (references_in .ne. REFERENCES) stop 17
-
-  call check(cf_inq_var(ncid, varid, comment = comment_in, &
-       institution = institution_in, source = source_in, references = references_in))
-  if (institution_in .ne. INSTITUTION2) stop 91
-  if (comment_in .ne. COMMENT2) stop 92
-  if (source_in .ne. SOURCE2) stop 93
-  if (references_in .ne. REFERENCES2) stop 94
-  print *, '***     institution = ', trim(institution_in)
-  print *, '***     comment = ', trim(comment_in)
-  print *, '***     source = ', trim(source_in)
-  print *, '***     references = ', trim(references_in)
-
-  call check(nf90_close(ncid))
-  print *,'*** SUCCESS!!!'
-
-contains
-  subroutine check(status)
-    integer, intent ( in) :: status
-
-    if(status /= nf90_noerr) then
-       print *, trim(nf90_strerror(status))
-       stop 2
-    end if
-  end subroutine check
-end program tst_f03_file
diff --git a/src/tst_files.c b/src/tst_files.c
index cac25c1..1397c6d 100644
--- a/src/tst_files.c
+++ b/src/tst_files.c
@@ -4,11 +4,11 @@
 
    Test libcf file stuff.
 
-   $Id: tst_files.c,v 1.2 2009/09/08 17:14:54 ed Exp $
+   $Id: tst_files.c 828 2011-09-14 20:05:08Z pletzer $
 */
 
-#include <config.h>
-#include <libcf.h>
+#include <cf_config.h>
+#include <libcf_src.h>
 #include <netcdf.h>
 #include <nc_tests.h>
 
diff --git a/src/tst_linear_interp.c b/src/tst_linear_interp.c
new file mode 100644
index 0000000..45f5793
--- /dev/null
+++ b/src/tst_linear_interp.c
@@ -0,0 +1,427 @@
+/**
+ * $Id: tst_linear_interp.c 892 2011-12-21 19:48:51Z pletzer $
+ */
+
+#include <math.h>
+#include <stdio.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <netcdf.h>
+#include <nccf_constants.h>
+#include <nccf_utility_functions.h>
+#include <nccf_handle_error.h>
+
+#ifdef HAVE_CONFIG_H
+#include <cf_config.h>
+#endif
+
+void test1d() {
+  int status;
+  const int ndims = 1;
+  const int dims[] = {11};
+  const double xmin[] = {0.0};
+  const double xmax[] = {1.0};
+  // set very large periocity lengths for non-periodic case
+  const double coord_periodicity[] = {CF_HUGE_DOUBLE};
+  // target
+  double x0[ndims];
+  int hit_bounds[ndims];
+  x0[0] = xmin[0] + 0.45 * (xmax[0] - xmin[0]);
+  const double tolpos = 1.e-3;
+  const int nitermax = 20;
+  double weights[2];
+
+  double f;
+  double dindices[ndims];
+  double **xs;
+  double *fs;
+  int ntot = 1;
+  int i, j;
+  int inx[ndims];
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+
+  xs = (double **) malloc(ndims * sizeof(double *));
+  for (i = 0; i < ndims; ++i) {
+    xs[i] = (double *) malloc(ntot * sizeof(double));
+  }
+  fs = (double *) malloc(ntot * sizeof(double));
+  for (i = 0; i < ndims; ++i) {
+    for (j = 0; j < ntot; ++j) {
+      nccf_get_multi_index(ndims, dims, j, inx);
+      xs[i][j] = xmin[i] + inx[i] * (xmax[i] - xmin[i])/(dims[i] - 1.0);      
+    }
+  }
+  for (j = 0; j < ntot; ++j) {
+    fs[j] = xs[0][j];
+  }
+  dindices[0] = 0;
+  int niter = nitermax;
+  double tol = tolpos;
+  status = nccf_find_indices_double(ndims, dims, (const double **) xs, 
+                                    coord_periodicity,
+                                    x0, 
+				    &niter, &tol, 
+                                    NULL, dindices, hit_bounds);
+  if (status) ERR;
+
+  status = nccf_get_linear_weights_double(ndims, dims,
+					  dindices, NULL, weights);
+  if (status) ERR;
+
+  status = nccf_linear_interp_double(ndims, dims,
+                                     (const double *) fs, 
+				     dindices, weights, NC_FILL_DOUBLE,
+				     &f);
+  if (status) ERR;
+
+  free(fs);
+  for (i = 0; i < ndims; ++i) {
+    free(xs[i]);
+  }
+  free(xs);
+
+  // check
+  assert( fabs(f - x0[0]) < 1.e-6 );
+}
+
+//////////////////////////////////////////////////////////////////////
+
+void test2d() {
+  int status;
+  const int ndims = 2;
+  const int dims[] = {11, 21};
+  const double xmin[] = {0.0, 0.0};
+  const double xmax[] = {1.0, 2.0};
+  // set very large periocity lengths for non-periodic case
+  const double coord_periodicity[] = {CF_HUGE_DOUBLE, CF_HUGE_DOUBLE};
+  // target
+  double x0[ndims];
+  int hit_bounds[ndims];
+  x0[0] = xmin[0] + 0.43*(xmax[0] - xmin[0]);
+  x0[1] = xmin[1] + 0.34*(xmax[1] - xmin[1]);
+  const double tolpos = 1.e-3;
+  const int nitermax = 20;
+  double weights[2 * 2];
+
+  double f;
+  double dindices[ndims];
+  double **xs;
+  double *fs;
+  int ntot = 1;
+  int i, j;
+  int inx[ndims];
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+
+  xs = (double **) malloc(ndims * sizeof(double *));
+  for (i = 0; i < ndims; ++i) {
+    xs[i] = (double *) malloc(ntot * sizeof(double));
+  }
+  fs = (double *) malloc(ntot * sizeof(double));
+  for (i = 0; i < ndims; ++i) {
+    for (j = 0; j < ntot; ++j) {
+      nccf_get_multi_index(ndims, dims, j, inx);
+      xs[i][j] = xmin[i] + inx[i] * (xmax[i] - xmin[i])/(dims[i] - 1.0);      
+    }
+  }
+  for (j = 0; j < ntot; ++j) {
+    fs[j] = xs[0][j]*xs[1][j];
+  }
+
+  dindices[0] = 0;
+  dindices[1] = 0;
+  int niter = nitermax;
+  double tol = tolpos;
+  status = nccf_find_indices_double(ndims, dims, (const double **) xs,
+                                    coord_periodicity,
+                                    x0, 
+				    &niter, &tol, 
+                                    NULL, dindices, hit_bounds);
+  if (status) ERR;
+
+  status = nccf_get_linear_weights_double(ndims, dims,
+					  dindices, NULL, weights);
+  if (status) ERR;
+
+  status = nccf_linear_interp_double(ndims, dims,
+                                     (const double *) fs, 
+				     dindices, weights, NC_FILL_DOUBLE,
+				     &f);
+  if (status) ERR;
+
+  free(fs);
+  for (i = 0; i < ndims; ++i) {
+    free(xs[i]);
+  }
+  free(xs);
+
+  // check
+  assert( fabs(f - x0[0]*x0[1]) < 1.e-6 );
+}
+
+//////////////////////////////////////////////////////////////////////
+
+void adjustIndicesFuncForPolarGrid(int ndims, const int dims[], double dindices[]) {
+
+  if (dindices[0] < 0.0) {
+    // when rho goes negative...
+
+    // rho adjustment
+    dindices[0] = fabs( dindices[0] );
+    // theta adjustment
+    dindices[1] += (dims[1] - 1.0) / 2.0; 
+    dindices[1] = fmod(dindices[1], dims[1] - 1.0);
+    if (dindices[1]< 0.0) dindices[1] += dims[1] - 1.0;
+  }
+  if (dindices[0] >= dims[0] - 1) {
+    // when rho is beyond the last point
+    dindices[0] = dims[0] - 1; // want to be sure that we are inside the domain
+  }
+}
+
+void test2dPolar() {
+  int status;
+  const int ndims = 2;
+  const int dims[] = {41, 129};
+  // rho, theta, must avoid the singular point @ rho = 0
+  const double xmin[] = {0.001, 0.0};
+  const double xmax[] = {1.0, 2.0 * M_PI};
+  // set very large periocity lengths for non-periodic case
+  const double coord_periodicity[] = {CF_HUGE_DOUBLE, M_2_PI};
+  // target
+  double xTarget[ndims];
+  int hit_bounds[ndims];
+  double rhoTarget, theTarget;
+
+  // tolerance
+  const double tolpos = 1.e-3;
+  // max number of iterations
+  const int nitermax = 20;
+  double weights[2 * 2]; // 2^ndims
+
+  double f;
+  double dindices[ndims];
+  double **xs;
+  double *fs;
+  int ntot = 1;
+  int i, j;
+  int inx[ndims];
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+
+  xs = (double **) malloc(ndims * sizeof(double *));
+  for (i = 0; i < ndims; ++i) {
+    xs[i] = (double *) malloc(ntot * sizeof(double));
+  }
+  fs = (double *) malloc(ntot * sizeof(double));
+
+  double dr = (xmax[0] - xmin[0]) / (double)(dims[0] - 1.0);
+  double dt = (xmax[1] - xmin[1]) / (double)(dims[1] - 1.0);
+
+  for (j = 0; j < ntot; ++j) {
+    nccf_get_multi_index(ndims, dims, j, inx);
+    double rho = xmin[0] + inx[0] * dr;
+    double the = xmin[1] + inx[1] * dt;
+    xs[0][j] = rho * cos(the); // x      
+    xs[1][j] = rho * sin(the); // y
+    fs[j] = 1.0 + rho*cos(2.0*the);
+  }
+
+  FILE *file = fopen("tst_linear_interp_polar2d.py", "w");
+  fprintf(file, "from matplotlib import pylab\n");
+  fprintf(file, "t = [\n");
+  
+  int iCase;
+  const int nCases = 1000;
+  for (iCase = 0; iCase < nCases; ++iCase) {
+  
+    // set the target point
+    rhoTarget = xmin[0] + (dims[0] - 1) * dr * (double)random()/ (double)RAND_MAX;
+    theTarget = xmin[1] + (dims[1] - 1) * dt * (double)random()/ (double)RAND_MAX;
+    xTarget[0] = rhoTarget * cos(theTarget);
+    xTarget[1] = rhoTarget * sin(theTarget);
+
+    // initial guess
+    dindices[0] = dims[0]/3.1235;
+    dindices[1] = dims[1]/2.5678;
+
+    // update dindices
+    int niter = nitermax;
+    double tol = tolpos;
+    status = nccf_find_indices_double(ndims, dims, (const double **) xs,
+                                      coord_periodicity,
+                                      xTarget, 
+				      &niter, &tol, 
+				      adjustIndicesFuncForPolarGrid, 
+				      dindices, hit_bounds);
+    fprintf(file, "[%lf, %lf,  %d],\n", xTarget[0], xTarget[1], status);
+    if (status) {
+      printf("warning: nccf_find_indices_double did not converge for case %d (status = %d)\n",
+	     iCase, status);
+      printf("achieved tol = %lf\n", tol);
+    }
+
+    if (!status) {
+      status = nccf_get_linear_weights_double(ndims, dims,
+					      dindices, NULL, weights);
+      if (status) ERR;
+
+      status = nccf_linear_interp_double(ndims, dims,
+                                         (const double *) fs, 
+					 dindices, weights, NC_FILL_DOUBLE,
+					 &f);
+      // check
+      double fx = 1.0 + rhoTarget*cos(2.0*theTarget);
+#ifdef LOGGING
+      printf("case: %d rho = %f the = %f f = %g fx = %g\n", iCase, 
+	     rhoTarget, theTarget, f, fx);
+#endif
+      assert( fabs(f - fx) < 1.e-2 );
+    }
+  }
+  fprintf(file, "]\n");
+  fprintf(file, "for i in range(len(t)):\n");
+  fprintf(file, "    if t[i][-1] == 0: pylab.plot([t[i][0]], [t[i][1]], 'go')\n"); // success
+  fprintf(file, "    if t[i][-1] != 0: pylab.plot([t[i][0]], [t[i][1]], 'rx')\n"); // failure
+  fprintf(file, "pylab.show()\n");
+  fclose(file);
+
+  free(fs);
+  for (i = 0; i < ndims; ++i) {
+    free(xs[i]);
+  }
+  free(xs);
+
+}
+
+//////////////////////////////////////////////////////////////////////
+
+void test2dTripolar() {
+  int status;
+  const int ndims = 2;
+  const int dims[] = {41, 41};
+  // set very large periocity lengths for non-periodic case
+  const double coord_periodicity[] = {CF_HUGE_DOUBLE, CF_HUGE_DOUBLE};
+  // target
+  double xTarget[ndims];
+  const double latPerim = 60.0;
+
+  // tolerance
+  const double tolpos = 1.e-3;
+  // max number of iterations
+  const int nitermax = 20;
+  double weights[2 * 2]; // 2^ndims
+
+  double f;
+  double dindices[ndims];
+  int hit_bounds[ndims];
+  double **xs;
+  double *fs;
+  int ntot = 1;
+  int i, j;
+  int failureCounter = 0;
+
+  for (i = 0; i < ndims; ++i) {
+    ntot *= dims[i];
+  }
+
+  xs = (double **) malloc(ndims * sizeof(double *));
+  for (i = 0; i < ndims; ++i) {
+    xs[i] = (double *) malloc(ntot * sizeof(double));
+  }
+  fs = (double *) malloc(ntot * sizeof(double));
+
+  if ((status = nccf_get_bipolar_cap(dims, latPerim, -90.0, xs[1], xs[0]))) ERR;
+
+  for (j = 0; j < ntot; ++j) {
+    fs[j] = sin(2.0 * xs[0][j]/180.) * cos(xs[1][j]/180.0);
+  }
+
+  FILE *file = fopen("tst_linear_interp_tripolar.py", "w");
+  fprintf(file, "from matplotlib import pylab\n");
+  fprintf(file, "t = [\n");
+  
+  int iCase;
+  const int nCases = 1000;
+  for (iCase = 0; iCase < nCases; ++iCase) {
+    // set the target point
+    xTarget[0] = latPerim + (90.0 - latPerim) * (double)random()/ (double)RAND_MAX;
+    xTarget[1] = -180 + 360.0 * (double)random()/ (double)RAND_MAX;
+
+    // initial guess
+    dindices[0] = dims[0]/3.1235;
+    dindices[1] = dims[1]/2.5678;
+
+    // update dindices
+    int niter = nitermax;
+    double tol = tolpos;
+    status = nccf_find_indices_double(ndims, dims, (const double **) xs,
+                                      coord_periodicity,
+                                      xTarget, 
+				      &niter, &tol, 
+				      NULL, 
+				      dindices, hit_bounds);
+    fprintf(file, "[%lf, %lf,  %d],\n", xTarget[0], xTarget[1], status);
+    if (status) {
+      printf("warning: nccf_find_indices_double did not converge for case %d (status = %d)\n",
+	     iCase, status);
+      printf("achieved tol = %lf\n", tol);
+      failureCounter++;
+    }
+
+    if (!status) {
+      status = nccf_get_linear_weights_double(ndims, dims,
+					      dindices, NULL, weights);
+      if (status) ERR;
+
+      status = nccf_linear_interp_double(ndims, dims,
+                                         (const double *) fs, 
+					 dindices, weights, NC_FILL_DOUBLE,
+					 &f);
+      // check
+      double fx = sin(2.0 * xTarget[0]/180.) * cos(xTarget[1]/180.0);;
+#ifdef LOGGING
+      printf("case: %d lat = %f lon = %f f = %g fx = %g\n", iCase, 
+	     xTarget[0], xTarget[1], f, fx);
+#endif
+      //assert( fabs(f - fx) < 1.e-2 );
+    }
+  }
+  fprintf(file, "]\n");
+  fprintf(file, "for i in range(len(t)):\n");
+  fprintf(file, "    if t[i][-1] == 0: pylab.plot([t[i][1]], [t[i][0]], 'go')\n"); // success
+  fprintf(file, "    if t[i][-1] != 0: pylab.plot([t[i][1]], [t[i][0]], 'rx')\n"); // failure
+  fprintf(file, "pylab.show()\n");
+  fclose(file);
+  printf("%d failures in test2dTripolar\n", failureCounter);
+
+  free(fs);
+  for (i = 0; i < ndims; ++i) {
+    free(xs[i]);
+  }
+  free(xs);
+
+}
+
+//////////////////////////////////////////////////////////////////////
+
+int main() {
+
+#ifdef HAVE_LAPACK_LIB
+
+  /* 1d interpolation */
+  //test1d();
+
+  /* 2d interpolation */
+  //test2d();
+  //test2dPolar();
+  test2dTripolar();
+
+#endif
+
+  return 0;
+}
diff --git a/src/tst_listitem.c b/src/tst_listitem.c
new file mode 100644
index 0000000..c647b19
--- /dev/null
+++ b/src/tst_listitem.c
@@ -0,0 +1,222 @@
+/**
+ * Unit test for list item API
+ * $Id: tst_listitem.c 924 2012-03-23 16:47:05Z pletzer $
+ */
+
+/* std includes */
+#include <stdio.h>
+#include <stdlib.h>
+#include <nc_tests.h>
+
+
+/* some struct */
+struct X {
+  float member;
+};
+
+/* Comparison function for inserting data.
+ * The user knows the data type and can therefore test equality */
+int item_comparision( const void *data1, const void *data2 ){
+  int result;
+  struct X *d1;
+  struct X *d2;
+
+  d1 = (struct X *)data1;
+  d2 = (struct X *)data2;
+
+  if( d1->member <  d2->member ) result = -1;
+  if( d1->member >  d2->member ) result =  1;
+  if( d1->member == d2->member ) result =  0;
+  return result;
+}
+
+#include <cflistitem.h>
+
+int 
+main(int argc, char **argv) 
+{
+
+  int id, i;
+  struct CFLISTITEM *lst;
+  
+  /* elements */
+  struct X *x0;
+  struct X *x1;
+  struct X *x2;
+  struct X *x3;
+  struct X *x4;
+  struct X *x5;
+  struct X *x;
+
+  /* create elements */
+  x0 = (struct X *) malloc(sizeof(struct X)); 
+  x0->member = 0;
+  x1 = (struct X *) malloc(sizeof(struct X)); 
+  x1->member = 1;
+  x2 = (struct X *) malloc(sizeof(struct X)); 
+  x2->member = 2;
+  x3 = (struct X *) malloc(sizeof(struct X)); 
+  x3->member = 3;
+  x4 = (struct X *) malloc(sizeof(struct X)); 
+  x4->member = 4;
+
+  const int outId1[] = {0, 1, 2};
+  const int outId2[] = {0, 1, 3, 2};
+  const int outId3[] = {4, 0, 1, 3, 2};
+  const int outId4[] = {5, 4, 0, 1, 3, 2};
+  const float outMem1[] = {0, 1, 2};
+  const float outMem2[] = {0, 1, 3, 2};
+  const float outMem3[] = {4, 0, 1, 3, 2};
+  const float outMem4[] = {1.5, 4, 0, 1, 3, 2};
+  
+  /* create linked list */
+  nccf_li_new(&lst);
+  assert( nccf_li_get_nelem( &lst ) == 0 );
+  
+  /* attach elements */
+  id = nccf_li_add(&lst, x0);
+  assert(id == 0);
+
+  id = nccf_li_add(&lst, x1);
+  assert(id == 1);
+
+  id = nccf_li_add(&lst, x2);
+  assert(id == 2);
+
+  /* iterate over elements */
+  int index = 0;
+  nccf_li_begin(&lst);
+  while (nccf_li_next(&lst)) {
+    id = nccf_li_get_id(&lst);
+    x = (struct X *) nccf_li_find(&lst, id);
+    assert(outId1[index] == id);
+    assert(x->member == outMem1[index++]);
+  }
+
+  assert( nccf_li_get_nelem( &lst ) == 3 );
+
+  /****** Insert a new element ******/
+  nccf_li_begin(&lst);
+  while( nccf_li_next( &lst ) ){
+    id = nccf_li_get_id(&lst);
+    x = (struct X *) nccf_li_find(&lst, id);
+    if( id == 1 ){
+      id = nccf_li_insert_after( &lst, x3, id);
+    }
+    x = (struct X *) nccf_li_find(&lst, id);
+    assert(x->member == id);
+  }
+  assert( nccf_li_get_nelem( &lst ) == 4 );
+  /* Check list */
+  nccf_li_begin(&lst);
+  index = 0;
+  while (nccf_li_next(&lst)) {
+    id = nccf_li_get_id(&lst);
+    x = (struct X *) nccf_li_find(&lst, id);
+    assert(x->member == id);
+    assert(x->member == outMem2[index]);
+    assert(outId2[index++] == id);
+  }
+  /* Test insert at beginning of list */
+  id = -1;
+  id = nccf_li_insert_after( &lst, x4, id);
+  x = (struct X *) nccf_li_find(&lst, id);
+  assert(x->member == id);
+  /* Check list - again */
+  index = 0;
+  nccf_li_begin(&lst);
+  while (nccf_li_next(&lst)) {
+    id = nccf_li_get_id(&lst);
+    x = (struct X *) nccf_li_find(&lst, id);
+    assert(x->member == outMem3[index]);
+    assert(outId3[index] == id);
+    assert(x->member == id);
+    index++;
+  }
+  /* Insert using comparison function pointer */
+  x5 = (struct X *) malloc(sizeof(struct X)); 
+  x5->member = 1.5;
+  id = nccf_li_insert( &lst, x5, &item_comparision, 0 );
+  x = (struct X *) nccf_li_find(&lst, id);
+  assert( x->member == 1.5 );
+  assert( id == 5 );
+  /* Check list - again */
+  index = 0;
+  nccf_li_begin(&lst);
+  while (nccf_li_next(&lst)) {
+    id = nccf_li_get_id(&lst);
+    x = (struct X *) nccf_li_find(&lst, id);
+    assert(x->member == outMem4[index]);
+    assert(outId4[index++] == id);
+  }
+
+  /* remove elements */
+  x = nccf_li_remove(&lst, 0);
+  free(x); x = NULL;
+  x = nccf_li_remove(&lst, 2);
+  free(x); x = NULL;
+  x = nccf_li_remove(&lst, 1);
+  free(x); x = NULL;
+  x = nccf_li_remove(&lst, 3);
+  free(x); x = NULL;
+  x = nccf_li_remove(&lst, 4);
+  free(x); x = NULL;
+  x = nccf_li_remove(&lst, 5);
+  free(x); x = NULL;
+  nccf_li_del(&lst);
+
+  /* start over again */
+  nccf_li_new(&lst);
+  
+  /* check that iterating over an empty list is ok */
+  nccf_li_begin(&lst);
+  while (nccf_li_next(&lst)) {
+    id = nccf_li_get_id(&lst);
+  }  
+
+  /* checking adding/removing works */
+  x0 = (struct X *) malloc(sizeof(struct X));
+  id = nccf_li_add(&lst, x0);
+  x = nccf_li_remove(&lst, id);
+  free(x); x = NULL;
+  nccf_li_del(&lst);
+
+  /* try to add an item to a list that has been reset */
+  nccf_li_new(&lst);
+  for (i = 0; i < 10; ++i) {
+    x = (struct X *) malloc(sizeof(struct X));
+    x->member = i;
+    id = nccf_li_add(&lst, x);
+  }
+  /* now reset */
+  nccf_li_begin(&lst);
+  /* add another element */
+  x = (struct X *) malloc(sizeof(struct X));
+  x->member = 10;
+  /* now add */
+  id = nccf_li_add(&lst, x);
+  assert(id == 10);
+
+  /* this is the proper way to destroy the list:
+     Iterate over all elements and remove each element.
+     The head will be removed with the destructor call.
+  */
+  nccf_li_begin(&lst);
+  while (nccf_li_next(&lst)) {
+    id = nccf_li_get_id(&lst);
+    x = (struct X *) nccf_li_remove(&lst, id);
+    free(x); x = NULL;
+  }
+  nccf_li_del(&lst);
+
+  /* check that the head will be removed even when there
+     are no elements in the list
+   */
+  nccf_li_new(&lst);
+  nccf_li_del(&lst);
+
+  SUMMARIZE_ERR;
+  FINAL_RESULTS;
+}
+
+
diff --git a/src/tst_nccf_find_adjacent.c b/src/tst_nccf_find_adjacent.c
new file mode 100644
index 0000000..727b627
--- /dev/null
+++ b/src/tst_nccf_find_adjacent.c
@@ -0,0 +1,93 @@
+/**
+ * Test flat index calculation
+ * $Id: tst_nccf_find_adjacent.c 589 2011-03-23 22:01:39Z dkindig $
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <nccf_utility_functions.h>
+
+int main() {
+
+  int i;
+  /* Did not inside acutally get tripped? */
+  int inside_domain = 1, ntot = 1, count = 0;
+
+  /* 4D */
+  int dims4d[] = {2, 3, 2, 3};
+  int kji1[] = {0, 0, 0, 0};
+  int kji2[] = {0, 0, 0, 0};
+  int ndims = 4;
+
+  for( i = 0; i < ndims; i++ ) ntot *= dims4d[i];
+
+  while( inside_domain ){
+    for( i = 0; i < ndims; i++ ) kji2[i] = kji1[i];
+    inside_domain = nccf_find_next_adjacent( ndims, dims4d, kji1 );
+    ++count;
+
+    if( count > ntot ) assert( count == ntot );
+  }
+
+  assert( count == ntot );
+
+  /* 3D */
+  int dims3d[] = {2, 3, 2};
+  kji1[0] = 0; kji1[1] = 0; kji1[2] = 0;
+  kji2[0] = 0; kji2[1] = 0; kji2[2] = 0;
+  ndims = 3;
+  inside_domain = 1; ntot = 1; count = 0;
+
+  for( i = 0; i < ndims; i++ ) ntot *= dims3d[i];
+
+  while( inside_domain ){
+    for( i = 0; i < ndims; i++ ) kji2[i] = kji1[i];
+    inside_domain = nccf_find_next_adjacent( ndims, dims3d, kji1 );
+    ++count;
+
+    if( count > ntot ) assert( count == ntot );
+  }
+
+  assert( count == ntot );
+
+  /* 2D */
+  int dims2d[] = {2, 3};
+  kji1[0] = 0; kji1[1] = 0;
+  kji2[0] = 0; kji2[1] = 0;
+  ndims = 2;
+  inside_domain = 1; ntot = 1; count = 0;
+
+  for( i = 0; i < ndims; i++ ) ntot *= dims2d[i];
+
+  while( inside_domain ){
+    for( i = 0; i < ndims; i++ ) kji2[i] = kji1[i];
+    inside_domain = nccf_find_next_adjacent( ndims, dims2d, kji1 );
+    ++count;
+
+    if( count > ntot ) assert( count == ntot );
+  }
+
+  assert( count == ntot );
+
+  /* 1D */
+  int dims1d[] = {2};
+  kji1[0] = 0;
+  kji2[0] = 0;
+  ndims = 1;
+  inside_domain = 1; ntot = 1; count = 0;
+
+  for( i = 0; i < ndims; i++ ) ntot *= dims1d[i];
+
+  while( inside_domain ){
+    for( i = 0; i < ndims; i++ ) kji2[i] = kji1[i];
+    inside_domain = nccf_find_next_adjacent( ndims, dims1d, kji1 );
+    ++count;
+
+    if( count > ntot ) assert( count == ntot );
+  }
+
+  assert( count == ntot );
+
+  return 0;
+
+}
diff --git a/src/tst_nccf_generate_id.c b/src/tst_nccf_generate_id.c
new file mode 100644
index 0000000..9ac0e4d
--- /dev/null
+++ b/src/tst_nccf_generate_id.c
@@ -0,0 +1,75 @@
+/*
+ * Test the creation of an 8 digit alpha-numeric id.
+ *
+ * "$Id: tst_nccf_generate_id.c 828 2011-09-14 20:05:08Z pletzer $"
+ * */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <time.h>
+#include <netcdf.h>
+
+#include "cf_config.h"
+#include "nccf_constants.h"
+#include "nccf_utility_functions.h"
+#include "nccf_handle_error.h"
+
+int main(  ){
+
+  int status, compare_value;
+  char *id1, *id2, *id3, *id4, *id5;
+
+  id1 = ( char * )calloc( STRING_SIZE, sizeof( char ));
+  id2 = ( char * )calloc( STRING_SIZE, sizeof( char ));
+  id3 = ( char * )calloc( STRING_SIZE, sizeof( char ));
+  id4 = ( char * )calloc( STRING_SIZE, sizeof( char ));
+  id5 = ( char * )calloc( STRING_SIZE, sizeof( char ));
+
+  if(( status = nccf_generate_id( 88, id1))) ERR;
+//  printf( "The id is:\n%s\n", id );
+
+  if(( status = nccf_generate_id( 7, id2 ))) ERR;
+//  printf( "The id is:\n%s\n", id );
+
+  if(( status = nccf_generate_id( 7, id3 ))) ERR;
+
+  if(( status = nccf_generate_id( -6, id4 ))) ERR;
+//  printf( "The id is:\n%s\n", id4);
+
+  if(( status = nccf_generate_id( 6, id5 ))) ERR;
+//  printf( "The id is:\n%s\n", id5);
+
+/* Compare each id. They should all be different */
+  compare_value = strcmp( id1, id2 );
+  assert( compare_value != 0 );
+  compare_value = strcmp( id1, id3 );
+  assert( compare_value != 0 );
+  compare_value = strcmp( id1, id4 );
+  assert( compare_value != 0 );
+  compare_value = strcmp( id1, id5 );
+  assert( compare_value != 0 );
+  compare_value = strcmp( id2, id3 );
+#ifdef HAVE_UUID_H
+  assert( compare_value != 0 );
+#else
+  assert( compare_value == 0 );
+#endif
+  compare_value = strcmp( id2, id4 );
+  assert( compare_value != 0 );
+  compare_value = strcmp( id3, id4 );
+  assert( compare_value != 0 );
+  compare_value = strcmp( id3, id5 );
+  assert( compare_value != 0 );
+  compare_value = strcmp( id4, id5 );
+
+  free( id1 );
+  free( id2 );
+  free( id3 );
+  free( id4 );
+  free( id5 );
+
+  return NC_NOERR;
+
+}
diff --git a/src/tst_nccf_get_bipolar_cap.c b/src/tst_nccf_get_bipolar_cap.c
new file mode 100644
index 0000000..04248b7
--- /dev/null
+++ b/src/tst_nccf_get_bipolar_cap.c
@@ -0,0 +1,51 @@
+/**
+ * $Id: tst_nccf_get_bipolar_cap.c 560 2011-03-14 15:53:54Z pletzer $
+ *
+ * Test bipolar cap grid generation.
+ */
+// std includes
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <netcdf.h>
+#include <nccf_utility_functions.h>
+#include <nccf_handle_error.h>
+
+int main() {
+  double latPerim = 66.;
+  int dims[] = {5, 5};
+  int nvert = dims[0] * dims[1];
+ 
+  double lats[nvert];
+  double lons[nvert];
+  double lonSing = 0.0;
+
+  nccf_get_bipolar_cap(dims, latPerim, lonSing, lons, lats);
+  
+  int i,j;
+  for (j=0; j<dims[1]; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+#ifdef LOGGING
+      printf("%f ", lons[i + j*dims[0]]);
+#endif
+    }
+#ifdef LOGGING
+    printf("\n");
+#endif
+  }
+  for (j=0; j<dims[1]; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+#ifdef LOGGING
+      printf("%f ", lats[i + j*dims[0]]);
+#endif
+    }
+#ifdef LOGGING
+    printf("\n");
+#endif
+  }
+#ifdef LOGGING
+  printf("\n");
+#endif
+  return 0;
+}
diff --git a/src/tst_nccf_get_cubedsphere_grid.c b/src/tst_nccf_get_cubedsphere_grid.c
new file mode 100644
index 0000000..f184073
--- /dev/null
+++ b/src/tst_nccf_get_cubedsphere_grid.c
@@ -0,0 +1,74 @@
+/**
+ * $Id: tst_nccf_get_cubedsphere_grid.c 560 2011-03-14 15:53:54Z pletzer $
+ *
+ * Test cubed sphere grid generation.
+ */
+// std includes
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <netcdf.h>
+#include <nccf_utility_functions.h>
+#include <nccf_handle_error.h>
+
+int main() {
+  int faceVec[] = {1, 0, 0};
+  int faceVec2[] = {0, 1, 0};
+  int dims[] = {3, 3};
+ 
+  double lats[9];
+  double lons[9];
+
+  nccf_get_cubedsphere_grid(dims, faceVec, lons, lats);
+  
+  int i,j;
+  for (j=0; j<dims[1]; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+#ifdef LOGGING
+      printf("%f ", lons[i + j*dims[0]]);
+#endif
+    }
+#ifdef LOGGING
+    printf("\n");
+#endif
+  }
+  for (j=0; j<dims[1]; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+#ifdef LOGGING
+      printf("%f ", lats[i + j*dims[0]]);
+#endif
+    }
+#ifdef LOGGING
+    printf("\n");
+#endif
+  }
+#ifdef LOGGING
+  printf("\n");
+#endif
+
+  nccf_get_cubedsphere_grid(dims, faceVec2, lons, lats);
+
+  for (j=0; j<dims[1]; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+#ifdef LOGGING
+      printf("%f ", lons[i + j*dims[0]]);
+#endif
+    }
+#ifdef LOGGING
+    printf("\n");
+#endif
+  }
+  for (j=0; j<dims[1]; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+#ifdef LOGGING
+      printf("%f ", lats[i + j*dims[0]]);
+#endif
+    }
+#ifdef LOGGING
+    printf("\n");
+#endif
+  }
+
+  return 0;
+}
diff --git a/src/tst_nccf_get_flat_index.c b/src/tst_nccf_get_flat_index.c
new file mode 100644
index 0000000..4615df1
--- /dev/null
+++ b/src/tst_nccf_get_flat_index.c
@@ -0,0 +1,41 @@
+/**
+ * Test flat index calculation
+ * $Id: tst_nccf_get_flat_index.c 589 2011-03-23 22:01:39Z dkindig $
+ */
+
+#include <assert.h>
+#include "nccf_utility_functions.h"
+
+int main() {
+  const int dims[] = {10, 11, 12};
+  const int idx[] = {9, 8, 7};
+  int idx2[3];
+  int ndims;
+  int fi;
+
+  /* 1d */
+  ndims = 1;
+  fi = nccf_get_flat_index(ndims, dims, idx);
+  nccf_get_multi_index(ndims, dims, fi, idx2);
+  assert(fi == idx[0]);
+  assert(idx[0] == idx2[0]);
+
+  /* 2d */
+  ndims = 2;
+  fi = nccf_get_flat_index(ndims, dims, idx);
+  nccf_get_multi_index(ndims, dims, fi, idx2);
+  assert(fi == idx[1] + dims[1]*idx[0]);
+  assert(idx[0] == idx2[0]);
+  assert(idx[1] == idx2[1]);
+
+  /* 3d */
+  ndims = 3;
+  fi = nccf_get_flat_index(ndims, dims, idx);
+  nccf_get_multi_index(ndims, dims, fi, idx2);
+  assert(fi == idx[2] + dims[2]*(idx[1] + dims[1]*idx[0]));
+  assert(idx[0] == idx2[0]);
+  assert(idx[1] == idx2[1]);
+  assert(idx[2] == idx2[2]);
+  
+  return 0;
+}
diff --git a/src/tst_nccf_get_tripolar_grid.c b/src/tst_nccf_get_tripolar_grid.c
new file mode 100644
index 0000000..e2d634a
--- /dev/null
+++ b/src/tst_nccf_get_tripolar_grid.c
@@ -0,0 +1,49 @@
+/**
+ * $Id: tst_nccf_get_tripolar_grid.c 560 2011-03-14 15:53:54Z pletzer $
+ *
+ * Test tripolar grid generation.
+ */
+// std includes
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <netcdf.h>
+#include <nccf_utility_functions.h>
+#include <nccf_handle_error.h>
+
+int main() {
+  int dims[] = {10, 10};
+  int capIndx = 7;
+
+  double lats[10*10];
+  double lons[10*10];
+
+  nccf_get_tripolar_grid(dims, capIndx, lons, lats);
+  
+  int i,j;
+  for (j=0; j<dims[1]; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+#ifdef LOGGING
+      printf("%f ", lons[i + j*dims[0]]);
+#endif
+    }
+#ifdef LOGGING
+    printf("\n");
+#endif
+  }
+  for (j=0; j<dims[1]; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+#ifdef LOGGING
+      printf("%f ", lats[i + j*dims[0]]);
+#endif
+    }
+#ifdef LOGGING
+    printf("\n");
+#endif
+  }
+#ifdef LOGGING
+  printf("\n");
+#endif
+  return 0;
+}
diff --git a/src/tst_nccf_get_tripolar_halfgrid.c b/src/tst_nccf_get_tripolar_halfgrid.c
new file mode 100644
index 0000000..dc7516e
--- /dev/null
+++ b/src/tst_nccf_get_tripolar_halfgrid.c
@@ -0,0 +1,75 @@
+/**
+ * $Id: tst_nccf_get_tripolar_halfgrid.c 560 2011-03-14 15:53:54Z pletzer $
+ *
+ * Test tripolar grid generation, another way to generate the tripolar grid.
+ */
+// std includes
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <netcdf.h>
+#include <nccf_utility_functions.h>
+#include <nccf_handle_error.h>
+
+int main() {
+  int dims[] = {5, 10};
+  int capIndx = 7;
+
+  double lats[5*10];
+  double lons[5*10];
+
+  nccf_get_tripolar_halfgrid(dims, 0, capIndx, lons, lats);
+  
+  int i,j;
+#ifdef LOGGING
+  printf("first half:\n");
+#endif
+  for (j=0; j<dims[1]; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+#ifdef LOGGING
+      printf("%f ", lons[i + j*dims[0]]);
+#endif
+    }
+#ifdef LOGGING
+    printf("\n");
+#endif
+  }
+  for (j=0; j<dims[1]; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+#ifdef LOGGING
+      printf("%f ", lats[i + j*dims[0]]);
+#endif
+    }
+#ifdef LOGGING
+    printf("\n");
+#endif
+  }
+#ifdef LOGGING
+  printf("\nsecond half:\n");
+#endif
+
+  nccf_get_tripolar_halfgrid(dims, 1, capIndx, lons, lats);
+  for (j=0; j<dims[1]; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+#ifdef LOGGING
+      printf("%f ", lons[i + j*dims[0]]);
+#endif
+    }
+#ifdef LOGGING
+    printf("\n");
+#endif
+  }
+  for (j=0; j<dims[1]; ++j) {
+    for (i=0; i<dims[0]; ++i) {
+#ifdef LOGGING
+      printf("%f ", lats[i + j*dims[0]]);
+#endif
+    }
+#ifdef LOGGING
+    printf("\n");
+#endif
+  }
+
+  return 0;
+}
diff --git a/src/tst_nccf_index2vector.c b/src/tst_nccf_index2vector.c
new file mode 100644
index 0000000..9857a3b
--- /dev/null
+++ b/src/tst_nccf_index2vector.c
@@ -0,0 +1,41 @@
+/*
+ * Test conversion of a flat index to a vector
+ * "$Id: tst_nccf_index2vector.c 560 2011-03-14 15:53:54Z pletzer $"
+ * */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include <nccf_utility_functions.h>
+
+int main(  ){
+
+    int *vector;
+    int ndims, i, ndims2;
+    int status;
+
+    /* 2D*/
+    ndims = 2;
+    ndims2 = ndims * 2;
+    vector = ( int * )malloc( ndims * sizeof( int ));
+
+    for( i = 0; i < ndims2; i++ ){
+        status = nccf_index2vector( i, ndims, vector );
+    }
+
+    free( vector );
+
+    /* 3D */
+    ndims = 3;
+    ndims2 = ndims * 2;
+    vector = ( int * )malloc( ndims * sizeof( int ));
+
+    for( i = 0; i < ndims2; i++ ){
+        status = nccf_index2vector( i, ndims, vector );
+    }
+
+    free( vector );
+    
+    return 0;
+}
diff --git a/src/tst_nccf_keyvalue.c b/src/tst_nccf_keyvalue.c
new file mode 100644
index 0000000..7a8f1d7
--- /dev/null
+++ b/src/tst_nccf_keyvalue.c
@@ -0,0 +1,107 @@
+/**
+ * Test nccf_keyvalue
+ * $Id: tst_nccf_keyvalue.c 664 2011-04-01 17:36:20Z pletzer $
+ */
+
+#include <nccf_keyvalue.h>
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+
+int main() {
+  
+  int i;
+  struct CFLISTITEM *lst;
+
+  //
+  // create attribut list 
+  //
+  nccf_kv_new(&lst);
+
+  //
+  // push attributes in
+  //
+  // add a string attribute, no need to pass the string length
+  nccf_kv_add(&lst, "att_string", NC_CHAR, 0, "att_string value");
+  // add a float attribute, a scalar
+  float vf = 1;
+  nccf_kv_add(&lst, "att_float", NC_FLOAT, 1, &vf);
+  // add a double array
+  double ad[] = {2, 3};
+  nccf_kv_add(&lst, "att_double_array", NC_DOUBLE, 2, ad);
+
+  //
+  // access known attributes
+  //
+  int nelem;
+  nc_type type;
+  const void *ds;
+  nccf_kv_get_value(&lst, "att_string", &type, &nelem, &ds);
+  assert(type == NC_CHAR);
+  assert(strcmp(ds, "att_string value") == 0);
+  
+  const float *df;
+  nccf_kv_get_value(&lst, "att_float", &type, &nelem, 
+		    (const void **) &df);
+  assert(nelem == 1);
+  assert(*df == 1);
+
+  const double *dd;
+  nccf_kv_get_value(&lst, "att_double_array", &type, &nelem, 
+		    (const void **) &dd);
+  assert(nelem == 2);
+  assert(dd[0] == 2 && dd[1] == 3);
+
+  // try to access a non-existant key 
+  const void *dn;
+  nccf_kv_get_value(&lst, "non existant", &type, &nelem, &dn);
+  assert(dn == NULL);
+
+  //
+  // iterator 
+  //
+  nccf_kv_begin(&lst);
+  while ( nccf_kv_next(&lst) ) {
+    const char *k;
+    const void *data;
+    nccf_kv_get_key(&lst, &k);
+    nccf_kv_get_value(&lst, k, &type, &nelem, &data);
+    if (type == NC_CHAR) {
+      printf("%s -> %s (NC_CHAR)\n", k, (char *) data);
+    }
+    else if (type == NC_DOUBLE) {
+      const double *dd = data;
+      printf("%s -> ", k);
+      for (i = 0; i < nelem; ++i) {
+	printf("%lf ", dd[i]);
+      }
+      printf(" (NC_DOUBLE) \n");
+    }
+    else if (type == NC_FLOAT) {
+      const float *df = data;
+      printf("%s -> ", k);
+      for (i = 0; i < nelem; ++i) {
+	printf("%f ", df[i]);
+      }
+      printf("(NC_FLOAT) \n");
+    }
+    else if (type == NC_INT) {
+      const int *di = data;
+      printf("%s -> ", k);
+      for (i = 0; i < nelem; ++i) {
+	printf("%d ", di[i]);
+      }
+      printf("(NC_INT) \n");
+    }
+    else {
+      // error
+      assert(1 == 0);
+    }
+  }
+  
+  //
+  // destroy attribute list
+  //
+  nccf_kv_del(&lst);
+  return 0;
+}
diff --git a/src/tst_nccf_linear_interp_mask.c b/src/tst_nccf_linear_interp_mask.c
new file mode 100644
index 0000000..a0684fc
--- /dev/null
+++ b/src/tst_nccf_linear_interp_mask.c
@@ -0,0 +1,180 @@
+/**
+ * Test linear masked interpolation
+ * $Id: tst_nccf_linear_interp_mask.c 891 2011-12-21 17:22:02Z pletzer $
+ */
+
+#include <assert.h>
+#include <math.h>
+#include <cf_config.h>
+#include <nccf_constants.h>
+#include <nccf_utility_functions.h>
+
+const double tol = 1.e-6;
+
+int main() {
+#ifdef HAVE_LAPACK_LIB
+  {
+    /* 1d tests */
+    int status;
+    const int ndims = 1;
+    const int nnodes = 2;
+    const int dims[] = {2};
+    double weights[nnodes];
+
+    // all data valid
+    const double dindices[] = {0.2};
+    int imask[] = {1, 1};
+    status = nccf_get_linear_weights_double(ndims, dims, 
+                                            dindices,
+                                            imask, weights);
+    assert(status == 0);
+    assert(fabs(weights[0] + weights[1] - 1) < tol);
+    assert(fabs(weights[0] - 0.8) < tol);
+    assert(fabs(weights[1] - 0.2) < tol);
+    
+    // one invalid datum, not possible to interpolate
+    imask[0] = 0; imask[1] = 1;
+    status = nccf_get_linear_weights_double(ndims, dims, 
+                                            dindices,
+                                            imask, weights);
+    assert(status == -1);
+    assert(fabs(weights[0] + weights[1]) < tol);
+
+    // no valid data
+    imask[0] = 0; imask[1] = 0;
+    status = nccf_get_linear_weights_double(ndims, dims, 
+                                            dindices,
+                                            imask, weights);
+    assert(status == -2);
+    assert(fabs(weights[0] + weights[1]) < tol); 
+  }
+  
+  /* 2d tests */
+  {
+    int status;
+    const int ndims = 2;
+    const int nnodes = 4;
+    const int dims[] = {2, 2};
+    double weights[nnodes];
+
+    // all data valid
+    double dindices[] = {0.2, 0.6};
+    int imask[] = {1, 1, 1, 1};
+    status = nccf_get_linear_weights_double(ndims, dims, 
+                                            dindices,
+                                            imask, weights);
+    assert(status == 0);
+    assert(fabs(weights[0] + weights[1] + weights[2] + weights[3]- 1) < tol);
+    assert(fabs(weights[0] - (1-dindices[0])*(1-dindices[1])) < tol);
+    assert(fabs(weights[1] - (1-dindices[0])*(0+dindices[1])) < tol);
+    assert(fabs(weights[2] - (0+dindices[0])*(1-dindices[1])) < tol);
+
+    // 1 missing datum, ok to interpolate
+    imask[0] = 1; imask[1] = 1; imask[2] = 0; imask[3] = 1;
+    status = nccf_get_linear_weights_double(ndims, dims, 
+                                            dindices,
+                                            imask, weights);
+    assert(status == 1);
+    assert(fabs(weights[0] + weights[1] + weights[2] + weights[3] - 1) < tol);
+    assert(fabs(weights[0] - (1-0.6)) < tol);
+    assert(fabs(weights[1] - (1 - (1-0.6) - 0.2)) < tol);
+    assert(fabs(weights[2] -   0) < tol);
+    assert(fabs(weights[3] - 0.2) < tol);
+    
+    // 1 missing datum, cannot interpolate
+    imask[0] = 0; imask[1] = 1; imask[2] = 1; imask[3] = 1;
+    status = nccf_get_linear_weights_double(ndims, dims, 
+                                            dindices,
+                                            imask, weights);
+    assert(status == -1);
+    assert(fabs(weights[0] + weights[1] + weights[2] + weights[3]) < tol);
+
+    // 1 missing datum, ok to interpolate
+    imask[0] = 1; imask[1] = 1; imask[2] = 1; imask[3] = 0;
+    status = nccf_get_linear_weights_double(ndims, dims, 
+                                            dindices,
+                                            imask, weights);
+    assert(status == 1);
+    assert(fabs(weights[0] + weights[1] + weights[2] + weights[3] - 1) < tol);
+    assert(fabs(weights[0] - (1 - 0.6 - 0.2)) < tol);
+    assert(fabs(weights[1] - 0.6) < tol);
+    assert(fabs(weights[2] - 0.2) < tol);
+    assert(fabs(weights[3] - 0) < tol);
+
+    // 2 missing data, cannot interpolate
+    imask[0] = 0; imask[1] = 1; imask[2] = 0; imask[3] = 1;
+    status = nccf_get_linear_weights_double(ndims, dims, 
+                                            dindices,
+                                            imask, weights);
+    assert(status == -2);
+    assert(fabs(weights[0] + weights[1] + weights[2] + weights[3]) < tol);
+  }
+
+  /* 3d tests */
+  {
+    int status;
+    const int ndims = 3;
+    const int nnodes = 8;
+    const int dims[] = {2, 2, 2};
+    double weights[nnodes];
+
+    // all data valid
+    double dindices[] = {0.2, 0.4, 0.6};
+    int imask[] = {1, 1, 1, 1, 1, 1, 1, 1};
+    status = nccf_get_linear_weights_double(ndims, dims, 
+                                            dindices,
+                                            imask, weights);
+    assert(status == 0);
+    assert(fabs(weights[0] + weights[1] + weights[2] + weights[3] +
+                weights[4] + weights[5] + weights[6] + weights[7]
+                - 1) < tol);
+    assert(fabs(weights[0] - 
+                (1-dindices[0])*(1-dindices[1])*(1-dindices[2]) < tol));
+    assert(fabs(weights[1] - 
+                (1-dindices[0])*(1-dindices[1])*(0+dindices[2]) < tol));
+    assert(fabs(weights[2] - 
+                (1-dindices[0])*(0+dindices[1])*(1-dindices[2]) < tol));
+    assert(fabs(weights[3] - 
+                (1-dindices[0])*(0+dindices[1])*(0+dindices[2]) < tol));
+    assert(fabs(weights[4] - 
+                (0+dindices[0])*(1-dindices[1])*(1-dindices[2]) < tol));
+    assert(fabs(weights[5] - 
+                (0+dindices[0])*(1-dindices[1])*(0+dindices[2]) < tol));
+    assert(fabs(weights[6] - 
+                (0+dindices[0])*(0+dindices[1])*(1-dindices[2]) < tol));
+    assert(fabs(weights[7] - 
+                (0+dindices[0])*(0+dindices[1])*(0+dindices[2]) < tol));
+
+    // missing values, ok to interpolate
+    imask[0] = 1; imask[1] = 1; imask[2] = 0; imask[3] = 1;
+    imask[4] = 0; imask[5] = 1; imask[6] = 0; imask[7] = 0;
+    status = nccf_get_linear_weights_double(ndims, dims, 
+                                            dindices,
+                                            imask, weights);
+    assert(status == 4);
+    assert(fabs(weights[0] + weights[1] + weights[2] + weights[3] +
+                weights[4] + weights[5] + weights[6] + weights[7] 
+                - 1) < tol);
+    assert(fabs(weights[5] - 0.2) < tol);
+    assert(fabs(weights[3] - 0.4) < tol);
+    assert(fabs(weights[0] - 0.4) < tol);
+    
+    // too many missing values
+    imask[0] = 0; imask[1] = 1; imask[2] = 0; imask[3] = 1;
+    imask[4] = 0; imask[5] = 1; imask[6] = 0; imask[7] = 0;
+    status = nccf_get_linear_weights_double(ndims, dims, 
+                                            dindices,
+                                            imask, weights);
+    assert(status == -5);
+
+    imask[0] = 0; imask[1] = 0; imask[2] = 0; imask[3] = 1;
+    imask[4] = 0; imask[5] = 1; imask[6] = 0; imask[7] = 0;
+    status = nccf_get_linear_weights_double(ndims, dims, 
+                                            dindices,
+                                            imask, weights);
+    assert(status == -6);
+  }
+#endif // HAVE_LAPACK_LIB
+
+  return 0;
+}
diff --git a/src/tst_nccf_varObj.c b/src/tst_nccf_varObj.c
new file mode 100644
index 0000000..7dc8762
--- /dev/null
+++ b/src/tst_nccf_varObj.c
@@ -0,0 +1,287 @@
+/**
+ * $Id: tst_nccf_varObj.c 922 2012-03-22 17:13:41Z pletzer $
+ *
+ * Test nccf_var_obj
+ */
+
+// std includes
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <netcdf.h>
+// libcf
+#include <cflistitem.h>
+
+// tools
+#include <nccf_varObj.h>
+#include <nccf_handle_error.h>
+#include <nccf_constants.h>
+
+#include <assert.h>
+
+int main() {
+
+  int status;
+  struct nccf_var_obj *ta, *u, *strVar, *global, *global_append;
+  struct nccf_var_obj *u2, *ta2, *global2, *u3;
+  double *taData;
+  double *uData;
+  const int ncontacts = 3;
+  const int nd[] = {ncontacts, NC_MAX_NAME};
+  const char *ndn[] = {"ncontacts", "string"};
+  const int ndims = 2;
+  int ndims2;
+  int *dims2;
+  nc_type dataType2;
+
+  const int ni = 10;
+  const int nj = 12;
+  const int dims[] = {ni, nj};
+  int i;
+  int ncid;
+  const char *dimname[] = {"lon", "lat"};
+  char *names;
+  names = (char *) calloc( ncontacts, STRING_SIZE * sizeof( char ));
+
+  const short as[] = {1, 2, 3, 4};
+  const int ai[] = {1, 2, 3, 4};
+  const float af[] = {1.0f, 2.0f, 3.0f, 4.0f};
+  const double ad[] = {1.0, 2.0, 3.0, 4.0};
+  /* create variables */
+  nccf_varCreate(&ta, "ta");
+  nccf_varSetAttribText(&ta, "long_name", "air temperature");
+  nccf_varSetAttribText(&ta, "units", "degrees K");
+  nccf_varSetAttribShortArray(&ta, "as", 4, as);
+  nccf_varSetAttribIntArray(&ta, "ai", 4, ai);
+  nccf_varSetAttribFloatArray(&ta, "af", 4, af);
+  nccf_varSetAttribDoubleArray(&ta, "ad", 4, ad);
+  nccf_varSetDims(&ta, ndims, dims, dimname);
+
+  nccf_varCreate(&u, "u");
+  /* set attributes of a variety of types */
+  nccf_varSetAttribText(&u, "long_name", "zonal wind");
+  nccf_varSetAttribText(&u, "units", "m/s");
+  nccf_varSetAttribDouble(&u, "u_attr_double", 1);
+  nccf_varSetAttribFloat(&u, "u_attr_float", 2);
+  nccf_varSetAttribInt(&u, "u_attr_int", 3);
+  nccf_varSetAttribShort(&u, "u_attr_short", 4);
+  nccf_varSetDims(&u, ndims, dims, dimname);
+
+  int *u_attr_int_value_p;
+  nccf_varGetAttribPtr(&u, "u_attr_int",
+                       (const void**) &u_attr_int_value_p);
+  assert(*u_attr_int_value_p == 3);
+
+  /* check that the attributes are properly stored */
+  nc_type xtype;
+  int len;
+  nccf_varInqAttrib(&u, "u_attr_double", &xtype, &len);
+  assert(xtype == NC_DOUBLE);
+  assert(len == 1);
+
+  nccf_varCreate(&strVar, "nametest");
+  nccf_varSetAttribText(&strVar, "cf_type_name", "name");
+  nccf_varSetDims(&strVar, 2, nd, ndn);
+
+  nccf_varCreate(&global, ""); // global attribute
+  nccf_varSetAttribText(&global, "history", "a short history");
+  
+  nccf_varCreate(&global_append, ""); // global attribute
+  nccf_varSetAttribText(&global_append, "history", "of human kind");
+  
+  /* define a variable with unlimited dimension */
+  struct nccf_var_obj *timeDependentData;
+  nccf_varCreate(&timeDependentData, "timeDependentData"); 
+  const int timeDependentData_dims[] = {NC_UNLIMITED, ni};
+  const char *timeDependentData_nms[] = {"ntime", "nx"};
+  nccf_varSetDims(&timeDependentData, 2, timeDependentData_dims, timeDependentData_nms);
+  float *timeDependentData_vals = (float *) malloc(ni * sizeof(float));
+  for (i = 0; i < ni; ++i) {
+    timeDependentData_vals[i] = i;
+  }
+  nccf_varSetDataPtr(&timeDependentData, NC_FLOAT, timeDependentData_vals);
+  
+  /* allocate data and fill in values */
+  taData = (double *) malloc(sizeof(double) * ni * nj);
+  uData = (double *) malloc(sizeof(double) * ni * nj);
+
+  for (i = 0; i < ni * nj; ++i) {
+    taData[i] = 192.0;
+    uData[i] = i;
+  }
+  for (i = 0; i < ncontacts; ++i) {
+    sprintf(&names[i * STRING_SIZE], "contact %d", i);
+  }
+
+  /* set data pointers */
+  nccf_varSetDataPtr(&ta, NC_DOUBLE, taData);
+  nccf_varSetDataPtr(&u, NC_DOUBLE, uData);
+  nccf_varSetDataPtr(&strVar, NC_CHAR, names);
+
+  /* write to disk */
+  if ( (status = nc_create("tst_varObj.nc", NC_CLOBBER, &ncid)) ) ERR;
+  nccf_writeListOfVars(ncid, 5, global, global_append, strVar, ta, u);
+
+  /* write first record of time dependent data */
+  nccf_writeListOfVars(ncid, 1, timeDependentData);
+  for (i = 0; i < ni; ++i) {
+    timeDependentData_vals[i] = 2*i;
+  }
+  /* use this to write subsequent records */
+  nccf_writeListOfVarData(ncid, 1, timeDependentData);
+  if ( (status = nc_close(ncid)) ) ERR;
+
+  /* Read from a variable */ 
+  const char *varname;
+  nccf_varGetVarNamePtr( &ta, &varname );
+
+  double *tat;
+  nccf_varGetDataPtr( &ta, (void **)&tat );
+
+  int *new_dims;
+  nccf_varGetDimsPtr( &ta, &new_dims );
+
+  // read from file 
+  if ( (status = nc_open("tst_varObj.nc", NC_NOWRITE, &ncid)) ) ERR;
+
+  /* With data, cast data as doubles */
+  nccf_varCreateFromFile(&u2, "u", ncid, 1, 1);
+  /* Without data */
+  nccf_varCreateFromFile(&u3, "u", ncid, 0, 0);
+
+  /* Create time dependent data, without reading the data */
+  struct nccf_var_obj *timeDependentData2;
+  nccf_varCreateFromFile(&timeDependentData2, "timeDependentData", ncid, 0, 0);
+  /* Check the number of written time slices */
+  int *tdims;
+  nccf_varGetDimsPtr(&timeDependentData2, &tdims);
+  /* Get the last data record */
+  nccf_varReadData(&timeDependentData2, ncid, tdims[0]-1, 0);
+  float *fd;
+  nccf_varGetDataPtr(&timeDependentData2, (void **) &fd);
+  for (i = 0; i < ni; ++i) {
+    assert(fd[i] == (float)2*i);
+  }
+ 
+  nccf_varGetNumDims(&u2, &ndims2);
+  assert(ndims2 == ndims);
+  nccf_varGetNumDims(&u3, &ndims2);
+  assert(ndims2 == ndims);
+
+  nccf_varGetDimsPtr(&u2, &dims2);
+  for (i = 0; i < ndims; ++i) {
+    assert(dims2[i] == dims[i]);
+  }
+  nccf_varGetDimsPtr(&u3, &dims2);
+  for (i = 0; i < ndims; ++i) {
+    assert(dims2[i] == dims[i]);
+  }
+
+  nccf_varGetDataType(&u2, &dataType2);
+  assert(dataType2 == NC_DOUBLE);
+
+  double *uData2;
+  nccf_varGetDataPtr(&u2, (void **) &uData2);
+  for (i = 0; i < ni * nj; ++i) {
+    assert(uData2[i] == (double) uData[i]);
+  }
+  nccf_varGetDataPtr(&u3, (void **) &uData2);
+  assert(uData2 == NULL); 
+
+  nccf_varAttribIterBegin(&u2);
+  while ( nccf_varAttribIterNext(&u2) ) {
+    const char *attrName;
+    nccf_kv_get_key(&(u2->attr), &attrName);
+    int nelem;
+    nc_type type;
+    const char *attrVal;
+    nccf_kv_get_value(&(u2->attr), attrName, &type, &nelem, 
+		      (const void **) &attrVal);
+    if (strcmp(attrName, "name") == 0) {
+      assert(strcmp(attrVal, "u") == 0);
+    }
+    if (strcmp(attrName, "long_name") == 0) {
+      assert(strcmp(attrVal, "zonal wind") == 0);
+    }
+    if (strcmp(attrName, "units") == 0) {
+      assert(strcmp(attrVal, "m/s") == 0);
+    }
+  }
+
+  nccf_varCreateFromFile(&ta2, "ta", ncid, 1, 0);
+
+  nccf_varInqAttrib(&ta2, "as", &xtype, &len);
+  assert(xtype == NC_SHORT);
+  assert(len == 4);
+  short *as2;
+  nccf_varGetAttribPtr(&ta2, "as", (const void **)&as2);
+  for (i = 0; i < (int)len; ++i) {
+    assert(as2[i] == as[i]);
+  }
+
+  nccf_varInqAttrib(&ta2, "ai", &xtype, &len);
+  assert(xtype == NC_INT);
+  assert(len == 4);
+  int *ai2;
+  nccf_varGetAttribPtr(&ta2, "ai", (const void **)&ai2);
+  for (i = 0; i < (int)len; ++i) {
+    assert(ai2[i] == ai[i]);
+  }
+
+  nccf_varInqAttrib(&ta2, "af", &xtype, &len);
+  assert(xtype == NC_FLOAT);
+  assert(len == 4);
+  float *af2;
+  nccf_varGetAttribPtr(&ta2, "af", (const void **)&af2);
+  for (i = 0; i < (int)len; ++i) {
+    assert(af2[i] == af[i]);
+  }
+
+  nccf_varInqAttrib(&ta2, "ad", &xtype, &len);
+  assert(xtype == NC_DOUBLE);
+  assert(len == 4);
+  double *ad2;
+  nccf_varGetAttribPtr(&ta2, "ad", (const void **)&ad2);
+  for (i = 0; i < (int)len; ++i) {
+    assert(ad2[i] == ad[i]);
+  }
+
+  nccf_varCreateFromFile(&global2, "", ncid, 1, 0);
+
+  nccf_kv_begin(&(global2->attr));
+  while ( nccf_kv_next(&(global2->attr)) ) {
+    const char * attrName;
+    nccf_kv_get_key(&(global2->attr), &attrName);
+    int nelem;
+    nc_type type;
+    const char * attrVal;
+    nccf_kv_get_value(&(global2->attr), attrName, &type, &nelem, 
+		      (const void **) &attrVal);
+    if (strcmp(attrName, "history") == 0) {
+      assert(strcmp(attrVal, "a short history of human kind") == 0);
+    }
+  }
+
+  /* close the file */
+  if ( (status = nc_close(ncid)) ) ERR;
+
+  /* reclaim memory */
+  free(uData);
+  free(taData);
+  free(names);
+  free(timeDependentData_vals);
+
+  nccf_varDestroy(&global);
+  nccf_varDestroy(&global_append);
+  nccf_varDestroy(&u);
+  nccf_varDestroy(&ta);
+  nccf_varDestroy(&strVar);
+  nccf_varDestroy(&global2);
+  nccf_varDestroy(&u2);
+  nccf_varDestroy(&u3);
+  nccf_varDestroy(&ta2);
+  nccf_varDestroy(&timeDependentData);
+  nccf_varDestroy(&timeDependentData2);
+  return 0;
+}
diff --git a/src/tst_princeton.c b/src/tst_princeton.c
new file mode 100644
index 0000000..ea8641b
--- /dev/null
+++ b/src/tst_princeton.c
@@ -0,0 +1,73 @@
+/* This is part of the netCDF package. Copyright 2005 University
+   Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
+   conditions of use. See www.unidata.ucar.edu for more info.
+
+   Test libcf file stuff.
+
+   $Id: tst_princeton.c 828 2011-09-14 20:05:08Z pletzer $
+*/
+
+#include <cf_config.h>
+#include <libcf_src.h>
+#include <netcdf.h>
+#include <nc_tests.h>
+
+#define FILE_NAME "tst_princeton.nc"
+
+int
+main(int argc, char **argv)
+{
+   printf("\n*** Testing GRIDSPEC Princeton API.\n");
+   printf("*** testing simple regular lon/lat grid creation...");
+   {
+#define START_LAT 0
+#define DELTA_LAT .5
+#define START_LON 50
+#define DELTA_LON .5
+#define NLON 60
+#define NLAT 20
+#define NXBNDS 2
+#define NYBNDS 2
+#define NRATIO 1
+#define SIMPLE_DX ((double)0)
+#define SIMPLE_DY ((double)0)
+#define NTILEX 0
+#define NTILEY 0
+#define MAXBOUNDS 2
+#define NDIMS 2
+      char gridname[] = "tst_princeton_reglonlat_1";
+      char center[] = "none";
+      char history[] = "libcf/gridspec/libsrc/tst_princeton.c: testing simple hgrid creation for libcf library.";
+      int  ndivx[] = {1};
+      int  ndivy[] = {1};
+      double xbnds[MAXBOUNDS] = {0, 30};
+      double ybnds[MAXBOUNDS] = {50, 60};
+      double lon[NLON], lat[NLAT];
+      int ncid, gridid;
+      int grid_dimid[NDIMS], grid_varid[NDIMS];
+      int x, y;
+
+      nccf_set_log_level(5);
+
+      /* Initialize coordinate data. */
+      for (x = 0; x < NLON; x++)
+	 lon[x] = START_LON + x * DELTA_LAT;
+      for (x = 0; x < NLAT; x++)
+	 lon[x] = START_LAT + x * DELTA_LAT;
+
+      /* Do everything to generate the grid generated by the following test:
+	 echo "*** generating regular lon-lat grid (supergrid size 60x20)..."
+	 ./make_hgrid --grid_type regular_lonlat_grid --nxbnd 2 --nybnd 2                   
+	 --xbnd 0,30 --ybnd 50,60  --nlon 60 --nlat 20 */
+      if (nc_create(FILE_NAME, NC_CLOBBER, &ncid)) ERR;
+      if (nccf_def_latitude(ncid, NXBNDS, NC_DOUBLE, &grid_dimid[0], &grid_varid[0])) ERR;
+      if (nccf_def_longitude(ncid, NYBNDS, NC_DOUBLE, &grid_dimid[1], &grid_varid[1])) ERR;
+      /*if (nccf_def_grid(ncid, NDIMS, grid_dimid, &gridid)) ERR;*/
+      /*if (nccf_put_grid(ncid, gridid)) ERR;*/
+      if (nc_close(ncid)) ERR;
+      /*if (nccf_close_grid(gridid)) ERR;*/
+   }
+   SUMMARIZE_ERR;
+   FINAL_RESULTS;
+}
+
diff --git a/src/tst_solve.c b/src/tst_solve.c
new file mode 100644
index 0000000..7270e8a
--- /dev/null
+++ b/src/tst_solve.c
@@ -0,0 +1,47 @@
+/**
+ * $Id: tst_solve.c 828 2011-09-14 20:05:08Z pletzer $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <cf_config.h>
+#endif
+
+#include <nccf_utility_functions.h>
+#include <nccf_handle_error.h>
+#include <math.h>
+#include <assert.h>
+
+int main() {
+
+#ifdef HAVE_LAPACK_LIB
+  const int n = 3;
+  double mat[n*n];
+  double matCopy[n*n];
+  double rhs[n];
+  double sol[n];
+  int i, j, status;
+  for (i = 0; i < n; ++i) {
+    rhs[i] = 2.0*i + 1.0;
+    for (j = 0; j < n; ++j) {
+      mat[j + n*i] = i - j;
+      if (i == j) mat[j + n*i] = 10.0;
+      matCopy[j + n*i] = mat[j + n*i];
+    }
+  }
+  status = nccf_solve_double(n, mat, rhs, sol);
+  if (status) ERR;
+
+  // check
+  double totError = 0.0;
+  for (i = 0; i < n; ++i) {
+    double sum = - rhs[i];
+    for (j = 0; j < n; ++j) {
+      sum += matCopy[i*n + j] * sol[j];
+    }
+    totError += fabs(sum);
+  }
+  assert(totError < 1.e-10);
+#endif
+
+  return 0;
+}
diff --git a/src/tst_subsets.c b/src/tst_subsets.c
index 036cbc6..dc624d7 100644
--- a/src/tst_subsets.c
+++ b/src/tst_subsets.c
@@ -6,11 +6,11 @@
 
    Ed Hartnett, 10/1/06
 
-   $Id: tst_subsets.c,v 1.2 2009/09/08 17:14:54 ed Exp $
+   $Id: tst_subsets.c 828 2011-09-14 20:05:08Z pletzer $
 */
 
-#include <config.h>
-#include <libcf.h>
+#include <cf_config.h>
+#include <libcf_src.h>
 #include <netcdf.h>
 #include <nc_tests.h>
 
diff --git a/src/tst_vars.c b/src/tst_vars.c
index c129315..6f93183 100644
--- a/src/tst_vars.c
+++ b/src/tst_vars.c
@@ -1,14 +1,14 @@
-/* This is part of the netCDF package. Copyright 2005 University
-   Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
-   conditions of use. See www.unidata.ucar.edu for more info.
+/*!
+\file
 
-   Test libcf variable stuff.
+This is a test of libcf variable-level functions.
 
-   $Id: tst_vars.c,v 1.2 2009/09/08 17:14:54 ed Exp $
+\example tst_vars.c
+This example shows how to use some of the LibCF variable funtions.
 */
 
-#include <config.h>
-#include <libcf.h>
+#include <cf_config.h>
+#include <libcf_src.h>
 #include <netcdf.h>
 #include <nc_tests.h>
 
diff --git a/src/tst_vert.c b/src/tst_vert.c
index 2855bd0..595f7e3 100644
--- a/src/tst_vert.c
+++ b/src/tst_vert.c
@@ -6,11 +6,11 @@
 
    Ed Hartnett, 11/18/06
 
-   $Id: tst_vert.c,v 1.2 2009/09/08 17:14:54 ed Exp $
+   $Id: tst_vert.c 828 2011-09-14 20:05:08Z pletzer $
 */
 
-#include <config.h>
-#include <libcf.h>
+#include <cf_config.h>
+#include <libcf_src.h>
 #include <netcdf.h>
 #include <nc_tests.h>
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/netcdf-libcf.git



More information about the Pkg-grass-devel mailing list