From d98b913aa9a0dd40a9373d65882f1cb742d033af Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 24 Sep 2005 04:56:51 +0000 Subject: r10466: work around missing pread/pwrite declaration on openbsd (This used to be commit e615f36733966f9992670e3650fbe9b20d7d218c) --- source4/lib/tdb/aclocal.m4 | 12 ++++++++++++ source4/lib/tdb/common/tdb_private.h | 8 ++++++++ source4/lib/tdb/config.m4 | 3 +++ 3 files changed, 23 insertions(+) create mode 100644 source4/lib/tdb/aclocal.m4 (limited to 'source4') diff --git a/source4/lib/tdb/aclocal.m4 b/source4/lib/tdb/aclocal.m4 new file mode 100644 index 0000000000..cdc2a2fa52 --- /dev/null +++ b/source4/lib/tdb/aclocal.m4 @@ -0,0 +1,12 @@ +dnl see if a declaration exists for a function or variable +dnl defines HAVE_function_DECL if it exists +dnl AC_HAVE_DECL(var, includes) +AC_DEFUN(AC_HAVE_DECL, +[ + AC_CACHE_CHECK([for $1 declaration],ac_cv_have_$1_decl,[ + AC_TRY_COMPILE([$2],[int i = (int)$1], + ac_cv_have_$1_decl=yes,ac_cv_have_$1_decl=no)]) + if test x"$ac_cv_have_$1_decl" = x"yes"; then + AC_DEFINE([HAVE_]translit([$1], [a-z], [A-Z])[_DECL],1,[Whether $1() is available]) + fi +]) diff --git a/source4/lib/tdb/common/tdb_private.h b/source4/lib/tdb/common/tdb_private.h index 2b2d6de411..a451dff0af 100644 --- a/source4/lib/tdb/common/tdb_private.h +++ b/source4/lib/tdb/common/tdb_private.h @@ -45,6 +45,14 @@ #include #include "config.h" #include "tdb.h" + +#ifndef HAVE_PREAD_DECL +ssize_t pread(int fd, void *buf, size_t count, off_t offset); +#endif +#ifndef HAVE_PWRITE_DECL +ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); +#endif + #else #include "includes.h" #include "lib/tdb/include/tdb.h" diff --git a/source4/lib/tdb/config.m4 b/source4/lib/tdb/config.m4 index 2ebd29993d..31c33552ea 100644 --- a/source4/lib/tdb/config.m4 +++ b/source4/lib/tdb/config.m4 @@ -1,6 +1,9 @@ AC_CHECK_FUNCS(mmap pread pwrite) AC_CHECK_HEADERS(getopt.h) +AC_HAVE_DECL(pread, [#include ]) +AC_HAVE_DECL(pwrite, [#include ]) + if test x"$experimental" = x"yes"; then SMB_LIBRARY_ENABLE(libtdb,YES) fi -- cgit