Commit 810de824 authored by Alastair McKinstry's avatar Alastair McKinstry

upstream release 2.2.1

parent 59b8fe8d
The Grid Analysis and Display System (GrADS)
Copyright (C) 1988-2017 by George Mason University
Copyright (C) 1988-2018 by George Mason University
The Center for Ocean-Land-Atmosphere Studies (COLA) is the center
within George Mason University where GrADS is developed and maintained.
......
......@@ -80,14 +80,15 @@ host_triplet = @host@
subdir = .
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(top_srcdir)/etc/mkinstalldirs INSTALL etc/compile \
$(top_srcdir)/etc/mkinstalldirs ChangeLog INSTALL etc/compile \
etc/config.guess etc/config.sub etc/install-sh etc/missing \
etc/mkinstalldirs etc/ltmain.sh $(top_srcdir)/etc/config.guess \
$(top_srcdir)/etc/config.sub $(top_srcdir)/etc/install-sh \
$(top_srcdir)/etc/ltmain.sh $(top_srcdir)/etc/missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/Xaw.m4 \
$(top_srcdir)/m4/ga_lib_readline.m4 $(top_srcdir)/m4/gd.m4 \
$(top_srcdir)/m4/cairo.m4 $(top_srcdir)/m4/ga_lib_readline.m4 \
$(top_srcdir)/m4/gadap.m4 $(top_srcdir)/m4/gd.m4 \
$(top_srcdir)/m4/geotiff.m4 $(top_srcdir)/m4/grib2.m4 \
$(top_srcdir)/m4/gui.m4 $(top_srcdir)/m4/hdf4.m4 \
$(top_srcdir)/m4/hdf5.m4 $(top_srcdir)/m4/libsx.m4 \
......@@ -95,7 +96,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/Xaw.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/netcdf.m4 \
$(top_srcdir)/m4/netcdf_header.m4 $(top_srcdir)/m4/pkg.m4 \
$(top_srcdir)/m4/udunits.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/m4/shapelib.m4 \
$(top_srcdir)/m4/udunits_testing.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
......@@ -213,6 +215,8 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CAIRO_CFLAGS = @CAIRO_CFLAGS@
CAIRO_LIBS = @CAIRO_LIBS@
CC = @CC@
CFLAGS = @CFLAGS@
CPP = @CPP@
......@@ -232,10 +236,10 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
G2_LIBS = @G2_LIBS@
GADAP_LIBS = @GADAP_LIBS@
GA_LIBSX_LIBS = @GA_LIBSX_LIBS@
GD_CFLAGS = @GD_CFLAGS@
GD_CONFIG = @GD_CONFIG@
GD_LDFLAGS = @GD_LDFLAGS@
GD_LIBS = @GD_LIBS@
GEOTIFF_CFLAGS = @GEOTIFF_CFLAGS@
GEOTIFF_LDFLAGS = @GEOTIFF_LDFLAGS@
......@@ -254,6 +258,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBGX_AGE = @LIBGX_AGE@
LIBGX_CURRENT = @LIBGX_CURRENT@
LIBGX_REVISION = @LIBGX_REVISION@
LIBGX_VERSION = @LIBGX_VERSION@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
......@@ -287,8 +295,11 @@ RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SHP_LIBS = @SHP_LIBS@
STRIP = @STRIP@
SUPPLIBS = @SUPPLIBS@
UDUNITS_CFLAGS = @UDUNITS_CFLAGS@
UDUNITS_LDFLAGS = @UDUNITS_LDFLAGS@
UDUNITS_LIBS = @UDUNITS_LIBS@
VERSION = @VERSION@
XAW7_CFLAGS = @XAW7_CFLAGS@
......@@ -319,7 +330,6 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
cairo_dynlibs = @cairo_dynlibs@
cairo_inc = @cairo_inc@
cairo_libs = @cairo_libs@
datadir = @datadir@
......@@ -327,23 +337,20 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
gadap_dynlibs = @gadap_dynlibs@
gadap_inc = @gadap_inc@
gadap_libs = @gadap_libs@
gd_dynlibs = @gd_dynlibs@
gd_inc = @gd_inc@
gd_ldflags = @gd_ldflags@
gd_libs = @gd_libs@
geotiff_dynlibs = @geotiff_dynlibs@
geotiff_inc = @geotiff_inc@
geotiff_ldflags = @geotiff_ldflags@
geotiff_libs = @geotiff_libs@
grads_xlibs = @grads_xlibs@
grib2_dynlibs = @grib2_dynlibs@
grib2_libs = @grib2_libs@
gui_inc = @gui_inc@
gui_libs = @gui_libs@
hdf5_dynlibs = @hdf5_dynlibs@
hdf5_inc = @hdf5_inc@
hdf5_libs = @hdf5_libs@
hdf_dynlibs = @hdf_dynlibs@
hdf_inc = @hdf_inc@
hdf_libs = @hdf_libs@
host = @host@
......@@ -362,7 +369,6 @@ localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
nc_dynlibs = @nc_dynlibs@
nc_inc = @nc_inc@
nc_libs = @nc_libs@
oldincludedir = @oldincludedir@
......@@ -370,11 +376,9 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
readline_dynlibs = @readline_dynlibs@
readline_libs = @readline_libs@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
shp_dynlibs = @shp_dynlibs@
shp_libs = @shp_libs@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
......
......@@ -759,7 +759,9 @@ AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/Xaw.m4])
m4_include([m4/cairo.m4])
m4_include([m4/ga_lib_readline.m4])
m4_include([m4/gadap.m4])
m4_include([m4/gd.m4])
m4_include([m4/geotiff.m4])
m4_include([m4/grib2.m4])
......@@ -775,5 +777,6 @@ m4_include([m4/lt~obsolete.m4])
m4_include([m4/netcdf.m4])
m4_include([m4/netcdf_header.m4])
m4_include([m4/pkg.m4])
m4_include([m4/udunits.m4])
m4_include([m4/shapelib.m4])
m4_include([m4/udunits_testing.m4])
m4_include([acinclude.m4])
This diff is collapsed.
This diff is collapsed.
......@@ -126,7 +126,7 @@ href="functions.html">functions</a> are provided. In addition, users may add the
</tr>
<tr bgcolor="c5d5ff">
<td><code>-d <em>gxdname</em></code></td>
<td>Specifies the name of the <a href="plugins.html">graphics display plug-in</a> (default is &quot;Cairo&quot;)</td>
<td>(<span class="style1">GrADS 2.2.0+</span>) Specifies the name of the <a href="plugins.html">graphics display plug-in</a> (default is &quot;Cairo&quot;)</td>
</tr>
<tr bgcolor="c5d5ff">
<td><code>-E</code></td>
......@@ -139,7 +139,7 @@ href="functions.html">functions</a> are provided. In addition, users may add the
</tr>
<tr bgcolor="c5d5ff">
<td><code>-h <em>gxpname</em></code></td>
<td>Specifies the name of the <a href="plugins.html">graphics printing plug-in</a> (default is &quot;Cairo&quot;)</td>
<td>(<span class="style1">GrADS 2.2.0+</span>) Specifies the name of the <a href="plugins.html">graphics printing plug-in</a> (default is &quot;Cairo&quot;)</td>
</tr>
<tr bgcolor="c5d5ff">
<td><code>-H <em>filename</em></code></td>
......
This diff is collapsed.
<!--Copyright (C) 1988-2005 by the Institute of Global Environment and Society (IGES). See file COPYRIGHT for more information.-->
<html>
<head>
<title>Plug-ins for GrADS</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="GrADS.css" rel="stylesheet" type="text/css">
<style type="text/css">
.red {
color: #C00;
}
body {
background-color: #e0f0ff;
}
</style>
</head>
<body text="#000000">
<h1>Plug-ins for GrADS</h1>
<p>GrADS
has begun to make use of plug-ins, which are software components (modules) that add specific features to an existing program. The use of plug-ins brings an improvement in performance and flexibility for users who want to create customized functions or features for GrADS.
The User Defined Plug-in Table (<a href="udpt.html">UDPT</a>) is a simple stand-alone text file that
contains all the information about plug-ins that GrADS requires.
Check the <a href="udpt.html">documentation</a> for more information about the proper syntax of UDPT records.
<h2>User-Defined Plug-in Functions</h2>
<p>The first plug-in capability was introduced in <span class="red">version 2.1.1.b0</span>, and replaced the old interface for user-defined functions. The <a href="udp.html"><code>User Defined Plug-ins (UDP)</code></a> allow users to write their own GrADS functions in the computer language of their choice, and have them
perform customized calculations and operations via the GrADS expression.
The function arguments and data grids are no longer passed between GrADS and the user's program through data files written out to disk. With plug-ins, the user's code is dynamically loaded into GrADS when the function is invoked by the user, and the data is operated on while still sitting in memory. The <a href="udp.html">documentation</a> has more information about how to compile, setup, and use user-defined plug-in functions.
<h2>Graphics Plug-ins</h2>
<p><span class="red">Version 2.2.0</span> introduced a redesign of the GrADS code so that the graphics capabilities are treated as plug-ins, with separate modules for the interactive display (in an X window) and printing (creating graphics output in image and vector formats). The graphics plug-ins are part of the GrADS core source code -- they are not user-defined -- although the plug-in architecture certainly makes it possible for motivated users to create new interfaces for printing or display that could be used instead of the options we provide. The plug-in architecture makes it possible to re-introduce the older graphics engines that were part of GrADS before the Cairo library was adopted.
The display and printing plug-ins are independent, so users can mix and match new and old depending on what is needed. The old pre-Cairo code for creating vector graphic output for printing (.ps and .eps) is no longer supported at all -- those output formats are now only supported through the Cairo interface.
<p><strong>Graphics Display</strong><br>
For the interactive X-window display, users can choose between the newer Cairo interface or the tradtional X11 code that supports widgets (buttons, drop menus, and rubber banding). The Cairo plug-in creates a more visually pleasing graphic because it support fonts, anti-aliasing, transparent colors, and pattern filling. The downsides of using Cairo for the display are: (1) it doesn't support the widgets, (2) it slower than the old X11 code, and (3) a few users have reported that it is buggy (fragmented and only partially rendered) for X11 servers on some desktop unix platforms. </p>
<p><strong>Graphics Printing</strong><br>
For printing -- creating graphical output in image or vector formats -- users can choose between Cairo or the GD library. The GD interface is very fast and creates relatively small image files, but the image quality is low. The GrADS GD plug-in does not support fonts, anti-aliasing, transparent colors, or pattern filling. If image quality is more important than the time it takes to create the files or the size of the output files, then the Cairo interface is recommended. The Cairo plug-in supports only .png for image output; the GD plug-in supports .png as well as .gif and .jpg image formats. If you want a vector graphic (.ps, .eps, .pdf, or .svg) then your only option is the Cairo plug-in.</p>
<p><strong>GrADS without Graphics<br>
</strong>We also provide a plug-in that is a no-op for all the graphics subroutines, called gxdummy. The gxdummy plug-in can be used when no graphics capabilities are needed, or as a template for creating new graphics plug-ins. </p>
<p><strong>Mix and Match</strong><br>
All combinations of display and printing plug-ins are supported. Selecting the Cairo plug-ins for display <em>and</em> printing guarantees that the output will exactly match what is seen in the display. Similarly, the selection of the old X11 and GD plug-ins will ensure that the output matches the display, except for the widgets, which are never printed. Specific user needs dictate which options are best.
<p><strong>How to Specify Graphics Plug-ins</strong><br>
The user can specify which graphics plug-ins to use on startup with the following arguments: -d (for display) and -h (for printing; 'h' is for hardcopy). Each argument is followed by the name of the desired plug-in. The names are provided in the <a href="udpt.html">UDPT</a>. <br>
<br>
Examples are:<br>
<code>
&gt; grads -d Cairo -h GD <br>
&gt; grads -d Cairo -h Cairo <br>
&gt; grads -d X11 -h GD <br>
&gt; grads -d X11 -h Cairo<br><br>
</code>
If the -h and -d options are not used, GrADS will look for graphics and display plug-ins named &quot;Cairo&quot; by default. It is only necessary to use -h or -d when Cairo is not desired.
<p><strong>Errors
</strong><br>
On startup, GrADS will look for information about plug-ins in two places: in
the file named by the GAUDPT environment variable, and in a file named &quot;udpt&quot; in the GADDIR directory. If there are any syntax errors in either of these files, it is not a fatal error -- GrADS will issue a warning message with information about where the error is and what is wrong with the record, then it will ignore the record and continue. After all the available information about plug-ins has been parsed, GrADS will initialize the graphics package, with the message <code>&quot;GX Package Initialization&quot;</code>. It is at this point that GrADS will try to open and load the graphics plug-ins. If there are any problems, GrADS will return the message <code>&quot;GX Package Error: Could not find a record for the printing plug-in&quot;</code> or <code>&quot;GX Package Error: Could not find a record for the display plug-in&quot;</code> followed by some helpful information about the name of the plug-in it is looking for, and the names of the files it parsed. These errors mean that something is wrong with the <a href="udpt.html">User-Defined Plug-in Tables</a>. Remember that the records in the GAUDPT file take precedence over records in the default udpt in GADDIR. If GrADS returns the message <code>&quot;GX Package Error: dlopen failed&quot;</code> it means the error is related to the shared object file itself -- it may be missing, corrupted, or the permissions may be wrong.
<p><strong>How to Query Graphics Plug-Ins</strong><br>
The <code>'q udpt'</code> command will return a list of the plug-ins that GrADS found after parsing the <a href="udpt.html">User-Defined Plug-in Tables</a> on startup. <br>
The <code>'q gxconfig'</code> command will return information about the graphics plug-ins currently in use: the name, shared object filename, and any relevant library version information.
<p>
<p>
</body>
</html>
<!--Copyright (C) 1988-2005 by the Institute of Global Environment and Society (IGES). See file COPYRIGHT for more information.-->
<html>
<head>
<title>GrADS-Python Interface</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="GrADS.css" rel="stylesheet" type="text/css">
<style type="text/css">
.red {
color: #C00;
}
body {
background-color: #e0f0ff;
}
</style>
</head>
<body text="#000000">
<h1>The GrADS- Python Interface (GradsPy)</h1>
<p> GrADS <span class="red">version 2.2.1</span> introduces a new C-language Python extension, called GradsPy. The interface has a few components: a C program called gradspy.c, a python script called setup.py, and a build of GrADS that is compiled as a dynamically loading library, called libgradspy.so (or libgradspy.dylib). The libgradspy.* files are generated along with the regular binary executables when compiling GrADS.
<h2>Installing GradsPy</h2>
<p>1. Move to the directory where your GrADS source code is installed (e.g. $HOME/grads-2.2.1/src). Make sure that gradspy.c, gradspy.h, and setup.py are in that directory. Edit the gradspy.c file so that the dlopen command will point to the correct name of the libgradspy file for your system (use the .so extension for linux, the .dylib extension for Mac OS X). The relevant code looks like this (you must comment out one of these):
<p> <code> handle = dlopen (&quot;libgradspy.so&quot;, RTLD_LAZY | RTLD_GLOBAL ); /* for linux */<br>
handle = dlopen (&quot;libgradspy.dylib&quot;, RTLD_LAZY | RTLD_GLOBAL ); /* for mac */
</code>
<p>2. Now you are ready to compile gradspy.c with the following command: <br>
<code> &gt; python setup.py install</code>
<p> Be sure you are using Python version 2, we haven't done any testing with Python 3. You must also have NumPy installed on your system, because the GradsPy extension delivers NumPy objects when evaluting expressions. Use 'sudo' in front of this command if you have root access privileges on your system.<br>
<br>
3. Now you are ready to run Python and issue the command:<br>
<code>
&gt;&gt;&gt; import gradspy</code>
<p>Before you do this, make sure that your shell environment will know where to find the libgradspy.so (or libgradspy.dylib) file that GradsPy will try to open. Update the environment variable LD_LIBRARY_PATH to include the path to your grads-2.2.1 installation (e.g. $HOME/grads-2.2.1/lib).
<p>
<h2>GradsPy Methods</h2>
<p>Once you have imported GradsPy into Python, there are three methods for interacting with GrADS: start, cmd, and result. </p>
<h3>start</h3>
<p>The 'start' method only needs to be issued once, it starts GrADS with any number of optional switches and arguments. Most space-delimited arguments to GrADS become comma-delimited and quoted arguments to the gradspy.start method.
The exception to this rule is when you are using the -c argument and the script name you provide takes arguments. In this case, you would invoke the script name and its arguments inside one set of quotes.
For example:<br>
<code>gradspy.start()<br>
gradspy.start(&quot;-lb&quot;)<br>
gradspy.start(&quot;-lc&quot;,&quot;open /data/samples/model.ctl&quot;)<br>
gradspy.start(&quot;-a&quot;,&quot;1.0&quot;,&quot;-g&quot;,&quot;800x800+60+0&quot;,&quot;-d&quot;,&quot;X11&quot;)<br>
gradspy.start(&quot;-lb&quot;,&quot;-c&quot;,&quot;scriptname.gs arg1 arg2&quot;)
</code>
<h3>cmd</h3>
<p>The 'cmd' method is how you issue any GrADS command. For example:<br>
<code>gradspy.cmd('q config')</code>
<p>The text that GrADS delivers to the command window (or the internal variable 'result' in a script) is also returned to Python when the cmd method is called. Python will print this unformatted text to your command window. A more elegant strategy is to assign the returned text to a local variable and save it for further parsing or better formatted printing:<br>
<code>a=gradspy.cmd('q file')<br>
print (a)</code>
<br>
<code>b=gradspy.cmd('q dims')<br>
print (b)</code>
<h3>result</h3>
<p>The 'result' method evaluates a user-provided GrADS expression and returns the resulting grid of data and relevant metadata in a Python tuple.<br>
<code>rt=gradspy.result('ave(tsfc,t=1,t=12)')</code>
<p>The returned tuple (here named '<code>rt</code>' for illustration purposes) has seven elements (one integer followed by six PyObjects):</p>
<p>[0] The return code. If the return code is negative, then an error occurred. Otherwise, it contains the number of varying dimensions (rank)
in the result grid. <br>
[1] A 2-D NumPy array that contains the grid of data from the expression evaluation (with NaN for missing data values)<br>
[2] A 1-D NumPy array of longitude coordinate values (NaN if X is not varying) <br>
[3] A 1-D NumPy array of latitude coordinate values (NaN if Y is not varying)<br>
[4] A 1-D NumPy array of level coordinate values (NaN if Z is not varying)<br>
[5] A 1-D NumPy array of additional grid metadata containing 14 integers, listed below.</p>
<p><code>
&nbsp;&nbsp;&nbsp;0. X (lon) size (1 if X is not varying) <br>
&nbsp;&nbsp;&nbsp;1. Y (lat) size (1 if Y is not varying) <br>
&nbsp;&nbsp;&nbsp;2. Z (lev) size (1 if Z is not varying) <br>
&nbsp;&nbsp;&nbsp;3. T (time) size (1 if T is not varying) <br>
&nbsp;&nbsp;&nbsp;4. E (ens) size (1 if E is not varying) <br>
&nbsp;&nbsp;&nbsp;5. T start time -- year <br>
&nbsp;&nbsp;&nbsp;6. T start time -- month <br>
&nbsp;&nbsp;&nbsp;7. T start time -- day <br>
&nbsp;&nbsp;&nbsp;8. T start time -- hour <br>
&nbsp;&nbsp;&nbsp;9. T start time -- minute <br>
&nbsp;&nbsp;&nbsp;10. T increment <br>
&nbsp;&nbsp;&nbsp;11. Type of T increment (0==months, 1==minutes) <br>
&nbsp;&nbsp;&nbsp;12. T calendar type (0==normal, 1==365-day) <br>
&nbsp;&nbsp;&nbsp;13. E start (E increment is always 1) </code></p>
<p>
[6] A 1-D NumPy array of additional grid metadata containing 6 doubles, listed below:</p>
<p><code>&nbsp;&nbsp;&nbsp;</code><code>0. X start value (if X dimension is linear) <br>
&nbsp;&nbsp;&nbsp;1. X increment (negative if non-linear) <br>
&nbsp;&nbsp;&nbsp;2. Y start value (if Y dimension is linear) <br>
&nbsp;&nbsp;&nbsp;3. Y increment (negative if non-linear) <br>
&nbsp;&nbsp;&nbsp;4. Z start value (if Z dimension is linear) <br>
&nbsp;&nbsp;&nbsp;5. Z increment (negative if non-linear) </code>
</p>
<h2>Usage Notes</h2>
<ol>
<li>When the result of an expression is a 2D lat/lon grid, GrADS orients the data with dimension 0 as i (or X, or longitude) and dimension 1 as j (or Y, or latitude). In Python, the dimension order convention is reversed, so the returned grid's dimension 0 is j/Y/latitude, and dimension 1 is i/X/longitude. This rule generalizes for all results that vary in two dimensions -- the (i,j) data array in GrADS gets sent to Python as (j,i).
</ol>
<p>
</html>
This diff is collapsed.
......@@ -77,9 +77,9 @@ AC_DEFUN([GA_LIB_READLINE], [
fi
])
if test "$vl_cv_lib_readline" != "no"; then
AC_DEFINE(HAVE_LIBREADLINE, 1,
[Define if you have a readline compatible library])
AC_DEFINE(HAVE_LIBREADLINE, 1, [Define if you have readline library])
AC_CHECK_HEADERS(readline.h readline/readline.h)
AC_CACHE_CHECK([whether readline supports history],
vl_cv_lib_readline_history, [
......@@ -87,13 +87,17 @@ AC_DEFUN([GA_LIB_READLINE], [
AC_TRY_LINK_FUNC(add_history, vl_cv_lib_readline_history="yes")
])
if test "$vl_cv_lib_readline_history" = "yes"; then
AC_DEFINE(HAVE_READLINE_HISTORY, 1,
[Define if your readline library has \`add_history'])
AC_DEFINE(HAVE_READLINE_HISTORY, 1, [Define if readline library has add_history])
AC_CHECK_HEADERS(history.h readline/history.h)
m4_if([$1], [], [:], [$1])
else
m4_if([$2], [], [:], [$2])
fi
fi
READLINE_LIBS=$TRY_LIB
LIBS="$ORIG_LIBS"
])
......@@ -8,13 +8,17 @@ AC_DEFUN([GA_CHECK_LIB_GD],
GD_CFLAGS=
GD_LDFLAGS=
ga_pkgconfig_gd=yes
PKG_CHECK_MODULES([GD],[gdlib],,[ga_pkgconfig_gd=no])
ac_save_LIBS="$LIBS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_LDFLAGS="$LDFLAGS"
ga_pkgconfig_gd=no
ga_config_gd=no
dnl Check for pkg-config
PKG_CHECK_MODULES([GD],[gdlib],[ga_pkgconfig_gd=yes])
dnl If pkg-config not found, look for gdlib-config
if test $ga_pkgconfig_gd != 'yes'; then
AC_PATH_PROG([GD_CONFIG],[gdlib-config],[no])
if test "$GD_CONFIG" != "no"; then
......@@ -25,14 +29,13 @@ AC_DEFUN([GA_CHECK_LIB_GD],
fi
fi
dnl We found something; check for the header gd.h, gdImageCreate
if test $ga_pkgconfig_gd = 'yes' -o $ga_config_gd = 'yes'; then
LDFLAGS="$LDFLAGS $GD_LDFLAGS"
LIBS="$LIBS $GD_LIBS"
AC_CHECK_HEADER([gd.h],
[ AC_CHECK_LIB([gd], [gdImageCreate],
[ ga_check_gd=yes
GD_LIBS="-lgd $GD_LIBS"
AC_CHECK_FUNCS([gdCompareInt])
],
[
GD_LDFLAGS=
......@@ -46,19 +49,6 @@ AC_DEFUN([GA_CHECK_LIB_GD],
CPPFLAGS="$ac_save_CPPFLAGS"
])
fi
if test $ga_check_gd = 'no'; then
AC_CHECK_HEADER([gd.h],
[ AC_CHECK_LIB([z], [compress],
[ AC_CHECK_LIB([png], [main],
[ AC_CHECK_LIB([gd], [gdImageCreate],
[ ga_check_gd=yes
AC_CHECK_FUNCS([gdCompareInt])
GD_LIBS='-lgd -lpng -lz'
])
])
])
])
fi
LIBS="$ac_save_LIBS"
CPPFLAGS="$ac_save_CPPFLAGS"
......@@ -70,7 +60,7 @@ AC_DEFUN([GA_CHECK_LIB_GD],
m4_if([$2], [], [:], [$2])
fi
AC_SUBST([GD_LIBS])
AC_SUBST([GD_LDFLAGS])
AC_SUBST([GD_CFLAGS])
# AC_SUBST([GD_LIBS])
# AC_SUBST([GD_LDFLAGS])
# AC_SUBST([GD_CFLAGS])
])
......@@ -2,6 +2,7 @@ dnl AC_CHECK_GEOTIFF : Check for geotiff
dnl args : action-if-yes, action-if-no
AC_DEFUN([AC_CHECK_GEOTIFF],
[
# set up help strings and parse user-provided paths
AC_ARG_WITH([geotiff],
[AS_HELP_STRING([--with-geotiff=ARG],[geotiff directory])],
[GEOTIFF_PATH=$withval],
......@@ -17,9 +18,7 @@ AC_DEFUN([AC_CHECK_GEOTIFF],
[GEOTIFF_PATH_LIBDIR=$withval],
[GEOTIFF_PATH_LIBDIR=""])
dnl This is a very common location for the geotiff code. jhrg 10/11/05
dnl AS_IF([test -d /usr/local/libgeotiff], [GEOTIFF_PATH="/usr/local/libgeotiff"])
# add /lib and /include to user-provided path
AS_IF([test "z$GEOTIFF_PATH" != "z"],
[
AS_IF([test "z$GEOTIFF_PATH_LIBDIR" = "z"],
......@@ -28,10 +27,12 @@ dnl AS_IF([test -d /usr/local/libgeotiff], [GEOTIFF_PATH="/usr/local/libgeotiff
[GEOTIFF_PATH_INC="$GEOTIFF_PATH/include"])
])
# initialize, save existing $LDFLAGS
ac_geotiff_lib_ok='no'
ac_geotiff_save_LDFLAGS=$LDFLAGS
GEOTIFF_LIBS=
# if the lib directory exists, call function to look for geotiff library
AS_IF([test -d "$GEOTIFF_PATH_LIBDIR"],
[
GEOTIFF_LDFLAGS="-L$GEOTIFF_PATH_LIBDIR"
......@@ -39,7 +40,7 @@ dnl AS_IF([test -d /usr/local/libgeotiff], [GEOTIFF_PATH="/usr/local/libgeotiff
AC_CHECK_GEOTIFF_LIB([ac_geotiff_lib_ok='yes'])
],
[
for ac_geotiff_libdir in "" /usr/geotiff/lib64 /usr/local/lib64/geotiff \
for ac_geotiff_libdir in "" /usr/lib64 /usr/geotiff/lib64 /usr/local/lib64/geotiff \
/usr/libgeotiff/lib64 /usr/local/lib64/libgeotiff \
/opt/lib64/geotiff /opt/lib64/libgeotiff \
/opt/geotiff/lib64 /usr/lib64/geotiff /usr/local/geotiff/lib64 \
......@@ -102,6 +103,7 @@ dnl AS_IF([test -d /usr/local/libgeotiff], [GEOTIFF_PATH="/usr/local/libgeotiff
AC_SUBST([GEOTIFF_LDFLAGS])
])
# the subroutine to check for 'main' in libtiff and libgeotiff
AC_DEFUN([AC_CHECK_GEOTIFF_LIB],
[
GEOTIFF_LIBS=
......
......@@ -4,18 +4,19 @@ AC_DEFUN([GA_CHECK_LIB_GRIB2],
[
ga_check_grib2="no"
AC_CHECK_HEADER(grib2.h,
[ AC_CHECK_LIB(grib2c, main,
[ AC_CHECK_LIB(png12, main,
[ AC_CHECK_LIB(z, main,
[ AC_CHECK_LIB(jasper, main,
[ ga_check_grib2="yes"
G2_LIBS='-lgrib2c -ljasper -lpng -lz'
])
])
])
[ AC_CHECK_LIB(grib2c, main, [
AC_CHECK_LIB([png15], [main], [
AC_CHECK_LIB([z], [compress], [
AC_CHECK_LIB([jpeg], [main], [
AC_CHECK_LIB([jasper], [main], [
ga_check_grib2="yes"
G2_LIBS="-lgrib2c -ljasper -lpng15 -lz"
])
])
])
])
])
])
if test $ga_check_grib2 = "yes" ; then
m4_if([$1], [], [:], [$1])
else
......
......@@ -39,10 +39,11 @@ dnl AS_IF([test -d /usr/local/hdf], [HDF4_PATH="/usr/local/hdf"])
AC_CHECK_HDF4_LIB([ac_hdf4_lib_ok='yes'])
],
[
for ac_hdf4_libdir in "" /usr/local/hdf4.2r1/lib64 /opt/hdf4.2r1/lib64 \
for ac_hdf4_libdir in "" /usr/lib64/hdf /usr/lib64 \
/usr/local/hdf4.2r1/lib64 /opt/hdf4.2r1/lib64 \
/usr/hdf4.2r1/lib64 /usr/local/lib64/hdf4.2r1 /opt/lib64/hdf4.2r1 \
/usr/lib64/hdf4.2r1 /usr/local/hdf/lib64/ /opt/hdf/lib64 /usr/hdf/lib64 \
/usr/local/lib64/hdf /opt/lib64/hdf /usr/lib64/hdf \
/usr/local/lib64/hdf /opt/lib64/hdf \
/usr/local/hdf4.2r1/lib /opt/hdf4.2r1/lib \
/usr/hdf4.2r1/lib /usr/local/lib/hdf4.2r1 /opt/lib/hdf4.2r1 \
/usr/lib/hdf4.2r1 /usr/local/hdf/lib/ /opt/hdf/lib /usr/hdf/lib \
......@@ -71,11 +72,12 @@ dnl AS_IF([test -d /usr/local/hdf], [HDF4_PATH="/usr/local/hdf"])
AC_CHECK_HEADER_NOCACHE_HDF4([mfhdf.h],[ac_hdf4_h='yes'])
],
[
for ac_hdf4_incdir in "" /usr/local/hdf4.2r1/include /opt/hdf4.2r1/include \
for ac_hdf4_incdir in "" /usr/include/hdf \
/usr/local/hdf4.2r1/include /opt/hdf4.2r1/include \
/usr/hdf4.2r1/include /usr/local/include/hdf4.2r1 \
/opt/include/hdf4.2r1 /usr/include/hdf4.2r1 /usr/local/hdf/include \
/opt/hdf/include /usr/hdf/include /usr/local/include/hdf \
/opt/include/hdf /usr/include/hdf ; do
/opt/include/hdf ; do
AS_IF([test "z$ac_hdf4_incdir" = 'z'],
[HDF4_CFLAGS=],
[
......
......@@ -94,14 +94,15 @@ AC_DEFUN([AC_CHECK_HDF5_LIB],
[
HDF5_LIBS=
ac_hdf5_save_LIBS=$LIBS
AC_CHECK_LIB_NOCACHE_HDF5([sz], [main],
[
LIBS="$LIBS -lsz"
HDF5_LIBS='-lsz'
])
dnl -lsz is not required because due to licencing it may not be present
dnl nor required everywhere
dnl nor required everywhere. GrADS will do without szip.
dnl AC_CHECK_LIB_NOCACHE_HDF5([sz], [main],
dnl [
dnl LIBS="$LIBS -lsz"
dnl HDF5_LIBS='-lsz'
dnl ])
ac_hdf5_lib='no'
AC_CHECK_LIB_NOCACHE_HDF5([z],[compress],
[ AC_CHECK_LIB_NOCACHE_HDF5([jpeg],[main],
......@@ -118,6 +119,7 @@ dnl nor required everywhere
[m4_if([$2], [], [:], [$2])])
])
dnl lib check
AC_DEFUN([AC_CHECK_LIB_NOCACHE_HDF5],
[
AS_TR_SH([ac_check_lib_nocache_ok_$1_$2])='no'
......@@ -137,6 +139,7 @@ AC_DEFUN([AC_CHECK_LIB_NOCACHE_HDF5],
[m4_if([$4], [], [:], [$4])])
])
dnl header check
AC_DEFUN([AC_CHECK_HEADER_NOCACHE_HDF5],
[
AS_TR_SH([ac_check_header_nocache_compile_$1])='no'
......
......@@ -68,6 +68,7 @@ dnl AC_LINK_IFELSE([AC_LANG_CALL([],[$ac_check_func_checked])],
],
[
for ac_netcdf_libdir in "" \
/usr/lib64 \
/usr/local/netcdf-${ac_check_nc_interface}/lib64 \
/opt/netcdf-${ac_check_nc_interface}/lib64 \
/usr/netcdf-${ac_check_nc_interface}/lib64 \
......
dnl GA_CHECK_UDUNITS : Check for udunits
dnl AC_CHECK_UDUNITS : Check for udunits
dnl args : action-if-yes, action-if-no
AC_DEFUN([GA_CHECK_UDUNITS],
AC_DEFUN([AC_CHECK_UDUNITS],
[
ga_use_udunits='no'
AC_CHECK_HEADER([udunits.h],
[ AC_CHECK_LIB([udunits],[utInit],
[ ga_use_udunits='yes'
UDUNITS_LIBS='-ludunits'
])
AC_ARG_WITH([udunits],
[AS_HELP_STRING([--with-udunits=ARG],[udunits directory])],
[UDUNITS_PATH=$withval],
[UDUNITS_PATH=""])
AC_ARG_WITH([udunits_include],
[AS_HELP_STRING([--with-udunits-include=ARG],[udunits include directory])],
[UDUNITS_PATH_INC=$withval],
[UDUNITS_PATH_INC=""])
AC_ARG_WITH([udunits_libdir],
[AS_HELP_STRING([--with-udunits-libdir=ARG],[udunits library directory])],
[UDUNITS_PATH_LIBDIR=$withval],
[UDUNITS_PATH_LIBDIR=""])
AS_IF([test "z$UDUNITS_PATH" != "z"],
[
AS_IF([test "z$UDUNITS_PATH_LIBDIR" = "z"],
[UDUNITS_PATH_LIBDIR="$UDUNITS_PATH/lib"])
AS_IF([test "z$UDUNITS_PATH_INC" = "z"],
[UDUNITS_PATH_INC="$UDUNITS_PATH/include"])
])
if test "z$ga_use_udunits" = "zyes" ; then
m4_if([$1], [], [:], [$1])
else
m4_if([$2], [], [:], [$2])
fi
echo JMA uZ$UDUNITS_PATH_LIBDIR
ac_udunits_lib_ok='no'
ac_udunits_save_LDFLAGS=$LDFLAGS
UDUNITS_LIBS=
AS_IF([test "z$UDUNITS_PATH_LIBDIR" != "z"],
[
UDUNITS_LDFLAGS="-L$UDUNITS_PATH_LIBDIR"
LDFLAGS="$LDFLAGS $UDUNITS_LDFLAGS"
AC_CHECK_UDUNITS_LIB([ac_udunits_lib_ok="yes"])
],
[
for ac_udunits_libdir in "" /usr/lib64 /usr/lib /usr/local/lib \
/usr/libudunits/lib64 /usr/local/lib64/libudunits \
/usr/local/udunits/lib /usr/local/libudunits/lib \
/usr/udunits/lib /usr/local/lib/udunits /opt/lib/udunits \
/usr/libudunits/lib /usr/local/lib/libudunits /opt/lib/libudunits \
/usr/lib/udunits /usr/lib/libudunits ; do
AS_IF([test "z$ac_udunits_libdir" = "z"],
[UDUNITS_LDFLAGS=],
[
AC_MSG_NOTICE([searching udunits libraries in $ac_udunits_libdir])
UDUNITS_LDFLAGS="-L$ac_udunits_libdir"
])
LDFLAGS="$LDFLAGS $UDUNITS_LDFLAGS"
AC_CHECK_UDUNITS_LIB([ac_udunits_lib_ok="yes"])
AS_IF([test $ac_udunits_lib_ok = "yes"],[break])
LDFLAGS=$ac_udunits_save_LDFLAGS
done
])
LDFLAGS=$ac_udunits_save_LDFLAGS
ac_udunits_h='no'
UDUNITS_CFLAGS=
ac_udunits_save_CPPFLAGS=$CPPFLAGS
AS_IF([test "z$UDUNITS_PATH_INC" != "z"],
[
UDUNITS_CFLAGS="-I$UDUNITS_PATH_INC"
CPPFLAGS="$CPPFLAGS $UDUNITS_CFLAGS"
AC_CHECK_HEADER_NOCACHE_UDUNITS([udunits.h],[ac_udunits_h="yes"])
],
[
for ac_udunits_incdir in /usr/include \
/usr/local/udunits/include /opt/udunits/include \
/usr/udunits/include /usr/local/include/udunits \
/opt/include/udunits /usr/include/udunits /usr/local/libudunits/include \
/opt/libudunits/include /usr/libudunits/include /usr/local/include/libudunits \
/opt/include/libudunits /usr/include/libudunits ; do
AS_IF([test "z$ac_udunits_incdir" = "z"],
[UDUNITS_CFLAGS=],
[
AC_MSG_NOTICE([searching udunits includes in $ac_udunits_incdir])
UDUNITS_CFLAGS="-I$ac_udunits_incdir"
])
CPPFLAGS="$CPPFLAGS $UDUNITS_CFLAGS"
AC_CHECK_HEADER_NOCACHE_UDUNITS([udunits.h],[ac_udunits_h="yes"])
AS_IF([test $ac_udunits_h = "yes"],[break])
CPPFLAGS=$ac_udunits_save_CPPFLAGS
done
])
CPPFLAGS=$ac_udunits_save_CPPFLAGS
AS_IF([test "$ac_udunits_h" = "yes" -a "$ac_udunits_lib_ok" = "yes"],
[m4_if([$1], [], [:], [$1])],
[m4_if([$2], [], [:], [$2])])
AC_SUBST([UDUNITS_LIBS])
AC_SUBST([UDUNITS_CFLAGS])
AC_SUBST([UDUNITS_LDFLAGS])
])
AC_DEFUN([AC_CHECK_UDUNITS_LIB],
[
UDUNITS_LIBS=
ac_udunits_save_LIBS=$LIBS
ac_udunits_lib='no'
AC_CHECK_LIB_NOCACHE_UDUNITS([udunits],[main],
[ ac_udunits_lib="yes"
UDUNITS_LIBS="-ludunits $UDUNITS_LIBS"
])
LIBS=$ac_udunits_save_LIBS
AS_IF([test "$ac_udunits_lib" = "yes"],
[m4_if([$1], [], [:], [$1])],
[m4_if([$2], [], [:], [$2])])
])
AC_DEFUN([AC_CHECK_LIB_NOCACHE_UDUNITS],
[
AS_TR_SH([ac_check_lib_nocache_ok_$1_$2])='no'
AS_TR_SH([ac_check_lib_nocache_$1_$2_LIBS])=$LIBS
LIBS="-l$1 $5 $LIBS"
AC_MSG_CHECKING([for $2 in -l$1])
AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
[
AS_TR_SH([ac_check_lib_nocache_ok_$1_$2])="yes"
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
])
LIBS=$AS_TR_SH([ac_check_lib_nocache_$1_$2_LIBS])
AS_IF([test $AS_TR_SH([ac_check_lib_nocache_ok_$1_$2]) = "yes"],
[m4_if([$3], [], [:], [$3])],
[m4_if([$4], [], [:], [$4])])
])
AC_DEFUN([AC_CHECK_HEADER_NOCACHE_UDUNITS],
[
AS_TR_SH([ac_check_header_nocache_compile_$1])='no'
AS_TR_SH([ac_check_header_nocache_preproc_$1])='no'
AC_MSG_CHECKING([for $1 with compiler])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <$1>]])],
[
AC_MSG_RESULT([yes])
AS_TR_SH([ac_check_header_nocache_compile_$1])="yes"
],
[
AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([for $1 with preprocessor])