From c790707d517dbf4fa6a8b2695a35b3bc3b784556 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 3 Dec 2015 18:42:08 -0800 Subject: Configure for large file support. * configure (lang_flags): _XOPEN_SOURCE is bumped from 600 to 700 so that fseeko and ftello are revealed in by glibc, and off_t is defined there too. New configure tests for fseeko/ftello and for detecting which macro, if any, do we add to lang_flags to enable large file support (64 bit off_t). --- configure | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/configure b/configure index d068496c..b63c7297 100755 --- a/configure +++ b/configure @@ -96,7 +96,7 @@ yacc='$(cross)$(tool_prefix)$(yaccname)' yacc_given= nm='$(cross)$(tool_prefix)nm' opt_flags=-O2 -lang_flags='-ansi -D_XOPEN_SOURCE=600' +lang_flags='-ansi -D_XOPEN_SOURCE=700' diag_flags='-Wall -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=strict-prototypes' debug_flags=-g debug_only_flags=-DTXR_DEBUG @@ -2335,6 +2335,75 @@ else printf "no\n" fi +# +# Do we have fseeko and ftello? +# + +printf "Checking for fseeko and ftello ... " + +cat > conftest.c < +#include + +int main(int argc, char **argv) +{ + int res = fseeko(stdin, 0, SEEK_CUR); + off_t pos = ftello(stdin); + return 0; +} +! + +if conftest ; then + printf "yes\n" + printf "#define HAVE_FSEEKO 1\n" >> $config_h +else + printf "no\n" +fi + +printf "Checking how to enable 64 bit file offsets ... " + +file_offset_define=none + +for try in NOTHING _LARGE_FILES=1 _FILE_OFFSET_BITS=64 ; do + cat > conftest.c < +char SIZEOF_OFF_T[sizeof (off_t)]; +char DUMMY; +! + if ! conftest_syms VERBOSE=y EXTRA_FLAGS=-D$try ; then + printf "failed\n\n" + + printf "Errors from compilation: \n\n" + cat conftest.err + exit 1 + fi + + SIZEOF_OFF_T=0 + + read_syms + + if [ $SIZEOF_OFF_T -eq 0 ] ; then + printf "failed\n" + exit 1 + fi + + if [ $SIZEOF_OFF_T -eq 8 ] ; then + if [ $try = NOTHING ] ; then + printf "default\n" + file_offset_define= + else + printf -- "-D%s\n" $try + file_offset_define=$try + fi + break; + fi +done + +if [ "$file_offset_define" = none ] ; then + printf "unable\n" +elif [ -n "$file_offset_define" ] ; then + lang_flags="$lang_flags -D$file_offset_define" +fi # # Dependent variables -- cgit v1.2.3