From b65859f65c3f5dcd88fd83df10774c5e30d841bf Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Thu, 11 Jun 2009 18:15:08 +0200 Subject: [PATCH] added support for neon >= 0.27 neon 0.27 dropped the ne_*64 functions in favor of a new type ne_off_t that was introduced to take care of LFS stuff. The build process now checks for the version of neon and uses the appropriate functions accordingly. --- configure.ac | 23 +++++++++++++++++++++++ src/filecache.c | 10 ++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 17210a5..3d4b1f9 100644 --- a/configure.ac +++ b/configure.ac @@ -110,6 +110,29 @@ AC_CHECK_FUNCS([ftruncate memset strdup strerror strrchr memchr strchr strcspn]) AC_CHECK_LIB([pthread], [pthread_create]) PKG_CHECK_MODULES(NEON, [ neon >= 0.26 ]) + +AC_MSG_CHECKING([for NEON >= 0.27]) +if pkg-config --atleast-version=0.27 neon; then + AC_DEFINE([NEON_GT_0_27], 1, [Define to 1 if you have neon >= 0.27.]) + AC_MSG_RESULT([yes]) + + OLDCFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $NEON_CFLAGS" + AC_CHECK_SIZEOF([off_t]) + AC_CHECK_SIZEOF([ne_off_t], [], + [ +AC_INCLUDES_DEFAULT +#include "ne_defs.h" + ]) + CFLAGS="$OLDCFLAGS" + + if test $ac_cv_sizeof_off_t -gt $ac_cv_sizeof_ne_off_t; then + AC_MSG_ERROR([*** Sorry, ne_off_t is incompatible to off_t ***]) + fi +else + AC_MSG_RESULT([no]) +fi + PKG_CHECK_MODULES(FUSE, [ fuse >= 2.5 ]) # LYNX documentation generation diff --git a/src/filecache.c b/src/filecache.c index 189db27..3677056 100644 --- a/src/filecache.c +++ b/src/filecache.c @@ -233,8 +233,13 @@ fail: } static int load_up_to_unlocked(struct file_info *fi, off_t l) { - +#ifdef NEON_GT_0_27 +#define NE_GET_RANGE ne_get_range + ne_content_range range; +#else +#define NE_GET_RANGE ne_get_range64 ne_content_range64 range; +#endif ne_session *session; assert(fi); @@ -257,7 +262,7 @@ static int load_up_to_unlocked(struct file_info *fi, off_t l) { range.end = l-1; range.total = 0; - if (ne_get_range64(session, fi->filename, &range, fi->fd) != NE_OK) { + if (NE_GET_RANGE(session, fi->filename, &range, fi->fd) != NE_OK) { fprintf(stderr, "GET failed: %s\n", ne_get_error(session)); errno = ENOENT; return -1; @@ -265,6 +270,7 @@ static int load_up_to_unlocked(struct file_info *fi, off_t l) { fi->present = l; return 0; +#undef NE_GET_RANGE } int file_cache_read(void *f, char *buf, size_t size, off_t offset) { -- 2.30.2