Commit f12b8c9a authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

improve check for udunits2 include file

parent 31bf5054
......@@ -18894,6 +18894,18 @@ _ACEOF
 
fi
 
done
for ac_header in udunits2/udunits2.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "udunits2/udunits2.h" "ac_cv_header_udunits2_udunits2_h" "$ac_includes_default"
if test "x$ac_cv_header_udunits2_udunits2_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_UDUNITS2_UDUNITS2_H 1
_ACEOF
fi
done
 
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ut_parse" >&5
......
......@@ -389,7 +389,9 @@ AC_ARG_WITH([udunits2],
[no],[AC_MSG_CHECKING([for udunits2 library])
AC_MSG_RESULT([suppressed])],
[yes],[AC_CHECK_HEADERS([udunits2.h])
AC_SEARCH_LIBS([ut_parse],[udunits2],[AC_DEFINE([HAVE_LIBUDUNITS2],[1],[Define to 1 for UDUNITS2 support])],
AC_SEARCH_LIBS([ut_parse],
[udunits2],
[AC_DEFINE([HAVE_LIBUDUNITS2],[1],[Define to 1 for UDUNITS2 support])],
[AC_MSG_ERROR([Could not link to udunits2 library!])])
AC_SUBST([UDUNITS_LDFLAGS],[" -ludunits2"])
AC_SUBST([UDUNITS_INCLUDE],[""])],
......@@ -398,6 +400,7 @@ AC_ARG_WITH([udunits2],
[LDFLAGS="$LDFLAGS -L$UDUNITS_ROOT/lib"
CPPFLAGS="$CPPFLAGS -I$UDUNITS_ROOT/include"
AC_CHECK_HEADERS([udunits2.h])
AC_CHECK_HEADERS([udunits2/udunits2.h])
AC_SEARCH_LIBS([ut_parse],
[udunits2],
[AC_DEFINE([HAVE_LIBUDUNITS2],[1],[Define to 1 for UDUNITS2 support])],
......
......@@ -21,13 +21,21 @@
Setpartab setpartab Set parameter table
*/
#if defined (HAVE_CONFIG_H)
#if defined(HAVE_CONFIG_H)
# include "config.h"
#endif
#if defined (HAVE_LIBUDUNITS2)
#if defined(HAVE_LIBUDUNITS2) && (defined(HAVE_UDUNITS2_H) || defined(HAVE_UDUNITS2_UDUNITS2_H))
#define HAVE_UDUNITS2
#endif
#if defined(HAVE_UDUNITS2)
#if defined(HAVE_UDUNITS2_UDUNITS2_H)
# include <udunits2/udunits2.h>
#else
# include <udunits2.h>
#endif
#endif
#include <errno.h>
#include <cdi.h>
......@@ -40,7 +48,7 @@
typedef enum {CODE_NUMBER, PARAMETER_ID, VARIABLE_NAME, STANDARD_NAME} pt_mode_t;
#if defined (HAVE_LIBUDUNITS2)
#if defined(HAVE_UDUNITS2)
static void udunitsInitialize(void);
static int udunitsInit = 0;
......@@ -218,7 +226,7 @@ void defineVarUnits(var_t *vars, int vlistID2, int varID, char *units, char *nam
vars[varID].changeunits = TRUE;
strcpy(vars[varID].units_old, units_old);
strcpy(vars[varID].units, units);
#if defined (HAVE_LIBUDUNITS2)
#if defined(HAVE_UDUNITS2)
int status;
UDUNITS_INIT();
UDUNITS_LOCK();
......@@ -764,7 +772,7 @@ void *Setpartab(void *argument)
}
}
#if defined (HAVE_LIBUDUNITS2)
#if defined(HAVE_UDUNITS2)
if ( vars[varID].changeunits == TRUE )
{
int nerr = 0;
......@@ -796,7 +804,7 @@ void *Setpartab(void *argument)
streamClose(streamID2);
streamClose(streamID1);
#if defined (HAVE_LIBUDUNITS2)
#if defined(HAVE_UDUNITS2)
UDUNITS_LOCK();
for ( varID = 0; varID < nvars; varID++ )
......
......@@ -184,6 +184,9 @@
/* Define to 1 if you have the <udunits2.h> header file. */
#undef HAVE_UDUNITS2_H
/* Define to 1 if you have the <udunits2/udunits2.h> header file. */
#undef HAVE_UDUNITS2_UDUNITS2_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment