diff --git a/Makefile.in b/Makefile.in index 4d656d1795..d7e0ed6036 100644 --- a/Makefile.in +++ b/Makefile.in @@ -117,6 +117,7 @@ TESTSRC = \ HDR = \ sqlite.h \ $(TOP)/src/btree.h \ + config.h \ $(TOP)/src/hash.h \ opcodes.h \ $(TOP)/src/os.h \ @@ -206,6 +207,21 @@ parse.c: $(TOP)/src/parse.y lemon cp $(TOP)/src/parse.y . ./lemon parse.y +# The config.h file will contain a single #define that tells us how +# many bytes are in a pointer. This only works if a pointer is the +# same size on the host as it is on the target. If you are cross-compiling +# to a target with a different pointer size, you'll need to manually +# configure the config.h file. +# +config.h: + echo '#include ' >temp.c + echo 'int main(){printf(' >>temp.c + echo '"#define SQLITE_PTR_SZ %d\n",sizeof(char*));' >>temp.c + echo 'exit(0);}' >>temp.c + $(BCC) -o temp temp.c + ./temp >config.h + rm -f temp.c temp + sqlite.h: $(TOP)/src/sqlite.h.in sed -e s/--VERS--/`cat ${TOP}/VERSION`/ \ -e s/--ENCODING--/$(ENCODING)/ \ diff --git a/main.mk b/main.mk index f84e064ab8..d7fe79255c 100644 --- a/main.mk +++ b/main.mk @@ -54,9 +54,10 @@ TCCX = $(TCC) $(OPTS) $(THREADSAFE) $(USLEEP) -I. -I$(TOP)/src # Object files for the SQLite library. # -LIBOBJ = btree.o build.o delete.o expr.o func.o hash.o insert.o main.o \ - opcodes.o os.o pager.o parse.o printf.o random.o select.o table.o \ - tokenize.o trigger.o update.o util.o vdbe.o where.o tclsqlite.o +LIBOBJ = btree.o build.o delete.o expr.o func.o hash.o insert.o \ + main.o opcodes.o os.o pager.o parse.o printf.o random.o \ + select.o table.o tokenize.o trigger.o update.o util.o \ + vdbe.o where.o tclsqlite.o # All of the source code files. # @@ -108,6 +109,7 @@ TESTSRC = \ HDR = \ sqlite.h \ $(TOP)/src/btree.h \ + config.h \ $(TOP)/src/hash.h \ opcodes.h \ $(TOP)/src/os.h \ @@ -118,7 +120,7 @@ HDR = \ # This is the default Makefile target. The objects listed here # are what get build when you type just "make" with no arguments. # -all: sqlite.h libsqlite.a sqlite$(EXE) +all: sqlite.h config.h libsqlite.a sqlite$(EXE) # Generate the file "last_change" which contains the date of change # of the most recently modified source code file @@ -194,7 +196,23 @@ parse.c: $(TOP)/src/parse.y lemon cp $(TOP)/src/parse.y . ./lemon parse.y +# The config.h file will contain a single #define that tells us how +# many bytes are in a pointer. This only works if a pointer is the +# same size on the host as it is on the target. If you are cross-compiling +# to a target with a different pointer size, you'll need to manually +# configure the config.h file. +# +config.h: + echo '#include ' >temp.c + echo 'int main(){printf(' >>temp.c + echo '"#define SQLITE_PTR_SZ %d\n",sizeof(char*));' >>temp.c + echo 'exit(0);}' >>temp.c + $(BCC) -o temp temp.c + ./temp >config.h + rm -f temp.c temp + sqlite.h: $(TOP)/src/sqlite.h.in + $(BCC) -o temp temp.c sed -e s/--VERS--/`cat ${TOP}/VERSION`/ \ -e s/--ENCODING--/$(ENCODING)/ \ $(TOP)/src/sqlite.h.in >sqlite.h diff --git a/manifest b/manifest index 3b5ac0da47..0836c9e09e 100644 --- a/manifest +++ b/manifest @@ -1,6 +1,6 @@ -C Get\sthe\snew\slarge\sfile\scode\sworking\swith\sthe\sBorland\scompiler.\s\sTicket\s#195.\s(CVS\s787) -D 2002-11-20T11:08:00 -F Makefile.in d6c9a85c2a5e696843201d090dcf8bf2f8716f2a +C Automatically\sdetermine\sif\spointers\sare\s4\sor\s8\sbytes\sin\ssize\sduring\sthe\ncompilation\sprocess.\s\sTicket\s#190.\s(CVS\s788) +D 2002-11-20T11:55:19 +F Makefile.in 868c17a1ae1c07603d491274cc8f86c04acf2a1e F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd F VERSION 3cd17ced6590df1bb65cb7e075ab529b481517f0 @@ -14,7 +14,7 @@ F doc/report1.txt a031aaf37b185e4fa540223cb516d3bccec7eeac F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 F libtool c56e618713c9510a103bda6b95f3ea3900dcacd6 F ltmain.sh e9ed72eb1d690f447c13945eaf69e28af531eda1 -F main.mk d7a9dfc003ab1eeb4fdb46dfcee8af0ab0e38a99 +F main.mk e0f1f0b2fe39593b5d1c41e467d409210656d3be F publish.sh e5b83867d14708ed58cec8cba0a4f201e969474d F spec.template 238f7db425a78dc1bb7682e56e3834c7270a3f5e F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea @@ -41,7 +41,7 @@ F src/select.c ce82596a2eaaf418edba45b2426f41065e49578b F src/shell.c 53185af128613a2bac79d50128f4c17794f0f992 F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e F src/sqlite.h.in 98b1574b2362abe02c4a4c73b9dbf99bcd713ab3 -F src/sqliteInt.h a001c52dfb10ec38f18d6b9ed7dd8b3f42ca8c72 +F src/sqliteInt.h 74198ccddb3443514f0218de1f5a6668c3dbbe59 F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63 F src/tclsqlite.c 9f2c00a92338c51171ded8943bd42d77f7e69e64 F src/test1.c a46e9f61915b32787c5d5a05a4b92e4dacc437d9 @@ -149,7 +149,7 @@ F www/speed.tcl a20a792738475b68756ea7a19321600f23d1d803 F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218 -P dc5d9c129c566bf57d108b824ba486cfe070dda6 -R a7df48d9796716d510521dcad732255a +P da4a79e2891aa81e2e6d96689f99b3924f940dd5 +R e6e632d6bef956a28043c04d8612ec4c U drh -Z 28922f3b0a8eee5e8c4c877b1de2de34 +Z 48fdd2120a0a70b5abec7fb92ba361ca diff --git a/manifest.uuid b/manifest.uuid index 101bbe1004..af53f9ba27 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -da4a79e2891aa81e2e6d96689f99b3924f940dd5 \ No newline at end of file +dd5396a73a782b6abe9da3de43a5ee11e0dddbb2 \ No newline at end of file diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 313ae5fdd1..642b76ce3b 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,8 +11,9 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.148 2002/10/27 19:35:35 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.149 2002/11/20 11:55:19 drh Exp $ */ +#include "config.h" #include "sqlite.h" #include "hash.h" #include "vdbe.h" @@ -73,7 +74,11 @@ # define UINT8_TYPE unsigned char #endif #ifndef INTPTR_TYPE -# define INTPTR_TYPE int +# if SQLITE_PTR_SZ==4 +# define INTPTR_TYPE int +# else +# define INTPTR_TYPE long long +# endif #endif typedef UINT32_TYPE u32; /* 4-byte unsigned integer */ typedef UINT16_TYPE u16; /* 2-byte unsigned integer */