Yuriy Kaminskiy wrote:
> Use of some function/features protected by #ifdefs, but lacks autoconf magic 
> to
> automatically enable them when possible. Of course, they can be manually
> enabled, but it is not very likely. And unused code tends to bitrot.

Oops, last time patch attachment with mime-type text/* worked :-(
Inlining instead:

===================================================================

Subject: autodetect and automatically use pread/pwrite

The author or authors of this code dedicate any and all copyright interest
in this code to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and successors.
We intend this dedication to be an overt act of relinquishment in perpetuity
of all present and future rights to this code under copyright law.

Signed-off-by: Yuriy M. Kaminskiy <yum...@gmail.com>

Index: sqlite3-3.7.14/configure.ac
===================================================================
--- sqlite3-3.7.14.orig/configure.ac
+++ sqlite3-3.7.14/configure.ac
@@ -127,7 +127,7 @@ AC_CHECK_HEADERS([sys/types.h stdlib.h s
 #########
 # Figure out whether or not we have these functions
 #
-AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime
malloc_usable_size])
+AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime
malloc_usable_size pread pwrite pread64 pwrite64])

 #########
 # By default, we use the amalgamation (this may be changed below...)
@@ -284,6 +284,18 @@ if test "$SQLITE_THREADSAFE" = "1"; then
 fi

 ##########
+# Auto-detect pread/pread64
+#
+AC_ARG_ENABLE(pread, AC_HELP_STRING([--disable-pread], [Disable pread(2) use]))
+if test x$enable_pread != xno; then
+       if test $ac_cv_func_pread64,$ac_cv_func_pwrite64 = yes,yes; then
+               AC_DEFINE(USE_PREAD64, 1, [Define if you want to use pread64 
function])
+       elif test $ac_cv_func_pread,$ac_cv_func_pwrite = yes,yes; then
+               AC_DEFINE(USE_PREAD, 1, [Define if you want to use pread 
function])
+       fi
+fi
+
+##########
 # Do we want to allow a connection created in one thread to be used
 # in another thread.  This does not work on many Linux systems (ex: RedHat 9)
 # due to bugs in the threading implementations.  This is thus off by default.
===================================================================

Subject: autodetect strchrnul

Signed-off-by: Yuriy M. Kaminskiy <yum...@gmail.com>

Index: sqlite3-3.8.7.1/configure.ac
===================================================================
--- sqlite3-3.8.7.1.orig/configure.ac
+++ sqlite3-3.8.7.1/configure.ac
@@ -127,7 +127,7 @@ AC_CHECK_HEADERS([sys/types.h stdlib.h s
 #########
 # Figure out whether or not we have these functions
 #
-AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime
malloc_usable_size pread pwrite pread64 pwrite64])
+AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime
malloc_usable_size pread pwrite pread64 pwrite64 strchrnul])

 #########
 # By default, we use the amalgamation (this may be changed below...)
===================================================================

Subject: autodetect posix_fallocate

Signed-off-by: Yuriy M. Kaminskiy <yum...@gmail.com>

Index: sqlite3-3.8.7.1/configure.ac
===================================================================
--- sqlite3-3.8.7.1.orig/configure.ac
+++ sqlite3-3.8.7.1/configure.ac
@@ -127,7 +127,7 @@ AC_CHECK_HEADERS([sys/types.h stdlib.h s
 #########
 # Figure out whether or not we have these functions
 #
-AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime
malloc_usable_size pread pwrite pread64 pwrite64 strchrnul])
+AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime
malloc_usable_size pread pwrite pread64 pwrite64 strchrnul posix_fallocate])

 #########
 # By default, we use the amalgamation (this may be changed below...)

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to