mirror of https://github.com/ecmwf/eccodes.git
ECC-1141: Compile error on MinGW: undefined reference to 'realpath'
This commit is contained in:
parent
d0b7b2e31f
commit
c39585dc93
|
@ -49,6 +49,7 @@ check_symbol_exists( fseeko "stdio.h" ECCODES_HAVE_FSEEKO )
|
|||
check_symbol_exists( posix_memalign "stdlib.h" ECCODES_HAVE_POSIX_MEMALIGN )
|
||||
check_symbol_exists( fmemopen "stdio.h" ECCODES_HAVE_FMEMOPEN )
|
||||
check_symbol_exists( funopen "stdio.h" ECCODES_HAVE_FUNOPEN )
|
||||
check_symbol_exists( realpath "stdlib.h" ECCODES_HAVE_REALPATH )
|
||||
|
||||
check_c_source_compiles(
|
||||
" typedef int foo_t;
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#cmakedefine ECCODES_HAVE_POSIX_MEMALIGN
|
||||
#cmakedefine ECCODES_HAVE_FMEMOPEN
|
||||
#cmakedefine ECCODES_HAVE_FUNOPEN
|
||||
#cmakedefine ECCODES_HAVE_REALPATH
|
||||
|
||||
#if defined(EC_HAVE_ASSERT_H) || defined(ECCODES_HAVE_ASSERT_H)
|
||||
#define HAVE_ASSERT_H 1
|
||||
|
@ -64,15 +65,15 @@
|
|||
#endif
|
||||
|
||||
#if defined(EC_HAVE_SYS_STAT_H) || defined(ECCODES_HAVE_SYS_STAT_H)
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
#endif
|
||||
|
||||
#if defined(EC_HAVE_FCNTL_H) || defined(ECCODES_HAVE_FCNTL_H)
|
||||
#define HAVE_FCNTL_H 1
|
||||
#define HAVE_FCNTL_H 1
|
||||
#endif
|
||||
|
||||
#if defined(EC_HAVE_UNISTD_H) || defined(ECCODES_HAVE_UNISTD_H)
|
||||
#define HAVE_UNISTD_H 1
|
||||
#define HAVE_UNISTD_H 1
|
||||
#endif
|
||||
|
||||
#if defined(EC_HAVE_FSEEKO) || defined(ECCODES_HAVE_FSEEKO)
|
||||
|
@ -80,9 +81,10 @@
|
|||
#endif
|
||||
|
||||
#if defined(EC_HAVE_POSIX_MEMALIGN) || defined(ECCODES_HAVE_POSIX_MEMALIGN)
|
||||
#define POSIX_MEMALIGN 1
|
||||
#define POSIX_MEMALIGN 1
|
||||
#endif
|
||||
|
||||
|
||||
/* other */
|
||||
|
||||
#define IEEE_BE @IEEE_BE@
|
||||
|
|
|
@ -607,9 +607,7 @@ grib_context* grib_context_new(grib_context* parent)
|
|||
static char* resolve_path(grib_context* c, char* path)
|
||||
{
|
||||
char* result = NULL;
|
||||
#ifdef ECCODES_ON_WINDOWS
|
||||
result = grib_context_strdup(c, path);
|
||||
#else
|
||||
#if defined(ECCODES_HAVE_REALPATH)
|
||||
char resolved[ECC_PATH_MAXLEN + 1];
|
||||
if (!realpath(path, resolved)) {
|
||||
result = grib_context_strdup(c, path); /* Failed to resolve. Use original path */
|
||||
|
@ -617,7 +615,10 @@ static char* resolve_path(grib_context* c, char* path)
|
|||
else {
|
||||
result = grib_context_strdup(c, resolved);
|
||||
}
|
||||
#else
|
||||
result = grib_context_strdup(c, path);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue