Commit 3fa93d44 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

added CDI function cdiHaveFiletype() to check whether a filetype is available

parent c90090fe
2013-06-18 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* Version 1.6.1 released
2013-05-17 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added CDI function cdiHaveFiletype() to check whether a filetype is available
2013-05-13 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added patch from Florian Prill: Lesen von "Nicht-Standard" GRIB-Keys (bug fix)
......
......@@ -56,6 +56,9 @@ int complevel = 0; // Compression level
static
void version(void)
{
int filetypes[] = {FILETYPE_SRV, FILETYPE_EXT, FILETYPE_IEG, FILETYPE_GRB, FILETYPE_GRB2, FILETYPE_NC, FILETYPE_NC2, FILETYPE_NC4, FILETYPE_NC4C};
char *typenames[] = { "srv", "ext", "ieg", "grb", "grb2", "nc", "nc2", "nc4", "nc4c"};
fprintf(stderr, "CDI version 1.8\n");
#if defined (COMPILER)
fprintf(stderr, "Compiler: %s\n", COMPILER);
......@@ -63,6 +66,16 @@ void version(void)
#if defined (COMP_VERSION)
fprintf(stderr, " version: %s\n", COMP_VERSION);
#endif
#if defined (USER_NAME) && defined(HOST_NAME) && defined(SYSTEM_TYPE)
fprintf(stderr, "Compiled: by %s on %s (%s) %s %s\n",
USER_NAME, HOST_NAME, SYSTEM_TYPE, __DATE__, __TIME__);
#endif
fprintf(stderr, "filetype: ");
for ( size_t i = 0; i < sizeof(filetypes)/sizeof(int); ++i )
if ( cdiHaveFiletype(filetypes[i]) ) fprintf(stderr, "%s ", typenames[i]);
fprintf(stderr, "\n");
fprintf(stderr, " with:");
#if defined (HAVE_LIBPTHREAD)
fprintf(stderr, " PTHREADS");
......@@ -95,10 +108,6 @@ void version(void)
fprintf(stderr, " CURL");
#endif
fprintf(stderr, "\n");
#if defined (USER_NAME) && defined(HOST_NAME) && defined(SYSTEM_TYPE)
fprintf(stderr, "Compiled: by %s on %s (%s) %s %s\n",
USER_NAME, HOST_NAME, SYSTEM_TYPE, __DATE__, __TIME__);
#endif
cdiPrintVersion();
fprintf(stderr, "\n");
/*
......
......@@ -674,6 +674,9 @@ PTHREAD_CFLAGS
PTHREAD_LIBS
PTHREAD_CC
ax_pthread_config
SYSTEM_TYPE
HOST_NAME
USER_NAME
AS
CXXCPP
am__fastdepCXX_FALSE
......@@ -758,9 +761,6 @@ am__isrc
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
SYSTEM_TYPE
HOST_NAME
USER_NAME
host_os
host_vendor
host_cpu
......@@ -2849,41 +2849,6 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
 
# Checks for username, hostname and system type
USERNAME=$LOGNAME
if test -z "$USERNAME" ; then USERNAME=$USER; fi;
if test -z "$USERNAME" ; then USERNAME="unknown"; fi;
cat >>confdefs.h <<_ACEOF
#define USER_NAME "$USERNAME"
_ACEOF
USER_NAME="$USERNAME"
if test -z "$HOST"; then :
HOST=unknown
if test -x /bin/hostname; then :
HOST=$(hostname)
else
if test -x /bin/uname; then :
HOST=$(uname -n)
fi
fi
fi
cat >>confdefs.h <<_ACEOF
#define HOST_NAME "$HOST"
_ACEOF
HOST_NAME="$HOST"
cat >>confdefs.h <<_ACEOF
#define SYSTEM_TYPE "$ac_cv_build"
_ACEOF
SYSTEM_TYPE="$ac_cv_build"
 
am__api_version='1.11'
 
......@@ -23887,6 +23852,62 @@ cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_ISNAN $ac_have_decl
_ACEOF
 
# Check compiler version
case "$CC" in
pgcc*) COMP_VERSION=`$CC -V | head -2 | tail -n 1`;;
*gcc*) COMP_VERSION=`$CC --version | head -n 1`;;
g++*) COMP_VERSION=`$CC --version | head -n 1`;;
clang*) COMP_VERSION=`$CC --version | head -n 1`;;
sxc*) COMP_VERSION=`$CC -V 2>&1 | tail -n 1`;;
xlc*) COMP_VERSION=`$CC -qversion 2>&1 | head -n 1`;;
*) COMP_VERSION=`$CC -V 2>&1 | head -n 1`;;
esac
if test -z "$COMP_VERSION" ; then COMP_VERSION="unknown"; fi;
cat >>confdefs.h <<_ACEOF
#define COMP_VERSION "$COMP_VERSION"
_ACEOF
# Checks for username, hostname and system type
USERNAME=$LOGNAME
if test -z "$USERNAME" ; then USERNAME=$USER; fi;
if test -z "$USERNAME" ; then USERNAME="unknown"; fi;
cat >>confdefs.h <<_ACEOF
#define USER_NAME "$USERNAME"
_ACEOF
USER_NAME="$USERNAME"
if test -z "$HOST"; then :
HOST=unknown
if test -x /bin/hostname; then :
HOST=$(hostname)
else
if test -x /bin/uname; then :
HOST=$(uname -n)
fi
fi
fi
cat >>confdefs.h <<_ACEOF
#define HOST_NAME "$HOST"
_ACEOF
HOST_NAME="$HOST"
cat >>confdefs.h <<_ACEOF
#define SYSTEM_TYPE "$ac_cv_build"
_ACEOF
SYSTEM_TYPE="$ac_cv_build"
# ----------------------------------------------------------------------
# Check for math library
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for floor in -lm" >&5
......@@ -26841,6 +26862,14 @@ fi
 
 
 
# Checks for compiler
COMPILER="$CC $CFLAGS"
cat >>confdefs.h <<_ACEOF
#define COMPILER "$COMPILER"
_ACEOF
ac_config_files="$ac_config_files tests/test_cksum_grib tests/test_cksum_nc tests/test_cksum_nc2 tests/test_cksum_nc4 tests/test_cksum_extra tests/test_cksum_service tests/test_cksum_ieg tests/pio_write_run tests/pio_cksum_mpinonb tests/pio_cksum_fpguard tests/pio_cksum_asynch tests/pio_cksum_writer util/serialrun"
 
 
......
......@@ -10,21 +10,6 @@ AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
# Checks for username, hostname and system type
USERNAME=$LOGNAME
if test -z "$USERNAME" ; then USERNAME=$USER; fi;
if test -z "$USERNAME" ; then USERNAME="unknown"; fi;
AC_DEFINE_UNQUOTED([USER_NAME],["$USERNAME"], [User name])
AC_SUBST([USER_NAME],["$USERNAME"])
AS_IF([test -z "$HOST"],
[HOST=unknown
AS_IF([test -x /bin/hostname],[HOST=$(hostname)],
[AS_IF([test -x /bin/uname],
[HOST=$(uname -n)])])])
AC_DEFINE_UNQUOTED([HOST_NAME],["$HOST"],[Host name])
AC_SUBST([HOST_NAME],["$HOST"])
AC_DEFINE_UNQUOTED([SYSTEM_TYPE],["$ac_cv_build"], [System type])
AC_SUBST([SYSTEM_TYPE],["$ac_cv_build"])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([src/config.h])
......@@ -80,6 +65,38 @@ AC_CHECK_FUNCS([getline])
# Checks for the availability of ANSI-C99 functions
AC_CHECK_DECLS([isnan],,,[AC_INCLUDES_DEFAULT
@%:@include <math.h>])
# Check compiler version
case "$CC" in
pgcc*) COMP_VERSION=`$CC -V | head -2 | tail -n 1`;;
*gcc*) COMP_VERSION=`$CC --version | head -n 1`;;
g++*) COMP_VERSION=`$CC --version | head -n 1`;;
clang*) COMP_VERSION=`$CC --version | head -n 1`;;
sxc*) COMP_VERSION=`$CC -V 2>&1 | tail -n 1`;;
xlc*) COMP_VERSION=`$CC -qversion 2>&1 | head -n 1`;;
*) COMP_VERSION=`$CC -V 2>&1 | head -n 1`;;
esac
if test -z "$COMP_VERSION" ; then COMP_VERSION="unknown"; fi;
AC_DEFINE_UNQUOTED(COMP_VERSION, ["$COMP_VERSION"], [Compiler version])
# Checks for username, hostname and system type
USERNAME=$LOGNAME
if test -z "$USERNAME" ; then USERNAME=$USER; fi;
if test -z "$USERNAME" ; then USERNAME="unknown"; fi;
AC_DEFINE_UNQUOTED([USER_NAME],["$USERNAME"], [User name])
AC_SUBST([USER_NAME],["$USERNAME"])
AS_IF([test -z "$HOST"],
[HOST=unknown
AS_IF([test -x /bin/hostname],[HOST=$(hostname)],
[AS_IF([test -x /bin/uname],
[HOST=$(uname -n)])])])
AC_DEFINE_UNQUOTED([HOST_NAME],["$HOST"],[Host name])
AC_SUBST([HOST_NAME],["$HOST"])
AC_DEFINE_UNQUOTED([SYSTEM_TYPE],["$ac_cv_build"], [System type])
AC_SUBST([SYSTEM_TYPE],["$ac_cv_build"])
# ----------------------------------------------------------------------
# Check for math library
AC_CHECK_LIB(m, floor)
......@@ -179,6 +196,10 @@ AM_CONDITIONAL([USE_FC],[test -n "$FC" && test "X$FC" != "Xno" && test x$acx_cv_
AC_SUBST([CPPFLAGS])
# Checks for compiler
COMPILER="$CC $CFLAGS"
AC_DEFINE_UNQUOTED(COMPILER, ["$COMPILER"], [Compiler])
AC_CONFIG_FILES([tests/test_cksum_grib \
tests/test_cksum_nc \
tests/test_cksum_nc2 \
......
......@@ -243,6 +243,8 @@ void cdiDebug(int debug);
char *cdiLibraryVersion(void);
void cdiPrintVersion(void);
int cdiHaveFiletype(int filetype);
void cdiDefMissval(double missval);
double cdiInqMissval(void);
void cdiDefGlobal(const char *string, int val);
......
/* src/config.h.in. Generated from configure.ac by autoheader. */
/* Compiler */
#undef COMPILER
/* Compiler version */
#undef COMP_VERSION
/* Define if C / Fortran interface cfortran.h works */
#undef HAVE_CF_INTERFACE
......
......@@ -85,6 +85,46 @@ void cdiDebug(int level)
}
int cdiHaveFiletype(int filetype)
{
int status = 0;
switch (filetype)
{
#if defined (HAVE_LIBSERVICE)
case FILETYPE_SRV: { status = 1; break; }
#endif
#if defined (HAVE_LIBEXTRA)
case FILETYPE_EXT: { status = 1; break; }
#endif
#if defined (HAVE_LIBIEG)
case FILETYPE_IEG: { status = 1; break; }
#endif
#if defined (HAVE_LIBGRIB)
#if defined (HAVE_LIBGRIB_API) || defined (HAVE_CGRIBEX)
case FILETYPE_GRB: { status = 1; break; }
#endif
#if defined (HAVE_LIBGRIB_API)
case FILETYPE_GRB2: { status = 1; break; }
#endif
#endif
#if defined (HAVE_LIBNETCDF)
case FILETYPE_NC: { status = 1; break; }
#if defined (HAVE_NETCDF2)
case FILETYPE_NC2: { status = 1; break; }
#endif
#if defined (HAVE_NETCDF4)
case FILETYPE_NC4: { status = 1; break; }
case FILETYPE_NC4C: { status = 1; break; }
#endif
#endif
default: { status = 0; break; }
}
return (status);
}
#undef IsBigendian
#define IsBigendian() ( u_byteorder.c[sizeof(long) - 1] )
......
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