Fossil SCM

Cherrypick [http://www.sqlite.org/src/info/e147230767] with one little change: __MINGW32_MAJOR_VERSION is renamed to __MINGW_MAJOR_VERSION in MinGW 4.0. The old macro name is still available but has the value 3, so that doesn't help at all! This way, it works as expected on MinGW-4.0

jan.nijtmans 2014-02-16 11:24 UTC trunk
Commit 483ebe5c6111b8d3f02eacb37a25a17914935ead
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -795,11 +795,11 @@
795795
writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n"
796796
writeln "\$(OBJDIR)/${s}.h:\t\$(OBJDIR)/headers\n"
797797
}
798798
799799
set MINGW_SQLITE_OPTIONS $SQLITE_OPTIONS
800
-lappend MINGW_SQLITE_OPTIONS -D_HAVE_SQLITE_CONFIG_H
800
+lappend MINGW_SQLITE_OPTIONS -D_HAVE__MINGW_H
801801
lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MALLOC_H
802802
lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MSIZE
803803
804804
set j " \\\n "
805805
writeln "SQLITE_OPTIONS = [join $MINGW_SQLITE_OPTIONS $j]\n"
806806
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -795,11 +795,11 @@
795 writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n"
796 writeln "\$(OBJDIR)/${s}.h:\t\$(OBJDIR)/headers\n"
797 }
798
799 set MINGW_SQLITE_OPTIONS $SQLITE_OPTIONS
800 lappend MINGW_SQLITE_OPTIONS -D_HAVE_SQLITE_CONFIG_H
801 lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MALLOC_H
802 lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MSIZE
803
804 set j " \\\n "
805 writeln "SQLITE_OPTIONS = [join $MINGW_SQLITE_OPTIONS $j]\n"
806
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -795,11 +795,11 @@
795 writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n"
796 writeln "\$(OBJDIR)/${s}.h:\t\$(OBJDIR)/headers\n"
797 }
798
799 set MINGW_SQLITE_OPTIONS $SQLITE_OPTIONS
800 lappend MINGW_SQLITE_OPTIONS -D_HAVE__MINGW_H
801 lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MALLOC_H
802 lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MSIZE
803
804 set j " \\\n "
805 writeln "SQLITE_OPTIONS = [join $MINGW_SQLITE_OPTIONS $j]\n"
806
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -7456,10 +7456,42 @@
74567456
# define _FILE_OFFSET_BITS 64
74577457
# endif
74587458
# define _LARGEFILE_SOURCE 1
74597459
#endif
74607460
7461
+/*
7462
+** For MinGW, check to see if we can include the header file containing its
7463
+** version information, among other things. Normally, this internal MinGW
7464
+** header file would [only] be included automatically by other MinGW header
7465
+** files; however, the contained version information is now required by this
7466
+** header file to work around binary compatibility issues (see below) and
7467
+** this is the only known way to reliably obtain it. This entire #if block
7468
+** would be completely unnecessary if there was any other way of detecting
7469
+** MinGW via their preprocessor (e.g. if they customized their GCC to define
7470
+** some MinGW-specific macros). When compiling for MinGW, either the
7471
+** _HAVE_MINGW_H or _HAVE__MINGW_H (note the extra underscore) macro must be
7472
+** defined; otherwise, detection of conditions specific to MinGW will be
7473
+** disabled.
7474
+*/
7475
+#if defined(_HAVE_MINGW_H)
7476
+# include "mingw.h"
7477
+#elif defined(_HAVE__MINGW_H)
7478
+# include "_mingw.h"
7479
+#endif
7480
+
7481
+/*
7482
+** For MinGW version 4.x (and higher), check to see if the _USE_32BIT_TIME_T
7483
+** define is required to maintain binary compatibility with the MSVC runtime
7484
+** library in use (e.g. for Windows XP).
7485
+*/
7486
+#if !defined(_USE_32BIT_TIME_T) && !defined(_USE_64BIT_TIME_T) && \
7487
+ defined(_WIN32) && !defined(_WIN64) && \
7488
+ defined(__MINGW_MAJOR_VERSION) && __MINGW_MAJOR_VERSION >= 4 && \
7489
+ defined(__MSVCRT__)
7490
+# define _USE_32BIT_TIME_T
7491
+#endif
7492
+
74617493
/*
74627494
** Include the configuration header output by 'configure' if we're using the
74637495
** autoconf-based build
74647496
*/
74657497
#ifdef _HAVE_SQLITE_CONFIG_H
74667498
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -7456,10 +7456,42 @@
7456 # define _FILE_OFFSET_BITS 64
7457 # endif
7458 # define _LARGEFILE_SOURCE 1
7459 #endif
7460
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7461 /*
7462 ** Include the configuration header output by 'configure' if we're using the
7463 ** autoconf-based build
7464 */
7465 #ifdef _HAVE_SQLITE_CONFIG_H
7466
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -7456,10 +7456,42 @@
7456 # define _FILE_OFFSET_BITS 64
7457 # endif
7458 # define _LARGEFILE_SOURCE 1
7459 #endif
7460
7461 /*
7462 ** For MinGW, check to see if we can include the header file containing its
7463 ** version information, among other things. Normally, this internal MinGW
7464 ** header file would [only] be included automatically by other MinGW header
7465 ** files; however, the contained version information is now required by this
7466 ** header file to work around binary compatibility issues (see below) and
7467 ** this is the only known way to reliably obtain it. This entire #if block
7468 ** would be completely unnecessary if there was any other way of detecting
7469 ** MinGW via their preprocessor (e.g. if they customized their GCC to define
7470 ** some MinGW-specific macros). When compiling for MinGW, either the
7471 ** _HAVE_MINGW_H or _HAVE__MINGW_H (note the extra underscore) macro must be
7472 ** defined; otherwise, detection of conditions specific to MinGW will be
7473 ** disabled.
7474 */
7475 #if defined(_HAVE_MINGW_H)
7476 # include "mingw.h"
7477 #elif defined(_HAVE__MINGW_H)
7478 # include "_mingw.h"
7479 #endif
7480
7481 /*
7482 ** For MinGW version 4.x (and higher), check to see if the _USE_32BIT_TIME_T
7483 ** define is required to maintain binary compatibility with the MSVC runtime
7484 ** library in use (e.g. for Windows XP).
7485 */
7486 #if !defined(_USE_32BIT_TIME_T) && !defined(_USE_64BIT_TIME_T) && \
7487 defined(_WIN32) && !defined(_WIN64) && \
7488 defined(__MINGW_MAJOR_VERSION) && __MINGW_MAJOR_VERSION >= 4 && \
7489 defined(__MSVCRT__)
7490 # define _USE_32BIT_TIME_T
7491 #endif
7492
7493 /*
7494 ** Include the configuration header output by 'configure' if we're using the
7495 ** autoconf-based build
7496 */
7497 #ifdef _HAVE_SQLITE_CONFIG_H
7498
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -1704,11 +1704,11 @@
17041704
-DSQLITE_ENABLE_LOCKING_STYLE=0 \
17051705
-DSQLITE_THREADSAFE=0 \
17061706
-DSQLITE_DEFAULT_FILE_FORMAT=4 \
17071707
-DSQLITE_OMIT_DEPRECATED \
17081708
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
1709
- -D_HAVE_SQLITE_CONFIG_H \
1709
+ -D_HAVE__MINGW_H \
17101710
-DSQLITE_USE_MALLOC_H \
17111711
-DSQLITE_USE_MSIZE
17121712
17131713
SHELL_OPTIONS = -Dmain=sqlite3_shell \
17141714
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
17151715
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -1704,11 +1704,11 @@
1704 -DSQLITE_ENABLE_LOCKING_STYLE=0 \
1705 -DSQLITE_THREADSAFE=0 \
1706 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
1707 -DSQLITE_OMIT_DEPRECATED \
1708 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
1709 -D_HAVE_SQLITE_CONFIG_H \
1710 -DSQLITE_USE_MALLOC_H \
1711 -DSQLITE_USE_MSIZE
1712
1713 SHELL_OPTIONS = -Dmain=sqlite3_shell \
1714 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
1715
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -1704,11 +1704,11 @@
1704 -DSQLITE_ENABLE_LOCKING_STYLE=0 \
1705 -DSQLITE_THREADSAFE=0 \
1706 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
1707 -DSQLITE_OMIT_DEPRECATED \
1708 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
1709 -D_HAVE__MINGW_H \
1710 -DSQLITE_USE_MALLOC_H \
1711 -DSQLITE_USE_MSIZE
1712
1713 SHELL_OPTIONS = -Dmain=sqlite3_shell \
1714 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
1715
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -1704,11 +1704,11 @@
17041704
-DSQLITE_ENABLE_LOCKING_STYLE=0 \
17051705
-DSQLITE_THREADSAFE=0 \
17061706
-DSQLITE_DEFAULT_FILE_FORMAT=4 \
17071707
-DSQLITE_OMIT_DEPRECATED \
17081708
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
1709
- -D_HAVE_SQLITE_CONFIG_H \
1709
+ -D_HAVE__MINGW_H \
17101710
-DSQLITE_USE_MALLOC_H \
17111711
-DSQLITE_USE_MSIZE
17121712
17131713
SHELL_OPTIONS = -Dmain=sqlite3_shell \
17141714
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
17151715
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -1704,11 +1704,11 @@
1704 -DSQLITE_ENABLE_LOCKING_STYLE=0 \
1705 -DSQLITE_THREADSAFE=0 \
1706 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
1707 -DSQLITE_OMIT_DEPRECATED \
1708 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
1709 -D_HAVE_SQLITE_CONFIG_H \
1710 -DSQLITE_USE_MALLOC_H \
1711 -DSQLITE_USE_MSIZE
1712
1713 SHELL_OPTIONS = -Dmain=sqlite3_shell \
1714 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
1715
--- win/Makefile.mingw.mistachkin
+++ win/Makefile.mingw.mistachkin
@@ -1704,11 +1704,11 @@
1704 -DSQLITE_ENABLE_LOCKING_STYLE=0 \
1705 -DSQLITE_THREADSAFE=0 \
1706 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
1707 -DSQLITE_OMIT_DEPRECATED \
1708 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
1709 -D_HAVE__MINGW_H \
1710 -DSQLITE_USE_MALLOC_H \
1711 -DSQLITE_USE_MSIZE
1712
1713 SHELL_OPTIONS = -Dmain=sqlite3_shell \
1714 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
1715

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button