Building UDUNITS on Windows
Diana / metlibs use the old, unsupported UDUNITS library, not the new UDUNITS-2 library. Unfortunately, converting from one to the other is not trivial, so we're stuck with the old library—for now.
First, get the latest source (1.12.9) from http://www.unidata.ucar.edu/downloads/udunits/index.jsp and extract it in a convenient place.
Building UDUNITS is not straightforward. Its autotools infrastructure is old, and its configure script does not use the correct autoconf idiom for locating yacc
, so you have to specify it manually; moreover, it fails to recognize g77, and uses POSIX features without defining the appropriate _XOPEN_SOURCE
macro. As a result, the configure
command line is a bit of a mess:
$ cd src $ LDFLAGS=-L/c/met.no/lib CPPFLAGS='-I/c/met.no/include -Df2cFortran -D_POSIX_MAX_INPUT=255' LD_YACC=-ly FC=g77 ./configure --prefix=/c/met.no
UDUNITS includes Perl modules and man pages which require additional tools to build, so we'll just manually build and install the parts we need:
$ make -C lib installed_library installed_headers installed_etcfiles $ make -C port install $ make -C udunits installed_program $ cp COPYRIGHT /c/met.no/copyright/udunits.txt
XXX do we actually need the program? If not, we can skip the last two lines.